@veritree/services 1.0.0 → 1.1.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": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -29,8 +29,8 @@ class SponsorsApi extends Api {
29
29
  return await this.get(url);
30
30
  }
31
31
 
32
- async totalPlantingStats() {
33
- const url = `${this.getUrl()}/total-planting-stats`;
32
+ async totalPlantingStats(args) {
33
+ const url = `${this.getUrl()}/total-planting-stats${this.getUrlParams(args)}`;
34
34
  return await this.get(url);
35
35
  }
36
36
 
@@ -7,8 +7,8 @@ class TagsApi extends Api {
7
7
  this.resource = "tags";
8
8
  }
9
9
 
10
- relation(prefix, id, args) {
11
- return Relations(this, prefix, id, args);
10
+ relation(prefix, id) {
11
+ return Relations(this, prefix, id);
12
12
  }
13
13
  }
14
14
 
@@ -1,32 +1,32 @@
1
- const Relations = (api, prefix, id, args) => {
1
+ const Relations = (api, prefix, id) => {
2
2
  let url = `${api.baseUrl}/${prefix}/${id}/${api.resource}`;
3
-
4
- const all = async () => {
3
+
4
+ const all = async (args) => {
5
5
  url = `${url}${api.getUrlParams(args)}`;
6
6
  return await api.get(url);
7
- }
7
+ };
8
8
 
9
- const single = async(tagId) => {
9
+ const single = async (tagId, args) => {
10
10
  url = `${url}/${tagId}${api.getUrlParams(args)}`;
11
11
  return await api.get(url);
12
- }
12
+ };
13
13
 
14
- const attach = async(tagId, data) => {
14
+ const attach = async (tagId, data, args) => {
15
15
  url = `${url}/${tagId}/attach${api.getUrlParams(args)}`;
16
16
  return await api.post(url, data);
17
- }
17
+ };
18
18
 
19
- const detach = async(tagId, data) => {
19
+ const detach = async (tagId, args) => {
20
20
  url = `${url}/${tagId}/detach${api.getUrlParams(args)}`;
21
- return await api.delete(url, data);
22
- }
21
+ return await api.post(url, null, "delete");
22
+ };
23
23
 
24
24
  return {
25
25
  all,
26
26
  single,
27
27
  attach,
28
- detach
29
- }
30
- }
28
+ detach,
29
+ };
30
+ };
31
31
 
32
- export default Relations;
32
+ export default Relations;