@zohoim/client-sdk 1.0.0-poc2 → 1.0.0-poc20

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 (94) hide show
  1. package/es/config/urls/bots/bots-api-url.js +11 -0
  2. package/es/config/urls/bots/index.js +2 -0
  3. package/es/config/urls/channels/channel-agents-api-url.js +11 -0
  4. package/es/config/urls/channels/index.js +2 -0
  5. package/es/config/urls/sessions/index.js +2 -0
  6. package/es/config/urls/sessions/sessions-api-url.js +12 -0
  7. package/es/core/constants/HttpMethods.js +8 -0
  8. package/es/core/constants/ModuleNames.js +6 -0
  9. package/es/core/constants/index.js +4 -0
  10. package/es/core/errors/AdapterError.js +7 -0
  11. package/es/core/errors/index.js +3 -0
  12. package/es/core/utils/index.js +2 -0
  13. package/es/core/utils/validateSchema.js +68 -0
  14. package/es/domain/entities/Actor/Actor.js +23 -0
  15. package/es/domain/entities/Actor/index.js +2 -2
  16. package/es/domain/entities/Agent/Agent.js +13 -102
  17. package/es/domain/entities/Agent/index.js +1 -1
  18. package/es/domain/entities/Bot/Bot.js +23 -0
  19. package/es/domain/entities/Bot/index.js +2 -0
  20. package/es/domain/entities/Session/Session.js +36 -0
  21. package/es/domain/entities/Session/index.js +2 -0
  22. package/es/domain/entities/index.js +3 -1
  23. package/es/domain/enum/actor/index.js +2 -0
  24. package/es/domain/enum/bot/BotServiceType.js +5 -0
  25. package/es/domain/enum/bot/index.js +2 -0
  26. package/es/domain/enum/index.js +4 -0
  27. package/es/domain/enum/integrationServices/IntegrationServices.js +11 -0
  28. package/es/domain/enum/integrationServices/index.js +2 -0
  29. package/es/domain/enum/session/SessionReplyStatus.js +20 -0
  30. package/es/domain/enum/session/SessionStatus.js +9 -0
  31. package/es/domain/enum/session/index.js +3 -0
  32. package/es/domain/interfaces/BaseAPI.js +63 -0
  33. package/es/domain/interfaces/bots/IBot.js +10 -0
  34. package/es/domain/interfaces/bots/index.js +2 -0
  35. package/es/domain/interfaces/channels/IChannelAgent.js +6 -2
  36. package/es/domain/interfaces/index.js +3 -1
  37. package/es/domain/interfaces/sessions/ISession.js +10 -0
  38. package/es/domain/interfaces/sessions/index.js +2 -0
  39. package/es/domain/schema/actor/ActorSchema.js +33 -0
  40. package/es/domain/schema/actor/AgentSchema.js +29 -0
  41. package/es/domain/schema/actor/index.js +3 -0
  42. package/es/domain/schema/bot/BotSchema.js +33 -0
  43. package/es/domain/schema/bot/index.js +2 -0
  44. package/es/domain/schema/index.js +3 -0
  45. package/es/domain/schema/session/SessionSchema.js +86 -0
  46. package/es/domain/schema/session/index.js +2 -0
  47. package/es/domain/services/bots/BotService.js +31 -0
  48. package/es/domain/services/bots/index.js +2 -0
  49. package/es/domain/services/channels/ChannelAgentService.js +23 -6
  50. package/es/domain/services/index.js +3 -1
  51. package/es/domain/services/sessions/SessionService.js +31 -0
  52. package/es/domain/services/sessions/index.js +2 -0
  53. package/es/index.js +8 -1
  54. package/es/infrastructure/adapters/BaseAdapter.js +23 -0
  55. package/es/infrastructure/adapters/bots/BotAdapter.js +25 -0
  56. package/es/infrastructure/adapters/bots/index.js +2 -0
  57. package/es/infrastructure/adapters/channels/ChannelAgentAdapter.js +35 -0
  58. package/es/infrastructure/adapters/channels/index.js +2 -0
  59. package/es/infrastructure/adapters/index.js +3 -0
  60. package/es/infrastructure/adapters/sessions/SessionAdapter.js +37 -0
  61. package/es/infrastructure/adapters/sessions/index.js +2 -0
  62. package/es/infrastructure/api/bots/BotAPI.js +22 -0
  63. package/es/infrastructure/api/bots/index.js +2 -0
  64. package/es/infrastructure/api/channels/ChannelAgentAPI.js +22 -0
  65. package/es/infrastructure/api/channels/index.js +2 -0
  66. package/es/infrastructure/api/index.js +3 -0
  67. package/es/infrastructure/api/sessions/SessionAPI.js +22 -0
  68. package/es/infrastructure/api/sessions/index.js +2 -0
  69. package/es/infrastructure/interfaces/api/bots/GetBotsRequest.js +14 -0
  70. package/es/infrastructure/interfaces/api/bots/index.js +2 -0
  71. package/es/infrastructure/interfaces/api/channels/agents/GetChannelAgentsRequest.js +13 -0
  72. package/es/infrastructure/interfaces/api/channels/agents/index.js +2 -0
  73. package/es/infrastructure/interfaces/api/channels/index.js +1 -0
  74. package/es/infrastructure/interfaces/api/index.js +3 -0
  75. package/es/infrastructure/interfaces/api/sessions/UpdateSessionAssigneeRequest.js +12 -0
  76. package/es/infrastructure/interfaces/api/sessions/index.js +2 -0
  77. package/es/infrastructure/interfaces/index.js +1 -0
  78. package/es/infrastructure/managers/ModuleFactory.js +31 -0
  79. package/es/infrastructure/managers/ModuleManager.js +44 -0
  80. package/es/infrastructure/managers/index.js +2 -0
  81. package/es/infrastructure/sdk/IMSDK.js +47 -0
  82. package/es/infrastructure/sdk/bots/BotSDK.js +20 -0
  83. package/es/infrastructure/sdk/bots/index.js +2 -0
  84. package/es/infrastructure/sdk/channels/ChannelSDK.js +23 -0
  85. package/es/infrastructure/sdk/channels/index.js +2 -0
  86. package/es/infrastructure/sdk/config/configRegistry.js +27 -0
  87. package/es/infrastructure/sdk/config/index.js +2 -0
  88. package/es/infrastructure/sdk/index.js +2 -0
  89. package/es/infrastructure/sdk/sessions/SessionSDK.js +20 -0
  90. package/es/infrastructure/sdk/sessions/index.js +2 -0
  91. package/package.json +1 -7
  92. package/es/domain/index.js +0 -3
  93. /package/es/{domain → core}/errors/ValidationError.js +0 -0
  94. /package/es/domain/{entities/Actor → enum/actor}/ActorType.js +0 -0
