@zohoim/client-sdk 0.0.5 → 1.0.0-calls1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/application/services/calls/CallService.js +36 -0
- package/es/application/services/calls/index.js +1 -0
- package/es/application/services/cannedMessages/CannedMessageService.js +51 -0
- package/es/application/services/cannedMessages/index.js +2 -0
- package/es/application/services/index.js +4 -1
- package/es/application/services/templateMessages/TemplateMessageService.js +26 -0
- package/es/application/services/templateMessages/index.js +2 -0
- package/es/core/constants/ModuleNames.js +5 -1
- package/es/core/utils/validateSchema.js +60 -26
- package/es/domain/dto/calls/getCallRequest.js +14 -0
- package/es/domain/dto/calls/getCallsRequest.js +19 -0
- package/es/domain/dto/calls/index.js +4 -0
- package/es/domain/dto/calls/initiateCallRequest.js +15 -0
- package/es/domain/dto/calls/updateCallStatusRequest.js +16 -0
- package/es/domain/dto/cannedMessages/createCannedMessageRequest.js +18 -0
- package/es/domain/dto/cannedMessages/deleteCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/disableCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/enableCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/getCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/getCannedMessagesRequest.js +18 -0
- package/es/domain/dto/cannedMessages/index.js +7 -0
- package/es/domain/dto/cannedMessages/updateCannedMessageRequest.js +20 -0
- package/es/domain/dto/index.js +4 -1
- package/es/domain/dto/messages/initiateSessionRequest.js +2 -0
- package/es/domain/dto/sessions/getSessionsRequest.js +1 -0
- package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +16 -0
- package/es/domain/dto/templateMessages/getTemplateLanguagesRequest.js +7 -0
- package/es/domain/dto/templateMessages/index.js +2 -0
- package/es/domain/entities/Actor/Actor.js +5 -1
- package/es/domain/entities/Agent/Agent.js +5 -1
- package/es/domain/entities/Attachment/Attachment.js +5 -1
- package/es/domain/entities/Bot/Bot.js +5 -1
- package/es/domain/entities/Call/Call.js +44 -0
- package/es/domain/entities/Call/index.js +1 -0
- package/es/domain/entities/CannedMessage/CannedMessage.js +50 -0
- package/es/domain/entities/CannedMessage/index.js +2 -0
- package/es/domain/entities/Channel/Channel.js +5 -1
- package/es/domain/entities/Contact/Contact.js +5 -1
- package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +26 -0
- package/es/domain/entities/CustomReplyExtension/index.js +2 -0
- package/es/domain/entities/IntegrationService/IntegrationService.js +5 -1
- package/es/domain/entities/Message/Action.js +5 -1
- package/es/domain/entities/Message/ExternalInfo.js +5 -1
- package/es/domain/entities/Message/Info.js +5 -1
- package/es/domain/entities/Message/InfoTarget.js +5 -1
- package/es/domain/entities/Message/Location.js +5 -1
- package/es/domain/entities/Message/Message.js +25 -2
- package/es/domain/entities/Message/MessageWithSession.js +5 -1
- package/es/domain/entities/Session/Session.js +5 -1
- package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +27 -0
- package/es/domain/entities/TemplateMessage/TemplateLanguage.js +22 -0
- package/es/domain/entities/TemplateMessage/index.js +3 -0
- package/es/domain/entities/index.js +5 -1
- package/es/domain/enum/call/CallStatus.js +8 -0
- package/es/domain/enum/call/index.js +1 -0
- package/es/domain/enum/cannedMessage/CannedMessageStatus.js +7 -0
- package/es/domain/enum/cannedMessage/CannedMessageType.js +5 -0
- package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +6 -0
- package/es/domain/enum/cannedMessage/TemplateItemFooterType.js +4 -0
- package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +7 -0
- package/es/domain/enum/cannedMessage/index.js +6 -0
- package/es/domain/enum/index.js +4 -1
- package/es/domain/enum/message/MessageMeta.js +2 -1
- package/es/domain/enum/message/MetaMessageSourceType.js +6 -0
- package/es/domain/enum/message/index.js +2 -1
- package/es/domain/enum/templateMessage/TemplateCreditExhaustStatusCode.js +4 -0
- package/es/domain/enum/templateMessage/index.js +2 -0
- package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
- package/es/domain/interfaces/repositories/calls/index.js +1 -0
- package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +47 -0
- package/es/domain/interfaces/repositories/cannedMessages/index.js +2 -0
- package/es/domain/interfaces/repositories/index.js +4 -1
- package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +21 -0
- package/es/domain/interfaces/repositories/templateMessages/index.js +2 -0
- package/es/domain/schema/call/CallSchema.js +59 -0
- package/es/domain/schema/call/index.js +1 -0
- package/es/domain/schema/cannedMessage/CannedMessageSchema.js +61 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +17 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemFooterSchema.js +13 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemHeaderSchema.js +19 -0
- package/es/domain/schema/cannedMessage/TemplateItem/index.js +4 -0
- package/es/domain/schema/cannedMessage/TemplateItemsSchema.js +21 -0
- package/es/domain/schema/cannedMessage/TranslationsSchema.js +43 -0
- package/es/domain/schema/cannedMessage/index.js +2 -0
- package/es/domain/schema/customReplyExtension/CustomReplyExtensionSchema.js +28 -0
- package/es/domain/schema/customReplyExtension/index.js +2 -0
- package/es/domain/schema/index.js +5 -1
- package/es/domain/schema/templateMessage/TemplateCreditExhaustStatusSchema.js +11 -0
- package/es/domain/schema/templateMessage/TemplateLanguageSchema.js +11 -0
- package/es/domain/schema/templateMessage/index.js +3 -0
- package/es/frameworks/managers/ModuleFactory.js +27 -0
- package/es/frameworks/managers/ModuleManager.js +1 -1
- package/es/frameworks/sdk/IMSDK.js +15 -0
- package/es/frameworks/sdk/calls/CallSDK.js +27 -0
- package/es/frameworks/sdk/calls/index.js +1 -0
- package/es/frameworks/sdk/cannedMessages/CannedMessageSDK.js +30 -0
- package/es/frameworks/sdk/cannedMessages/index.js +2 -0
- package/es/frameworks/sdk/templateMessages/TemplateMessageSDK.js +30 -0
- package/es/frameworks/sdk/templateMessages/index.js +2 -0
- package/es/infrastructure/adapters/calls/CallAdapter.js +30 -0
- package/es/infrastructure/adapters/calls/index.js +1 -0
- package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +28 -0
- package/es/infrastructure/adapters/cannedMessages/index.js +2 -0
- package/es/infrastructure/adapters/customReplyExtension/CustomReplyExtensionAdapter.js +24 -0
- package/es/infrastructure/adapters/customReplyExtension/index.js +2 -0
- package/es/infrastructure/adapters/index.js +5 -1
- package/es/infrastructure/adapters/templateMessages/TemplateCreditExhaustStatusAdapter.js +20 -0
- package/es/infrastructure/adapters/templateMessages/TemplateLanguageAdapter.js +20 -0
- package/es/infrastructure/adapters/templateMessages/index.js +3 -0
- package/es/infrastructure/api/calls/CallAPI.js +44 -0
- package/es/infrastructure/api/calls/index.js +1 -0
- package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +74 -0
- package/es/infrastructure/api/cannedMessages/index.js +2 -0
- package/es/infrastructure/api/index.js +4 -1
- package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
- package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
- package/es/infrastructure/api/registry/calls/index.js +1 -0
- package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +42 -0
- package/es/infrastructure/api/registry/cannedMessages/constructCannedMessageEndPoint.js +10 -0
- package/es/infrastructure/api/registry/cannedMessages/index.js +2 -0
- package/es/infrastructure/api/registry/getRegistryConfig.js +7 -1
- package/es/infrastructure/api/registry/templateMessages/constructTemplateMessageEndPoint.js +11 -0
- package/es/infrastructure/api/registry/templateMessages/index.js +2 -0
- package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +18 -0
- package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +24 -0
- package/es/infrastructure/api/templateMessages/index.js +2 -0
- package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
- package/es/infrastructure/repositories/calls/index.js +1 -0
- package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +97 -0
- package/es/infrastructure/repositories/cannedMessages/index.js +2 -0
- package/es/infrastructure/repositories/index.js +4 -1
- package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +77 -0
- package/es/infrastructure/repositories/templateMessages/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest } from '../../../domain/dto';
|
|
2
|
+
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories';
|
|
3
|
+
export default class CannedMessageAPI extends ICannedMessageRepository {
|
|
4
|
+
async getCannedMessages() {
|
|
5
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessagesRequest();
|
|
6
|
+
const operation = 'getCannedMessages';
|
|
7
|
+
const httpRequest = await this.request({
|
|
8
|
+
operation,
|
|
9
|
+
request
|
|
10
|
+
});
|
|
11
|
+
return httpRequest;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getCannedMessage() {
|
|
15
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessageRequest();
|
|
16
|
+
const operation = 'getCannedMessage';
|
|
17
|
+
const httpRequest = await this.request({
|
|
18
|
+
operation,
|
|
19
|
+
request
|
|
20
|
+
});
|
|
21
|
+
return httpRequest;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async createCannedMessage() {
|
|
25
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createCannedMessageRequest();
|
|
26
|
+
const operation = 'createCannedMessage';
|
|
27
|
+
const httpRequest = await this.request({
|
|
28
|
+
operation,
|
|
29
|
+
request
|
|
30
|
+
});
|
|
31
|
+
return httpRequest;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async updateCannedMessage() {
|
|
35
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCannedMessageRequest();
|
|
36
|
+
const operation = 'updateCannedMessage';
|
|
37
|
+
const httpRequest = await this.request({
|
|
38
|
+
operation,
|
|
39
|
+
request
|
|
40
|
+
});
|
|
41
|
+
return httpRequest;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async deleteCannedMessage() {
|
|
45
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : deleteCannedMessageRequest();
|
|
46
|
+
const operation = 'deleteCannedMessage';
|
|
47
|
+
const httpRequest = await this.request({
|
|
48
|
+
operation,
|
|
49
|
+
request
|
|
50
|
+
});
|
|
51
|
+
return httpRequest;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async enableCannedMessage() {
|
|
55
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : enableCannedMessageRequest();
|
|
56
|
+
const operation = 'enableCannedMessage';
|
|
57
|
+
const httpRequest = await this.request({
|
|
58
|
+
operation,
|
|
59
|
+
request
|
|
60
|
+
});
|
|
61
|
+
return httpRequest;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async disableCannedMessage() {
|
|
65
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : disableCannedMessageRequest();
|
|
66
|
+
const operation = 'disableCannedMessage';
|
|
67
|
+
const httpRequest = await this.request({
|
|
68
|
+
operation,
|
|
69
|
+
request
|
|
70
|
+
});
|
|
71
|
+
return httpRequest;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
@@ -3,4 +3,7 @@ export * from './sessions';
|
|
|
3
3
|
export * from './bots';
|
|
4
4
|
export * from './messages';
|
|
5
5
|
export * from './agents';
|
|
6
|
-
export * from './contacts';
|
|
6
|
+
export * from './contacts';
|
|
7
|
+
export * from './cannedMessages';
|
|
8
|
+
export * from './templateMessages';
|
|
9
|
+
export * from './calls';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { getCallsRequest, getCallRequest, updateCallStatusRequest, initiateCallRequest } from '../../../../domain/dto';
|
|
3
|
+
import constructCallEndPoint from './constructCallEndPoint';
|
|
4
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
5
|
+
const SINGLE_CALL_URL = '/:callId';
|
|
6
|
+
const UPDATE_CALL_URL = `${SINGLE_CALL_URL}/status`;
|
|
7
|
+
|
|
8
|
+
function getCalls() {
|
|
9
|
+
return createAPIRegistry(constructCallEndPoint(), HTTP_METHODS.GET, getCallsRequest());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getCall() {
|
|
13
|
+
return createAPIRegistry(constructCallEndPoint(SINGLE_CALL_URL), HTTP_METHODS.GET, getCallRequest());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function updateCallStatus() {
|
|
17
|
+
return createAPIRegistry(constructCallEndPoint(UPDATE_CALL_URL), HTTP_METHODS.PATCH, updateCallStatusRequest());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function initiateCall() {
|
|
21
|
+
return createAPIRegistry(constructCallEndPoint(), HTTP_METHODS.POST, initiateCallRequest());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
getCalls,
|
|
26
|
+
getCall,
|
|
27
|
+
updateCallStatus,
|
|
28
|
+
initiateCall
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as callAPIRegistry } from './callAPIRegistry';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest } from '../../../../domain/dto';
|
|
3
|
+
import constructCannedMessageEndPoint from './constructCannedMessageEndPoint';
|
|
4
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
5
|
+
|
|
6
|
+
function getCannedMessages() {
|
|
7
|
+
return createAPIRegistry(constructCannedMessageEndPoint(), HTTP_METHODS.GET, getCannedMessagesRequest());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getCannedMessage() {
|
|
11
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.GET, getCannedMessageRequest());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function createCannedMessage() {
|
|
15
|
+
return createAPIRegistry(constructCannedMessageEndPoint(), HTTP_METHODS.POST, createCannedMessageRequest());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function updateCannedMessage() {
|
|
19
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.PATCH, updateCannedMessageRequest());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function enableCannedMessage() {
|
|
23
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/activation'), HTTP_METHODS.PATCH, enableCannedMessageRequest());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function disableCannedMessage() {
|
|
27
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/activation'), HTTP_METHODS.DELETE, disableCannedMessageRequest());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function deleteCannedMessage() {
|
|
31
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.DELETE, deleteCannedMessageRequest());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
getCannedMessage,
|
|
36
|
+
getCannedMessages,
|
|
37
|
+
createCannedMessage,
|
|
38
|
+
updateCannedMessage,
|
|
39
|
+
deleteCannedMessage,
|
|
40
|
+
enableCannedMessage,
|
|
41
|
+
disableCannedMessage
|
|
42
|
+
};
|
|
@@ -5,6 +5,9 @@ import { botAPIRegistry } from './bots';
|
|
|
5
5
|
import { messageAPIRegistry } from './messages';
|
|
6
6
|
import { agentAPIRegistry } from './agents';
|
|
7
7
|
import { contactAPIRegistry } from './contacts';
|
|
8
|
+
import { cannedMessageAPIRegistry } from './cannedMessages';
|
|
9
|
+
import { templateMessageAPIRegistry } from './templateMessages';
|
|
10
|
+
import { callAPIRegistry } from './calls';
|
|
8
11
|
import { ModuleNames } from '../../../core/constants';
|
|
9
12
|
const APIRegistry = {
|
|
10
13
|
[ModuleNames.CHANNELS]: channelAPIRegistry,
|
|
@@ -12,7 +15,10 @@ const APIRegistry = {
|
|
|
12
15
|
[ModuleNames.BOTS]: botAPIRegistry,
|
|
13
16
|
[ModuleNames.MESSAGES]: messageAPIRegistry,
|
|
14
17
|
[ModuleNames.AGENTS]: agentAPIRegistry,
|
|
15
|
-
[ModuleNames.CONTACTS]: contactAPIRegistry
|
|
18
|
+
[ModuleNames.CONTACTS]: contactAPIRegistry,
|
|
19
|
+
[ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry,
|
|
20
|
+
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry,
|
|
21
|
+
[ModuleNames.CALLS]: callAPIRegistry
|
|
16
22
|
};
|
|
17
23
|
export default function getRegistryConfig(module, operation) {
|
|
18
24
|
const moduleConfig = selectn(module, APIRegistry);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationServices } from '../../../../domain/enum';
|
|
2
|
+
import createBaseUrl from '../createBaseUrl';
|
|
3
|
+
export default function constructTemplateMessageEndPoint(extra) {
|
|
4
|
+
const base = `/integrations/${IntegrationServices.WHATSAPP}`;
|
|
5
|
+
|
|
6
|
+
if (extra) {
|
|
7
|
+
return createBaseUrl(base + extra);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return createBaseUrl(base);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest } from '../../../../domain/dto';
|
|
3
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
4
|
+
import constructTemplateMessageEndPoint from './constructTemplateMessageEndPoint';
|
|
5
|
+
|
|
6
|
+
function getTemplateLanguages() {
|
|
7
|
+
return createAPIRegistry(constructTemplateMessageEndPoint('/templateLanguages'), HTTP_METHODS.GET, getTemplateLanguagesRequest());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getTemplateCreditExhaustStatus() {
|
|
11
|
+
return createAPIRegistry(constructTemplateMessageEndPoint('/templateCreditExhaustStatus'), // NO I18N
|
|
12
|
+
HTTP_METHODS.GET, getTemplateCreditExhaustStatusRequest());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
getTemplateLanguages,
|
|
17
|
+
getTemplateCreditExhaustStatus
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest } from '../../../domain/dto';
|
|
2
|
+
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
3
|
+
export default class TemplateMessageAPI extends ITemplateMessageRepository {
|
|
4
|
+
async getTemplateLanguages() {
|
|
5
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateLanguagesRequest();
|
|
6
|
+
const operation = 'getTemplateLanguages';
|
|
7
|
+
const httpRequest = await this.request({
|
|
8
|
+
request,
|
|
9
|
+
operation
|
|
10
|
+
});
|
|
11
|
+
return httpRequest;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getWhatsAppTemplateCreditExhaustStatus() {
|
|
15
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateCreditExhaustStatusRequest();
|
|
16
|
+
const operation = 'getWhatsAppTemplateCreditExhaustStatus';
|
|
17
|
+
const httpRequest = await this.request({
|
|
18
|
+
request,
|
|
19
|
+
operation
|
|
20
|
+
});
|
|
21
|
+
return httpRequest;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CallAdapter } from '../../adapters';
|
|
2
|
+
import { CallAPI } from '../../api';
|
|
3
|
+
import { ICallRepository } from '../../../domain/interfaces/repositories/calls';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class CallRepository extends ICallRepository {
|
|
6
|
+
constructor(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
callAPI,
|
|
9
|
+
callAdapter
|
|
10
|
+
} = _ref;
|
|
11
|
+
super();
|
|
12
|
+
this.defaultAPI = new CallAPI();
|
|
13
|
+
this.customAPI = callAPI;
|
|
14
|
+
this.callAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
15
|
+
this.callAdapter = callAdapter || new CallAdapter();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async invokeAPI(_ref2) {
|
|
19
|
+
let {
|
|
20
|
+
operation,
|
|
21
|
+
request,
|
|
22
|
+
adapter = this.callAdapter,
|
|
23
|
+
responseType
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return this.executeAPICall({
|
|
26
|
+
operation,
|
|
27
|
+
request,
|
|
28
|
+
apiProxy: this.callAPI,
|
|
29
|
+
customAPI: this.customAPI,
|
|
30
|
+
adapter,
|
|
31
|
+
responseType
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getCalls(request) {
|
|
36
|
+
return this.invokeAPI({
|
|
37
|
+
operation: 'getCalls',
|
|
38
|
+
request,
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getCall(request) {
|
|
44
|
+
return this.invokeAPI({
|
|
45
|
+
operation: 'getCall',
|
|
46
|
+
request
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async updateCallStatus(request) {
|
|
51
|
+
return this.invokeAPI({
|
|
52
|
+
operation: 'updateCallStatus',
|
|
53
|
+
request
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async initiateCall(request) {
|
|
58
|
+
return this.invokeAPI({
|
|
59
|
+
operation: 'initiateCall',
|
|
60
|
+
request
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
toJSON() {
|
|
65
|
+
return {
|
|
66
|
+
getCalls: this.getCalls.bind(this),
|
|
67
|
+
getCall: this.getCall.bind(this),
|
|
68
|
+
updateCallStatus: this.updateCallStatus.bind(this),
|
|
69
|
+
initiateCall: this.initiateCall.bind(this)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CallRepository } from './CallRepository';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CannedMessageAdapter } from '../../adapters';
|
|
2
|
+
import { CannedMessageAPI } from '../../api';
|
|
3
|
+
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories/cannedMessages';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class CannedMessageRepository extends ICannedMessageRepository {
|
|
6
|
+
constructor(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
cannedMessageAPI,
|
|
9
|
+
cannedMessageAdapter
|
|
10
|
+
} = _ref;
|
|
11
|
+
super();
|
|
12
|
+
this.defaultAPI = new CannedMessageAPI();
|
|
13
|
+
this.customAPI = cannedMessageAPI;
|
|
14
|
+
this.cannedMessageAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
15
|
+
this.cannedMessageAdapter = cannedMessageAdapter || new CannedMessageAdapter();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async invokeAPI(_ref2) {
|
|
19
|
+
let {
|
|
20
|
+
operation,
|
|
21
|
+
request,
|
|
22
|
+
adapter = this.cannedMessageAdapter,
|
|
23
|
+
responseType
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return this.executeAPICall({
|
|
26
|
+
operation,
|
|
27
|
+
request,
|
|
28
|
+
apiProxy: this.cannedMessageAPI,
|
|
29
|
+
customAPI: this.customAPI,
|
|
30
|
+
adapter,
|
|
31
|
+
responseType
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getCannedMessages(request) {
|
|
36
|
+
return this.invokeAPI({
|
|
37
|
+
operation: 'getCannedMessages',
|
|
38
|
+
request,
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getCannedMessage(request) {
|
|
44
|
+
return this.invokeAPI({
|
|
45
|
+
operation: 'getCannedMessage',
|
|
46
|
+
request
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async createCannedMessage(request) {
|
|
51
|
+
return this.invokeAPI({
|
|
52
|
+
operation: 'createCannedMessage',
|
|
53
|
+
request
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async deleteCannedMessage(request) {
|
|
58
|
+
return this.invokeAPI({
|
|
59
|
+
operation: 'deleteCannedMessage',
|
|
60
|
+
request
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async updateCannedMessage(request) {
|
|
65
|
+
return this.invokeAPI({
|
|
66
|
+
operation: 'updateCannedMessage',
|
|
67
|
+
request
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async enableCannedMessage(request) {
|
|
72
|
+
return this.invokeAPI({
|
|
73
|
+
operation: 'enableCannedMessage',
|
|
74
|
+
request
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async disableCannedMessage(request) {
|
|
79
|
+
return this.invokeAPI({
|
|
80
|
+
operation: 'disableCannedMessage',
|
|
81
|
+
request
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
toJSON() {
|
|
86
|
+
return {
|
|
87
|
+
getCannedMessages: this.getCannedMessages.bind(this),
|
|
88
|
+
getCannedMessage: this.getCannedMessage.bind(this),
|
|
89
|
+
createCannedMessage: this.createCannedMessage.bind(this),
|
|
90
|
+
updateCannedMessage: this.updateCannedMessage.bind(this),
|
|
91
|
+
deleteCannedMessage: this.deleteCannedMessage.bind(this),
|
|
92
|
+
enableCannedMssage: this.enableCannedMessage.bind(this),
|
|
93
|
+
disableCannedMessage: this.disableCannedMessage.bind(this)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|
|
@@ -3,4 +3,7 @@ export * from './sessions';
|
|
|
3
3
|
export * from './bots';
|
|
4
4
|
export * from './messages';
|
|
5
5
|
export * from './agents';
|
|
6
|
-
export * from './contacts';
|
|
6
|
+
export * from './contacts';
|
|
7
|
+
export * from './cannedMessages';
|
|
8
|
+
export * from './templateMessages';
|
|
9
|
+
export * from './calls';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
import { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter } from '../../adapters';
|
|
3
|
+
import { TemplateMessageAPI } from '../../api';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class TemplateMessageRepository extends ITemplateMessageRepository {
|
|
6
|
+
constructor(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
templateMessageAPI,
|
|
9
|
+
templateLanguageAdapter,
|
|
10
|
+
templateCreditExhaustStatusAdapter
|
|
11
|
+
} = _ref;
|
|
12
|
+
super();
|
|
13
|
+
this.defaultAPI = new TemplateMessageAPI();
|
|
14
|
+
this.customAPI = templateMessageAPI;
|
|
15
|
+
this.templateMessageAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
16
|
+
this.templateLanguageAdapter = templateLanguageAdapter || new TemplateLanguageAdapter();
|
|
17
|
+
this.templateCreditExhaustStatusAdapter = templateCreditExhaustStatusAdapter || new TemplateCreditExhaustStatusAdapter();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async invokeTemplateLanguageAPI(_ref2) {
|
|
21
|
+
let {
|
|
22
|
+
operation,
|
|
23
|
+
request,
|
|
24
|
+
adapter = this.templateLanguageAdapter,
|
|
25
|
+
responseType
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return this.executeAPICall({
|
|
28
|
+
operation,
|
|
29
|
+
request,
|
|
30
|
+
apiProxy: this.templateMessageAPI,
|
|
31
|
+
customAPI: this.customAPI,
|
|
32
|
+
adapter,
|
|
33
|
+
responseType
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async invokeTemplateCreditExhaustStatusAPI(_ref3) {
|
|
38
|
+
let {
|
|
39
|
+
operation,
|
|
40
|
+
request,
|
|
41
|
+
adapter = this.templateCreditExhaustStatusAdapter,
|
|
42
|
+
responseType
|
|
43
|
+
} = _ref3;
|
|
44
|
+
return this.executeAPICall({
|
|
45
|
+
operation,
|
|
46
|
+
request,
|
|
47
|
+
apiProxy: this.templateMessageAPI,
|
|
48
|
+
customAPI: this.customAPI,
|
|
49
|
+
adapter,
|
|
50
|
+
responseType
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async getTemplateLanguages(request) {
|
|
55
|
+
return this.invokeTemplateLanguageAPI({
|
|
56
|
+
operation: 'getTemplateLanguages',
|
|
57
|
+
request,
|
|
58
|
+
responseType: ResponseTypes.LIST
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getWhatsAppTemplateCreditExhaustStatus(request) {
|
|
63
|
+
return this.invokeTemplateCreditExhaustStatusAPI({
|
|
64
|
+
operation: 'getWhatsAppTemplateCreditExhaustStatus',
|
|
65
|
+
request,
|
|
66
|
+
responseType: ResponseTypes.SINGLE
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
toJSON() {
|
|
71
|
+
return {
|
|
72
|
+
getTemplateLanguages: this.getTemplateLanguages.bind(this),
|
|
73
|
+
getWhatsAppTemplateCreditExhaustStatus: this.getWhatsAppTemplateCreditExhaustStatus.bind(this)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/client-sdk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0-calls1",
|
|
4
4
|
"description": "To have the client sdk for the IM",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"@zohodesk/docs-builder": "1.0.2",
|
|
33
33
|
"@testing-library/jest-dom": "^5.16.5"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|