totalum-api-sdk 1.0.5 → 1.0.6
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/index.js +19 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -57,19 +57,23 @@ class TotalumApiSdk {
|
|
|
57
57
|
this.authOptions = authOptions;
|
|
58
58
|
if ((_a = this.authOptions.token) === null || _a === void 0 ? void 0 : _a.accessToken) {
|
|
59
59
|
this.headers = {
|
|
60
|
-
authorization:
|
|
60
|
+
authorization: this.authOptions.token.accessToken
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
else if (((_b = this.authOptions.apiKey) === null || _b === void 0 ? void 0 : _b.apiKey) && ((_c = this.authOptions.apiKey) === null || _c === void 0 ? void 0 : _c.organizationId)) {
|
|
64
64
|
this.headers = {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
'api-key': this.authOptions.apiKey.apiKey,
|
|
66
|
+
'organization-id': this.authOptions.apiKey.organizationId,
|
|
67
|
+
'api-key-name': this.authOptions.apiKey.apiKeyName
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
else {
|
|
70
71
|
throw new Error('Error: invalid auth options');
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
changeBaseUrl(newBaseUrl) {
|
|
75
|
+
this.baseUrl = newBaseUrl;
|
|
76
|
+
}
|
|
73
77
|
getUrl(pattern, params) {
|
|
74
78
|
let url = this.baseUrl + pattern;
|
|
75
79
|
for (const key in params) {
|
|
@@ -102,5 +106,17 @@ class TotalumApiSdk {
|
|
|
102
106
|
return axios_1.default.post(url, item, { headers: this.headers });
|
|
103
107
|
});
|
|
104
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param customMongoFilter an string with the mongo filter query
|
|
112
|
+
* @param rootTypeId an string with the id of the element that we make the aggregation query
|
|
113
|
+
* @param typeIdToGet the id of the type that we want to get
|
|
114
|
+
* @param options
|
|
115
|
+
* @param returnCount
|
|
116
|
+
*/
|
|
117
|
+
customMongoFilter(customMongoFilter, rootTypeId, typeIdToGet, options, returnCount) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
});
|
|
120
|
+
}
|
|
105
121
|
}
|
|
106
122
|
exports.TotalumApiSdk = TotalumApiSdk;
|