@zohoim/client-sdk 1.0.0-poc49 → 1.0.0-poc50

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 (120) hide show
  1. package/es/application/services/agents/AgentService.js +21 -0
  2. package/es/application/services/agents/index.js +2 -0
  3. package/es/application/services/contacts/ContactService.js +26 -0
  4. package/es/application/services/contacts/index.js +2 -0
  5. package/es/application/services/index.js +4 -1
  6. package/es/application/services/messages/MessageService.js +56 -0
  7. package/es/application/services/messages/index.js +2 -0
  8. package/es/application/services/sessions/SessionService.js +31 -1
  9. package/es/core/constants/ModuleNames.js +4 -1
  10. package/es/domain/dto/agents/getAgentsRequest.js +12 -0
  11. package/es/domain/dto/agents/index.js +1 -0
  12. package/es/domain/dto/bots/index.js +1 -2
  13. package/es/domain/dto/channels/agents/index.js +1 -2
  14. package/es/domain/dto/contacts/getContactsRequest.js +10 -0
  15. package/es/domain/dto/contacts/index.js +2 -0
  16. package/es/domain/dto/contacts/searchContactsRequest.js +11 -0
  17. package/es/domain/dto/index.js +4 -1
  18. package/es/domain/dto/messages/deleteMessageRequest.js +14 -0
  19. package/es/domain/dto/messages/getFullContentRequest.js +14 -0
  20. package/es/domain/dto/messages/getMessagesRequest.js +20 -0
  21. package/es/domain/dto/messages/getSearchedMessagesRequest.js +22 -0
  22. package/es/domain/dto/messages/index.js +8 -0
  23. package/es/domain/dto/messages/initiateSessionRequest.js +21 -0
  24. package/es/domain/dto/messages/resendMessageRequest.js +14 -0
  25. package/es/domain/dto/messages/sendAttachmentRequest.js +20 -0
  26. package/es/domain/dto/messages/sendMessageRequest.js +17 -0
  27. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +13 -0
  28. package/es/domain/dto/sessions/getSessionLastMessagesRequest.js +13 -0
  29. package/es/domain/dto/sessions/getSessionRequest.js +13 -0
  30. package/es/domain/dto/sessions/getSessionsRequest.js +26 -0
  31. package/es/domain/dto/sessions/index.js +7 -2
  32. package/es/domain/dto/sessions/markSessionAsReadRequest.js +13 -0
  33. package/es/domain/dto/sessions/updateSessionStatusRequest.js +17 -0
  34. package/es/domain/entities/Attachment/Attachment.js +22 -0
  35. package/es/domain/entities/Attachment/index.js +2 -0
  36. package/es/domain/entities/Contact/Contact.js +22 -0
  37. package/es/domain/entities/Contact/index.js +2 -0
  38. package/es/domain/entities/Message/Action.js +19 -0
  39. package/es/domain/entities/Message/ExternalInfo.js +17 -0
  40. package/es/domain/entities/Message/Info.js +21 -0
  41. package/es/domain/entities/Message/Location.js +18 -0
  42. package/es/domain/entities/Message/Message.js +45 -0
  43. package/es/domain/entities/Message/MessageWithSession.js +21 -0
  44. package/es/domain/entities/Message/index.js +6 -0
  45. package/es/domain/entities/index.js +4 -1
  46. package/es/domain/enum/actor/ActorType.js +2 -1
  47. package/es/domain/enum/index.js +2 -1
  48. package/es/domain/enum/message/MessageContentType.js +6 -0
  49. package/es/domain/enum/message/MessageDirection.js +6 -0
  50. package/es/domain/enum/message/MessageStatus.js +11 -0
  51. package/es/domain/enum/message/MessageType.js +11 -0
  52. package/es/domain/enum/message/index.js +5 -0
  53. package/es/domain/interfaces/repositories/agents/IAgentRepository.js +9 -0
  54. package/es/domain/interfaces/repositories/agents/index.js +2 -0
  55. package/es/domain/interfaces/repositories/contacts/IContactRepository.js +14 -0
  56. package/es/domain/interfaces/repositories/contacts/index.js +2 -0
  57. package/es/domain/interfaces/repositories/index.js +4 -1
  58. package/es/domain/interfaces/repositories/messages/IMessageRepository.js +43 -0
  59. package/es/domain/interfaces/repositories/messages/index.js +2 -0
  60. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +32 -2
  61. package/es/domain/schema/attachment/AttachmentSchema.js +27 -0
  62. package/es/domain/schema/attachment/index.js +2 -0
  63. package/es/domain/schema/contact/ContactSchema.js +27 -0
  64. package/es/domain/schema/contact/index.js +2 -0
  65. package/es/domain/schema/index.js +4 -1
  66. package/es/domain/schema/message/ActionSchema.js +15 -0
  67. package/es/domain/schema/message/ExternalInfoSchema.js +7 -0
  68. package/es/domain/schema/message/InfoSchema.js +21 -0
  69. package/es/domain/schema/message/LocationSchema.js +11 -0
  70. package/es/domain/schema/message/MessageSchema.js +112 -0
  71. package/es/domain/schema/message/MessageWithSessionSchema.js +10 -0
  72. package/es/domain/schema/message/index.js +7 -0
  73. package/es/frameworks/managers/ModuleFactory.js +27 -0
  74. package/es/frameworks/managers/ModuleManager.js +1 -1
  75. package/es/frameworks/sdk/IMSDK.js +15 -0
  76. package/es/frameworks/sdk/agents/AgentSDK.js +30 -0
  77. package/es/frameworks/sdk/agents/index.js +2 -0
  78. package/es/frameworks/sdk/contacts/ContactSDK.js +30 -0
  79. package/es/frameworks/sdk/contacts/index.js +2 -0
  80. package/es/frameworks/sdk/messages/MessageSDK.js +32 -0
  81. package/es/frameworks/sdk/messages/index.js +2 -0
  82. package/es/frameworks/sdk/sessions/SessionSDK.js +6 -2
  83. package/es/infrastructure/adapters/agents/agentAdapter.js +27 -0
  84. package/es/infrastructure/adapters/agents/index.js +2 -0
  85. package/es/infrastructure/adapters/attachments/AttachmentAdapter.js +24 -0
  86. package/es/infrastructure/adapters/attachments/index.js +2 -0
  87. package/es/infrastructure/adapters/contacts/contactAdapter.js +24 -0
  88. package/es/infrastructure/adapters/contacts/index.js +2 -0
  89. package/es/infrastructure/adapters/index.js +5 -1
  90. package/es/infrastructure/adapters/message/MessageAdapter.js +41 -0
  91. package/es/infrastructure/adapters/message/MessageWithSessionAdapter.js +23 -0
  92. package/es/infrastructure/adapters/message/index.js +2 -0
  93. package/es/infrastructure/api/agents/AgentAPI.js +21 -0
  94. package/es/infrastructure/api/agents/index.js +2 -0
  95. package/es/infrastructure/api/contacts/ContactAPI.js +31 -0
  96. package/es/infrastructure/api/contacts/index.js +2 -0
  97. package/es/infrastructure/api/index.js +4 -1
  98. package/es/infrastructure/api/messages/MessageAPI.js +91 -0
  99. package/es/infrastructure/api/messages/index.js +2 -0
  100. package/es/infrastructure/api/registry/agents/agentAPIRegistry.js +12 -0
  101. package/es/infrastructure/api/registry/agents/constructAgentEndPoint.js +10 -0
  102. package/es/infrastructure/api/registry/agents/index.js +2 -0
  103. package/es/infrastructure/api/registry/contacts/constructContactEndPoint.js +10 -0
  104. package/es/infrastructure/api/registry/contacts/contactAPIRegistry.js +17 -0
  105. package/es/infrastructure/api/registry/contacts/index.js +2 -0
  106. package/es/infrastructure/api/registry/getRegistryConfig.js +7 -1
  107. package/es/infrastructure/api/registry/messages/constructMessageEndPoint.js +10 -0
  108. package/es/infrastructure/api/registry/messages/index.js +2 -0
  109. package/es/infrastructure/api/registry/messages/messageAPIRegistry.js +57 -0
  110. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +37 -3
  111. package/es/infrastructure/api/sessions/SessionAPI.js +61 -1
  112. package/es/infrastructure/repositories/agents/AgentRepository.js +27 -0
  113. package/es/infrastructure/repositories/agents/index.js +2 -0
  114. package/es/infrastructure/repositories/contacts/ContactRepository.js +33 -0
  115. package/es/infrastructure/repositories/contacts/index.js +2 -0
  116. package/es/infrastructure/repositories/index.js +4 -1
  117. package/es/infrastructure/repositories/messages/MessageRepository.js +72 -0
  118. package/es/infrastructure/repositories/messages/index.js +2 -0
  119. package/es/infrastructure/repositories/sessions/SessionRepository.js +43 -3
  120. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ import { IAgentRepository } from "../../../domain/interfaces/repositories";
