@veritree/services 2.54.0 → 2.56.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.54.0",
3
+ "version": "2.56.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,9 +1,9 @@
1
- import Api from '../helpers/api';
1
+ import Api from "../helpers/api";
2
2
 
3
3
  class OrganizationsApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = 'organizations';
6
+ this.resource = "organizations";
7
7
  }
8
8
 
9
9
  tasks(orgId) {
@@ -57,9 +57,7 @@ class OrganizationsApi extends Api {
57
57
 
58
58
  pins(orgId) {
59
59
  const all = async (params) => {
60
- const url = `${this.getUrl()}/${orgId}/pins/${this.getUrlParams(
61
- params
62
- )}`;
60
+ const url = `${this.getUrl()}/${orgId}/pins/${this.getUrlParams(params)}`;
63
61
 
64
62
  return await this.get(url);
65
63
  };
@@ -72,9 +70,18 @@ class OrganizationsApi extends Api {
72
70
  return await this.get(url);
73
71
  };
74
72
 
73
+ const create = async (data, params) => {
74
+ const url = `${this.getUrl()}/${orgId}/pins${this.getUrlParams(
75
+ params
76
+ )}`;
77
+
78
+ return await this.post(url, data);
79
+ };
80
+
75
81
  return {
76
82
  all,
77
83
  single,
84
+ create,
78
85
  };
79
86
  }
80
87
 
@@ -1,20 +1,34 @@
1
- import Api from '../helpers/api';
1
+ import Api from "../helpers/api";
2
2
 
3
3
  class PinsApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = 'pins';
6
+ this.resource = "pins";
7
7
  }
8
8
 
9
9
  evidence(pinId) {
10
- const all = async (args) => {
11
- const url = `${this.getUrl()}/${pinId}/evidence/${this.getUrlParams(
12
- args
10
+ const all = async (params) => {
11
+ const url = `${this.getUrl()}/${pinId}/evidence${this.getUrlParams(
12
+ params
13
13
  )}`;
14
+
14
15
  return await this.get(url);
15
16
  };
16
17
 
17
- return { all };
18
+ const attach = async (formData, params) => {
19
+ const url = `${this.getUrl()}/${pinId}/evidence${this.getUrlParams(
20
+ params
21
+ )}`;
22
+
23
+ return await this.post(url, formData);
24
+ };
25
+
26
+ const detach = async (evidenceId, fileType = 'images') => {
27
+ const url = `${this.getUrl()}/${pinId}/evidence/${fileType}/${evidenceId}${this.getUrlParams()}`;
28
+ return await this.post(url, null, 'delete');
29
+ };
30
+
31
+ return { all, attach, detach };
18
32
  }
19
33
  }
20
34