zudello-integration-sdk 1.0.12 → 1.0.14

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": "zudello-integration-sdk",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -165,28 +165,6 @@ class ZudelloSDK extends BaseSDK {
165
165
  return await axios.get(response.data);
166
166
  }
167
167
 
168
- async ai({ key, model, messages }) {
169
- const validateIsEmpty = this.validator.isEmpty({ key, model, messages });
170
-
171
- if (!validateIsEmpty.valid) {
172
- return this.responseHandler.error(validateIsEmpty.errors);
173
- }
174
-
175
- return await axios.post(
176
- "https://openrouter.ai/api/v1/chat/completions",
177
- {
178
- model,
179
- messages,
180
- },
181
- {
182
- headers: {
183
- Authorization: `Bearer ${key}`,
184
- "Content-Type": "application/json",
185
- },
186
- }
187
- );
188
- }
189
-
190
168
  async update({
191
169
  model,
192
170
  module = null,
@@ -15,32 +15,48 @@ class UniversalModule {
15
15
  * @param {string} method Method of request.
16
16
  * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
17
17
  * @param {object} body Some available data inside.
18
+ * @param {string} apiProvider API Provider.
19
+ * @param {string} apiGroup API Group.
18
20
  * @returns {object} Universal Request Response.
19
21
  */
20
- async request ({ url, method, qs = {}, body = {} }) {
22
+ async request ({ url, method, qs = {}, body = {}, apiProvider = null, apiGroup = null }) {
21
23
  const validateIsEmpty = this.module.validator.isEmpty({ url, method })
22
24
 
23
25
  if (!validateIsEmpty.valid) {
24
26
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
27
  }
26
28
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/0d7314b0-a105-49b0-b8d4-09844c91cc0c`, {
28
- mappable_parameters: {
29
- url: {
30
- value: url
31
- },
32
- method: {
33
- value: method
34
- },
35
- qs: {
36
- isMap: true,
37
- value: JSON.stringify(qs)
38
- },
39
- body: {
40
- isMap: true,
41
- value: JSON.stringify(body)
42
- }
29
+ const mappableParams = {
30
+ url: {
31
+ value: url
32
+ },
33
+ method: {
34
+ value: method
35
+ },
36
+ qs: {
37
+ isMap: true,
38
+ value: JSON.stringify(qs)
39
+ },
40
+ body: {
41
+ isMap: true,
42
+ value: JSON.stringify(body)
43
43
  }
44
+ }
45
+
46
+ if (apiProvider) {
47
+ mappableParams.apiProvider = {
48
+ value: apiProvider
49
+ }
50
+ }
51
+
52
+ if (apiGroup) {
53
+ mappableParams.apiGroup = {
54
+ value: apiGroup
55
+ }
56
+ }
57
+
58
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/0d7314b0-a105-49b0-b8d4-09844c91cc0c`, {
59
+ mappable_parameters: mappableParams
44
60
  })
45
61
  }
46
62
 
@@ -49,9 +65,11 @@ class UniversalModule {
49
65
  * @param {string} url URL of listed data.
50
66
  * @param {string} method Method of listed data.
51
67
  * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
68
+ * @param {string} apiProvider API Provider.
69
+ * @param {string} apiGroup API Group.
52
70
  * @returns {object} Universal List Response.
53
71
  */
54
- async list ({ url, method, qs = {} }) {
72
+ async list ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
55
73
  const validateIsEmpty = this.module.validator.isEmpty({ url, method })
56
74
 
57
75
  if (!validateIsEmpty.valid) {
@@ -66,7 +84,7 @@ class UniversalModule {
66
84
  qs.$top = 100
67
85
  }
68
86
 
69
- return await this.request({ url, method, qs })
87
+ return await this.request({ url, method, qs, apiProvider, apiGroup })
70
88
  }
71
89
 
72
90
  /**
@@ -74,9 +92,11 @@ class UniversalModule {
74
92
  * @param {string} url URL of listed data.
75
93
  * @param {string} method Method of listed data.
76
94
  * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
95
+ * @param {string} apiProvider API Provider.
96
+ * @param {string} apiGroup API Group.
77
97
  * @returns {object} Auto Pagination responses.
78
98
  */
79
- async * autoPaginationList ({ url, method, qs = {} }) {
99
+ async * autoPaginationList ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
80
100
  if (!qs.$skip) {
81
101
  qs.$skip = 0
82
102
  }
@@ -85,7 +105,7 @@ class UniversalModule {
85
105
  qs.$top = 100
86
106
  }
87
107
 
88
- let response = await this.list({ url, method, qs })
108
+ let response = await this.list({ url, method, qs, apiProvider, apiGroup })
89
109
  let currentPageCount = response?.data?.value?.length
90
110
  let currentOffset = qs.$skip
91
111
 
@@ -97,7 +117,7 @@ class UniversalModule {
97
117
 
98
118
  qs.$skip = currentOffset
99
119
 
100
- response = await this.list({ url, method, qs })
120
+ response = await this.list({ url, method, qs, apiProvider, apiGroup })
101
121
  currentPageCount = response?.data?.value?.length
102
122
 
103
123
  yield response
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/c0292290-24f9-419a-b319-d0de76e479a5`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/c0292290-24f9-419a-b319-d0de76e479a5`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/80ff022b-6789-48d9-9a2c-25ecd6f19545`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/80ff022b-6789-48d9-9a2c-25ecd6f19545`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -18,7 +18,7 @@ class ApBillModule {
18
18
  * @returns {object} Create AP Bill Response.
19
19
  */
20
20
  async create ({ ...fields }) {
21
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/afed01d9-d8f4-44ff-b736-d45e2d3aaa48`, {
21
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/afed01d9-d8f4-44ff-b736-d45e2d3aaa48`, {
22
22
  mappable_parameters: {
23
23
  debug: {
24
24
  value: false
@@ -18,7 +18,7 @@ class PoDocumentModule {
18
18
  * @returns {object} Create PO Document Response.
19
19
  */
20
20
  async create ({ ...fields }) {
21
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/48dad8d8-cbc4-41a0-a006-5fd3e76e0273`, {
21
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/48dad8d8-cbc4-41a0-a006-5fd3e76e0273`, {
22
22
  mappable_parameters: {
23
23
  debug: {
24
24
  value: false
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/107c52fc-0404-4768-8d0d-deb7a348b8a3`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/107c52fc-0404-4768-8d0d-deb7a348b8a3`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -24,7 +24,7 @@ class ODataModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/fd070d22-ec9e-4d85-82ab-6645d7fd4326`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/fd070d22-ec9e-4d85-82ab-6645d7fd4326`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -25,7 +25,7 @@ class UniversalModule {
25
25
  }
26
26
 
27
27
  return await this.module.makeRequest(
28
- "GET",
28
+ "POST",
29
29
  `${this.module.apiURL}/zintegrations/action/5f752f97-03f9-4893-8245-7d03cf217e37`,
30
30
  {
31
31
  mappable_parameters: {
@@ -123,7 +123,7 @@ class UniversalModule {
123
123
  }
124
124
 
125
125
  return await this.module.makeRequest(
126
- "GET",
126
+ "POST",
127
127
  `${this.module.apiURL}/zintegrations/action/086840ce-942c-44ee-b2dd-ca66e5dd7b02`,
128
128
  {
129
129
  mappable_parameters: {
@@ -29,7 +29,7 @@ class UniversalModule {
29
29
  url = `${url}?limit=${qs.limit}&offset=${qs.offset}`
30
30
  }
31
31
 
32
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/41a68068-6812-4634-a464-aab17d6b2358`, {
32
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/41a68068-6812-4634-a464-aab17d6b2358`, {
33
33
  mappable_parameters: {
34
34
  url: {
35
35
  value: url
@@ -17,7 +17,7 @@ class PurchaseOrderModule {
17
17
  * @returns {object} Response.
18
18
  */
19
19
  async create ({ body, memo, customForm }) {
20
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/23509d2d-47dd-4aa3-b8ab-a0057c5d3a0d`, {
20
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/23509d2d-47dd-4aa3-b8ab-a0057c5d3a0d`, {
21
21
  mappable_parameters: {
22
22
  debug: {
23
23
  value: false
@@ -17,7 +17,7 @@ class ReceiptModule {
17
17
  * @returns {object} Response.
18
18
  */
19
19
  async create ({ body, memo, customForm }) {
20
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/76c5863a-4c54-47f7-a4a9-42edfac82300`, {
20
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/76c5863a-4c54-47f7-a4a9-42edfac82300`, {
21
21
  mappable_parameters: {
22
22
  debug: {
23
23
  value: false
@@ -59,7 +59,7 @@ class UniversalModule {
59
59
  return this.module.responseHandler.error(validateIncludes.errors)
60
60
  }
61
61
 
62
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/0491e05e-8f35-4422-a037-8490de1c37b4`, {
62
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/0491e05e-8f35-4422-a037-8490de1c37b4`, {
63
63
  mappable_parameters: {
64
64
  type: {
65
65
  isMap: false,
@@ -73,7 +73,7 @@ class UniversalTransactionModule {
73
73
  return this.module.responseHandler.error(validateIncludes.errors)
74
74
  }
75
75
 
76
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/c0682187-6d05-4ccf-9a43-1250ca867588`, {
76
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/c0682187-6d05-4ccf-9a43-1250ca867588`, {
77
77
  mappable_parameters: {
78
78
  type: {
79
79
  isMap: false,
@@ -17,7 +17,7 @@ class VendorCreditModule {
17
17
  * @returns {object} Response.
18
18
  */
19
19
  async create ({ body, memo, customForm }) {
20
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/cdb6be5c-1137-425e-a162-76cfdbc8e65b`, {
20
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/cdb6be5c-1137-425e-a162-76cfdbc8e65b`, {
21
21
  mappable_parameters: {
22
22
  debug: {
23
23
  value: false
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/33b775b3-0ef4-4ed7-bc16-5a3396f26a7a`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/33b775b3-0ef4-4ed7-bc16-5a3396f26a7a`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/ae4efc7a-b6ba-4093-8e06-fa9d846e4e29`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/ae4efc7a-b6ba-4093-8e06-fa9d846e4e29`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/37e52a1d-aa46-4f9c-9931-bd651e5081f2`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/37e52a1d-aa46-4f9c-9931-bd651e5081f2`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url
@@ -24,7 +24,7 @@ class UniversalModule {
24
24
  return this.module.responseHandler.error(validateIsEmpty.errors)
25
25
  }
26
26
 
27
- return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/699323d6-1f13-4748-a539-0c45b7fa6a84`, {
27
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/699323d6-1f13-4748-a539-0c45b7fa6a84`, {
28
28
  mappable_parameters: {
29
29
  url: {
30
30
  value: url