@veritree/services 2.57.0 → 2.59.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/tree-codes.js +53 -27
package/package.json
CHANGED
|
@@ -29,57 +29,83 @@ class TreeCodesApi extends Api {
|
|
|
29
29
|
* @returns {object} - An object with a method 'all' that, when called, fetches all campaign data.
|
|
30
30
|
*/
|
|
31
31
|
campaigns(orgType, orgPublicId, params) {
|
|
32
|
-
const url = this._constructFetchUrl(
|
|
33
|
-
orgType,
|
|
34
|
-
orgPublicId,
|
|
35
|
-
"campaigns",
|
|
36
|
-
params
|
|
37
|
-
);
|
|
38
|
-
|
|
39
32
|
/**
|
|
40
33
|
* Fetches campaign data
|
|
41
34
|
*/
|
|
42
35
|
const all = async () => {
|
|
36
|
+
const url = this._constructFetchUrl(
|
|
37
|
+
orgType,
|
|
38
|
+
orgPublicId,
|
|
39
|
+
"campaigns",
|
|
40
|
+
params
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return await this.get(url);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const create = async (data) => {
|
|
47
|
+
const url = this._constructFetchUrl(
|
|
48
|
+
orgType,
|
|
49
|
+
orgPublicId,
|
|
50
|
+
"campaigns",
|
|
51
|
+
params
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return await this.post(url, data);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const single = async (id) => {
|
|
58
|
+
const url = `${this.getUrl()}/campaigns/${id}`;
|
|
59
|
+
|
|
43
60
|
return await this.get(url);
|
|
44
|
-
}
|
|
61
|
+
};
|
|
45
62
|
|
|
46
63
|
return {
|
|
47
64
|
all,
|
|
65
|
+
create,
|
|
66
|
+
single,
|
|
48
67
|
};
|
|
49
68
|
}
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
* @param {string} orgType - The shortened identifier for the organization type (o, s, r).
|
|
53
|
-
* @param {string} orgPublicId - The public identifier of the organization.
|
|
54
|
-
* @param {Object} params - Additional parameters for the API request.
|
|
55
|
-
* @returns {Object} An object with a method 'all' to initiate the API request and retrieve recipes based on the provided parameters.
|
|
56
|
-
*/
|
|
57
|
-
recipes(orgType, orgPublicId, params) {
|
|
58
|
-
const url = this._constructFetchUrl(
|
|
59
|
-
orgType,
|
|
60
|
-
orgPublicId,
|
|
61
|
-
"recipes",
|
|
62
|
-
params
|
|
63
|
-
);
|
|
64
|
-
|
|
70
|
+
recipes() {
|
|
65
71
|
/**
|
|
66
72
|
* Fetches recipes data
|
|
73
|
+
* @param {string} orgType - The shortened identifier for the organization type (o, s, r).
|
|
74
|
+
* @param {string} orgPublicId - The public identifier of the organization.
|
|
75
|
+
* @param {Object} params - Additional parameters for the API request.
|
|
76
|
+
* @returns {Object} An object with a method 'all' to initiate the API request and retrieve recipes based on the provided parameters.
|
|
67
77
|
*/
|
|
68
|
-
const all = async () => {
|
|
78
|
+
const all = async (orgType, orgPublicId, params) => {
|
|
79
|
+
const url = this._constructFetchUrl(
|
|
80
|
+
orgType,
|
|
81
|
+
orgPublicId,
|
|
82
|
+
"recipes",
|
|
83
|
+
params
|
|
84
|
+
);
|
|
85
|
+
|
|
69
86
|
return await this.get(url);
|
|
70
|
-
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const single = async (id, params) => {
|
|
90
|
+
const url = `${this.getUrl()}/recipes/${id}${this.getUrlParams(params)}`;
|
|
91
|
+
|
|
92
|
+
return await this.get(url);
|
|
93
|
+
};
|
|
71
94
|
|
|
72
95
|
return {
|
|
73
96
|
all,
|
|
97
|
+
single,
|
|
74
98
|
};
|
|
75
99
|
}
|
|
76
100
|
|
|
77
|
-
ingredients(
|
|
78
|
-
const url = `${this.getUrl()}/recipes/${
|
|
101
|
+
ingredients(recipeId, params) {
|
|
102
|
+
const url = `${this.getUrl()}/recipes/${recipeId}/ingredients${this.getUrlParams(
|
|
103
|
+
params
|
|
104
|
+
)}`;
|
|
79
105
|
|
|
80
106
|
const all = async () => {
|
|
81
107
|
return await this.get(url);
|
|
82
|
-
}
|
|
108
|
+
};
|
|
83
109
|
|
|
84
110
|
return {
|
|
85
111
|
all,
|