@zohoim/client-sdk 1.0.0-poc3 → 1.0.0-poc31

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 (100) hide show
  1. package/es/config/urls/base/index.js +11 -0
  2. package/es/config/urls/bots/bots-api-url.js +8 -0
  3. package/es/config/urls/bots/index.js +2 -0
  4. package/es/config/urls/channels/channel-agents-api-url.js +8 -0
  5. package/es/config/urls/channels/index.js +2 -0
  6. package/es/config/urls/index.js +16 -0
  7. package/es/config/urls/sessions/index.js +2 -0
  8. package/es/config/urls/sessions/sessions-api-url.js +9 -0
  9. package/es/core/constants/HttpMethods.js +8 -0
  10. package/es/core/constants/ModuleNames.js +6 -0
  11. package/es/core/constants/index.js +4 -0
  12. package/es/core/errors/AdapterError.js +7 -0
  13. package/es/core/errors/index.js +3 -0
  14. package/es/core/utils/index.js +2 -0
  15. package/es/core/utils/validateSchema.js +68 -0
  16. package/es/domain/entities/Actor/Actor.js +23 -0
  17. package/es/domain/entities/Actor/index.js +2 -2
  18. package/es/domain/entities/Agent/Agent.js +13 -102
  19. package/es/domain/entities/Agent/index.js +1 -1
  20. package/es/domain/entities/Bot/Bot.js +23 -0
  21. package/es/domain/entities/Bot/index.js +2 -0
  22. package/es/domain/entities/Session/Session.js +36 -0
  23. package/es/domain/entities/Session/index.js +2 -0
  24. package/es/domain/entities/index.js +4 -2
  25. package/es/domain/enum/actor/index.js +2 -0
  26. package/es/domain/enum/bot/BotServiceType.js +5 -0
  27. package/es/domain/enum/bot/index.js +2 -0
  28. package/es/domain/enum/index.js +4 -0
  29. package/es/domain/enum/integrationServices/IntegrationServices.js +11 -0
  30. package/es/domain/enum/integrationServices/index.js +2 -0
  31. package/es/domain/enum/session/SessionReplyStatus.js +20 -0
  32. package/es/domain/enum/session/SessionStatus.js +9 -0
  33. package/es/domain/enum/session/index.js +3 -0
  34. package/es/domain/interfaces/BaseAPI.js +74 -0
  35. package/es/domain/interfaces/IAdapter.js +6 -0
  36. package/es/domain/interfaces/bots/IBot.js +10 -0
  37. package/es/domain/interfaces/bots/index.js +2 -0
  38. package/es/domain/interfaces/channels/IChannelAgent.js +6 -2
  39. package/es/domain/interfaces/channels/index.js +1 -1
  40. package/es/domain/interfaces/index.js +3 -1
  41. package/es/domain/interfaces/sessions/ISession.js +10 -0
  42. package/es/domain/interfaces/sessions/index.js +2 -0
  43. package/es/domain/schema/actor/ActorSchema.js +33 -0
  44. package/es/domain/schema/actor/AgentSchema.js +29 -0
  45. package/es/domain/schema/actor/index.js +3 -0
  46. package/es/domain/schema/bot/BotSchema.js +33 -0
  47. package/es/domain/schema/bot/index.js +2 -0
  48. package/es/domain/schema/index.js +3 -0
  49. package/es/domain/schema/session/SessionSchema.js +86 -0
  50. package/es/domain/schema/session/index.js +2 -0
  51. package/es/domain/services/bots/BotService.js +33 -0
  52. package/es/domain/services/bots/index.js +2 -0
  53. package/es/domain/services/channels/ChannelAgentService.js +25 -6
  54. package/es/domain/services/channels/index.js +1 -1
  55. package/es/domain/services/index.js +3 -1
  56. package/es/domain/services/sessions/SessionService.js +33 -0
  57. package/es/domain/services/sessions/index.js +2 -0
  58. package/es/index.js +10 -1
  59. package/es/infrastructure/adapters/bots/BotAdapter.js +25 -0
  60. package/es/infrastructure/adapters/bots/index.js +2 -0
  61. package/es/infrastructure/adapters/channels/ChannelAgentAdapter.js +30 -0
  62. package/es/infrastructure/adapters/channels/index.js +2 -0
  63. package/es/infrastructure/adapters/index.js +3 -0
  64. package/es/infrastructure/adapters/sessions/SessionAdapter.js +37 -0
  65. package/es/infrastructure/adapters/sessions/index.js +2 -0
  66. package/es/infrastructure/api/bots/BotAPI.js +22 -0
  67. package/es/infrastructure/api/bots/index.js +2 -0
  68. package/es/infrastructure/api/channels/ChannelAgentAPI.js +22 -0
  69. package/es/infrastructure/api/channels/index.js +2 -0
  70. package/es/infrastructure/api/index.js +3 -0
  71. package/es/infrastructure/api/sessions/SessionAPI.js +22 -0
  72. package/es/infrastructure/api/sessions/index.js +2 -0
  73. package/es/infrastructure/interfaces/api/base/RequestBuilder.js +42 -0
  74. package/es/infrastructure/interfaces/api/base/index.js +2 -0
  75. package/es/infrastructure/interfaces/api/bots/getBotsRequest.js +18 -0
  76. package/es/infrastructure/interfaces/api/bots/index.js +2 -0
  77. package/es/infrastructure/interfaces/api/channels/agents/getChannelAgentsRequest.js +19 -0
  78. package/es/infrastructure/interfaces/api/channels/agents/index.js +2 -0
  79. package/es/infrastructure/interfaces/api/channels/index.js +1 -0
  80. package/es/infrastructure/interfaces/api/index.js +3 -0
  81. package/es/infrastructure/interfaces/api/sessions/index.js +2 -0
  82. package/es/infrastructure/interfaces/api/sessions/updateSessionAssigneeRequest.js +18 -0
  83. package/es/infrastructure/interfaces/index.js +1 -0
  84. package/es/infrastructure/managers/ModuleFactory.js +31 -0
  85. package/es/infrastructure/managers/ModuleManager.js +44 -0
  86. package/es/infrastructure/managers/index.js +2 -0
  87. package/es/infrastructure/sdk/IMSDK.js +47 -0
  88. package/es/infrastructure/sdk/bots/BotSDK.js +20 -0
  89. package/es/infrastructure/sdk/bots/index.js +2 -0
  90. package/es/infrastructure/sdk/channels/ChannelSDK.js +23 -0
  91. package/es/infrastructure/sdk/channels/index.js +2 -0
  92. package/es/infrastructure/sdk/config/configRegistry.js +27 -0
  93. package/es/infrastructure/sdk/config/index.js +2 -0
  94. package/es/infrastructure/sdk/index.js +2 -0
  95. package/es/infrastructure/sdk/sessions/SessionSDK.js +20 -0
  96. package/es/infrastructure/sdk/sessions/index.js +2 -0
  97. package/package.json +1 -7
  98. package/es/domain/index.js +0 -3
  99. /package/es/{domain → core}/errors/ValidationError.js +0 -0
  100. /package/es/domain/{entities/Actor → enum/actor}/ActorType.js +0 -0
