@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.
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 +5 -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,61 @@
1
+ import { CannedMessageType } from '../../enum';
2
+ import { ActorSchema } from '../actor';
3
+ import TranslationsSchema from './TranslationsSchema';
4
+ const CannedMessageSchema = {
5
+ id: {
6
+ type: 'string',
7
+ required: true
8
+ },
9
+ title: {
10
+ type: 'string',
11
+ required: true
12
+ },
13
+ tags: {
14
+ type: 'string',
15
+ required: false
16
+ },
17
+ status: {
18
+ type: 'string',
19
+ required: false
20
+ },
21
+ createdBy: {
22
+ type: 'object',
23
+ required: true,
24
+ schema: ActorSchema
25
+ },
26
+ uuid: {
27
+ type: 'string',
28
+ required: false
29
+ },
30
+ displayMessage: {
31
+ type: 'string',
32
+ required: true
33
+ },
34
+ type: {
35
+ type: 'string',
36
+ required: true,
37
+ enum: Object.values(CannedMessageType)
38
+ },
39
+ translations: {
40
+ type: 'array',
41
+ required: false,
42
+ schema: TranslationsSchema
43
+ },
44
+ isPrivate: {
45
+ type: 'bool',
46
+ required: false
47
+ },
48
+ isActive: {
49
+ type: 'bool',
50
+ required: true
51
+ },
52
+ meta: {
53
+ type: 'array',
54
+ required: false
55
+ },
56
+ message: {
57
+ type: 'string',
58
+ required: false
59
+ }
60
+ };
61
+ export default CannedMessageSchema;
@@ -0,0 +1,17 @@
1
+ import { TemplateItemButtonType } from '../../../enum';
2
+ const TemplateItemButtonsSchema = {
3
+ type: {
4
+ type: 'string',
5
+ required: true,
6
+ enum: Object.values(TemplateItemButtonType)
7
+ },
8
+ message: {
9
+ type: 'string',
10
+ required: true
11
+ },
12
+ action: {
13
+ type: 'string',
14
+ required: true
15
+ }
16
+ };
17
+ export default TemplateItemButtonsSchema;
@@ -0,0 +1,13 @@
1
+ import { TemplateItemFooterType } from '../../../enum';
2
+ const TemplateItemFooterSchema = {
3
+ type: {
4
+ type: 'string',
5
+ required: true,
6
+ enum: Object.values(TemplateItemFooterType)
7
+ },
8
+ message: {
9
+ type: 'string',
10
+ required: true
11
+ }
12
+ };
13
+ export default TemplateItemFooterSchema;
@@ -0,0 +1,19 @@
1
+ import { TemplateItemHeaderType } from '../../../enum';
2
+ import { AttachmentSchema } from '../../attachment';
3
+ const TemplateItemHeaderSchema = {
4
+ attachment: {
5
+ type: 'string',
6
+ required: false,
7
+ schema: AttachmentSchema
8
+ },
9
+ type: {
10
+ type: 'string',
11
+ required: true,
12
+ enum: Object.values(TemplateItemHeaderType)
13
+ },
14
+ message: {
15
+ type: 'string',
16
+ required: false
17
+ }
18
+ };
19
+ export default TemplateItemHeaderSchema;
@@ -0,0 +1,4 @@
1
+ import TemplateItemButtonsSchema from './TemplateItemButtonsSchema';
2
+ import TemplateItemFooterSchema from './TemplateItemFooterSchema';
3
+ import TemplateItemHeaderSchema from './TemplateItemHeaderSchema';
4
+ export { TemplateItemButtonsSchema, TemplateItemFooterSchema, TemplateItemHeaderSchema };
@@ -0,0 +1,21 @@
1
+ import TemplateItemButtonsSchema from './TemplateItem/TemplateItemButtonsSchema';
2
+ import TemplateItemFooterSchema from './TemplateItem/TemplateItemFooterSchema';
3
+ import TemplateItemHeaderSchema from './TemplateItem/TemplateItemHeaderSchema';
4
+ const TemplateItemsSchema = {
5
+ header: {
6
+ type: 'string',
7
+ required: false,
8
+ schema: TemplateItemHeaderSchema
9
+ },
10
+ footer: {
11
+ type: 'string',
12
+ required: false,
13
+ schema: TemplateItemFooterSchema
14
+ },
15
+ buttons: {
16
+ type: 'string',
17
+ required: false,
18
+ schema: TemplateItemButtonsSchema
19
+ }
20
+ };
21
+ export default TemplateItemsSchema;
@@ -0,0 +1,43 @@
1
+ import { CannedMessageStatus } from '../../enum';
2
+ import TemplateItemsSchema from './TemplateItemsSchema';
3
+ const TranslationsSchema = {
4
+ displayMessage: {
5
+ type: 'string',
6
+ required: true
7
+ },
8
+ id: {
9
+ type: 'string',
10
+ required: true
11
+ },
12
+ language: {
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ message: {
17
+ type: 'string',
18
+ required: true
19
+ },
20
+ uuid: {
21
+ type: 'string',
22
+ required: true
23
+ },
24
+ failedReason: {
25
+ type: 'string',
26
+ required: false
27
+ },
28
+ modifiedTime: {
29
+ type: 'string',
30
+ required: false
31
+ },
32
+ status: {
33
+ type: 'string',
34
+ required: true,
35
+ enum: Object.values(CannedMessageStatus)
36
+ },
37
+ templateItems: {
38
+ type: 'object',
39
+ required: false,
40
+ schema: TemplateItemsSchema
41
+ }
42
+ };
43
+ export default TranslationsSchema;
@@ -0,0 +1,2 @@
1
+ import CannedMessageSchema from './CannedMessageSchema';
2
+ export { CannedMessageSchema };
@@ -0,0 +1,28 @@
1
+ import '../../enum';
2
+ const CustomReplyExtensionSchema = {
3
+ id: {
4
+ type: 'string',
5
+ required: true
6
+ },
7
+ title: {
8
+ type: 'string',
9
+ required: true
10
+ },
11
+ displayMessage: {
12
+ type: 'string',
13
+ required: true
14
+ },
15
+ message: {
16
+ type: 'string',
17
+ required: false
18
+ },
19
+ webUrl: {
20
+ type: 'string',
21
+ required: false
22
+ },
23
+ categoryName: {
24
+ type: 'string',
25
+ required: false
26
+ }
27
+ };
28
+ export default CustomReplyExtensionSchema;
@@ -0,0 +1,2 @@
1
+ import CustomReplyExtensionSchema from './CustomReplyExtensionSchema';
2
+ export { CustomReplyExtensionSchema };
@@ -5,4 +5,8 @@ export * from './attachment';
5
5
  export * from './message';
6
6
  export * from './channel';
7
7
  export * from './integrationService';
8
- export * from './contact';
8
+ export * from './contact';
9
+ export * from './cannedMessage';
10
+ export * from './templateMessage';
11
+ export * from './customReplyExtension';
12
+ export * from './call';
@@ -0,0 +1,11 @@
1
+ const TemplateCreditExhaustStatusSchema = {
2
+ code: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ message: {
7
+ type: 'string',
8
+ required: false
9
+ }
10
+ };
11
+ export default TemplateCreditExhaustStatusSchema;
@@ -0,0 +1,11 @@
1
+ const TemplateLanguageSchema = {
2
+ code: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ language: {
7
+ type: 'string',
8
+ required: true
9
+ }
10
+ };
11
+ export default TemplateLanguageSchema;
@@ -0,0 +1,3 @@
1
+ import TemplateLanguageSchema from './TemplateLanguageSchema';
2
+ import TemplateCreditExhaustStatusSchema from './TemplateCreditExhaustStatusSchema';
3
+ export { TemplateLanguageSchema, TemplateCreditExhaustStatusSchema };
@@ -5,6 +5,9 @@ import { SessionSDK } from '../sdk/sessions';
5
5
  import { MessageSDK } from '../sdk/messages';
6
6
  import { AgentSDK } from '../sdk/agents';
7
7
  import { ContactSDK } from '../sdk/contacts';
8
+ import { CannedMessageSDK } from '../sdk/cannedMessages';
9
+ import { TemplateMessageSDK } from '../sdk/templateMessages';
10
+ import { CallSDK } from '../sdk/calls';
8
11
  const ModuleFactory = {
9
12
  [ModuleNames.CHANNELS]: _ref => {
10
13
  let {
@@ -53,6 +56,30 @@ const ModuleFactory = {
53
56
  return new MessageSDK({
54
57
  config
55
58
  }).toJSON();
59
+ },
60
+ [ModuleNames.CANNED_MESSAGES]: _ref7 => {
61
+ let {
62
+ config
63
+ } = _ref7;
64
+ return new CannedMessageSDK({
65
+ config
66
+ }).toJSON();
67
+ },
68
+ [ModuleNames.TEMPLATE_MESSAGES]: _ref8 => {
69
+ let {
70
+ config
71
+ } = _ref8;
72
+ return new TemplateMessageSDK({
73
+ config
74
+ }).toJSON();
75
+ },
76
+ [ModuleNames.CALLS]: _ref9 => {
77
+ let {
78
+ config
79
+ } = _ref9;
80
+ return new CallSDK({
81
+ config
82
+ }).toJSON();
56
83
  }
57
84
  };
58
85
  export default ModuleFactory;
@@ -3,7 +3,7 @@ import ModuleFactory from './ModuleFactory';
3
3
  export default class ModuleManager {
4
4
  constructor() {
5
5
  this._modules = new Map();
6
- this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS, ModuleNames.MESSAGES, ModuleNames.AGENTS, ModuleNames.CONTACTS];
6
+ this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS, ModuleNames.MESSAGES, ModuleNames.AGENTS, ModuleNames.CONTACTS, ModuleNames.CANNED_MESSAGES, ModuleNames.TEMPLATE_MESSAGES, ModuleNames.CALLS];
7
7
  }
8
8
 
9
9
  initialize(_ref) {
@@ -43,6 +43,18 @@ export default class IMSDK {
43
43
  return this._moduleManager.getModule(ModuleNames.CONTACTS);
44
44
  }
45
45
 
46
+ get cannedMessages() {
47
+ return this._moduleManager.getModule(ModuleNames.CANNED_MESSAGES);
48
+ }
49
+
50
+ get templateMessages() {
51
+ return this._moduleManager.getModule(ModuleNames.TEMPLATE_MESSAGES);
52
+ }
53
+
54
+ get calls() {
55
+ return this._moduleManager.getModule(ModuleNames.CALLS);
56
+ }
57
+
46
58
  hasModule(moduleName) {
47
59
  return this._moduleManager.hasModule(moduleName);
48
60
  }
@@ -55,6 +67,9 @@ export default class IMSDK {
55
67
  messages: this.messages,
56
68
  agents: this.agents,
57
69
  contacts: this.contacts,
70
+ cannedMessages: this.cannedMessages,
71
+ templateMessages: this.templateMessages,
72
+ calls: this.calls,
58
73
  hasModule: this.hasModule.bind(this)
59
74
  };
60
75
  }
@@ -0,0 +1,27 @@
1
+ import { CallService } from '../../../application/services';
2
+ import { CallRepository } from '../../../infrastructure/repositories';
3
+ export default class CallSDK {
4
+ constructor(_ref) {
5
+ let {
6
+ config
7
+ } = _ref;
8
+ const {
9
+ callAPI,
10
+ callAdapter
11
+ } = config;
12
+ const callRepository = new CallRepository({
13
+ callAPI,
14
+ callAdapter
15
+ }).toJSON();
16
+ const callService = new CallService({
17
+ callRepository
18
+ }).toJSON();
19
+ this.services = { ...callService
20
+ };
21
+ }
22
+
23
+ toJSON() {
24
+ return this.services;
25
+ }
26
+
27
+ }
@@ -0,0 +1 @@
1
+ export { default as CallSDK } from './CallSDK';
@@ -0,0 +1,30 @@
1
+ import { CannedMessageService } from '../../../application/services';
2
+ import { CannedMessageRepository } from '../../../infrastructure/repositories';
3
+
4
+ class CannedMessageSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ cannedMessageAPI,
11
+ cannedMessageAdapter
12
+ } = config;
13
+ const cannedMessageRepository = new CannedMessageRepository({
14
+ cannedMessageAPI,
15
+ cannedMessageAdapter
16
+ }).toJSON();
17
+ const cannedMessageService = new CannedMessageService({
18
+ cannedMessageRepository
19
+ }).toJSON();
20
+ this.services = { ...cannedMessageService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default CannedMessageSDK;
@@ -0,0 +1,2 @@
1
+ import CannedMessageSDK from './CannedMessageSDK';
2
+ export { CannedMessageSDK };
@@ -0,0 +1,30 @@
1
+ import { TemplateMessageService } from '../../../application/services';
2
+ import { TemplateMessageRepository } from '../../../infrastructure/repositories';
3
+
4
+ class TemplateMessageSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ templateMessageAPI,
11
+ templateLanguageAdapter
12
+ } = config;
13
+ const templateMessageRepository = new TemplateMessageRepository({
14
+ templateMessageAPI,
15
+ templateLanguageAdapter
16
+ }).toJSON();
17
+ const templateMessageService = new TemplateMessageService({
18
+ templateMessageRepository
19
+ }).toJSON();
20
+ this.services = { ...templateMessageService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default TemplateMessageSDK;
@@ -0,0 +1,2 @@
1
+ import TemplateMessageSDK from './TemplateMessageSDK';
2
+ export { TemplateMessageSDK };
@@ -0,0 +1,30 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Call } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class CallAdapter extends IAdapter {
5
+ adapt(callData) {
6
+ if (!callData) {
7
+ throw new AdapterError('Call data is required');
8
+ }
9
+
10
+ try {
11
+ return new Call({
12
+ id: callData.id,
13
+ integrationServiceId: callData.integrationServiceId,
14
+ actor: callData.actor,
15
+ channelId: callData.channelId,
16
+ createdTime: callData.createdTime,
17
+ direction: callData.direction,
18
+ sessionId: callData.sessionId,
19
+ status: callData.status,
20
+ meta: callData.meta,
21
+ participants: callData.participants,
22
+ session: callData.session,
23
+ statuses: callData.statuses
24
+ }).toJSON();
25
+ } catch (error) {
26
+ throw new AdapterError(`Failed to adapt message: ${error.message}`);
27
+ }
28
+ }
29
+
30
+ }
@@ -0,0 +1 @@
1
+ export { default as CallAdapter } from './CallAdapter';
@@ -0,0 +1,28 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { CannedMessage } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class CannedMessageAdapter extends IAdapter {
5
+ adapt(cannedMessageData) {
6
+ if (!cannedMessageData) {
7
+ throw new AdapterError('Canned Message data is required');
8
+ }
9
+
10
+ try {
11
+ return new CannedMessage({
12
+ id: cannedMessageData.id,
13
+ title: cannedMessageData.title,
14
+ tags: cannedMessageData.tags,
15
+ status: cannedMessageData.status,
16
+ createdBy: cannedMessageData.createdBy,
17
+ isActive: cannedMessageData.isActive,
18
+ isPrivate: cannedMessageData.isPrivate,
19
+ translations: cannedMessageData.translations,
20
+ uuid: cannedMessageData.uuid,
21
+ meta: cannedMessageData.meta
22
+ }).toJSON();
23
+ } catch (error) {
24
+ throw new AdapterError(`Failed to adapt canned message: ${error.message}`);
25
+ }
26
+ }
27
+
28
+ }
@@ -0,0 +1,2 @@
1
+ import CannedMessageAdapter from './CannedMessageAdapter';
2
+ export { CannedMessageAdapter };
@@ -0,0 +1,24 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { CustomReplyExtension } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class CustomReplyExtensionAdapter extends IAdapter {
5
+ adapt(customReplyExtData) {
6
+ if (!customReplyExtData) {
7
+ throw new AdapterError('custom Reply Extension Data is required');
8
+ }
9
+
10
+ try {
11
+ return new CustomReplyExtension({
12
+ id: customReplyExtData.id,
13
+ title: customReplyExtData.title,
14
+ message: customReplyExtData.message,
15
+ displayMessage: customReplyExtData.displayMessage,
16
+ webUrl: customReplyExtData.webUrl,
17
+ categoryName: customReplyExtData.categoryName
18
+ }).toJSON();
19
+ } catch (error) {
20
+ throw new AdapterError(`Failed to adapt custom Reply Extension Data: ${error.message}`);
21
+ }
22
+ }
23
+
24
+ }
@@ -0,0 +1,2 @@
1
+ import CustomReplyExtensionAdapter from './CustomReplyExtensionAdapter';
2
+ export { CustomReplyExtensionAdapter };
@@ -4,4 +4,8 @@ export * from './bots';
4
4
  export * from './attachments';
5
5
  export * from './messages';
6
6
  export * from './agents';
7
- export * from './contacts';
7
+ export * from './contacts';
8
+ export * from './cannedMessages';
9
+ export * from './templateMessages';
10
+ export * from './customReplyExtension';
11
+ export * from './calls';
@@ -0,0 +1,20 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { TemplateCreditExhaustStatus } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class TemplateCreditExhaustStatusAdapter extends IAdapter {
5
+ adapt(templateCreditExhaustStatusData) {
6
+ if (!templateCreditExhaustStatusData) {
7
+ throw new AdapterError('Template Credit Exhaust Status data is required');
8
+ }
9
+
10
+ try {
11
+ return new TemplateCreditExhaustStatus({
12
+ code: templateCreditExhaustStatusData.code,
13
+ message: templateCreditExhaustStatusData.message
14
+ }).toJSON();
15
+ } catch (error) {
16
+ throw new AdapterError(`Failed to adapt Template Credit Exhaust Status: ${error.message}`);
17
+ }
18
+ }
19
+
20
+ }
@@ -0,0 +1,20 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { TemplateLanguage } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class TemplateLanguageAdapter extends IAdapter {
5
+ adapt(templateLanguageData) {
6
+ if (!templateLanguageData) {
7
+ throw new AdapterError('templateLanguage data is required');
8
+ }
9
+
10
+ try {
11
+ return new TemplateLanguage({
12
+ code: templateLanguageData.code,
13
+ language: templateLanguageData.language
14
+ }).toJSON();
15
+ } catch (error) {
16
+ throw new AdapterError(`Failed to adapt TemplateLanguage: ${error.message}`);
17
+ }
18
+ }
19
+
20
+ }
@@ -0,0 +1,3 @@
1
+ import TemplateLanguageAdapter from './TemplateLanguageAdapter';
2
+ import TemplateCreditExhaustStatusAdapter from './TemplateCreditExhaustStatusAdapter';
3
+ export { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter };
@@ -0,0 +1,44 @@
1
+ import { getCallsRequest, getCallRequest, updateCallStatusRequest, initiateCallRequest } from '../../../domain/dto';
2
+ import { ICallRepository } from '../../../domain/interfaces/repositories';
3
+ export default class CallAPI extends ICallRepository {
4
+ async getCalls() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallsRequest();
6
+ const operation = 'getCalls';
7
+ const httpRequest = await this.request({
8
+ operation,
9
+ request
10
+ });
11
+ return httpRequest;
12
+ }
13
+
14
+ async getCall() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallRequest();
16
+ const operation = 'getCall';
17
+ const httpRequest = await this.request({
18
+ operation,
19
+ request
20
+ });
21
+ return httpRequest;
22
+ }
23
+
24
+ async updateCallStatus() {
25
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCallStatusRequest();
26
+ const operation = 'updateCallStatus';
27
+ const httpRequest = await this.request({
28
+ operation,
29
+ request
30
+ });
31
+ return httpRequest;
32
+ }
33
+
34
+ async initiateCall() {
35
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initiateCallRequest();
36
+ const operation = 'initiateCall';
37
+ const httpRequest = await this.request({
38
+ operation,
39
+ request
40
+ });
41
+ return httpRequest;
42
+ }
43
+
44
+ }
@@ -0,0 +1 @@
1
+ export { default as CallAPI } from './CallAPI';