feat: Add video call option with Dyte in the dashboard (#6207)
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
23
app/javascript/dashboard/api/integrations/dyte.js
Normal file
23
app/javascript/dashboard/api/integrations/dyte.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/* global axios */
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
|
||||
class DyteAPI extends ApiClient {
|
||||
constructor() {
|
||||
super('integrations/dyte', { accountScoped: true });
|
||||
}
|
||||
|
||||
createAMeeting(conversationId) {
|
||||
return axios.post(`${this.url}/create_a_meeting`, {
|
||||
conversation_id: conversationId,
|
||||
});
|
||||
}
|
||||
|
||||
addParticipantToMeeting(messageId) {
|
||||
return axios.post(`${this.url}/add_participant_to_meeting`, {
|
||||
message_id: messageId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new DyteAPI();
|
||||
35
app/javascript/dashboard/api/specs/integrations/dyte.spec.js
Normal file
35
app/javascript/dashboard/api/specs/integrations/dyte.spec.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import DyteAPIClient from '../../integrations/dyte';
|
||||
import ApiClient from '../../ApiClient';
|
||||
import describeWithAPIMock from '../apiSpecHelper';
|
||||
|
||||
describe('#accountAPI', () => {
|
||||
it('creates correct instance', () => {
|
||||
expect(DyteAPIClient).toBeInstanceOf(ApiClient);
|
||||
expect(DyteAPIClient).toHaveProperty('createAMeeting');
|
||||
expect(DyteAPIClient).toHaveProperty('addParticipantToMeeting');
|
||||
});
|
||||
|
||||
describeWithAPIMock('createAMeeting', context => {
|
||||
it('creates a valid request', () => {
|
||||
DyteAPIClient.createAMeeting(1);
|
||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
||||
'/api/v1/integrations/dyte/create_a_meeting',
|
||||
{
|
||||
conversation_id: 1,
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describeWithAPIMock('addParticipantToMeeting', context => {
|
||||
it('creates a valid request', () => {
|
||||
DyteAPIClient.addParticipantToMeeting(1);
|
||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
||||
'/api/v1/integrations/dyte/add_participant_to_meeting',
|
||||
{
|
||||
message_id: 1,
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user