2
+ export default class AgentService extends IAgentRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ agentRepository
6
+ } = _ref;
7
+ super();
8
+ this.agentRepository = agentRepository;
9
+ }
10
+
11
+ async getAgents(request) {
12
+ return this.agentRepository.getAgents(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ getAgents: this.getAgents.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,2 @@
1
+ import AgentService from "./AgentService";
2
+ export { AgentService };
@@ -0,0 +1,26 @@
1
+ import { IContactRepository } from "../../../domain/interfaces/repositories";
2
+ export default class ContactService extends IContactRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ contactRepository
6
+ } = _ref;
7
+ super();
8
+ this.contactRepository = contactRepository;
9
+ }
10
+
11
+ async getContacts(request) {
12
+ return this.contactRepository.getContacts(request);
13
+ }
14
+
15
+ async searchContacts(request) {
16
+ return this.contactRepository.searchContacts(request);
17
+ }
18
+
19
+ toJSON() {
20
+ return {
21
+ getContacts: this.getContacts.bind(this),
22
+ searchContacts: this.searchContacts.bind(this)
23
+ };
24
+ }
25
+
26
+ }
@@ -0,0 +1,2 @@
1
+ import ContactService from "./ContactService";
2
+ export { ContactService };
@@ -1,3 +1,6 @@
1
1
  export * from "./channels";
