@veritree/services 2.77.0 → 2.79.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.77.0",
3
+ "version": "2.79.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,14 +1,13 @@
1
- import Api from "../helpers/api";
1
+ import Api from '../helpers/api';
2
2
 
3
3
  class EvidenceApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = "evidence";
6
+ this.resource = 'evidence';
7
7
  }
8
8
 
9
9
  image(imageId, params) {
10
-
11
- let url = `${this.getUrl()}/image/${imageId}${this.getUrlParams(params)}`
10
+ let url = `${this.getUrl()}/image/${imageId}${this.getUrlParams(params)}`;
12
11
 
13
12
  const single = async () => {
14
13
  return await this.get(url);
@@ -18,7 +17,6 @@ class EvidenceApi extends Api {
18
17
  return await this.post(url, null, 'delete');
19
18
  };
20
19
 
21
-
22
20
  return {
23
21
  single,
24
22
  delete: remove,
@@ -26,7 +24,9 @@ class EvidenceApi extends Api {
26
24
  }
27
25
 
28
26
  attachment(attachmentId, params) {
29
- let url = `${this.getUrl()}/attachment/${attachmentId}${this.getUrlParams(params)}`
27
+ let url = `${this.getUrl()}/attachment/${attachmentId}${this.getUrlParams(
28
+ params
29
+ )}`;
30
30
 
31
31
  const single = async () => {
32
32
  return await this.get(url);
@@ -36,9 +36,31 @@ class EvidenceApi extends Api {
36
36
  return await this.post(url, null, 'delete');
37
37
  };
38
38
 
39
+ return {
40
+ single,
41
+ delete: remove,
42
+ };
43
+ }
44
+
45
+ evidenceType(evidenceType, evidenceId) {
46
+ const url = `${this.getUrl()}/${evidenceType}/${evidenceId}`;
47
+
48
+ const single = async (params) => {
49
+ const urlWithParams = `${url}${this.getUrlParams(params)}`;
50
+ return await this.get(urlWithParams);
51
+ };
52
+
53
+ const update = async (data) => {
54
+ return await this.post(url, data, 'patch');
55
+ };
56
+
57
+ const remove = async () => {
58
+ return await this.post(url, null, 'delete');
59
+ };
39
60
 
40
61
  return {
41
62
  single,
63
+ update,
42
64
  delete: remove,
43
65
  };
44
66
  }
@@ -29,6 +29,11 @@ class TreeOrdersApi extends Api {
29
29
  create,
30
30
  };
31
31
  }
32
+
33
+ moveCapacity(treeOrderId, data, args) {
34
+ const url = `${this.getUrl()}/${treeOrderId}/move-capacity${this.getUrlParams(args)}`;
35
+ return this.post(url, data);
36
+ }
32
37
  }
33
38
 
34
39
  export const TreeOrders = new TreeOrdersApi();