@zohoim/client-sdk 1.0.0-poc70 → 1.0.0-poc72

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.
@@ -12,9 +12,14 @@ export default class BotService extends IBotRepository {
12
12
  return this.botRepository.getBots(request);
13
13
  }
14
14
 
15
+ async getBot(request) {
16
+ return this.botRepository.getBot(request);
17
+ }
18
+
15
19
  toJSON() {
16
20
  return {
17
- getBots: this.getBots.bind(this)
21
+ getBots: this.getBots.bind(this),
22
+ getBot: this.getBot.bind(this)
18
23
  };
19
24
  }
20
25
 
@@ -0,0 +1,9 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function getBotRequest() {
4
+ return new RequestBuilder().withParams({
5
+ botId: null
6
+ }).build();
7
+ }
8
+
9
+ export default getBotRequest;
@@ -1 +1,2 @@
1
- export { default as getBotsRequest } from "./getBotsRequest";
1
+ export { default as getBotsRequest } from "./getBotsRequest";
2
+ export { default as getBotRequest } from "./getBotRequest";
@@ -38,11 +38,11 @@ export default class Message {
38
38
  };
39
39
  }
40
40
 
41
- static isLocationMessage(type) {
41
+ static isLocation(type) {
42
42
  return type === MessageTypes.LOCATION;
43
43
  }
44
44
 
45
- static isDeletedMessage(status) {
45
+ static isDeleted(status) {
46
46
  return status === MessageStatus.DELETED;
47
47
  }
48
48
 
@@ -50,7 +50,7 @@ export default class Message {
50
50
  return direction === MessageDirection.OUT;
51
51
  }
52
52
 
53
- static isInfoMessage(type) {
53
+ static isInfo(type) {
54
54
  return type === MessageTypes.INFO;
55
55
  }
56
56
 
@@ -1,6 +1,6 @@
1
1
  import { ModuleNames } from "../../../../core/constants";
2
2
  import BaseAPI from "../../../../infrastructure/api/BaseAPI";
3
- import { getBotsRequest } from "../../../dto";
3
+ import { getBotsRequest, getBotRequest } from "../../../dto";
4
4
  export default class IBotRepository extends BaseAPI {
5
5
  constructor() {
6
6
  super({
@@ -12,6 +12,12 @@ export default class IBotRepository extends BaseAPI {
12
12
  async getBots() {
13
13
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotsRequest();
14
14
  throw new Error('Method not implemented');
15
+ } // eslint-disable-next-line no-unused-vars
16
+
17
+
18
+ async getBot() {
19
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotRequest();
20
+ throw new Error('Method not implemented');
15
21
  }
16
22
 
17
23
  }
@@ -1,4 +1,4 @@
1
- import { getBotsRequest } from "../../../domain/dto";
1
+ import { getBotsRequest, getBotRequest } from "../../../domain/dto";
2
2
  import { IBotRepository } from "../../../domain/interfaces/repositories";
3
3
  export default class BotAPI extends IBotRepository {
4
4
  async getBots() {
@@ -11,4 +11,14 @@ export default class BotAPI extends IBotRepository {
11
11
  return httpRequest;
12
12
  }
13
13
 
14
+ async getBot() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotRequest();
16
+ const operation = 'getBot';
17
+ const httpRequest = await this.request({
18
+ request,
19
+ operation
20
+ });
21
+ return httpRequest;
22
+ }
23
+
14
24
  }
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from "../../../../core/constants";
2
- import { getBotsRequest } from "../../../../domain/dto";
2
+ import { getBotsRequest, getBotRequest } from "../../../../domain/dto";
3
3
  import createAPIRegistry from "../createAPIRegistry";
4
4
  import constructBotEndPoint from "./constructBotEndPoint";
5
5
 
@@ -7,6 +7,11 @@ function getBots() {
7
7
  return createAPIRegistry(constructBotEndPoint(), HTTP_METHODS.GET, getBotsRequest());
8
8
  }
9
9
 
10
+ function getBot() {
11
+ return createAPIRegistry(constructBotEndPoint('/:botId'), HTTP_METHODS.GET, getBotRequest());
12
+ }
13
+
10
14
  export default {
11
- getBots
15
+ getBots,
16
+ getBot
12
17
  };
@@ -40,9 +40,18 @@ export default class BotRepository extends IBotRepository {
40
40
  });
41
41
  }
42
42
 
43
+ async getBot(request) {
44
+ return this.invokeAPI({
45
+ operation: 'getBot',
46
+ request,
47
+ responseType: ResponseTypes.LIST
48
+ });
49
+ }
50
+
43
51
  toJSON() {
44
52
  return {
45
- getBots: this.getBots.bind(this)
53
+ getBots: this.getBots.bind(this),
54
+ getBot: this.getBot.bind(this)
46
55
  };
47
56
  }
48
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc70",
3
+ "version": "1.0.0-poc72",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",