@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.
Files changed (134) hide show
  1. package/es/application/services/calls/CallService.js +36 -0
  2. package/es/application/services/calls/index.js +1 -0
  3. package/es/application/services/cannedMessages/CannedMessageService.js +51 -0
  4. package/es/application/services/cannedMessages/index.js +2 -0
  5. package/es/application/services/index.js +4 -1
  6. package/es/application/services/templateMessages/TemplateMessageService.js +26 -0
  7. package/es/application/services/templateMessages/index.js +2 -0
  8. package/es/core/constants/ModuleNames.js +5 -1
  9. package/es/core/utils/validateSchema.js +60 -26
  10. package/es/domain/dto/calls/getCallRequest.js +14 -0
  11. package/es/domain/dto/calls/getCallsRequest.js +19 -0
  12. package/es/domain/dto/calls/index.js +4 -0
  13. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  14. package/es/domain/dto/calls/updateCallStatusRequest.js +16 -0
  15. package/es/domain/dto/cannedMessages/createCannedMessageRequest.js +18 -0
  16. package/es/domain/dto/cannedMessages/deleteCannedMessageRequest.js +13 -0
  17. package/es/domain/dto/cannedMessages/disableCannedMessageRequest.js +13 -0
  18. package/es/domain/dto/cannedMessages/enableCannedMessageRequest.js +13 -0
  19. package/es/domain/dto/cannedMessages/getCannedMessageRequest.js +13 -0
  20. package/es/domain/dto/cannedMessages/getCannedMessagesRequest.js +18 -0
  21. package/es/domain/dto/cannedMessages/index.js +7 -0
  22. package/es/domain/dto/cannedMessages/updateCannedMessageRequest.js +20 -0
  23. package/es/domain/dto/index.js +4 -1
  24. package/es/domain/dto/messages/initiateSessionRequest.js +2 -0
  25. package/es/domain/dto/sessions/getSessionsRequest.js +1 -0
  26. package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +16 -0
  27. package/es/domain/dto/templateMessages/getTemplateLanguagesRequest.js +7 -0
  28. package/es/domain/dto/templateMessages/index.js +2 -0
  29. package/es/domain/entities/Actor/Actor.js +9 -1
  30. package/es/domain/entities/Agent/Agent.js +5 -1
  31. package/es/domain/entities/Attachment/Attachment.js +5 -1
  32. package/es/domain/entities/Bot/Bot.js +5 -1
  33. package/es/domain/entities/Call/Call.js +44 -0
  34. package/es/domain/entities/Call/index.js +1 -0
  35. package/es/domain/entities/CannedMessage/CannedMessage.js +50 -0
  36. package/es/domain/entities/CannedMessage/index.js +2 -0
  37. package/es/domain/entities/Channel/Channel.js +5 -1
  38. package/es/domain/entities/Contact/Contact.js +5 -1
  39. package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +26 -0
  40. package/es/domain/entities/CustomReplyExtension/index.js +2 -0
  41. package/es/domain/entities/IntegrationService/IntegrationService.js +5 -1
  42. package/es/domain/entities/Message/Action.js +5 -1
  43. package/es/domain/entities/Message/ExternalInfo.js +5 -1
  44. package/es/domain/entities/Message/Info.js +5 -1
  45. package/es/domain/entities/Message/InfoTarget.js +5 -1
  46. package/es/domain/entities/Message/Location.js +5 -1
  47. package/es/domain/entities/Message/Message.js +25 -2
  48. package/es/domain/entities/Message/MessageWithSession.js +5 -1
  49. package/es/domain/entities/Session/Session.js +5 -1
  50. package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +27 -0
  51. package/es/domain/entities/TemplateMessage/TemplateLanguage.js +22 -0
  52. package/es/domain/entities/TemplateMessage/index.js +3 -0
  53. package/es/domain/entities/index.js +5 -1
  54. package/es/domain/enum/call/CallStatus.js +8 -0
  55. package/es/domain/enum/call/index.js +1 -0
  56. package/es/domain/enum/cannedMessage/CannedMessageStatus.js +7 -0
  57. package/es/domain/enum/cannedMessage/CannedMessageType.js +5 -0
  58. package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +6 -0
  59. package/es/domain/enum/cannedMessage/TemplateItemFooterType.js +4 -0
  60. package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +7 -0
  61. package/es/domain/enum/cannedMessage/index.js +6 -0
  62. package/es/domain/enum/index.js +4 -1
  63. package/es/domain/enum/message/MessageMeta.js +2 -1
  64. package/es/domain/enum/message/MetaMessageSourceType.js +6 -0
  65. package/es/domain/enum/message/index.js +2 -1
  66. package/es/domain/enum/templateMessage/TemplateCreditExhaustStatusCode.js +4 -0
  67. package/es/domain/enum/templateMessage/index.js +2 -0
  68. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  69. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  70. package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +47 -0
  71. package/es/domain/interfaces/repositories/cannedMessages/index.js +2 -0
  72. package/es/domain/interfaces/repositories/index.js +4 -1
  73. package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +21 -0
  74. package/es/domain/interfaces/repositories/templateMessages/index.js +2 -0
  75. package/es/domain/schema/call/CallSchema.js +59 -0
  76. package/es/domain/schema/call/index.js +1 -0
  77. package/es/domain/schema/cannedMessage/CannedMessageSchema.js +61 -0
  78. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +17 -0
  79. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemFooterSchema.js +13 -0
  80. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemHeaderSchema.js +19 -0
  81. package/es/domain/schema/cannedMessage/TemplateItem/index.js +4 -0
  82. package/es/domain/schema/cannedMessage/TemplateItemsSchema.js +21 -0
  83. package/es/domain/schema/cannedMessage/TranslationsSchema.js +43 -0
  84. package/es/domain/schema/cannedMessage/index.js +2 -0
  85. package/es/domain/schema/customReplyExtension/CustomReplyExtensionSchema.js +28 -0
  86. package/es/domain/schema/customReplyExtension/index.js +2 -0
  87. package/es/domain/schema/index.js +5 -1
  88. package/es/domain/schema/templateMessage/TemplateCreditExhaustStatusSchema.js +11 -0
  89. package/es/domain/schema/templateMessage/TemplateLanguageSchema.js +11 -0
  90. package/es/domain/schema/templateMessage/index.js +3 -0
  91. package/es/frameworks/managers/ModuleFactory.js +27 -0
  92. package/es/frameworks/managers/ModuleManager.js +1 -1
  93. package/es/frameworks/sdk/IMSDK.js +15 -0
  94. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  95. package/es/frameworks/sdk/calls/index.js +1 -0
  96. package/es/frameworks/sdk/cannedMessages/CannedMessageSDK.js +30 -0
  97. package/es/frameworks/sdk/cannedMessages/index.js +2 -0
  98. package/es/frameworks/sdk/templateMessages/TemplateMessageSDK.js +30 -0
  99. package/es/frameworks/sdk/templateMessages/index.js +2 -0
  100. package/es/infrastructure/adapters/calls/CallAdapter.js +30 -0
  101. package/es/infrastructure/adapters/calls/index.js +1 -0
  102. package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +28 -0
  103. package/es/infrastructure/adapters/cannedMessages/index.js +2 -0
  104. package/es/infrastructure/adapters/customReplyExtension/CustomReplyExtensionAdapter.js +24 -0
  105. package/es/infrastructure/adapters/customReplyExtension/index.js +2 -0
  106. package/es/infrastructure/adapters/index.js +5 -1
  107. package/es/infrastructure/adapters/templateMessages/TemplateCreditExhaustStatusAdapter.js +20 -0
  108. package/es/infrastructure/adapters/templateMessages/TemplateLanguageAdapter.js +20 -0
  109. package/es/infrastructure/adapters/templateMessages/index.js +3 -0
  110. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  111. package/es/infrastructure/api/calls/index.js +1 -0
  112. package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +74 -0
  113. package/es/infrastructure/api/cannedMessages/index.js +2 -0
  114. package/es/infrastructure/api/index.js +4 -1
  115. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  116. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  117. package/es/infrastructure/api/registry/calls/index.js +1 -0
  118. package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +42 -0
  119. package/es/infrastructure/api/registry/cannedMessages/constructCannedMessageEndPoint.js +10 -0
  120. package/es/infrastructure/api/registry/cannedMessages/index.js +2 -0
  121. package/es/infrastructure/api/registry/getRegistryConfig.js +7 -1
  122. package/es/infrastructure/api/registry/templateMessages/constructTemplateMessageEndPoint.js +11 -0
  123. package/es/infrastructure/api/registry/templateMessages/index.js +2 -0
  124. package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +18 -0
  125. package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +24 -0
  126. package/es/infrastructure/api/templateMessages/index.js +2 -0
  127. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  128. package/es/infrastructure/repositories/calls/index.js +1 -0
  129. package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +97 -0
  130. package/es/infrastructure/repositories/cannedMessages/index.js +2 -0
  131. package/es/infrastructure/repositories/index.js +4 -1
  132. package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +77 -0
  133. package/es/infrastructure/repositories/templateMessages/index.js +2 -0
  134. 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
