@veritree/services 2.30.1 → 2.30.2

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.30.1",
3
+ "version": "2.30.2",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -17,8 +17,8 @@ class PasswordApi extends Api {
17
17
  * Sends a recovery password email to the specified email address.
18
18
  *
19
19
  * @param {Object} data - An object containing the following properties:
20
- * @param {string} data.email - The email address to send the recovery email to.
21
- * @param {string} [data.return_url] - The URL to redirect the user to after they reset their password.
20
+ * @param {string} data.email - The email address to send the recovery email to.
21
+ * @param {string} [data.return_url] - The URL to redirect the user to after they reset their password.
22
22
  * @returns {Promise<boolean>} - A Promise that resolves to a boolean indicating whether the email was sent successfully.
23
23
  */
24
24
  const post = async (data) => {
@@ -75,6 +75,36 @@ class PlantingSitesApi extends Api {
75
75
  all,
76
76
  };
77
77
  }
78
+
79
+ evidence(subsiteId, params) {
80
+ let url = `${this.getUrl()}/${subsiteId}/evidence`;
81
+
82
+ console.log(url);
83
+
84
+ const all = async () => {
85
+ url = `${url}${this.getUrlParams(params)}`;
86
+ return await this.get(url);
87
+ };
88
+
89
+ const attach = async (formData) => {
90
+ url = `${url}${this.getUrlParams(params)}`;
91
+ return await this.post(url, formData);
92
+ };
93
+
94
+ const remove = async (evidenceType, evidenceId) => {
95
+ url = `${url}/${evidenceType}/${evidenceId}${this.getUrlParams(
96
+ params
97
+ )}`;
98
+
99
+ return await this.post(url, null, "delete");
100
+ };
101
+
102
+ return {
103
+ all,
104
+ attach,
105
+ delete: remove,
106
+ };
107
+ }
78
108
  }
79
109
 
80
110
  export const PlantingSites = new PlantingSitesApi();