@veritree/services 2.70.0 → 2.71.1
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/resellers.js +25 -3
- package/src/endpoints/subdomains.js +19 -2
- package/src/helpers/api.js +7 -4
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class ResellersApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'resellers';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
statsSold() {
|
|
@@ -13,7 +13,7 @@ class ResellersApi extends Api {
|
|
|
13
13
|
try {
|
|
14
14
|
response = await this.get(url);
|
|
15
15
|
} catch (e) {
|
|
16
|
-
console.log(
|
|
16
|
+
console.log('error ', e);
|
|
17
17
|
}
|
|
18
18
|
return response;
|
|
19
19
|
};
|
|
@@ -89,6 +89,28 @@ class ResellersApi extends Api {
|
|
|
89
89
|
all,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fetches all planting parter organizations for the specified reseller.
|
|
95
|
+
*
|
|
96
|
+
* @param {string} resellerId - The unique identifier of the reseller.
|
|
97
|
+
* @param {Object} params - Additional parameters for customizing the request.
|
|
98
|
+
* @returns {Promise} A promise that resolves to the organizations data.
|
|
99
|
+
* @memberof Resellers
|
|
100
|
+
*/
|
|
101
|
+
organizations(resellerId) {
|
|
102
|
+
const all = async (params) => {
|
|
103
|
+
const url = `${this.getUrl()}/${resellerId}/organizations${this.getUrlParams(
|
|
104
|
+
params
|
|
105
|
+
)}`;
|
|
106
|
+
|
|
107
|
+
return await this.get(url);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
all,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
92
114
|
}
|
|
93
115
|
|
|
94
116
|
export const Resellers = new ResellersApi();
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class SubdomainsApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = "subdomains";
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Toggles the active status of a subdomain.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} orgId - The ID of the organization.
|
|
13
|
+
* @param {string} subdomainId - The ID of the subdomain.
|
|
14
|
+
* @returns {Promise} A promise that resolves with the response data.
|
|
15
|
+
*/
|
|
16
|
+
toggle(orgId, subdomainId) {
|
|
17
|
+
const url = `${this.baseUrl}/sponsors/${orgId}/subdomains/${subdomainId}/toggle-active-status`;
|
|
18
|
+
return this.post(url, null, 'patch');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Subdomains = new SubdomainsApi();
|
package/src/helpers/api.js
CHANGED
|
@@ -153,12 +153,15 @@ export default class Api {
|
|
|
153
153
|
return await this.post(null, data, null, args);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
|
|
156
157
|
/**
|
|
158
|
+
* Updates a resource with the specified ID.
|
|
157
159
|
*
|
|
158
|
-
* @param {string}
|
|
159
|
-
* @param {object} data
|
|
160
|
-
* @param {string} as
|
|
161
|
-
* @
|
|
160
|
+
* @param {string} id - The ID of the resource to update.
|
|
161
|
+
* @param {object} data - The data to update the resource with.
|
|
162
|
+
* @param {string} [as='put'] - The HTTP method to use for the update request. Defaults to 'put'.
|
|
163
|
+
* @param {object} args - Additional arguments for the update request.
|
|
164
|
+
* @returns {Promise<any>} - A promise that resolves to the response from the update request.
|
|
162
165
|
*/
|
|
163
166
|
async update(id, data, as = 'put', args) {
|
|
164
167
|
const url = `${this.getUrl(id)}${this.getUrlParams(args)}`;
|