@zohoim/client-sdk 1.0.0-poc14 → 1.0.0-poc16

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.
@@ -32,15 +32,23 @@ export default class BaseAPI {
32
32
  return `${this.baseURL}${_url}`;
33
33
  }
34
34
 
35
- buildQuery(object) {
36
- return new URLSearchParams(object).toString();
35
+ buildQuery(query) {
36
+ const filteredQuery = Object.entries(query).filter(_ref3 => {
37
+ let [, value] = _ref3;
38
+ return value !== undefined && value !== null && value !== '';
39
+ }).reduce((acc, _ref4) => {
40
+ let [key, value] = _ref4;
41
+ acc[key] = value;
42
+ return acc;
43
+ }, {});
44
+ return new URLSearchParams(filteredQuery).toString();
37
45
  }
38
46
 
39
- async request(_ref3) {
47
+ async request(_ref5) {
40
48
  let {
41
49
  urlConfig,
42
50
  request
43
- } = _ref3;
51
+ } = _ref5;
44
52
  const url = this.buildUrl({
45
53
  url: urlConfig.url,
46
54
  params: request.params,
@@ -22,4 +22,10 @@ export default class ChannelAgentService extends IChannelAgent {
22
22
  return channelAgents.map(this.channelAgentAdapter.adapt);
23
23
  }
24
24
 
25
+ toJSON() {
26
+ return {
27
+ getAgents: this.getAgents.bind(this)
28
+ };
29
+ }
30
+
25
31
  }
@@ -22,4 +22,10 @@ export default class SessionService extends ISession {
22
22
  return this.channelAgentAdapter.adapt(session);
23
23
  }
24
24
 
25
+ toJSON() {
26
+ return {
27
+ updateAssignee: this.updateAssignee.bind(this)
28
+ };
29
+ }
30
+
25
31
  }
@@ -8,7 +8,7 @@ const ModuleFactory = {
8
8
  } = _ref;
9
9
  return new ChannelSDK({
10
10
  config
11
- });
11
+ }).toJSON();
12
12
  },
13
13
  [ModuleNames.SESSIONS]: _ref2 => {
14
14
  let {
@@ -16,7 +16,7 @@ const ModuleFactory = {
16
16
  } = _ref2;
17
17
  return new SessionSDK({
18
18
  config
19
- });
19
+ }).toJSON();
20
20
  }
21
21
  };
22
22
  export default ModuleFactory;
@@ -8,10 +8,10 @@ export default class ModuleManager {
8
8
 
9
9
  initialize(_ref) {
10
10
  let {
11
- config
11
+ apiConfig
12
12
  } = _ref;
13
13
  this.supportedModules.forEach(moduleName => {
14
- const moduleConfig = config[moduleName] || {};
14
+ const moduleConfig = apiConfig[moduleName] || {};
15
15
  this.initializeModule({
16
16
  moduleName,
17
17
  config: moduleConfig
@@ -5,7 +5,7 @@ export default class IMSDK {
5
5
  constructor(_ref) {
6
6
  let {
7
7
  baseURL,
8
- config = {},
8
+ apiConfig = {},
9
9
  httpClient
10
10
  } = _ref;
11
11
  configRegistry.setConfig({
@@ -15,7 +15,7 @@ export default class IMSDK {
15
15
  this._moduleManager = new ModuleManager();
16
16
 
17
17
  this._moduleManager.initialize({
18
- config
18
+ apiConfig
19
19
  });
20
20
  }
21
21
 
@@ -1,4 +1,4 @@
1
- import ChannelAgentsSDK from './ChannelAgentsSDK';
1
+ import { ChannelAgentService } from '../../../domain/services';
2
2
  export default class ChannelSDK {
3
3
  constructor(_ref) {
4
4
  let {
@@ -8,10 +8,16 @@ export default class ChannelSDK {
8
8
  channelAgentAPI,
9
9
  channelAgentAdapter
10
10
  } = config;
11
- this.agents = new ChannelAgentsSDK({
11
+ this.agents = new ChannelAgentService({
12
12
  channelAgentAPI,
13
13
  channelAgentAdapter
14
- });
14
+ }).toJSON();
15
+ }
16
+
17
+ toJSON() {
18
+ return {
19
+ agents: this.agents
20
+ };
15
21
  }
16
22
 
17
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc14",
3
+ "version": "1.0.0-poc16",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -1,20 +0,0 @@
1
- import { ChannelAgentService } from '../../../domain/services';
2
- import { GetChannelAgentsRequest } from '../../interfaces/api';
3
- export default class ChannelAgentsSDK {
4
- constructor(_ref) {
5
- let {
6
- channelAgentAPI,
7
- channelAgentAdapter
8
- } = _ref;
9
- this.channelAgentService = new ChannelAgentService({
10
- channelAgentAPI,
11
- channelAgentAdapter
12
- });
13
- }
14
-
15
- async getAgents() {
16
- let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetChannelAgentsRequest;
17
- return this.channelAgentService.getAgents(request);
18
- }
19
-
20
- }