@veritree/services 2.37.0 → 2.39.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 +1 -1
- package/src/endpoints/sponsors.js +28 -10
- package/src/endpoints/standards.js +13 -6
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
2
|
|
|
3
3
|
class SponsorsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = "sponsors";
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
async map() {
|
|
10
10
|
this.setOrg();
|
|
11
11
|
|
|
12
12
|
if (!this.orgId) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error("No org id provided");
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const url = `${this.getUrl()}/${this.orgId}/map-data`;
|
|
@@ -21,7 +21,7 @@ class SponsorsApi extends Api {
|
|
|
21
21
|
this.setOrg();
|
|
22
22
|
|
|
23
23
|
if (!this.orgId) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error("No org id provided");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const url = `${this.getUrl()}/${this.orgId}/profile`;
|
|
@@ -49,7 +49,9 @@ class SponsorsApi extends Api {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const imageUploadUrl = async () => {
|
|
52
|
-
const url = `${this.getUrl()}/${
|
|
52
|
+
const url = `${this.getUrl()}/${
|
|
53
|
+
this.orgId
|
|
54
|
+
}/cms/image-upload-url${urlParams}`;
|
|
53
55
|
return await this.get(url);
|
|
54
56
|
};
|
|
55
57
|
|
|
@@ -67,19 +69,35 @@ class SponsorsApi extends Api {
|
|
|
67
69
|
|
|
68
70
|
tools(args) {
|
|
69
71
|
const get = async (sponsorId) => {
|
|
70
|
-
const url = `${this.getUrl()}/${sponsorId}/tools${this.getUrlParams(
|
|
72
|
+
const url = `${this.getUrl()}/${sponsorId}/tools${this.getUrlParams(
|
|
73
|
+
args
|
|
74
|
+
)}`;
|
|
71
75
|
return await this.get(url);
|
|
72
|
-
}
|
|
76
|
+
};
|
|
73
77
|
|
|
74
78
|
const create = async (sponsorId, data) => {
|
|
75
79
|
const url = `${this.getUrl()}/${sponsorId}/tools`;
|
|
76
80
|
return await this.post(url, data);
|
|
77
|
-
}
|
|
81
|
+
};
|
|
78
82
|
|
|
79
83
|
return {
|
|
80
84
|
get,
|
|
81
|
-
create
|
|
82
|
-
}
|
|
85
|
+
create,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
treeOrderSummary(args) {
|
|
90
|
+
const all = async (sponsorId) => {
|
|
91
|
+
const url = `${this.getUrl()}/${sponsorId}/tree-order-summary${this.getUrlParams(
|
|
92
|
+
args
|
|
93
|
+
)}`;
|
|
94
|
+
|
|
95
|
+
return await this.get(url);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
all,
|
|
100
|
+
};
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
103
|
|
|
@@ -8,6 +8,13 @@ class StandardsApi extends Api {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
themes() {
|
|
11
|
+
const single = async (id, args) => {
|
|
12
|
+
const url = `${this.getUrl()}/themes/${id}?${createParamsStringFromArgs(
|
|
13
|
+
args
|
|
14
|
+
)}`;
|
|
15
|
+
return await this.get(url);
|
|
16
|
+
};
|
|
17
|
+
|
|
11
18
|
const all = async (args) => {
|
|
12
19
|
const url = `${this.getUrl()}/themes?${createParamsStringFromArgs(args)}`;
|
|
13
20
|
return await this.get(url);
|
|
@@ -61,22 +68,22 @@ class StandardsApi extends Api {
|
|
|
61
68
|
|
|
62
69
|
const UNSDGs = (themeId) => {
|
|
63
70
|
const create = async (data) => {
|
|
64
|
-
console.log('this.getUrl:', this.getUrl())
|
|
65
71
|
const url = `${this.getUrl()}/themes/${themeId}/attach-sdg`;
|
|
66
72
|
return await this.post(url, data);
|
|
67
73
|
};
|
|
68
74
|
return {
|
|
69
|
-
create
|
|
75
|
+
create,
|
|
70
76
|
};
|
|
71
77
|
};
|
|
72
78
|
|
|
73
79
|
return {
|
|
80
|
+
single,
|
|
74
81
|
all,
|
|
75
82
|
create,
|
|
76
83
|
update,
|
|
77
84
|
delete: remove,
|
|
78
85
|
goals,
|
|
79
|
-
UNSDGs
|
|
86
|
+
UNSDGs,
|
|
80
87
|
};
|
|
81
88
|
}
|
|
82
89
|
|
|
@@ -125,14 +132,14 @@ class StandardsApi extends Api {
|
|
|
125
132
|
delete: remove,
|
|
126
133
|
};
|
|
127
134
|
}
|
|
128
|
-
UNSDGs(themeId){
|
|
135
|
+
UNSDGs(themeId) {
|
|
129
136
|
const attach = async (data) => {
|
|
130
137
|
const url = `${this.getUrl()}/themes/${themeId}/attach-sdg`;
|
|
131
|
-
return await this.update(url,{
|
|
138
|
+
return await this.update(url, { sdg_id: data });
|
|
132
139
|
};
|
|
133
140
|
|
|
134
141
|
return {
|
|
135
|
-
attach
|
|
142
|
+
attach,
|
|
136
143
|
};
|
|
137
144
|
}
|
|
138
145
|
}
|