2
2
  export * from "./sessions";
3
- export * from "./bots";
3
+ export * from "./bots";
4
+ export * from "./messages";
5
+ export * from "./agents";
6
+ export * from "./contacts";
@@ -0,0 +1,56 @@
1
+ import { IMessageRepository } from "../../../domain/interfaces/repositories";
2
+ export default class MessageService extends IMessageRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ messageRepository
6
+ } = _ref;
7
+ super();
8
+ this.messageRepository = messageRepository;
9
+ }
10
+
11
+ async getMessages(request) {
12
+ return this.messageRepository.getMessages(request);
13
+ }
14
+
15
+ async getFullContent(request) {
16
+ return this.messageRepository.getFullContent(request);
17
+ }
18
+
19
+ async sendMessage(request) {
20
+ return this.messageRepository.sendMessage(request);
21
+ }
22
+
23
+ async sendAttachment(request) {
24
+ return this.messageRepository.sendAttachment(request);
25
+ }
26
+
27
+ async resendMessage(request) {
28
+ return this.messageRepository.resendMessage(request);
29
+ }
30
+
31
+ async deleteMessage(request) {
32
+ return this.messageRepository.deleteMessage(request);
33
+ }
34
+
35
+ async initiateSession(request) {
36
+ return this.messageRepository.initiateSession(request);
37
+ }
38
+
39
+ async getSearchedMessages(request) {
40
+ return this.messageRepository.getSearchedMessages(request);
41
+ }
42
+
43
+ toJSON() {
44
+ return {
45
+ getMessages: this.getMessages.bind(this),
46
+ getFullContent: this.getFullContent.bind(this),
47
+ sendMessage: this.sendMessage.bind(this),
48
+ sendAttachment: this.sendAttachment.bind(this),
49
+ resendMessage: this.resendMessage.bind(this),
50
+ deleteMessage: this.deleteMessage.bind(this),
51
+ initiateSession: this.initiateSession.bind(this),
52
+ getSearchedMessages: this.getSearchedMessages.bind(this)
53
+ };
54
+ }
55
+
56
+ }
@@ -0,0 +1,2 @@
1
+ import MessageService from "./MessageService";
2
+ export { MessageService };
@@ -12,9 +12,39 @@ export default class SessionService extends ISessionRepository {
12
12
  return this.sessionRepository.updateAssignee(request);
13
13
  }
