@veritree/services 2.41.0 → 2.42.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.41.0",
3
+ "version": "2.42.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,10 +1,10 @@
1
- import Api from "../helpers/api";
2
- import { createParamsStringFromArgs } from "../utils/args";
1
+ import Api from '../helpers/api';
2
+ import { createParamsStringFromArgs } from '../utils/args';
3
3
 
4
4
  class StandardsApi extends Api {
5
5
  constructor(resource) {
6
6
  super(resource);
7
- this.resource = "standards";
7
+ this.resource = 'standards';
8
8
  }
9
9
 
10
10
  themes() {
@@ -29,14 +29,14 @@ class StandardsApi extends Api {
29
29
  const url = `${this.getUrl()}/themes/${themeId}?${createParamsStringFromArgs(
30
30
  args
31
31
  )}`;
32
- return await this.post(url, data, "patch");
32
+ return await this.post(url, data, 'patch');
33
33
  };
34
34
 
35
35
  const remove = async (themeId, args) => {
36
36
  const url = `${this.getUrl()}/themes/${themeId}?${createParamsStringFromArgs(
37
37
  args
38
38
  )}`;
39
- return await this.post(url, data, "delete");
39
+ return await this.post(url, null, 'delete');
40
40
  };
41
41
 
42
42
  const goals = (themeId) => {
@@ -95,12 +95,12 @@ class StandardsApi extends Api {
95
95
 
96
96
  const update = async (data) => {
97
97
  const url = `${this.getUrl()}/goals/${goalId}`;
98
- return await this.post(url, data, "patch");
98
+ return await this.post(url, data, 'patch');
99
99
  };
100
100
 
101
101
  const remove = async () => {
102
102
  const url = `${this.getUrl()}/goals/${goalId}`;
103
- return await this.post(url, null, "delete");
103
+ return await this.post(url, null, 'delete');
104
104
  };
105
105
 
106
106
  return {
@@ -110,6 +110,25 @@ class StandardsApi extends Api {
110
110
  };
111
111
  }
112
112
 
113
+ goalsThemes(goalId) {
114
+ let url = `${this.getUrl()}/goals-themes/${goalId}`;
115
+
116
+ const single = async () => {
117
+ return await this.get(url);
118
+ };
119
+
120
+ const detach = async (themeId) => {
121
+ const args = { id: themeId };
122
+ url = `${url}${this.getUrlParams(args)}`;
123
+ return await this.post(url, null, 'delete');
124
+ };
125
+
126
+ return {
127
+ single,
128
+ delete: detach,
129
+ };
130
+ }
131
+
113
132
  indicators(indicatorId) {
114
133
  const single = async () => {
115
134
  const url = `${this.getUrl()}/indicators/${indicatorId}`;
@@ -118,12 +137,12 @@ class StandardsApi extends Api {
118
137
 
119
138
  const update = async (data) => {
120
139
  const url = `${this.getUrl()}/indicators/${indicatorId}`;
121
- return await this.post(url, data, "patch");
140
+ return await this.post(url, data, 'patch');
122
141
  };
123
142
 
124
143
  const remove = async () => {
125
144
  const url = `${this.getUrl()}/indicators/${indicatorId}`;
126
- return await this.post(url, null, "delete");
145
+ return await this.post(url, null, 'delete');
127
146
  };
128
147
 
129
148
  return {
@@ -132,6 +151,7 @@ class StandardsApi extends Api {
132
151
  delete: remove,
133
152
  };
134
153
  }
154
+
135
155
  UNSDGs(themeId) {
136
156
  const attach = async (data) => {
137
157
  const url = `${this.getUrl()}/themes/${themeId}/attach-sdg`;