@@ -0,0 +1,33 @@
1
+ import { ActorType } from "../../enum";
2
+ const ActorSchema = {
3
+ name: {
4
+ type: 'string',
5
+ required: true
6
+ },
7
+ type: {
8
+ type: 'string',
9
+ required: true,
10
+ enum: Object.values(ActorType)
11
+ },
12
+ photoURL: {
13
+ type: 'string',
14
+ required: false
15
+ },
16
+ extId: {
17
+ type: 'string',
18
+ required: false
19
+ },
20
+ id: {
21
+ type: 'string',
22
+ required: true
23
+ },
24
+ email: {
25
+ type: 'string',
26
+ required: false
27
+ },
28
+ botType: {
29
+ type: 'string',
30
+ required: false
31
+ }
32
+ };
33
+ export default ActorSchema;
@@ -0,0 +1,29 @@
1
+ import { ActorType } from "../../enum";
2
+ const AgentSchema = {
3
+ id: {
4
+ type: 'string',
5
+ required: true
6
+ },
7
+ name: {
8
+ type: 'string',
9
+ required: true
10
+ },
11
+ email: {
12
+ type: 'string',
13
+ required: true
14
+ },
15
+ photoURL: {
16
+ type: 'string',
17
+ required: false
18
+ },
19
+ zuid: {
20
+ type: 'string',
21
+ required: true
22
+ },
23
+ type: {
24
+ type: 'string',
25
+ required: true,
26
+ enum: [ActorType.AGENT]
27
+ }
28
+ };
29
+ export default AgentSchema;
@@ -0,0 +1,3 @@
1
+ import ActorSchema from "./ActorSchema";
2
+ import AgentSchema from "./AgentSchema";
3
+ export { ActorSchema, AgentSchema };
@@ -0,0 +1,33 @@
1
+ import { BotServiceType } from "../../enum";
2
+ const BotSchema = {
3
+ id: {
4
+ type: 'string',
5
+ required: true
6
+ },
7
+ botServiceType: {
8
+ type: 'string',
9
+ required: true,
10
+ enum: [BotServiceType.DESK_GC_BOT, BotServiceType.DESK_ZIA_BOT]
11
+ },
12
+ name: {
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ isActive: {
17
+ type: 'boolean',
18
+ required: true
19
+ },
20
+ createdTime: {
21
+ type: 'string',
22
+ required: true
23
+ },
24
+ logoURL: {
25
+ type: 'string',
26
+ required: true
27
+ },
28
+ createdBy: {
29
+ type: 'string',
30
+ required: true
31
+ }
32
+ };
33
+ export default BotSchema;
@@ -0,0 +1,2 @@
1
+ import BotSchema from "./BotSchema";
2
+ export { BotSchema };
@@ -0,0 +1,3 @@
1
+ export * from "./actor";
2
+ export * from "./session";
3
+ export * from "./bot";
@@ -0,0 +1,86 @@
1
+ import { IntegrationServices, SessionReplyStatus, SessionStatus } from "../../enum";
2
+ import { ActorSchema } from "../actor";
3
+ const SessionSchema = {
4
+ channelId: {
5
+ type: 'string',
6
+ required: true
7
+ },
8
+ status: {
9
+ type: 'string',
10
+ required: true,
11
+ enum: Object.values(SessionStatus)
12
+ },
13
+ createdTime: {
14
+ type: 'string',
15
+ required: true
16
+ },
17
+ agentId: {
18
+ type: 'string',
19
+ required: false
20
+ },
21
+ botId: {
22
+ type: 'string',
23
+ required: false
24
+ },
25
+ actor: {
26
+ type: 'object',
27
+ required: true,
28
+ schema: ActorSchema
29
+ },
30
+ subject: {
31
+ type: 'string',
32
+ required: true
33
+ },
34
+ messagesCount: {
35
+ type: 'string',
36
+ required: true
37
+ },
38
+ agentLastActiveTime: {
39
+ type: 'string',
40
+ required: true
41
+ },
42
+ contactLastActiveTime: {
43
+ type: 'string',
44
+ required: true
45
+ },
46
+ lastActiveTime: {
47
+ type: 'string',
48
+ required: true
49
+ },
50
+ unreadMessagesCount: {
51
+ type: 'string',
52
+ required: true
53
+ },
54
+ integrationServiceId: {
55
+ type: 'string',
56
+ required: true,
57
+ enum: Object.values(IntegrationServices)
58
+ },
59
+ replyStatus: {
60
+ type: 'string',
61
+ required: true,
62
+ enum: Object.values(SessionReplyStatus)
63
+ },
64
+ id: {
65
+ type: 'string',
66
+ required: true
67
+ },
68
+ contactId: {
69
+ type: 'string',
70
+ required: true
71
+ },
72
+ meta: {
73
+ type: 'array',
74
+ required: false
75
+ },
76
+ assignee: {
77
+ type: 'object',
78
+ required: false,
79
+ schema: ActorSchema
80
+ },
81
+ channel: {
82
+ type: 'string',
83
+ required: true
84
+ }
85
+ };
86
+ export default SessionSchema;
@@ -0,0 +1,2 @@
1
+ import SessionSchema from "./SessionSchema";
2
+ export { SessionSchema };
@@ -0,0 +1,33 @@
1
+ import { getUrlConfig } from "../../../config/urls";
2
+ import { ModuleNames } from "../../../core/constants";
3
+ import { BotAdapter } from "../../../infrastructure/adapters";
4
+ import { BotAPI } from "../../../infrastructure/api";
5
+ import { getBotsRequest } from "../../../infrastructure/interfaces/api";
6
+ import { IBot } from "../../interfaces";
7
+ export default class BotService extends IBot {
8
+ constructor(_ref) {
9
+ let {
10
+ botAPI,
11
+ botAdapter
12
+ } = _ref;
13
+ super();
14
+ const urlConfig = getUrlConfig(ModuleNames.BOTS);
15
+ this.botAPI = botAPI || new BotAPI({
16
+ urlConfig
17
+ });
18
+ this.botAdapter = botAdapter || new BotAdapter();
19
+ }
20
+
21
+ async getBots() {
22
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotsRequest();
23
+ const bots = await this.botAPI.getBots(request);
24
+ return bots.map(this.botAdapter.adapt);
25
+ }
26
+
27
+ toJSON() {
28
+ return {
29
+ getBots: this.getBots.bind(this)
30
+ };
31
+ }
32
+
33
+ }
@@ -0,0 +1,2 @@
1
+ import BotService from "./BotService";
2
+ export { BotService };
@@ -1,14 +1,33 @@
1
- import IChannelAgent from '../../interfaces/channels/IChannelAgent';
1
+ import { getUrlConfig } from "../../../config/urls";
2
+ import { ModuleNames } from "../../../core/constants";
3
+ import { ChannelAgentAdapter } from "../../../infrastructure/adapters";
4
+ import { ChannelAgentAPI } from "../../../infrastructure/api";
5
+ import { getChannelAgentsRequest } from "../../../infrastructure/interfaces/api";
6
+ import { IChannelAgent } from "../../interfaces";
2
7
  export default class ChannelAgentService extends IChannelAgent {
3
- constructor(channelAPI, channelAgentAdapter) {
8
+ constructor(_ref) {
9
+ let {
10
+ channelAgentAPI,
11
+ channelAgentAdapter
12
+ } = _ref;
4
13
  super();
5
- this.channelAPI = channelAPI;
6
- this.channelAgentAdapter = channelAgentAdapter;
14
+ const urlConfig = getUrlConfig(`${ModuleNames.CHANNELS}.agents`);
15
+ this.channelAgentAPI = channelAgentAPI || new ChannelAgentAPI({
16
+ urlConfig
17
+ });
18
+ this.channelAgentAdapter = channelAgentAdapter || new ChannelAgentAdapter();
7
19
  }
8
20
 
9
- async getChannelAgents() {
10
- const channelAgents = await this.channelAPI.getChannelAgents();
21
+ async getAgents() {
22
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getChannelAgentsRequest();
23
+ const channelAgents = await this.channelAgentAPI.getAgents(request);
11
24
  return channelAgents.map(this.channelAgentAdapter.adapt);
12
25
  }
13
26
 
27
+ toJSON() {
28
+ return {
29
+ getAgents: this.getAgents.bind(this)
30
+ };
31
+ }
32
+
14
33
  }
@@ -1,2 +1,2 @@
1
- import ChannelAgentService from './ChannelAgentService';
1
+ import ChannelAgentService from "./ChannelAgentService";
2
2
  export { ChannelAgentService };
@@ -1 +1,3 @@
1
- export * from './channels';
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -0,0 +1,33 @@
1
+ import { getUrlConfig } from "../../../config/urls";
2
+ import { ModuleNames } from "../../../core/constants";
3
+ import { SessionAdapter } from "../../../infrastructure/adapters";
4
+ import { SessionAPI } from "../../../infrastructure/api";
5
+ import { updateSessionAssigneeRequest } from "../../../infrastructure/interfaces/api";
6
+ import { ISession } from "../../interfaces";
7
+ export default class SessionService extends ISession {
8
+ constructor(_ref) {
9
+ let {
10
+ sessionAPI,
11
+ sessionAdapter
12
+ } = _ref;
13
+ super();
14
+ const urlConfig = getUrlConfig(ModuleNames.SESSIONS);
15
+ this.sessionAPI = sessionAPI || new SessionAPI({
16
+ urlConfig
17
+ });
18
+ this.sessionAdapter = sessionAdapter || new SessionAdapter();
19
+ }
20
+
21
+ async updateAssignee() {
22
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateSessionAssigneeRequest();
23
+ const session = await this.sessionAPI.updateAssignee(request);
24
+ return this.sessionAdapter.adapt(session);
25
+ }
26
+
27
+ toJSON() {
28
+ return {
29
+ updateAssignee: this.updateAssignee.bind(this)
30
+ };
31
+ }
32
+
33
+ }
@@ -0,0 +1,2 @@
1
+ import SessionService from "./SessionService";
2
+ export { SessionService };
package/es/index.js CHANGED
@@ -1 +1,10 @@
1
- // export * from './domain';
1
+ export * from "./domain/entities";
2
+ export * from "./domain/enum";
3
+ export * from "./domain/interfaces";
4
+ export * from "./domain/services";
5
+ export * from "./infrastructure/sdk";
6
+ export * from "./infrastructure/adapters";
7
+ export * from "./infrastructure/api";
8
+ export * from "./infrastructure/interfaces/api";
9
+ export * from "./core/constants";
10
+ export * from "./config/urls/base";
@@ -0,0 +1,25 @@
1
+ import { AdapterError } from "../../../core/errors";
2
+ import { Bot } from "../../../domain/entities";
3
+ import IAdapter from "../../../domain/interfaces/IAdapter";
4
+ export default class BotAdapter extends IAdapter {
5
+ adapt(botData) {
6
+ if (!botData) {
7
+ throw new AdapterError('Bot data is required');
8
+ }
9
+
10
+ try {
11
+ return new Bot({
12
+ id: botData.id,
13
+ botServiceType: botData.botService.id,
14
+ name: botData.name,
15
+ isActive: botData.isActive,
16
+ createdTime: botData.createdTime,
17
+ logoURL: botData.logoURL,
18
+ createdBy: botData.createdBy
19
+ }).toJSON();
20
+ } catch (error) {
21
+ throw new AdapterError(`Failed to adapt bot: ${error.message}`);
22
+ }
23
+ }
24
+
25
+ }
@@ -0,0 +1,2 @@
1
+ import BotAdapter from "./BotAdapter";
2
+ export { BotAdapter };
@@ -0,0 +1,30 @@
1
+ import { AdapterError } from "../../../core/errors";
2
+ import { Agent } from "../../../domain/entities";
3
+ import IAdapter from "../../../domain/interfaces/IAdapter";
4
+ export default class ChannelAgentAdapter extends IAdapter {
5
+ /**
6
+ * Adapts channel agent data to Agent entity
7
+ * @param {Object} channelAgent - Channel agent data to adapt
8
+ * @returns {Object} Adapted agent data
9
+ * @throws {AdapterError} When adaptation fails
10
+ */
11
+ adapt(channelAgent) {
12
+ if (!channelAgent) {
13
+ throw new AdapterError('Channel agent data is required');
14
+ }
15
+
16
+ try {
17
+ return new Agent({
18
+ id: channelAgent.id,
19
+ name: channelAgent.name,
20
+ email: channelAgent.email,
21
+ photoURL: channelAgent.photoURL || '',
22
+ zuid: channelAgent.zuid,
23
+ type: channelAgent.type
24
+ }).toJSON();
25
+ } catch (error) {
26
+ throw new AdapterError(`Failed to adapt channel agent: ${error.message}`);
27
+ }
28
+ }
29
+
30
+ }
@@ -0,0 +1,2 @@
1
+ import ChannelAgentAdapter from "./ChannelAgentAdapter";
2
+ export { ChannelAgentAdapter };
@@ -0,0 +1,3 @@
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -0,0 +1,37 @@
1
+ import { AdapterError } from "../../../core/errors";
2
+ import { Session } from "../../../domain/entities";
3
+ import IAdapter from "../../../domain/interfaces/IAdapter";
4
+ export default class SessionAdapter extends IAdapter {
5
+ adapt(sessionData) {
6
+ if (!sessionData) {
7
+ throw new AdapterError('Session data is required');
8
+ }
9
+
10
+ try {
11
+ return new Session({
12
+ id: sessionData.id,
13
+ channelId: sessionData.channelId,
14
+ status: sessionData.status,
15
+ createdTime: sessionData.createdTime,
16
+ agentId: sessionData.agentId,
17
+ botId: sessionData.botId,
18
+ actor: sessionData.actor,
19
+ subject: sessionData.subject,
20
+ messagesCount: sessionData.messagesCount,
21
+ agentLastActiveTime: sessionData.agentLastActiveTime,
22
+ contactLastActiveTime: sessionData.contactLastActiveTime,
23
+ lastActiveTime: sessionData.lastActiveTime,
24
+ unreadMessagesCount: sessionData.unreadMessagesCount,
25
+ integrationServiceId: sessionData.integrationServiceId,
26
+ replyStatus: sessionData.replyStatus,
27
+ contactId: sessionData.contactId,
28
+ meta: sessionData.meta,
29
+ assignee: sessionData.assignee,
30
+ channel: sessionData.channel
31
+ }).toJSON();
32
+ } catch (error) {
33
+ throw new AdapterError(`Failed to adapt session: ${error.message}`);
34
+ }
35
+ }
36
+
37
+ }
@@ -0,0 +1,2 @@
1
+ import SessionAdapter from "./SessionAdapter";
2
+ export { SessionAdapter };
@@ -0,0 +1,22 @@
1
+ import { IBot } from "../../../domain/interfaces";
2
+ import { getBotsRequest } from "../../interfaces/api";
3
+ export default class BotAPI extends IBot {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async getBots() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotsRequest();
14
+ const urlConfig = this.urlConfig.LIST;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import BotAPI from "./BotAPI";
2
+ export { BotAPI };
@@ -0,0 +1,22 @@
1
+ import IChannelAgent from "../../../domain/interfaces/channels/IChannelAgent";
2
+ import { getChannelAgentsRequest } from "../../interfaces/api";
3
+ export default class ChannelAgentAPI extends IChannelAgent {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async getAgents() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getChannelAgentsRequest();
14
+ const urlConfig = this.urlConfig.LIST;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import ChannelAgentAPI from "./ChannelAgentAPI";
2
+ export { ChannelAgentAPI };
@@ -0,0 +1,3 @@
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -0,0 +1,22 @@
1
+ import { ISession } from "../../../domain/interfaces";
2
+ import { updateSessionAssigneeRequest } from "../../interfaces/api";
3
+ export default class SessionAPI extends ISession {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async updateAssignee() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateSessionAssigneeRequest();
14
+ const urlConfig = this.urlConfig.UPDATE_SESSION_ASSIGNEE;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import SessionAPI from "./SessionAPI";
2
+ export { SessionAPI };
@@ -0,0 +1,42 @@
1
+ class RequestBuilder {
2
+ constructor() {
3
+ this._params = {};
4
+ this._query = {};
5
+ this._body = {};
6
+ }
7
+
8
+ withParams() {
9
+ let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10
+ this._params = { ...this._params,
11
+ ...params
12
+ };
13
+ return this;
14
+ }
15
+
16
+ withQuery() {
17
+ let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
+ this._query = { ...this._query,
19
+ ...query
20
+ };
21
+ return this;
22
+ }
23
+
24
+ withBody() {
25
+ let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
+ this._body = { ...this._body,
27
+ ...body
28
+ };
29
+ return this;
30
+ }
31
+
32
+ build() {
33
+ return {
34
+ params: this._params,
35
+ query: this._query,
36
+ body: Object.keys(this._body).length ? this._body : undefined
37
+ };
38
+ }
39
+
40
+ }
41
+
42
+ export default RequestBuilder;
@@ -0,0 +1,2 @@
1
+ import RequestBuilder from "./RequestBuilder";
2
+ export { RequestBuilder };
@@ -0,0 +1,18 @@
1
+ import { RequestBuilder } from "../base";
2
+
3
+ function getBotsRequest() {
4
+ let {
5
+ query = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withQuery({
8
+ from: 0,
9
+ limit: 10,
10
+ modifiedAfter: null,
11
+ botServiceId: null,
12
+ externalAccountId: null,
13
+ searchStr: null,
14
+ ...query
15
+ }).build();
16
+ }
17
+
18
+ export default getBotsRequest;
@@ -0,0 +1,2 @@
1
+ import getBotsRequest from "./getBotsRequest";
2
+ export { getBotsRequest };
@@ -0,0 +1,19 @@
1
+ import { RequestBuilder } from "../../base";
2
+
3
+ function getChannelAgentsRequest() {
4
+ let {
5
+ query = {},
6
+ params = {}
7
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ return new RequestBuilder().withQuery({
9
+ from: 0,
10
+ limit: 10,
11
+ searchStr: null,
12
+ ...query
13
+ }).withParams({
14
+ channelId: null,
15
+ ...params
16
+ }).build();
17
+ }
18
+
19
+ export default getChannelAgentsRequest;
@@ -0,0 +1,2 @@
1
+ import getChannelAgentsRequest from "./getChannelAgentsRequest";
2
+ export { getChannelAgentsRequest };
@@ -0,0 +1 @@
1
+ export * from "./agents";
@@ -0,0 +1,3 @@
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -0,0 +1,2 @@
1
+ import updateSessionAssigneeRequest from "./updateSessionAssigneeRequest";
2
+ export { updateSessionAssigneeRequest };