14
14
 
15
+ async getSessions(request) {
16
+ return this.sessionRepository.getSessions(request);
17
+ }
18
+
19
+ async getSession(request) {
20
+ return this.sessionRepository.getSession(request);
21
+ }
22
+
23
+ async getSessionAttachments(request) {
24
+ return this.sessionRepository.getSessionAttachments(request);
25
+ }
26
+
27
+ async getSessionLastMessages(request) {
28
+ return this.sessionRepository.getSessionLastMessages(request);
29
+ }
30
+
31
+ async markSessionAsRead(request) {
32
+ return this.sessionRepository.markSessionAsRead(request);
33
+ }
34
+
35
+ async updateSessionStatus(request) {
36
+ return this.sessionRepository.updateSessionStatus(request);
37
+ }
38
+
15
39
  toJSON() {
16
40
  return {
17
- updateAssignee: this.updateAssignee.bind(this)
41
+ updateAssignee: this.updateAssignee.bind(this),
42
+ getSessions: this.getSessions.bind(this),
43
+ getSession: this.getSession.bind(this),
44
+ getSessionAttachments: this.getSessionAttachments.bind(this),
45
+ getSessionLastMessages: this.getSessionLastMessages.bind(this),
46
+ markSessionAsRead: this.markSessionAsRead.bind(this),
47
+ updateSessionStatus: this.updateSessionStatus.bind(this)
18
48
  };
19
49
  }
20
50
 
@@ -1,6 +1,9 @@
1
1
  const ModuleNames = {
2
2
  CHANNELS: 'channels',
3
3
  SESSIONS: 'sessions',
4
- BOTS: 'bots'
4
+ BOTS: 'bots',
5
+ MESSAGES: 'messages',
6
+ CONTACTS: 'contacts',
7
+ AGENTS: 'agents'
5
8
  };
6
9
  export default ModuleNames;
@@ -0,0 +1,12 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getAgentsRequest() {
4
+ return new RequestBuilder().withQuery({
5
+ from: 0,
6
+ limit: 10,
7
+ modifiedAfter: null,
8
+ searchStr: null
9
+ }).build();
10
+ }
11
+
12
+ export default getAgentsRequest;
@@ -0,0 +1 @@
1
+ export { default as getAgentsRequest } from "./getAgentsRequest";
@@ -1,2 +1 @@
1
- import getBotsRequest from "./getBotsRequest";
2
- export { getBotsRequest };
1
+ export { default as getBotsRequest } from "./getBotsRequest";
@@ -1,2 +1 @@
1
- import getChannelAgentsRequest from "./getChannelAgentsRequest";
2
- export { getChannelAgentsRequest };
1
+ export { default as getChannelAgentsRequest } from "./getChannelAgentsRequest";
@@ -0,0 +1,10 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getContactsRequest() {
4
+ return new RequestBuilder().withQuery({
5
+ from: 0,
6
+ limit: 10
7
+ }).build();
8
+ }
9
+
10
+ export default getContactsRequest;
@@ -0,0 +1,2 @@
1
+ export { default as getContactsRequest } from "./getContactsRequest";
2
+ export { default as searchContactsRequest } from "./searchContactsRequest";
@@ -0,0 +1,11 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function searchContactsRequest() {
4
+ return new RequestBuilder().withQuery({
5
+ from: 0,
6
+ limit: 10,
7
+ searchStr: null
8
+ }).build();
9
+ }
10
+
11
+ export default searchContactsRequest;
@@ -1,3 +1,6 @@
1
1
  export * from "./channels";
2
2
  export * from "./sessions";
