zudello-integration-sdk 1.0.2 → 1.0.4
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
|
@@ -15,16 +15,19 @@ class UniversalModule {
|
|
|
15
15
|
* @param {string} method Method of request.
|
|
16
16
|
* @param {object} qs Some available filters inside: offset, limit.
|
|
17
17
|
* @param {object} body Some available data inside.
|
|
18
|
+
* @param {boolean} appendLimit Append limit & offset to URL.
|
|
18
19
|
* @returns {object} Universal Request Response.
|
|
19
20
|
*/
|
|
20
|
-
async request ({ url, method, qs = {}, body = {} }) {
|
|
21
|
+
async request ({ url, method, qs = {}, body = {}, appendLimit = false }) {
|
|
21
22
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method })
|
|
22
23
|
|
|
23
24
|
if (!validateIsEmpty.valid) {
|
|
24
25
|
return this.module.responseHandler.error(validateIsEmpty.errors)
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
if (appendLimit) {
|
|
29
|
+
url = `${url}?limit=${qs.limit}&offset=${qs.offset}`
|
|
30
|
+
}
|
|
28
31
|
|
|
29
32
|
return await this.module.makeRequest('GET', `${this.module.apiURL}/zintegrations/action/41a68068-6812-4634-a464-aab17d6b2358`, {
|
|
30
33
|
mappable_parameters: {
|
|
@@ -63,7 +66,8 @@ class UniversalModule {
|
|
|
63
66
|
},
|
|
64
67
|
body: {
|
|
65
68
|
q: query
|
|
66
|
-
}
|
|
69
|
+
},
|
|
70
|
+
appendLimit: true
|
|
67
71
|
})
|
|
68
72
|
}
|
|
69
73
|
|
package/src/utils/logger.js
CHANGED
package/src/utils/metadata.js
CHANGED
|
@@ -45,7 +45,7 @@ class Metadata {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Retrieves all metadata and global metadata.
|
|
48
|
-
*
|
|
48
|
+
*
|
|
49
49
|
* @returns {Object} An object containing both metadata and globalMetadata arrays.
|
|
50
50
|
*/
|
|
51
51
|
getAll() {
|
|
@@ -55,6 +55,17 @@ class Metadata {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Metadata setter.
|
|
60
|
+
*
|
|
61
|
+
* @param {array} metadata Metadata
|
|
62
|
+
* @param {array} globalMetadata Global Metadata
|
|
63
|
+
*/
|
|
64
|
+
setAll(metadata = [], globalMetadata = []) {
|
|
65
|
+
this.metadata = metadata
|
|
66
|
+
this.globalMetadata = globalMetadata
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* Sets the value for a specified key in either metadata or global metadata.
|
|
60
71
|
*
|