drapcode-developer-sdk 1.0.10-dev → 1.0.11

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/README.md CHANGED
@@ -12,7 +12,11 @@ npm install drapcode-developer-sdk
12
12
 
13
13
  ```typescript
14
14
  import { DrapcodeApis } from "drapcode-developer-sdk";
15
+ ```
16
+
17
+ If using version 1:
15
18
 
19
+ ```typescript
16
20
  const api = new DrapcodeApis(
17
21
  project_seo_name,
18
22
  xApiKey,
@@ -21,6 +25,13 @@ const api = new DrapcodeApis(
21
25
  );
22
26
  ```
23
27
 
28
+ If using version 2:
29
+
30
+ ```typescript
31
+ const opts = { xApiKey: "", authorization: "", environment, version: 2 };
32
+ const api = new DrapcodeApis(project_seo_name, opts);
33
+ ```
34
+
24
35
  **project_seo_name (Required):** The SEO name of your Drapcode project.
25
36
 
26
37
  **xApiKey (Optional)**: Your Developer API key to authorize API calls, if enabled.
@@ -29,10 +40,31 @@ const api = new DrapcodeApis(
29
40
 
30
41
  **environment (Optional)**: The environment (PRODUCTION, PREVIEW, SANDBOX, UAT). Defaults to PRODUCTION if not provided.
31
42
 
43
+ **version (Optional, default version is 1)**: This is used to decide which version you want to use.
44
+
32
45
  ### Example:
33
46
 
47
+ If using version 1:
48
+
49
+ ```typescript
50
+ V1: const drapcodeApi = new DrapcodeApis(
51
+ "test-project-7138",
52
+ xApiKey,
53
+ authorization,
54
+ environment
55
+ );
34
56
  ```
35
- const drapcodeApi = new DrapcodeApis("test-project-7138",xApiKey, authorization, environment);
57
+
58
+ If using version 2:
59
+
60
+ ```typescript
61
+ V2: const opts = {
62
+ xApiKey: "xApiKey",
63
+ authorization: "authorization",
64
+ environment: "environment",
65
+ version: 2,
66
+ };
67
+ const drapcodeApi = new DrapcodeApis("test-project-7138", opts);
36
68
  ```
37
69
 
38
70
  # Methods
@@ -49,6 +81,14 @@ Retrieves all items from a specified collection. The items will come under 'data
49
81
  const items = await drapcodeApi.getAllItems("users");
50
82
  ```
51
83
 
84
+ ### In version 2, we have info methods
85
+
86
+ ```typescript
87
+ info();
88
+ ```
89
+
90
+ This will return an object with all the information which you have provided.
91
+
52
92
  Retrieves items from the "users" collection.
53
93
 
54
94
  ## Pagination and Search
package/build/index.d.ts CHANGED
@@ -1,106 +1,48 @@
1
1
  import { Query, SearchPaginate } from "./utils/constants";
2
+ export declare enum Environment {
3
+ PRODUCTION = "PRODUCTION",
4
+ PREVIEW = "PREVIEW",
5
+ BETA = "BETA",
6
+ ALPHA = "ALPHA"
7
+ }
8
+ export interface DrapcodeApiOptions {
9
+ xApiKey?: string;
10
+ authorization?: string;
11
+ environment?: Environment | keyof typeof Environment | string;
12
+ builderKey?: string;
13
+ version?: number;
14
+ }
2
15
  export declare class DrapcodeApis {
3
- private project_seo_name;
4
- private xApiKey;
5
- private authorization;
16
+ private seoName;
17
+ private xApiKey?;
18
+ private authorization?;
6
19
  private environment;
20
+ private builderKey?;
7
21
  private API_PATH;
8
- private builderKey;
22
+ private version?;
9
23
  private protocol;
10
- constructor(project_seo_name: string, xApiKey?: string, authorization?: string, environment?: string, builderKey?: string);
24
+ constructor(projectSeoName: string, opts?: DrapcodeApiOptions);
25
+ setProjectSeoName(seo_name: string): void;
26
+ getProjectSeoName(): string;
27
+ setXApiKey(apiKey: string): void;
28
+ getXApiKey(): string | undefined;
29
+ setAuthorization(authorization: string): void;
30
+ getAuthorization(): string | undefined;
31
+ setEnvironment(env: string): void;
32
+ getEnvironment(): string | undefined;
33
+ setBuilderKey(builderKey: string): void;
34
+ getBuilderKey(): string | undefined;
35
+ setVersion(version: number): void;
36
+ getVersion(): number | undefined;
37
+ info(): any;
38
+ private getEnvSubdomain;
11
39
  getBaseUrl(): string;
12
40
  getHeaders(): Record<string, string>;
13
- getAllItems(collectionName: string, reqQuery?: SearchPaginate | any, query?: Query[] | []): Promise<{
14
- code: any;
15
- success: boolean;
16
- data: any;
17
- error: string;
18
- message: string;
19
- } | {
20
- code: any;
21
- success: boolean;
22
- data: string;
23
- error: any;
24
- message: string;
25
- } | {
26
- code: any;
27
- success: boolean;
28
- error: any;
29
- message: any;
30
- data: string;
31
- totalItems?: undefined;
32
- totalPages?: undefined;
33
- } | {
34
- code: number;
35
- error: any;
36
- message: any;
37
- }>;
38
- createItem(collectionName: string, body: any): Promise<{
39
- code: any;
40
- success: boolean;
41
- data: any;
42
- error: string;
43
- message: string;
44
- } | {
45
- code: any;
46
- success: boolean;
47
- data: string;
48
- error: any;
49
- message: string;
50
- } | {
51
- code: number;
52
- error: any;
53
- message: any;
54
- } | undefined>;
55
- getItemsWithFilter(collectionName: string, filterUuid: string): Promise<{
56
- code: any;
57
- success: boolean;
58
- error: any;
59
- message: any;
60
- data: string;
61
- totalItems?: undefined;
62
- totalPages?: undefined;
63
- } | {
64
- code: number;
65
- success: boolean;
66
- error: string;
67
- message: string;
68
- data: any;
69
- totalItems: any;
70
- totalPages: any;
71
- } | {
72
- code: number;
73
- error: any;
74
- message: any;
75
- }>;
41
+ private callApi;
42
+ getAllItems(collectionName: string, reqQuery?: SearchPaginate | any, query?: Query[] | []): Promise<unknown>;
43
+ createItem(collectionName: string, body: any): Promise<any>;
44
+ getItemsWithFilter(collectionName: string, filterUuid: string): Promise<any>;
76
45
  getItemsCountWithFilter(collectionName: string, filterUuid: string): Promise<{
77
- code: any;
78
- success: boolean;
79
- error: any;
80
- message: any;
81
- data: string;
82
- totalItems?: undefined;
83
- totalPages?: undefined;
84
- } | {
85
- code: number;
86
- success: boolean;
87
- error: string;
88
- message: string;
89
- data: any;
90
- totalItems: any;
91
- totalPages: any;
92
- } | {
93
- code: number;
94
- error: any;
95
- message: any;
96
- }>;
97
- getItemWithUuid(collectionName: string, itemUuid: string): Promise<any>;
98
- getItemOnly(collectionName: string, itemUuid: string): Promise<any>;
99
- countItemByValue(collectionName: string, fieldName: string, fieldValue: any): Promise<any>;
100
- saveCSVData(collectionName: string, items: any[]): Promise<any>;
101
- validateItem(collectionName: string, item: any): Promise<any>;
102
- lastItem(collectionName: string): Promise<any>;
103
- updateItemWithUuid(collectionName: string, itemUuid: string, body: any): Promise<{
104
46
  code: any;
105
47
  success: boolean;
106
48
  data: any;
@@ -114,129 +56,40 @@ export declare class DrapcodeApis {
114
56
  message: string;
115
57
  } | {
116
58
  code: any;
117
- success: boolean;
118
- error: any;
119
- message: any;
120
- data: string;
121
- totalItems?: undefined;
122
- totalPages?: undefined;
123
- } | {
124
- code: number;
125
- error: any;
126
- message: any;
127
- }>;
128
- clearItem(collectionName: string): Promise<{
129
- code: any;
130
- success: boolean;
131
- data: any;
132
- error: string;
133
- message: string;
134
- } | {
135
- code: number;
136
- error: any;
137
- message: any;
138
- success?: undefined;
139
- data?: undefined;
140
- }>;
141
- deleteFieldItem(collectionName: string, fieldName: string): Promise<{
142
- code: any;
143
- success: boolean;
144
59
  data: any;
60
+ count: any;
145
61
  error: string;
62
+ status: string;
146
63
  message: string;
147
64
  } | {
148
- code: number;
149
- error: any;
150
- message: any;
151
- success?: undefined;
152
- data?: undefined;
153
- }>;
154
- deleteItemWithUuid(collectionName: string, itemUuid: string): Promise<{
155
65
  code: any;
156
- success: boolean;
157
- error: any;
158
- message: any;
159
- data: string;
160
- totalItems?: undefined;
161
- totalPages?: undefined;
162
- } | {
163
- code: number;
164
- success: boolean;
165
- error: string;
166
- message: string;
167
- data: any;
168
- totalItems: any;
169
- totalPages: any;
170
- } | {
171
- code: number;
172
- error: any;
173
- message: any;
174
- }>;
175
- bulkDeleteItems(collectionName: string, body: any): Promise<{
176
- success: boolean;
177
- data: any;
178
- error: string;
179
- message: string;
180
- code?: undefined;
181
- } | {
182
- code: number;
183
- error: any;
184
- message: any;
185
- success?: undefined;
186
- data?: undefined;
187
- }>;
188
- removeReferenceItem(collectionName: string, body: any): Promise<{
189
- success: boolean;
190
- data: any;
191
- error: string;
192
- message: string;
193
- code?: undefined;
194
- } | {
195
- code: number;
196
- error: any;
197
- message: any;
198
- success?: undefined;
199
- data?: undefined;
200
- }>;
201
- addReferenceItem(collectionName: string, body: any): Promise<{
202
- success: boolean;
203
- data: any;
204
- error: string;
205
- message: string;
206
- code?: undefined;
207
- } | {
208
- code: number;
66
+ data: never[];
67
+ count: number;
209
68
  error: any;
69
+ status: string;
210
70
  message: any;
211
- success?: undefined;
212
- data?: undefined;
213
- }>;
214
- getItemsByids(collectionName: string, body: any): Promise<{
215
- success: boolean;
216
- data: any;
217
- error: string;
218
- message: string;
219
- code?: undefined;
220
71
  } | {
221
72
  code: number;
222
73
  error: any;
223
- message: any;
224
- success?: undefined;
225
- data?: undefined;
226
- }>;
227
- sendEmail(templateId: string, sendTo: string): Promise<{
228
- success: boolean;
229
- data: any;
230
- error: string;
231
- message: string;
232
- code?: undefined;
233
- } | {
234
- code: number;
235
- error: any;
236
- message: any;
237
- success?: undefined;
238
- data?: undefined;
74
+ data: never[];
75
+ count: number;
76
+ status: string;
239
77
  }>;
78
+ getItemWithUuid(collectionName: string, itemUuid: string): Promise<any>;
79
+ getItemOnly(collectionName: string, itemUuid: string): Promise<unknown>;
80
+ countItemByValue(collectionName: string, fieldName: string, fieldValue: any): Promise<unknown>;
81
+ saveCSVData(collectionName: string, items: any[]): Promise<unknown>;
82
+ validateItem(collectionName: string, item: any): Promise<unknown>;
83
+ lastItem(collectionName: string): Promise<unknown>;
84
+ updateItemWithUuid(collectionName: string, itemUuid: string, body: any): Promise<unknown>;
85
+ clearItem(collectionName: string): Promise<unknown>;
86
+ deleteFieldItem(collectionName: string, fieldName: string): Promise<unknown>;
87
+ deleteItemWithUuid(collectionName: string, itemUuid: string): Promise<unknown>;
88
+ bulkDeleteItems(collectionName: string, body: any): Promise<unknown>;
89
+ removeReferenceItem(collectionName: string, body: any): Promise<unknown>;
90
+ addReferenceItem(collectionName: string, body: any): Promise<unknown>;
91
+ getItemsByids(collectionName: string, body: any): Promise<unknown>;
92
+ sendEmail(templateId: string, sendTo: string): Promise<unknown>;
240
93
  }
241
94
  export * from "./utils/index";
242
95
  export * from "./utils/crypt";
package/build/index.js CHANGED
@@ -49,37 +49,115 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
50
  }
51
51
  };
52
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
53
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
54
+ if (ar || !(i in from)) {
55
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
56
+ ar[i] = from[i];
57
+ }
58
+ }
59
+ return to.concat(ar || Array.prototype.slice.call(from));
60
+ };
52
61
  Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.DrapcodeApis = void 0;
62
+ exports.DrapcodeApis = exports.Environment = void 0;
54
63
  var methods_1 = require("./methods/methods");
64
+ var Environment;
65
+ (function (Environment) {
66
+ Environment["PRODUCTION"] = "PRODUCTION";
67
+ Environment["PREVIEW"] = "PREVIEW";
68
+ Environment["BETA"] = "BETA";
69
+ Environment["ALPHA"] = "ALPHA";
70
+ })(Environment = exports.Environment || (exports.Environment = {}));
55
71
  var DrapcodeApis = /** @class */ (function () {
56
- // private protocol = "http";
57
- function DrapcodeApis(project_seo_name, xApiKey, authorization, environment, builderKey) {
58
- if (xApiKey === void 0) { xApiKey = ""; }
59
- if (authorization === void 0) { authorization = ""; }
60
- if (environment === void 0) { environment = "PRODUCTION"; }
61
- if (builderKey === void 0) { builderKey = ""; }
62
- this.API_PATH = "drapcode.io/api/v1/developer";
72
+ // private protocol: string = "http";
73
+ function DrapcodeApis(projectSeoName, opts) {
74
+ if (opts === void 0) { opts = {}; }
75
+ var _a;
76
+ //Network/URL Related
77
+ this.API_PATH = "drapcode.io/api";
78
+ // private API_PATH = "webkonnect.site/api";
79
+ // private API_PATH = "prodeless.com:5002/api";
80
+ this.version = 1;
63
81
  this.protocol = "https";
64
- this.project_seo_name = project_seo_name;
65
- this.xApiKey = xApiKey;
82
+ this.seoName = projectSeoName;
83
+ this.xApiKey = opts.xApiKey;
84
+ this.authorization = opts.authorization;
85
+ this.environment =
86
+ (_a = opts.environment) !== null && _a !== void 0 ? _a : Environment.PRODUCTION;
87
+ this.builderKey = opts.builderKey;
88
+ this.version = opts.version;
89
+ }
90
+ DrapcodeApis.prototype.setProjectSeoName = function (seo_name) {
91
+ this.seoName = seo_name;
92
+ };
93
+ DrapcodeApis.prototype.getProjectSeoName = function () {
94
+ return this.seoName;
95
+ };
96
+ DrapcodeApis.prototype.setXApiKey = function (apiKey) {
97
+ this.xApiKey = apiKey;
98
+ };
99
+ DrapcodeApis.prototype.getXApiKey = function () {
100
+ return this.xApiKey;
101
+ };
102
+ DrapcodeApis.prototype.setAuthorization = function (authorization) {
66
103
  this.authorization = authorization;
67
- this.environment = environment;
104
+ };
105
+ DrapcodeApis.prototype.getAuthorization = function () {
106
+ return this.authorization;
107
+ };
108
+ DrapcodeApis.prototype.setEnvironment = function (env) {
109
+ this.environment = env;
110
+ };
111
+ DrapcodeApis.prototype.getEnvironment = function () {
112
+ return this.environment;
113
+ };
114
+ DrapcodeApis.prototype.setBuilderKey = function (builderKey) {
68
115
  this.builderKey = builderKey;
69
- }
70
- DrapcodeApis.prototype.getBaseUrl = function () {
71
- switch (this.environment.toUpperCase()) {
72
- case "PRODUCTION":
73
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.").concat(this.API_PATH);
74
- case "PREVIEW":
75
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.preview.").concat(this.API_PATH);
76
- case "BETA":
77
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.sandbox.").concat(this.API_PATH);
78
- case "ALPHA":
79
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.uat.").concat(this.API_PATH);
116
+ };
117
+ DrapcodeApis.prototype.getBuilderKey = function () {
118
+ return this.builderKey;
119
+ };
120
+ DrapcodeApis.prototype.setVersion = function (version) {
121
+ this.version = version;
122
+ };
123
+ DrapcodeApis.prototype.getVersion = function () {
124
+ return this.version;
125
+ };
126
+ DrapcodeApis.prototype.info = function () {
127
+ // private protocol :string= "https"
128
+ return {
129
+ seoName: this.seoName,
130
+ xApiKey: this.xApiKey,
131
+ authorization: this.authorization,
132
+ environment: this.environment,
133
+ builderKey: this.builderKey,
134
+ api: this.API_PATH,
135
+ version: this.version,
136
+ protocol: this.protocol,
137
+ headers: this.getHeaders(),
138
+ url: this.getBaseUrl(),
139
+ };
140
+ };
141
+ DrapcodeApis.prototype.getEnvSubdomain = function () {
142
+ var env = String(this.environment).toUpperCase();
143
+ switch (env) {
144
+ case Environment.PREVIEW:
145
+ return "preview";
146
+ case Environment.BETA:
147
+ return "sandbox";
148
+ case Environment.ALPHA:
149
+ return "uat";
150
+ case Environment.PRODUCTION:
80
151
  default:
81
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.").concat(this.API_PATH);
152
+ return ""; // no extra subdomain for prod
153
+ }
154
+ };
155
+ DrapcodeApis.prototype.getBaseUrl = function () {
156
+ var envSub = this.getEnvSubdomain();
157
+ if (envSub) {
158
+ return "".concat(this.protocol, "://").concat(this.seoName, ".api.").concat(envSub, ".").concat(this.API_PATH, "/v").concat(this.version, "/developer");
82
159
  }
160
+ return "".concat(this.protocol, "://").concat(this.seoName, ".api.").concat(this.API_PATH, "/v").concat(this.version, "/developer");
83
161
  };
84
162
  DrapcodeApis.prototype.getHeaders = function () {
85
163
  var headers = {
@@ -93,142 +171,156 @@ var DrapcodeApis = /** @class */ (function () {
93
171
  headers["Authorization"] = this.authorization;
94
172
  }
95
173
  if (this.builderKey) {
96
- headers["BuilderKey"] = this.builderKey;
174
+ headers["builder-key"] = this.builderKey;
97
175
  }
98
176
  return headers;
99
177
  };
178
+ DrapcodeApis.prototype.callApi = function (fn, name) {
179
+ var args = [];
180
+ for (var _i = 2; _i < arguments.length; _i++) {
181
+ args[_i - 2] = arguments[_i];
182
+ }
183
+ return __awaiter(this, void 0, void 0, function () {
184
+ return __generator(this, function (_a) {
185
+ return [2 /*return*/, fn.apply(void 0, __spreadArray([this.getBaseUrl(),
186
+ this.getHeaders(),
187
+ this.getVersion() || 2,
188
+ name], args, false))];
189
+ });
190
+ });
191
+ };
100
192
  DrapcodeApis.prototype.getAllItems = function (collectionName, reqQuery, query) {
101
193
  if (reqQuery === void 0) { reqQuery = null; }
102
194
  if (query === void 0) { query = []; }
103
195
  return __awaiter(this, void 0, void 0, function () {
104
196
  return __generator(this, function (_a) {
105
- return [2 /*return*/, (0, methods_1.getAllItems)(this.getBaseUrl(), this.getHeaders(), collectionName, reqQuery, query)];
197
+ return [2 /*return*/, this.callApi(methods_1.getAllItems, collectionName, reqQuery, query)];
106
198
  });
107
199
  });
108
200
  };
109
201
  DrapcodeApis.prototype.createItem = function (collectionName, body) {
110
202
  return __awaiter(this, void 0, void 0, function () {
111
203
  return __generator(this, function (_a) {
112
- return [2 /*return*/, (0, methods_1.createItem)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
204
+ return [2 /*return*/, this.callApi(methods_1.createItem, collectionName, body)];
113
205
  });
114
206
  });
115
207
  };
116
208
  DrapcodeApis.prototype.getItemsWithFilter = function (collectionName, filterUuid) {
117
209
  return __awaiter(this, void 0, void 0, function () {
118
210
  return __generator(this, function (_a) {
119
- return [2 /*return*/, (0, methods_1.getItemsWithFilter)(this.getBaseUrl(), this.getHeaders(), collectionName, filterUuid)];
211
+ return [2 /*return*/, this.callApi(methods_1.getItemsWithFilter, collectionName, filterUuid)];
120
212
  });
121
213
  });
122
214
  };
123
215
  DrapcodeApis.prototype.getItemsCountWithFilter = function (collectionName, filterUuid) {
124
216
  return __awaiter(this, void 0, void 0, function () {
125
217
  return __generator(this, function (_a) {
126
- return [2 /*return*/, (0, methods_1.getItemsCountWithFilter)(this.getBaseUrl(), this.getHeaders(), collectionName, filterUuid)];
218
+ return [2 /*return*/, this.callApi(methods_1.getItemsCountWithFilter, collectionName, filterUuid)];
127
219
  });
128
220
  });
129
221
  };
130
222
  DrapcodeApis.prototype.getItemWithUuid = function (collectionName, itemUuid) {
131
223
  return __awaiter(this, void 0, void 0, function () {
132
224
  return __generator(this, function (_a) {
133
- return [2 /*return*/, (0, methods_1.getItemWithUuid)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
225
+ return [2 /*return*/, this.callApi(methods_1.getItemWithUuid, collectionName, itemUuid)];
134
226
  });
135
227
  });
136
228
  };
137
229
  DrapcodeApis.prototype.getItemOnly = function (collectionName, itemUuid) {
138
230
  return __awaiter(this, void 0, void 0, function () {
139
231
  return __generator(this, function (_a) {
140
- return [2 /*return*/, (0, methods_1.getItemOnly)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
232
+ return [2 /*return*/, this.callApi(methods_1.getItemOnly, collectionName, itemUuid)];
141
233
  });
142
234
  });
143
235
  };
144
236
  DrapcodeApis.prototype.countItemByValue = function (collectionName, fieldName, fieldValue) {
145
237
  return __awaiter(this, void 0, void 0, function () {
146
238
  return __generator(this, function (_a) {
147
- return [2 /*return*/, (0, methods_1.countItemByValue)(this.getBaseUrl(), this.getHeaders(), collectionName, fieldName, fieldValue)];
239
+ return [2 /*return*/, this.callApi(methods_1.countItemByValue, collectionName, fieldName, fieldValue)];
148
240
  });
149
241
  });
150
242
  };
151
243
  DrapcodeApis.prototype.saveCSVData = function (collectionName, items) {
152
244
  return __awaiter(this, void 0, void 0, function () {
153
245
  return __generator(this, function (_a) {
154
- return [2 /*return*/, (0, methods_1.saveCSVData)(this.getBaseUrl(), this.getHeaders(), collectionName, items)];
246
+ return [2 /*return*/, this.callApi(methods_1.saveCSVData, collectionName, items)];
155
247
  });
156
248
  });
157
249
  };
158
250
  DrapcodeApis.prototype.validateItem = function (collectionName, item) {
159
251
  return __awaiter(this, void 0, void 0, function () {
160
252
  return __generator(this, function (_a) {
161
- return [2 /*return*/, (0, methods_1.validateItem)(this.getBaseUrl(), this.getHeaders(), collectionName, item)];
253
+ return [2 /*return*/, this.callApi(methods_1.validateItem, collectionName, item)];
162
254
  });
163
255
  });
164
256
  };
165
257
  DrapcodeApis.prototype.lastItem = function (collectionName) {
166
258
  return __awaiter(this, void 0, void 0, function () {
167
259
  return __generator(this, function (_a) {
168
- return [2 /*return*/, (0, methods_1.lastItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
260
+ return [2 /*return*/, this.callApi(methods_1.lastItem, collectionName)];
169
261
  });
170
262
  });
171
263
  };
172
264
  DrapcodeApis.prototype.updateItemWithUuid = function (collectionName, itemUuid, body) {
173
265
  return __awaiter(this, void 0, void 0, function () {
174
266
  return __generator(this, function (_a) {
175
- return [2 /*return*/, (0, methods_1.updateItemWithUuid)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid, body)];
267
+ return [2 /*return*/, this.callApi(methods_1.updateItemWithUuid, collectionName, itemUuid, body)];
176
268
  });
177
269
  });
178
270
  };
179
271
  DrapcodeApis.prototype.clearItem = function (collectionName) {
180
272
  return __awaiter(this, void 0, void 0, function () {
181
273
  return __generator(this, function (_a) {
182
- return [2 /*return*/, (0, methods_1.clearItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
274
+ return [2 /*return*/, this.callApi(methods_1.clearItem, collectionName)];
183
275
  });
184
276
  });
185
277
  };
186
278
  DrapcodeApis.prototype.deleteFieldItem = function (collectionName, fieldName) {
187
279
  return __awaiter(this, void 0, void 0, function () {
188
280
  return __generator(this, function (_a) {
189
- return [2 /*return*/, (0, methods_1.deleteFieldItem)(this.getBaseUrl(), this.getHeaders(), collectionName, fieldName)];
281
+ return [2 /*return*/, this.callApi(methods_1.deleteFieldItem, collectionName, fieldName)];
190
282
  });
191
283
  });
192
284
  };
193
285
  DrapcodeApis.prototype.deleteItemWithUuid = function (collectionName, itemUuid) {
194
286
  return __awaiter(this, void 0, void 0, function () {
195
287
  return __generator(this, function (_a) {
196
- return [2 /*return*/, (0, methods_1.deleteItemWithUuid)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
288
+ return [2 /*return*/, this.callApi(methods_1.deleteItemWithUuid, collectionName, itemUuid)];
197
289
  });
198
290
  });
199
291
  };
200
292
  DrapcodeApis.prototype.bulkDeleteItems = function (collectionName, body) {
201
293
  return __awaiter(this, void 0, void 0, function () {
202
294
  return __generator(this, function (_a) {
203
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
295
+ return [2 /*return*/, this.callApi(methods_1.bulkDeleteItems, collectionName, body)];
204
296
  });
205
297
  });
206
298
  };
207
299
  DrapcodeApis.prototype.removeReferenceItem = function (collectionName, body) {
208
300
  return __awaiter(this, void 0, void 0, function () {
209
301
  return __generator(this, function (_a) {
210
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
302
+ return [2 /*return*/, this.callApi(methods_1.removeReferenceItem, collectionName, body)];
211
303
  });
212
304
  });
213
305
  };
214
306
  DrapcodeApis.prototype.addReferenceItem = function (collectionName, body) {
215
307
  return __awaiter(this, void 0, void 0, function () {
216
308
  return __generator(this, function (_a) {
217
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
309
+ return [2 /*return*/, this.callApi(methods_1.addReferenceItem, collectionName, body)];
218
310
  });
219
311
  });
220
312
  };
221
313
  DrapcodeApis.prototype.getItemsByids = function (collectionName, body) {
222
314
  return __awaiter(this, void 0, void 0, function () {
223
315
  return __generator(this, function (_a) {
224
- return [2 /*return*/, (0, methods_1.getItemsByids)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
316
+ return [2 /*return*/, this.callApi(methods_1.getItemsByids, collectionName, body)];
225
317
  });
226
318
  });
227
319
  };
228
320
  DrapcodeApis.prototype.sendEmail = function (templateId, sendTo) {
229
321
  return __awaiter(this, void 0, void 0, function () {
230
322
  return __generator(this, function (_a) {
231
- return [2 /*return*/, (0, methods_1.sendEmail)(this.getBaseUrl(), this.getHeaders(), templateId, sendTo)];
323
+ return [2 /*return*/, this.callApi(methods_1.sendEmail, templateId, sendTo)];
232
324
  });
233
325
  });
234
326
  };