+ }
@@ -0,0 +1,2 @@
1
+ import CannedMessageService from './CannedMessageService';
2
+ export { CannedMessageService };
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ import TemplateMessageService from './TemplateMessageService';
2
+ export { TemplateMessageService };
@@ -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
- import { ValidationError } from '../errors'; // function validateSchemaKeys(schema, data) {
2
- // Object.keys(schema).forEach((key) => {
3
- // if (!(key in data)) {
4
- // throw new ValidationError(`Key '${key}' is missing in the data`);
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(_ref) {
22
+ function validateRequiredCheck(_ref2) {
18
23
  let {
19
24
  value,
20
25
  rules,
21
- path
22
- } = _ref;
26
+ path,
27
+ entityName
28
+ } = _ref2;
23
29
 
24
30
  if (rules.required && isEmpty(value)) {
25
- throw new ValidationError(rules.message || `${path} is required`);
31
+ console.warn(`${entityName} - ${path} is required`);
26
32
  }
27
33
  }
28
34
 
29
- function validateEnumCheck(_ref2) {
35
+ function validateEnumCheck(_ref3) {
30
36
  let {
31
37
  value,
32
38
  rules,
33
- path
34
- } = _ref2;
39
+ path,
40
+ entityName
41
+ } = _ref3;
35
42
 
36
43
  if (rules.enum && !rules.enum.includes(value)) {
37
- throw new ValidationError(`${path} must be one of: ${rules.enum.join(', ')}`);
44
+ console.warn(`${entityName} - ${path} must be one of: ${rules.enum.join(', ')}. Received: ${value}`);
38
45
  }
39
46
  }
