@veritree/services 2.78.0 → 2.80.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.78.0",
3
+ "version": "2.80.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,33 @@ 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
+ const urlWithParams = `${url}${this.getUrlParams()}`;
55
+ return await this.post(urlWithParams, data, 'patch');
56
+ };
57
+
58
+ const remove = async () => {
59
+ const urlWithParams = `${url}${this.getUrlParams()}`;
60
+ return await this.post(urlWithParams, null, 'delete');
61
+ };
39
62
 
40
63
  return {
41
64
  single,
65
+ update,
42
66
  delete: remove,
43
67
  };
44
68
  }
@@ -133,9 +133,15 @@ class TasksApi extends Api {
133
133
  return await this.post(url, data);
134
134
  };
135
135
 
136
+ const deleteImage = async (imageId) => {
137
+ const imageUrl = `${url}/images/${imageId}${this.getUrlParams()}`;
138
+ return await this.post(imageUrl, null, 'delete');
139
+ };
140
+
136
141
  return {
137
142
  all,
138
143
  attach,
144
+ deleteImage,
139
145
  };
140
146
  }
141
147
  }