@zohoim/client-sdk 1.0.0-poc65 → 1.0.0-poc66
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.
- package/es/core/constants/ResponseTypes.js +6 -4
- package/es/core/constants/index.js +2 -2
- package/es/infrastructure/api/BaseAPI.js +4 -4
- package/es/infrastructure/repositories/agents/AgentRepository.js +2 -2
- package/es/infrastructure/repositories/bots/BotRepository.js +2 -2
- package/es/infrastructure/repositories/channels/ChannelAgentRepository.js +2 -2
- package/es/infrastructure/repositories/channels/ChannelRepository.js +2 -2
- package/es/infrastructure/repositories/contacts/ContactRepository.js +2 -2
- package/es/infrastructure/repositories/messages/MessageRepository.js +4 -4
- package/es/infrastructure/repositories/sessions/SessionRepository.js +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpMethods } from '@zohoim/http-client';
|
|
2
2
|
import ModuleNames from "./ModuleNames";
|
|
3
|
-
import
|
|
3
|
+
import ResponseTypes from "./ResponseTypes";
|
|
4
4
|
const IM_API_PREFIX = '/api/v1';
|
|
5
5
|
const HTTP_METHODS = HttpMethods;
|
|
6
|
-
export { ModuleNames, IM_API_PREFIX, HTTP_METHODS,
|
|
6
|
+
export { ModuleNames, IM_API_PREFIX, HTTP_METHODS, ResponseTypes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResponseTypes } from "../../core/constants";
|
|
2
2
|
import { ResponseUtils } from "../../core/utils";
|
|
3
3
|
import configRegistry from "../config/configRegistry";
|
|
4
4
|
import { getRegistryConfig } from "./registry";
|
|
@@ -128,7 +128,7 @@ export default class BaseAPI {
|
|
|
128
128
|
apiProxy,
|
|
129
129
|
customAPI,
|
|
130
130
|
adapter,
|
|
131
|
-
responseType = SINGLE
|
|
131
|
+
responseType = ResponseTypes.SINGLE
|
|
132
132
|
} = _ref7;
|
|
133
133
|
const response = await apiProxy[operation](request);
|
|
134
134
|
const isOverridden = this.isMethodOverridden(customAPI, operation);
|
|
@@ -137,11 +137,11 @@ export default class BaseAPI {
|
|
|
137
137
|
return response;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
if (responseType === NONE || !adapter) {
|
|
140
|
+
if (responseType === ResponseTypes.NONE || !adapter) {
|
|
141
141
|
return response;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
return responseType === LIST ? ResponseUtils.adaptListResponse(response, adapter.adapt) : ResponseUtils.adaptSingleResponse(response, adapter.adapt);
|
|
144
|
+
return responseType === ResponseTypes.LIST ? ResponseUtils.adaptListResponse(response, adapter.adapt) : ResponseUtils.adaptSingleResponse(response, adapter.adapt);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAgentRepository } from "../../../domain/interfaces/repositories";
|
|
2
2
|
import { AgentAdapter } from "../../adapters";
|
|
3
3
|
import { AgentAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class AgentRepository extends IAgentRepository {
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
@@ -36,7 +36,7 @@ export default class AgentRepository extends IAgentRepository {
|
|
|
36
36
|
return this.invokeAPI({
|
|
37
37
|
operation: 'getAgents',
|
|
38
38
|
request,
|
|
39
|
-
responseType: LIST
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IBotRepository } from "../../../domain/interfaces/repositories";
|
|
2
2
|
import { BotAdapter } from "../../adapters";
|
|
3
3
|
import { BotAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class BotRepository extends IBotRepository {
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
@@ -36,7 +36,7 @@ export default class BotRepository extends IBotRepository {
|
|
|
36
36
|
return this.invokeAPI({
|
|
37
37
|
operation: 'getBots',
|
|
38
38
|
request,
|
|
39
|
-
responseType: LIST
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IChannelAgentRepository } from "../../../domain/interfaces/repositories";
|
|
2
2
|
import { ChannelAgentAdapter } from "../../adapters";
|
|
3
3
|
import { ChannelAgentAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class ChannelAgentRepository extends IChannelAgentRepository {
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
@@ -36,7 +36,7 @@ export default class ChannelAgentRepository extends IChannelAgentRepository {
|
|
|
36
36
|
return this.invokeAPI({
|
|
37
37
|
operation: 'getAgents',
|
|
38
38
|
request,
|
|
39
|
-
responseType: LIST
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IChannelRepository } from "../../../domain/interfaces/repositories";
|
|
2
2
|
import { ChannelAdapter } from "../../adapters";
|
|
3
3
|
import { ChannelAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class ChannelRepository extends IChannelRepository {
|
|
6
6
|
constructor() {
|
|
7
7
|
let {
|
|
@@ -36,7 +36,7 @@ export default class ChannelRepository extends IChannelRepository {
|
|
|
36
36
|
return this.invokeAPI({
|
|
37
37
|
operation: 'getChannels',
|
|
38
38
|
request,
|
|
39
|
-
responseType: LIST
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IContactRepository } from "../../../domain/interfaces/repositories";
|
|
2
2
|
import { ContactAdapter } from "../../adapters";
|
|
3
3
|
import { ContactAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class ContactRepository extends IContactRepository {
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
@@ -36,7 +36,7 @@ export default class ContactRepository extends IContactRepository {
|
|
|
36
36
|
return this.invokeAPI({
|
|
37
37
|
operation: 'getContacts',
|
|
38
38
|
request,
|
|
39
|
-
responseType: LIST
|
|
39
|
+
responseType: ResponseTypes.LIST
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -2,7 +2,7 @@ import { MessageAdapter } from "../../adapters";
|
|
|
2
2
|
import { MessageAPI } from "../../api";
|
|
3
3
|
import { IMessageRepository } from "../../../domain/interfaces/repositories/messages";
|
|
4
4
|
import MessageWithSessionAdapter from "../../adapters/messages/MessageWithSessionAdapter";
|
|
5
|
-
import {
|
|
5
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
6
6
|
export default class MessageRepository extends IMessageRepository {
|
|
7
7
|
constructor(_ref) {
|
|
8
8
|
let {
|
|
@@ -39,7 +39,7 @@ export default class MessageRepository extends IMessageRepository {
|
|
|
39
39
|
return this.invokeAPI({
|
|
40
40
|
operation: 'getMessages',
|
|
41
41
|
request,
|
|
42
|
-
responseType: LIST
|
|
42
|
+
responseType: ResponseTypes.LIST
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ export default class MessageRepository extends IMessageRepository {
|
|
|
47
47
|
return this.invokeAPI({
|
|
48
48
|
operation: 'getFullContent',
|
|
49
49
|
request,
|
|
50
|
-
responseType: NONE
|
|
50
|
+
responseType: ResponseTypes.NONE
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -91,7 +91,7 @@ export default class MessageRepository extends IMessageRepository {
|
|
|
91
91
|
operation: 'searchMessages',
|
|
92
92
|
request,
|
|
93
93
|
adapter: this.messageWithSessionAdapter,
|
|
94
|
-
responseType: LIST
|
|
94
|
+
responseType: ResponseTypes.LIST
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AttachmentAdapter, MessageAdapter, SessionAdapter } from "../../adapters/index";
|
|
2
2
|
import { ISessionRepository } from "../../../domain/interfaces/repositories";
|
|
3
3
|
import { SessionAPI } from "../../api";
|
|
4
|
-
import {
|
|
4
|
+
import { ResponseTypes } from "../../../core/constants";
|
|
5
5
|
export default class SessionRepository extends ISessionRepository {
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
@@ -47,7 +47,7 @@ export default class SessionRepository extends ISessionRepository {
|
|
|
47
47
|
return this.invokeAPI({
|
|
48
48
|
operation: 'getSessions',
|
|
49
49
|
request,
|
|
50
|
-
responseType: LIST
|
|
50
|
+
responseType: ResponseTypes.LIST
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -63,7 +63,7 @@ export default class SessionRepository extends ISessionRepository {
|
|
|
63
63
|
operation: 'getSessionAttachments',
|
|
64
64
|
request,
|
|
65
65
|
adapter: this.attachmentAdapter,
|
|
66
|
-
responseType: LIST
|
|
66
|
+
responseType: ResponseTypes.LIST
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ export default class SessionRepository extends ISessionRepository {
|
|
|
72
72
|
operation: 'getSessionLastMessages',
|
|
73
73
|
request,
|
|
74
74
|
adapter: this.messageAdapter,
|
|
75
|
-
responseType: LIST
|
|
75
|
+
responseType: ResponseTypes.LIST
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
|