3
- export * from "./bots";
3
+ export * from "./bots";
4
+ export * from "./messages";
5
+ export * from "./agents";
6
+ export * from "./contacts";
@@ -0,0 +1,14 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function deleteMessageRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ sessionId: null,
9
+ messageId: null,
10
+ ...params
11
+ }).build();
12
+ }
13
+
14
+ export default deleteMessageRequest;
@@ -0,0 +1,14 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getFullContentRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ sessionId: null,
9
+ messageId: null,
10
+ ...params
11
+ }).build();
12
+ }
13
+
14
+ export default getFullContentRequest;
@@ -0,0 +1,20 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getMessagesRequest() {
4
+ let {
5
+ query = {},
6
+ params = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withParams({
9
+ sessionId: null,
10
+ ...params
11
+ }).withQuery({
12
+ from: 0,
13
+ limit: 10,
14
+ modifiedAfter: null,
15
+ type: null,
16
+ ...query
17
+ }).build();
18
+ }
19
+
20
+ export default getMessagesRequest;
@@ -0,0 +1,22 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getSearchedMessagesRequest() {
4
+ let {
5
+ query = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withQuery({
8
+ from: 0,
9
+ limit: 50,
10
+ searchStr: null,
11
+ channelId: null,
12
+ agentId: null,
13
+ botId: null,
14
+ contactId: null,
15
+ sessionId: null,
16
+ sortBy: null,
17
+ workSpaceId: null,
18
+ ...query
19
+ }).build();
20
+ }
21
+
22
+ export default getSearchedMessagesRequest;
@@ -0,0 +1,8 @@
1
+ export { default as getMessagesRequest } from "./getMessagesRequest";
2
+ export { default as deleteMessageRequest } from "./deleteMessageRequest";
3
+ export { default as getFullContentRequest } from "./getFullContentRequest";
4
+ export { default as resendMessageRequest } from "./resendMessageRequest";
5
+ export { default as sendAttachmentRequest } from "./sendAttachmentRequest";
6
+ export { default as sendMessageRequest } from "./sendMessageRequest";
7
+ export { default as initiateSessionRequest } from "./initiateSessionRequest";
8
+ export { default as getSearchedMessagesRequest } from "./getSearchedMessagesRequest";
@@ -0,0 +1,21 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function initiateSessionRequest() {
4
+ let {
5
+ params = {},
6
+ body = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withParams({
9
+ channelId: null,
10
+ ...params
11
+ }).withBody({
12
+ receiverId: null,
13
+ receiverType: null,
14
+ cannedMessageId: null,
15
+ language: null,
16
+ parameters: {},
17
+ ...body
18
+ }).build();
19
+ }
20
+
21
+ export default initiateSessionRequest;
@@ -0,0 +1,14 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function resendMessageRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ sessionId: null,
9
+ messageId: null,
10
+ ...params
11
+ }).build();
12
+ }
13
+
14
+ export default resendMessageRequest;
@@ -0,0 +1,20 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function sendAttachmentRequest() {
4
+ let {
5
+ params = {},
6
+ body = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withParams({
9
+ sessionId: null,
10
+ messageId: null,
11
+ ...params
12
+ }).withBody({
13
+ message: null,
14
+ file: null,
15
+ replyToMessageId: null,
16
+ ...body
17
+ }).build();
18
+ }
19
+
20
+ export default sendAttachmentRequest;
@@ -0,0 +1,17 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function sendMessageRequest() {
4
+ let {
5
+ params = {},
6
+ body = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withParams({
9
+ sessionId: null,
10
+ ...params
11
+ }).withBody({
12
+ message: null,
13
+ ...body
14
+ }).build();
15
+ }
16
+
17
+ export default sendMessageRequest;
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getSessionAttachmentsRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ sessionId: null,
9
+ ...params
10
+ }).build();
11
+ }
12
+
13
+ export default getSessionAttachmentsRequest;
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getSessionLastMessagesRequest() {
4
+ let {
5
+ body = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withBody({
8
+ data: null,
9
+ ...body
10
+ }).build();
11
+ }
12
+
13
+ export default getSessionLastMessagesRequest;
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getSessionRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ sessionId: null,
9
+ ...params
10
+ }).build();
11
+ }
12
+
13
+ export default getSessionRequest;
@@ -0,0 +1,26 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getSessionsRequest() {
4
+ let {
5
+ query = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withQuery({
8
+ from: 0,
9
+ limit: 50,
10
+ channelIds: null,
11
+ channelId: null,
12
+ agentId: null,
13
+ contactId: null,
14
+ profileId: null,
15
+ modifiedAfter: null,
16
+ createdBefore: null,
17
+ createdAfter: null,
18
+ status: null,
19
+ assigneeFilter: null,
20
+ workspaceId: null,
21
+ botIds: null,
22
+ ...query
23
+ }).build();
24
+ }
25
+
26
+ export default getSessionsRequest;
@@ -1,2 +1,7 @@
1
- import updateSessionAssigneeRequest from "./updateSessionAssigneeRequest";
2
- export { updateSessionAssigneeRequest };
1
+ export { default as updateSessionAssigneeRequest } from "./updateSessionAssigneeRequest";
2
+ export { default as getSessionsRequest } from "./getSessionsRequest";
3
+ export { default as getSessionRequest } from "./getSessionRequest";
4
+ export { default as getSessionAttachmentsRequest } from "./getSessionAttachmentsRequest";
5
+ export { default as getSessionLastMessagesRequest } from "./getSessionLastMessagesRequest";
6
+ export { default as markSessionAsReadRequest } from "./markSessionAsReadRequest";
7
+ export { default as updateSessionStatusRequest } from "./updateSessionStatusRequest";
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function markSessionAsReadRequest() {
4
+ let {
5
+ body = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withBody({
8
+ lastSeenMessageId: null,
9
+ ...body
10
+ }).build();
11
+ }
12
+
13
+ export default markSessionAsReadRequest;
@@ -0,0 +1,17 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function updateSessionStatusRequest() {
4
+ let {
5
+ params = {},
6
+ body = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withParams({
9
+ sessionId: null,
10
+ ...params
11
+ }).withBody({
12
+ status: null,
13
+ ...body
14
+ }).build();
15
+ }
16
+
17
+ export default updateSessionStatusRequest;
@@ -0,0 +1,22 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { AttachmentSchema } from "../../schema";
3
+ export default class Attachment {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(AttachmentSchema, data);
7
+ this.data = {
8
+ id: validatedData.id,
9
+ name: validatedData.name,
10
+ type: validatedData.type,
11
+ createdTime: validatedData.createdTime,
12
+ size: validatedData.size,
13
+ url: validatedData.url
14
+ };
15
+ }
16
+
17
+ toJSON() {
18
+ return { ...this.data
19
+ };
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import Attachment from "./Attachment";
2
+ export { Attachment };
@@ -0,0 +1,22 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { ContactSchema } from "../../schema";
3
+ export default class Contact {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(ContactSchema, data);
7
+ this.data = {
8
+ id: validatedData.id,
9
+ name: validatedData.name,
10
+ email: validatedData.email,
11
+ photoURL: validatedData.photoURL || '',
12
+ mobile: validatedData.mobile,
13
+ phone: validatedData.phone
14
+ };
15
+ }
16
+
17
+ toJSON() {
18
+ return { ...this.data
19
+ };
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import Contact from "./Contact";
2
+ export { Contact };
@@ -0,0 +1,19 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { ActionSchema } from "../../schema";
3
+ export default class Action {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(ActionSchema, data);
7
+ this.data = {
8
+ type: validatedData.type,
9
+ subType: validatedData.subType,
10
+ value: validatedData.value
11
+ };
12
+ }
13
+
14
+ toJSON() {
15
+ return { ...this.data
16
+ };
17
+ }
18
+
19
+ }
@@ -0,0 +1,17 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { ExternalInfoSchema } from "../../schema";
3
+ export default class ExternalInfo {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(ExternalInfoSchema, data);
7
+ this.data = {
8
+ action: validatedData.action
9
+ };
10
+ }
11
+
12
+ toJSON() {
13
+ return { ...this.data
14
+ };
15
+ }
16
+
17
+ }
@@ -0,0 +1,21 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { Actor } from "../Actor";
3
+ import { InfoSchema } from "../../schema/message";
4
+ export default class Info {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema(InfoSchema, data);
8
+ this.data = {
9
+ actor: new Actor(validatedData.actor).toJSON(),
10
+ action: validatedData.action,
11
+ sessionStatus: validatedData.sessionStatus,
12
+ targets: validatedData.targets
13
+ };
14
+ }
15
+
16
+ toJSON() {
17
+ return { ...this.data
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,18 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { LocationSchema } from "../../schema";
3
+ export default class Location {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(LocationSchema, data);
7
+ this.data = {
8
+ latitude: validatedData.latitude,
9
+ longitude: validatedData.longitude
10
+ };
11
+ }
12
+
13
+ toJSON() {
14
+ return { ...this.data
15
+ };
16
+ }
17
+
18
+ }