@@ -0,0 +1,11 @@
1
+ import { HTTP_METHODS, IM_API_PREFIX } from '../../../core/constants';
2
+ import { GetBotsRequest } from '../../../infrastructure/interfaces/api';
3
+ const BASE_URL = `${IM_API_PREFIX}/bots`;
4
+ const BOTS_API_URLS = {
5
+ LIST: {
6
+ url: BASE_URL,
7
+ method: HTTP_METHODS.GET,
8
+ ...GetBotsRequest
9
+ }
10
+ };
11
+ export default BOTS_API_URLS;
@@ -0,0 +1,2 @@
1
+ import BOTS_API_URLS from './bots-api-url';
2
+ export { BOTS_API_URLS };
@@ -0,0 +1,11 @@
1
+ import { HTTP_METHODS, IM_API_PREFIX } from '../../../core/constants';
2
+ import { GetChannelAgentsRequest } from '../../../infrastructure/interfaces/api';
3
+ const BASE_URL = `${IM_API_PREFIX}/channels/:channelId/agents`;
4
+ const CHANNEL_AGENTS_API_URLS = {
5
+ LIST: {
6
+ url: BASE_URL,
7
+ method: HTTP_METHODS.GET,
8
+ ...GetChannelAgentsRequest
9
+ }
10
+ };
11
+ export default CHANNEL_AGENTS_API_URLS;
@@ -0,0 +1,2 @@
1
+ import CHANNEL_AGENTS_API_URLS from './channel-agents-api-url';
2
+ export { CHANNEL_AGENTS_API_URLS };
@@ -0,0 +1,2 @@
1
+ import SESSIONS_API_URLS from './sessions-api-url';
2
+ export { SESSIONS_API_URLS };
@@ -0,0 +1,12 @@
1
+ import { UpdateSessionAssigneeRequest } from '../../../infrastructure/interfaces/api';
2
+ import { HTTP_METHODS, IM_API_PREFIX } from '../../../core/constants';
3
+ const BASE_URL = `${IM_API_PREFIX}/sessions`;
4
+ const SINGLE_SESSION_URL = `${BASE_URL}/:sessionId`;
5
+ const SESSIONS_API_URLS = {
6
+ UPDATE_SESSION_ASSIGNEE: {
7
+ url: SINGLE_SESSION_URL,
8
+ method: HTTP_METHODS.PATCH,
9
+ ...UpdateSessionAssigneeRequest
10
+ }
11
+ };
12
+ export default SESSIONS_API_URLS;
@@ -0,0 +1,8 @@
1
+ const HTTP_METHODS = {
2
+ GET: 'GET',
3
+ POST: 'POST',
4
+ PUT: 'PUT',
5
+ PATCH: 'PATCH',
6
+ DELETE: 'DELETE'
7
+ };
8
+ export default HTTP_METHODS;
@@ -0,0 +1,6 @@
1
+ const ModuleNames = {
2
+ CHANNELS: 'channels',
3
+ SESSIONS: 'sessions',
4
+ BOTS: 'bots'
5
+ };
6
+ export default ModuleNames;
@@ -0,0 +1,4 @@
1
+ import HTTP_METHODS from './HttpMethods';
2
+ import ModuleNames from './ModuleNames';
3
+ const IM_API_PREFIX = '/api/v1';
4
+ export { ModuleNames, IM_API_PREFIX, HTTP_METHODS };
@@ -0,0 +1,7 @@
1
+ export default class AdapterError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = 'AdapterError';
5
+ }
6
+
7
+ }
@@ -0,0 +1,3 @@
1
+ import AdapterError from './AdapterError';
2
+ import ValidationError from './ValidationError';
3
+ export { ValidationError, AdapterError };
@@ -0,0 +1,2 @@
1
+ import { validateSchema } from './validateSchema';
2
+ export { validateSchema };
@@ -0,0 +1,68 @@
1
+ import { ValidationError } from '../errors';
2
+
3
+ function validateSchemaKeys(schema, data) {
4
+ Object.keys(schema).forEach(key => {
5
+ if (!(key in data)) {
6
+ throw new ValidationError(`Key '${key}' is missing in the data`);
7
+ }
8
+ });
9
+ }
10
+
11
+ function validateRequiredCheck(_ref) {
12
+ let {
13
+ value,
14
+ rules,
15
+ path
16
+ } = _ref;
17
+
18
+ if (rules.required && !value) {
19
+ throw new ValidationError(rules.message || `${path} is required`);
20
+ }
21
+ }
22
+
23
+ function validateEnumCheck(_ref2) {
24
+ let {
25
+ value,
26
+ rules,
27
+ path
28
+ } = _ref2;
29
+
30
+ if (rules.enum && !rules.enum.includes(value)) {
31
+ throw new ValidationError(`${path} must be one of: ${rules.enum.join(', ')}`);
32
+ }
33
+ }
34
+
35
+ export const validateSchema = (schema, data) => {
36
+ const validate = function (schemaObj, dataObj) {
37
+ let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
38
+ // Check if all schema keys exist in data
39
+ validateSchemaKeys(schemaObj, dataObj); // Validate each field
40
+
41
+ Object.entries(schemaObj).forEach(_ref3 => {
42
+ let [field, rules] = _ref3;
43
+ const value = dataObj[field];
44
+ const fieldPath = path ? `${path}.${field}` : field;
45
+ validateRequiredCheck({
46
+ value,
47
+ rules,
48
+ path: fieldPath
49
+ });
50
+
51
+ if (value !== null && value !== undefined) {
52
+ // Enum validation
53
+ validateEnumCheck({
54
+ value,
55
+ rules,
56
+ path: fieldPath
57
+ }); // Nested object validation
58
+
59
+ if (rules.type === 'object' && rules.schema) {
60
+ validate(rules.schema, value, fieldPath);
61
+ }
62
+ }
63
+ });
64
+ return dataObj;
65
+ };
66
+
67
+ return validate(schema, data);
68
+ };
@@ -0,0 +1,23 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { ActorSchema } from '../../schema';
3
+ export default class Actor {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(ActorSchema, data);
7
+ this.data = {
8
+ name: validatedData.name,
9
+ type: validatedData.type,
10
+ photoURL: validatedData.photoURL,
11
+ extId: validatedData.extId,
12
+ id: validatedData.id,
13
+ email: validatedData.email,
14
+ botType: validatedData.botType
15
+ };
16
+ }
17
+
18
+ toJSON() {
19
+ return { ...this.data
20
+ };
21
+ }
22
+
23
+ }
@@ -1,2 +1,2 @@
1
- import ActorType from './ActorType';
2
- export { ActorType };
1
+ import Actor from './Actor';
2
+ export { Actor };
@@ -1,110 +1,21 @@
1
- import ValidationError from '../../errors/ValidationError';
2
- import ActorType from '../Actor/ActorType';
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { AgentSchema } from '../../schema';
3
3
  export default class Agent {
4
4
  constructor() {
5
- let {
6
- id = '',
7
- name = '',
8
- email = '',
9
- photoURL = '',
10
- zuid = '',
11
- type = ''
12
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
- this.validateFields({
14
- id,
15
- email,
16
- name,
17
- zuid
18
- });
19
- this._id = id;
20
- this._name = name;
21
- this._email = email;
22
- this._photoURL = photoURL;
23
- this._zuid = zuid;
24
- this.setType(type);
25
- }
26
-
27
- validateFields(_ref) {
28
- let {
29
- id,
30
- email,
31
- name,
32
- zuid
33
- } = _ref;
34
- this.validateId(id);
35
- this.validateEmail(email);
36
- this.validateName(name);
37
- this.validateZuid(zuid);
38
- }
39
-
40
- static validateId(id) {
41
- if (!id) {
42
- throw new ValidationError('Agent ID is required');
43
- }
44
- }
45
-
46
- static validateEmail(email) {
47
- if (!email) {
48
- throw new ValidationError('Agent email is required');
49
- }
50
- }
51
-
52
- static validateName(name) {
53
- if (!name) {
54
- throw new ValidationError('Agent name is required');
55
- }
56
- }
57
-
58
- static validateZuid(zuid) {
59
- if (!zuid) {
60
- throw new ValidationError('Agent zuid is required');
61
- }
62
- }
63
-
64
- static validateType(type) {
65
- return type === ActorType.AGENT;
66
- }
67
-
68
- setType(type) {
69
- if (!Agent.validateType(type)) {
70
- throw new Error('Invalid actor type. Must be AGENT');
71
- }
72
-
73
- this._type = type;
74
- }
75
-
76
- get id() {
77
- return this._id;
78
- }
79
-
80
- get name() {
81
- return this._name;
82
- }
83
-
84
- get email() {
85
- return this._email;
86
- }
87
-
88
- get photoURL() {
89
- return this._photoURL;
90
- }
91
-
92
- get zuid() {
93
- return this._zuid;
94
- }
95
-
96
- get type() {
97
- return this._type;
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(AgentSchema, data);
7
+ this.data = {
8
+ id: validatedData.id,
9
+ name: validatedData.name,
10
+ email: validatedData.email,
11
+ photoURL: validatedData.photoURL || '',
12
+ zuid: validatedData.zuid,
13
+ type: validatedData.type
14
+ };
98
15
  }
99
16
 
100
17
  toJSON() {
101
- return {
102
- id: this._id,
103
- name: this._name,
104
- email: this._email,
105
- photoURL: this._photoURL,
106
- zuid: this._zuid,
107
- type: this._type
18
+ return { ...this.data
108
19
  };
109
20
  }
110
21
 
@@ -1,2 +1,2 @@
1
1
  import Agent from './Agent';
2
- export { Agent }; //
2
+ export { Agent };
@@ -0,0 +1,23 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { BotSchema } from '../../schema';
3
+ export default class Bot {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema(BotSchema, data);
7
+ this.data = {
8
+ id: validatedData.id,
9
+ botServiceType: validatedData.botService,
10
+ name: validatedData.name,
11
+ isActive: validatedData.isActive,
12
+ createdTime: validatedData.createdTime,
13
+ logoURL: validatedData.logoURL,
14
+ createdBy: validatedData.createdBy
15
+ };
16
+ }
17
+
18
+ toJSON() {
19
+ return { ...this.data
20
+ };
21
+ }
22
+
23
+ }
@@ -0,0 +1,2 @@
1
+ import Bot from './Bot';
2
+ export { Bot };
@@ -0,0 +1,36 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { SessionSchema } from '../../schema';
3
+ import { Actor } from '../Actor';
4
+ export default class Session {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema(SessionSchema, data);
8
+ this.data = {
9
+ channelId: validatedData.channelId,
10
+ status: validatedData.status,
11
+ createdTime: validatedData.createdTime,
12
+ agentId: validatedData.agentId,
13
+ botId: validatedData.botId,
14
+ actor: new Actor(validatedData.actor).toJSON(),
15
+ subject: validatedData.subject,
16
+ messagesCount: validatedData.messagesCount,
17
+ agentLastActiveTime: validatedData.agentLastActiveTime,
18
+ contactLastActiveTime: validatedData.contactLastActiveTime,
19
+ lastActiveTime: validatedData.lastActiveTime,
20
+ unreadMessagesCount: validatedData.unreadMessagesCount,
21
+ integrationServiceId: validatedData.integrationServiceId,
22
+ replyStatus: validatedData.replyStatus,
23
+ id: validatedData.id,
24
+ contactId: validatedData.contactId,
25
+ meta: validatedData.meta,
26
+ assignee: validatedData.assignee ? new Actor(validatedData.assignee).toJSON() : null,
27
+ channel: validatedData.channel
28
+ };
29
+ }
30
+
31
+ toJSON() {
32
+ return { ...this.data
33
+ };
34
+ }
35
+
36
+ }
@@ -0,0 +1,2 @@
1
+ import Session from './Session';
2
+ export { Session };
@@ -1,2 +1,4 @@
1
1
  export * from './Actor';
2
- export * from './Agent';
2
+ export * from './Agent';
3
+ export * from './Session';
4
+ export * from './Bot';
@@ -0,0 +1,2 @@
1
+ import ActorType from './ActorType';
2
+ export { ActorType };
@@ -0,0 +1,5 @@
1
+ const BotServiceType = {
2
+ DESK_GC_BOT: 'DESK_GC_BOT',
3
+ DESK_ZIA_BOT: 'DESK_ZIA_BOT'
4
+ };
5
+ export default BotServiceType;
@@ -0,0 +1,2 @@
1
+ import BotServiceType from './BotServiceType';
2
+ export { BotServiceType };
@@ -0,0 +1,4 @@
1
+ export * from './integrationServices';
2
+ export * from './session';
3
+ export * from './actor';
4
+ export * from './bot';
@@ -0,0 +1,11 @@
1
+ const IntegrationServices = {
2
+ TWILIO: 'TWILIO',
3
+ WHATSAPP: 'WHATSAPP',
4
+ TELEGRAM: 'TELEGRAM',
5
+ WECHAT: 'WECHAT',
6
+ LINE: 'LINE',
7
+ IM_TALK: 'IM_TALK',
8
+ FACEBOOKMESSENGER: 'FACEBOOKMESSENGER',
9
+ INSTAGRAM: 'INSTAGRAM'
10
+ };
11
+ export default IntegrationServices;
@@ -0,0 +1,2 @@
1
+ import IntegrationServices from './IntegrationServices';
2
+ export { IntegrationServices };
@@ -0,0 +1,20 @@
1
+ const SessionReplyStatus = {
2
+ ACCEPTED: 'ACCEPTED',
3
+ CHANNEL_INACTIVE: 'CHANNEL_INACTIVE',
4
+ CHANNEL_REVOKED: 'CHANNEL_REVOKED',
5
+ SESSION_ENDED: 'SESSION_ENDED',
6
+ SESSION_BLOCKED: 'SESSION_BLOCKED',
7
+ SESSION_EXPIRED: 'SESSION_EXPIRED',
8
+ UNASSIGNED: 'UNASSIGNED',
9
+ NOT_AN_ASSIGNEE: 'NOT_AN_ASSIGNEE',
10
+ CREDIT_EXHAUSTED: 'CREDIT_EXHAUSTED',
11
+ ACCESSTOKEN_EXPIRED: 'ACCESSTOKEN_EXPIRED',
12
+ PERMISSION_REVOKED: 'PERMISSION_REVOKED',
13
+ UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
14
+ PAGE_REMOVED: 'PAGE_REMOVED',
15
+ SANDBOX_LIMIT_REACHED: 'SANDBOX_LIMIT_REACHED',
16
+ CHANNEL_DELETED: 'CHANNEL_DELETED',
17
+ ENDUSER_OFFLINE: 'ENDUSER_OFFLINE',
18
+ CONFIG_SKIPPED_CHANNEL: 'CONFIG_SKIPPED_CHANNEL'
19
+ };
20
+ export default SessionReplyStatus;
@@ -0,0 +1,9 @@
1
+ const SessionStatus = {
2
+ CREATED: 'CREATED',
3
+ OPEN: 'OPEN',
4
+ ON_PROGRESS: 'ON_PROGRESS',
5
+ ON_HOLD: 'ON_HOLD',
6
+ ENDED: 'ENDED',
7
+ BLOCKED: 'BLOCKED'
8
+ };
9
+ export default SessionStatus;
@@ -0,0 +1,3 @@
1
+ import SessionReplyStatus from './SessionReplyStatus';
2
+ import SessionStatus from './SessionStatus';
3
+ export { SessionStatus, SessionReplyStatus };
@@ -0,0 +1,63 @@
1
+ import { configRegistry } from '../../infrastructure/sdk/config';
2
+ export default class BaseAPI {
3
+ constructor() {
4
+ this.httpClient = configRegistry.getHttpClient();
5
+ this.baseURL = configRegistry.getBaseURL();
6
+ }
7
+
8
+ replacePathParams(url, params) {
9
+ let _url = url;
10
+ Object.entries(params).forEach(_ref => {
11
+ let [key, value] = _ref;
12
+ _url = url.replace(`:${key}`, value);
13
+ });
14
+ return _url;
15
+ }
16
+
17
+ buildUrl(_ref2) {
18
+ let {
19
+ url,
20
+ params,
21
+ query
22
+ } = _ref2;
23
+ const _url = `${this.baseURL}${this.replacePathParams(url, params)}`;
24
+ const queryString = this.buildQuery(query);
25
+
26
+ if (queryString) {
27
+ return `${_url}?${queryString}`;
28
+ }
29
+
30
+ return _url;
31
+ }
32
+
33
+ buildQuery(query) {
34
+ const filteredQuery = Object.entries(query).filter(_ref3 => {
35
+ let [, value] = _ref3;
36
+ return value !== undefined && value !== null && value !== '';
37
+ }).reduce((acc, _ref4) => {
38
+ let [key, value] = _ref4;
39
+ acc[key] = value;
40
+ return acc;
41
+ }, {});
42
+ return new URLSearchParams(filteredQuery).toString();
43
+ }
44
+
45
+ async request(_ref5) {
46
+ let {
47
+ urlConfig,
48
+ request
49
+ } = _ref5;
50
+ const url = this.buildUrl({
51
+ url: urlConfig.url,
52
+ params: request.params,
53
+ query: request.query
54
+ });
55
+ const httpRequest = await this.httpClient.request({
56
+ url,
57
+ method: urlConfig.method,
58
+ header: urlConfig.header
59
+ });
60
+ return httpRequest;
61
+ }
62
+
63
+ }
@@ -0,0 +1,10 @@
1
+ import { GetBotsRequest } from '../../../infrastructure/interfaces/api';
2
+ import BaseAPI from '../BaseAPI';
3
+ export default class IBot extends BaseAPI {
4
+ // eslint-disable-next-line no-unused-vars
5
+ async getBots() {
6
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetBotsRequest;
7
+ throw new Error('Method not implemented');
8
+ }
9
+
10
+ }
@@ -0,0 +1,2 @@
1
+ import IBot from './IBot';
2
+ export { IBot };
@@ -1,5 +1,9 @@
1
- export default class IChannelAgent {
2
- static getChannelAgents() {
1
+ import { GetChannelAgentsRequest } from '../../../infrastructure/interfaces/api';
2
+ import BaseAPI from '../BaseAPI';
3
+ export default class IChannelAgent extends BaseAPI {
4
+ // eslint-disable-next-line no-unused-vars
5
+ getAgents() {
6
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetChannelAgentsRequest;
3
7
  throw new Error('Method not implemented.');
4
8
  }
5
9
 
@@ -1 +1,3 @@
1
- export * from './channels';
1
+ export * from './channels';
2
+ export * from './sessions';
3
+ export * from './bots';
@@ -0,0 +1,10 @@
1
+ import { UpdateSessionAssigneeRequest } from '../../../infrastructure/interfaces/api';
2
+ import BaseAPI from '../BaseAPI';
3
+ export default class ISession extends BaseAPI {
4
+ // eslint-disable-next-line no-unused-vars
5
+ updateAssignee() {
6
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : UpdateSessionAssigneeRequest;
7
+ throw new Error('Method not implemented.');
8
+ }
9
+
10
+ }
@@ -0,0 +1,2 @@
1
+ import ISession from './ISession';
2
+ export { ISession };
@@ -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 };