@zohoim/client-sdk 0.0.5 → 1.0.0-calls2
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 +9 -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,36 @@
|
|
|
1
|
+
import { ICallRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
export default class CallService extends ICallRepository {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
callRepository
|
|
6
|
+
} = _ref;
|
|
7
|
+
super();
|
|
8
|
+
this.callRepository = callRepository;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getCalls(request) {
|
|
12
|
+
return this.callRepository.getCalls(request);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getCall(request) {
|
|
16
|
+
return this.callRepository.getCall(request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async updateCallStatus(request) {
|
|
20
|
+
return this.callRepository.updateCallStatus(request);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async initiateCall(request) {
|
|
24
|
+
return this.callRepository.initiateCall(request);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toJSON() {
|
|
28
|
+
return {
|
|
29
|
+
getCalls: this.getCalls.bind(this),
|
|
30
|
+
getCall: this.getCall.bind(this),
|
|
31
|
+
updateCallStatus: this.updateCallStatus.bind(this),
|
|
32
|
+
initiateCall: this.initiateCall.bind(this)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CallService } from './CallService';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
export default class CannedMessageService extends ICannedMessageRepository {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
cannedMessageRepository
|
|
6
|
+
} = _ref;
|
|
7
|
+
super();
|
|
8
|
+
this.cannedMessageRepository = cannedMessageRepository;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getCannedMessages(request) {
|
|
12
|
+
return this.cannedMessageRepository.getCannedMessages(request);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getCannedMessage(request) {
|
|
16
|
+
return this.cannedMessageRepository.getCannedMessage(request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async createCannedMessage(request) {
|
|
20
|
+
return this.cannedMessageRepository.createCannedMessage(request);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async deleteCannedMessage(request) {
|
|
24
|
+
return this.cannedMessageRepository.deleteCannedMessage(request);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async updateCannedMessage(request) {
|
|
28
|
+
return this.cannedMessageRepository.updateCannedMessage(request);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async enableCannedMessage(request) {
|
|
32
|
+
return this.cannedMessageRepository.enableCannedMessage(request);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async disableCannedMessage(request) {
|
|
36
|
+
return this.cannedMessageRepository.disableCannedMessage(request);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toJSON() {
|
|
40
|
+
return {
|
|
41
|
+
getCannedMessages: this.getCannedMessages.bind(this),
|
|
42
|
+
getCannedMessage: this.getCannedMessage.bind(this),
|
|
43
|
+
createCannedMessage: this.createCannedMessage.bind(this),
|
|
44
|
+
deleteCannedMessage: this.deleteCannedMessage.bind(this),
|
|
45
|
+
updateCannedMessage: this.updateCannedMessage.bind(this),
|
|
46
|
+
enableCannedMessage: this.enableCannedMessage.bind(this),
|
|
47
|
+
disableCannedMessage: this.disableCannedMessage.bind(this)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
@@ -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,26 @@
|
|
|
1
|
+
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
export default class TemplateMessageService extends ITemplateMessageRepository {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
templateMessageRepository
|
|
6
|
+
} = _ref;
|
|
7
|
+
super();
|
|
8
|
+
this.templateMessageRepository = templateMessageRepository;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getTemplateLanguages(request) {
|
|
12
|
+
return this.templateMessageRepository.getTemplateLanguages(request);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getWhatsAppTemplateCreditExhaustStatus(request) {
|
|
16
|
+
return this.templateMessageRepository.getWhatsAppTemplateCreditExhaustStatus(request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toJSON() {
|
|
20
|
+
return {
|
|
21
|
+
getTemplateLanguages: this.getTemplateLanguages.bind(this),
|
|
22
|
+
getWhatsAppTemplateCreditExhaustStatus: this.getWhatsAppTemplateCreditExhaustStatus.bind(this)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -4,6 +4,10 @@ const ModuleNames = {
|
|
|
4
4
|
BOTS: 'bots',
|
|
5
5
|
MESSAGES: 'messages',
|
|
6
6
|
CONTACTS: 'contacts',
|
|
7
|
-
AGENTS: 'agents'
|
|
7
|
+
AGENTS: 'agents',
|
|
8
|
+
CANNED_MESSAGES: 'cannedMessages',
|
|
9
|
+
TEMPLATE_MESSAGES: 'templateMessages',
|
|
10
|
+
CUSTOM_REPLY_EXTENSIONS: 'articles',
|
|
11
|
+
CALLS: 'calls'
|
|
8
12
|
};
|
|
9
13
|
export default ModuleNames;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function validateSchemaKeys(_ref) {
|
|
2
|
+
let {
|
|
3
|
+
schema = {},
|
|
4
|
+
data = {},
|
|
5
|
+
entityName = ''
|
|
6
|
+
} = _ref;
|
|
7
|
+
Object.keys(schema).forEach(key => {
|
|
8
|
+
if (!(key in data)) {
|
|
9
|
+
console.warn(`${entityName} - Key '${key}' is missing in the data`);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
function isEmpty(value) {
|
|
10
15
|
if (value === null || value === undefined || value === '') {
|
|
@@ -14,44 +19,63 @@ function isEmpty(value) {
|
|
|
14
19
|
return false;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
function validateRequiredCheck(
|
|
22
|
+
function validateRequiredCheck(_ref2) {
|
|
18
23
|
let {
|
|
19
24
|
value,
|
|
20
25
|
rules,
|
|
21
|
-
path
|
|
22
|
-
|
|
26
|
+
path,
|
|
27
|
+
entityName
|
|
28
|
+
} = _ref2;
|
|
23
29
|
|
|
24
30
|
if (rules.required && isEmpty(value)) {
|
|
25
|
-
|
|
31
|
+
console.warn(`${entityName} - ${path} is required`);
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
function validateEnumCheck(
|
|
35
|
+
function validateEnumCheck(_ref3) {
|
|
30
36
|
let {
|
|
31
37
|
value,
|
|
32
38
|
rules,
|
|
33
|
-
path
|
|
34
|
-
|
|
39
|
+
path,
|
|
40
|
+
entityName
|
|
41
|
+
} = _ref3;
|
|
35
42
|
|
|
36
43
|
if (rules.enum && !rules.enum.includes(value)) {
|
|
37
|
-
|
|
44
|
+
console.warn(`${entityName} - ${path} must be one of: ${rules.enum.join(', ')}. Received: ${value}`);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
export const validateSchema =
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
export const validateSchema = _ref4 => {
|
|
49
|
+
let {
|
|
50
|
+
schema,
|
|
51
|
+
data,
|
|
52
|
+
entityName = ''
|
|
53
|
+
} = _ref4;
|
|
54
|
+
|
|
55
|
+
const validate = _ref5 => {
|
|
56
|
+
let {
|
|
57
|
+
schema: schemaObj,
|
|
58
|
+
data: dataObj,
|
|
59
|
+
path = '',
|
|
60
|
+
entityName
|
|
61
|
+
} = _ref5;
|
|
44
62
|
// Check if all schema keys exist in data
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
validateSchemaKeys({
|
|
64
|
+
schema: schemaObj,
|
|
65
|
+
data: dataObj,
|
|
66
|
+
entityName,
|
|
67
|
+
path
|
|
68
|
+
}); // Validate each field
|
|
69
|
+
|
|
70
|
+
Object.entries(schemaObj).forEach(_ref6 => {
|
|
71
|
+
let [field, rules] = _ref6;
|
|
49
72
|
const value = dataObj[field];
|
|
50
73
|
const fieldPath = path ? `${path}.${field}` : field;
|
|
51
74
|
validateRequiredCheck({
|
|
52
75
|
value,
|
|
53
76
|
rules,
|
|
54
|
-
path: fieldPath
|
|
77
|
+
path: fieldPath,
|
|
78
|
+
entityName
|
|
55
79
|
});
|
|
56
80
|
|
|
57
81
|
if (value !== null && value !== undefined) {
|
|
@@ -59,16 +83,26 @@ export const validateSchema = (schema, data) => {
|
|
|
59
83
|
validateEnumCheck({
|
|
60
84
|
value,
|
|
61
85
|
rules,
|
|
62
|
-
path: fieldPath
|
|
86
|
+
path: fieldPath,
|
|
87
|
+
entityName
|
|
63
88
|
}); // Nested object validation
|
|
64
89
|
|
|
65
90
|
if (rules.type === 'object' && rules.schema) {
|
|
66
|
-
validate(
|
|
91
|
+
validate({
|
|
92
|
+
schema: rules.schema,
|
|
93
|
+
data: value,
|
|
94
|
+
path: fieldPath,
|
|
95
|
+
entityName
|
|
96
|
+
});
|
|
67
97
|
}
|
|
68
98
|
}
|
|
69
99
|
});
|
|
70
100
|
return dataObj;
|
|
71
101
|
};
|
|
72
102
|
|
|
73
|
-
return validate(
|
|
103
|
+
return validate({
|
|
104
|
+
schema,
|
|
105
|
+
data,
|
|
106
|
+
entityName
|
|
107
|
+
});
|
|
74
108
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
export default function getCallRequest() {
|
|
3
|
+
let {
|
|
4
|
+
params = {},
|
|
5
|
+
query = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
callId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).withQuery({
|
|
11
|
+
include: null,
|
|
12
|
+
...query
|
|
13
|
+
}).build();
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
export default function getCallsRequest() {
|
|
3
|
+
let {
|
|
4
|
+
query = {}
|
|
5
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
return new RequestBuilder().withQuery({
|
|
7
|
+
from: 0,
|
|
8
|
+
limit: 10,
|
|
9
|
+
status: null,
|
|
10
|
+
integrationServiceId: null,
|
|
11
|
+
userType: null,
|
|
12
|
+
callIds: null,
|
|
13
|
+
sessionIds: null,
|
|
14
|
+
include: null,
|
|
15
|
+
userId: null,
|
|
16
|
+
channelIds: null,
|
|
17
|
+
...query
|
|
18
|
+
}).build();
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as getCallRequest } from './getCallRequest';
|
|
2
|
+
export { default as getCallsRequest } from './getCallsRequest';
|
|
3
|
+
export { default as initiateCallRequest } from './initiateCallRequest';
|
|
4
|
+
export { default as updateCallStatusRequest } from './updateCallStatusRequest';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
export default function initiateCall() {
|
|
3
|
+
let {
|
|
4
|
+
params = {},
|
|
5
|
+
body = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
callId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).withBody({
|
|
11
|
+
platform: null,
|
|
12
|
+
meta: null,
|
|
13
|
+
...body
|
|
14
|
+
}).build();
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
export default function updateCallStatusRequest() {
|
|
3
|
+
let {
|
|
4
|
+
params = {},
|
|
5
|
+
body = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
callId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).withBody({
|
|
11
|
+
status: null,
|
|
12
|
+
meta: null,
|
|
13
|
+
message: null,
|
|
14
|
+
...body
|
|
15
|
+
}).build();
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function createCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {},
|
|
6
|
+
body = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({ ...params
|
|
9
|
+
}).withBody({
|
|
10
|
+
title: null,
|
|
11
|
+
message: null,
|
|
12
|
+
tags: null,
|
|
13
|
+
type: null,
|
|
14
|
+
...body
|
|
15
|
+
}).build();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default createCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function deleteCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default deleteCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function disableCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default disableCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function enableCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default enableCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default getCannedMessageRequest;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getCannedMessagesRequest() {
|
|
4
|
+
let {
|
|
5
|
+
query = {},
|
|
6
|
+
params = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({ ...params
|
|
9
|
+
}).withQuery({
|
|
10
|
+
from: 0,
|
|
11
|
+
limit: 10,
|
|
12
|
+
modifiedAfter: null,
|
|
13
|
+
type: null,
|
|
14
|
+
...query
|
|
15
|
+
}).build();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default getCannedMessagesRequest;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as getCannedMessagesRequest } from './getCannedMessagesRequest';
|
|
2
|
+
export { default as getCannedMessageRequest } from './getCannedMessageRequest';
|
|
3
|
+
export { default as deleteCannedMessageRequest } from './deleteCannedMessageRequest';
|
|
4
|
+
export { default as createCannedMessageRequest } from './createCannedMessageRequest';
|
|
5
|
+
export { default as enableCannedMessageRequest } from './enableCannedMessageRequest';
|
|
6
|
+
export { default as disableCannedMessageRequest } from './disableCannedMessageRequest';
|
|
7
|
+
export { default as updateCannedMessageRequest } from './updateCannedMessageRequest';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function updateCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {},
|
|
6
|
+
body = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({
|
|
9
|
+
cannedMessageId: null,
|
|
10
|
+
...params
|
|
11
|
+
}).withBody({
|
|
12
|
+
title: null,
|
|
13
|
+
message: null,
|
|
14
|
+
tags: null,
|
|
15
|
+
type: null,
|
|
16
|
+
...body
|
|
17
|
+
}).build();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default updateCannedMessageRequest;
|
package/es/domain/dto/index.js
CHANGED
|
@@ -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,16 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getTemplateCreditExhaustStatusRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {},
|
|
6
|
+
query = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({ ...params
|
|
9
|
+
}).withQuery({
|
|
10
|
+
channelId: null,
|
|
11
|
+
receiverId: null,
|
|
12
|
+
...query
|
|
13
|
+
}).build();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default getTemplateCreditExhaustStatusRequest;
|
|
@@ -4,7 +4,11 @@ import { ActorSchema } from '../../schema';
|
|
|
4
4
|
export default class Actor {
|
|
5
5
|
constructor() {
|
|
6
6
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
const validatedData = validateSchema(
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: ActorSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'Actor'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
name: validatedData.name,
|
|
10
14
|
type: validatedData.type,
|
|
@@ -29,6 +33,10 @@ export default class Actor {
|
|
|
29
33
|
return type === ActorType.ENDUSER;
|
|
30
34
|
}
|
|
31
35
|
|
|
36
|
+
static isAgent(type) {
|
|
37
|
+
return type === ActorType.AGENT;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
toJSON() {
|
|
33
41
|
return { ...this.data
|
|
34
42
|
};
|
|
@@ -3,7 +3,11 @@ import { AgentSchema } from '../../schema';
|
|
|
3
3
|
export default class Agent {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: AgentSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Agent'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
firstName: validatedData.firstName,
|
|
@@ -3,7 +3,11 @@ import { AttachmentSchema } from '../../schema';
|
|
|
3
3
|
export default class Attachment {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: AttachmentSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Attachment'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
name: validatedData.name,
|
|
@@ -3,7 +3,11 @@ import { BotSchema } from '../../schema';
|
|
|
3
3
|
export default class Bot {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: BotSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Bot'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
botServiceType: validatedData.botServiceType,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { CallSchema } from '../../schema';
|
|
3
|
+
export default class Call {
|
|
4
|
+
constructor() {
|
|
5
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: CallSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Call'
|
|
10
|
+
}); // Set required properties from schema
|
|
11
|
+
|
|
12
|
+
this.id = validatedData.id;
|
|
13
|
+
this.integrationServiceId = validatedData.integrationServiceId;
|
|
14
|
+
this.actor = validatedData.actor;
|
|
15
|
+
this.channelId = validatedData.channelId;
|
|
16
|
+
this.createdTime = validatedData.createdTime;
|
|
17
|
+
this.direction = validatedData.direction;
|
|
18
|
+
this.sessionId = validatedData.sessionId;
|
|
19
|
+
this.status = validatedData.status; // Set optional properties from schema
|
|
20
|
+
|
|
21
|
+
this.meta = validatedData.meta || null;
|
|
22
|
+
this.participants = validatedData.participants || null;
|
|
23
|
+
this.session = validatedData.session || false;
|
|
24
|
+
this.statuses = validatedData.statuses || null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toJSON() {
|
|
28
|
+
return {
|
|
29
|
+
id: this.id,
|
|
30
|
+
integrationServiceId: this.integrationServiceId,
|
|
31
|
+
actor: this.actor,
|
|
32
|
+
channelId: this.channelId,
|
|
33
|
+
createdTime: this.createdTime,
|
|
34
|
+
direction: this.direction,
|
|
35
|
+
sessionId: this.sessionId,
|
|
36
|
+
status: this.status,
|
|
37
|
+
meta: this.meta,
|
|
38
|
+
participants: this.participants,
|
|
39
|
+
session: this.session,
|
|
40
|
+
statuses: this.statuses
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Call } from './Call';
|