@veritree/services 2.58.0 → 2.59.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.58.0",
3
+ "version": "2.59.1",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -29,62 +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
43
  return await this.get(url);
44
- }
44
+ };
45
45
 
46
46
  const create = async (data) => {
47
+ const url = this._constructFetchUrl(
48
+ orgType,
49
+ orgPublicId,
50
+ "campaigns",
51
+ params
52
+ );
53
+
47
54
  return await this.post(url, data);
48
- }
55
+ };
56
+
57
+ const single = async (id, params) => {
58
+ const url = `${this.getUrl()}/campaigns/${id}${this.getUrlParams(params)}`;
59
+
60
+ return await this.get(url);
61
+ };
49
62
 
50
63
  return {
51
64
  all,
52
- create
65
+ create,
66
+ single,
53
67
  };
54
68
  }
55
69
 
56
- /**
57
- * @param {string} orgType - The shortened identifier for the organization type (o, s, r).
58
- * @param {string} orgPublicId - The public identifier of the organization.
59
- * @param {Object} params - Additional parameters for the API request.
60
- * @returns {Object} An object with a method 'all' to initiate the API request and retrieve recipes based on the provided parameters.
61
- */
62
- recipes(orgType, orgPublicId, params) {
63
- const url = this._constructFetchUrl(
64
- orgType,
65
- orgPublicId,
66
- "recipes",
67
- params
68
- );
69
-
70
+ recipes() {
70
71
  /**
71
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.
72
77
  */
73
- 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
+
74
86
  return await this.get(url);
75
- }
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
+ };
76
94
 
77
95
  return {
78
96
  all,
97
+ single,
79
98
  };
80
99
  }
81
100
 
82
- ingredients(recipePubliId, params) {
83
- const url = `${this.getUrl()}/recipes/${recipePubliId}/ingredients${this.getUrlParams(params)}`;
101
+ ingredients(recipeId, params) {
102
+ const url = `${this.getUrl()}/recipes/${recipeId}/ingredients${this.getUrlParams(
103
+ params
104
+ )}`;
84
105
 
85
106
  const all = async () => {
86
107
  return await this.get(url);
87
- }
108
+ };
88
109
 
89
110
  return {
90
111
  all,