40
47
 
41
- export const validateSchema = (schema, data) => {
42
- const validate = function (schemaObj, dataObj) {
43
- let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
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
- // validateSchemaKeys(schemaObj, dataObj);
46
- // Validate each field
47
- Object.entries(schemaObj).forEach(_ref3 => {
48
- let [field, rules] = _ref3;
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(rules.schema, value, fieldPath);
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(schema, data);
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;
@@ -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';
@@ -15,6 +15,8 @@ function initiateSessionRequest() {
15
15
  language: null,
16
16
  parameters: {},
17
17
  message: null,
18
+ headerMessage: null,
19
+ urlMessage: null,
18
20
  ...body
19
21
  }).build();
20
22
  }
@@ -19,6 +19,7 @@ function getSessionsRequest() {
19
19
  assigneeFilter: null,
20
20
  workspaceId: null,
21
21
  botIds: null,
22
+ excludeSyncingChannels: false,
22
23
  ...query
23
24
  }).build();
24
25
  }
@@ -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;
@@ -0,0 +1,7 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getTemplateLanguagesRequest() {
4
+ return new RequestBuilder().build();
5
+ }
6
+
7
+ export default getTemplateLanguagesRequest;
@@ -0,0 +1,2 @@
1
+ export { default as getTemplateLanguagesRequest } from './getTemplateLanguagesRequest';
2
+ export { default as getTemplateCreditExhaustStatusRequest } from './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(ActorSchema, data);
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(AgentSchema, data);
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(AttachmentSchema, data);
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(BotSchema, data);
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';