@veritree/services 2.71.0 → 2.72.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.71.0",
3
+ "version": "2.72.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -48,8 +48,14 @@ class RegionsApi extends Api {
48
48
  return await this.get(url);
49
49
  };
50
50
 
51
+ const single = async (id) => {
52
+ const url = `${this.getUrl()}/public/${id}${this.getUrlParams(args)}`;
53
+ return await this.get(url);
54
+ }
55
+
51
56
  return {
52
57
  all,
58
+ single
53
59
  };
54
60
  }
55
61
 
@@ -1,5 +1,22 @@
1
1
  import Api from '../helpers/api';
2
2
 
3
- const resource = 'subdomains';
3
+ class SubdomainsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "subdomains";
7
+ }
4
8
 
5
- export const Subdomains = new Api(resource);
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();
@@ -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} url
159
- * @param {object} data
160
- * @param {string} as - 'put' // necessary for updates because of how Laravel handles PUT requests
161
- * @returns {promise}
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)}`;