drapcode-developer-sdk 1.0.9-dev → 1.0.10

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,39 +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
- function DrapcodeApis(project_seo_name, xApiKey, authorization, environment, builderKey) {
57
- if (xApiKey === void 0) { xApiKey = ""; }
58
- if (authorization === void 0) { authorization = ""; }
59
- if (environment === void 0) { environment = "PRODUCTION"; }
60
- if (builderKey === void 0) { builderKey = ""; }
61
- // private API_PATH = "drapcode.io/api/v1/developer";
62
- // private API_PATH = "webkonnect.site/api/v1/developer";
63
- this.API_PATH = "prodeless.com:5002/api/v1/developer";
64
- // private protocol = "https";
65
- this.protocol = "http";
66
- this.project_seo_name = project_seo_name;
67
- this.xApiKey = xApiKey;
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;
81
+ this.protocol = "https";
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) {
68
103
  this.authorization = authorization;
69
- 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) {
70
115
  this.builderKey = builderKey;
71
- }
72
- DrapcodeApis.prototype.getBaseUrl = function () {
73
- switch (this.environment.toUpperCase()) {
74
- case "PRODUCTION":
75
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.").concat(this.API_PATH);
76
- case "PREVIEW":
77
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.preview.").concat(this.API_PATH);
78
- case "BETA":
79
- return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.sandbox.").concat(this.API_PATH);
80
- case "ALPHA":
81
- 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:
82
151
  default:
83
- 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");
84
159
  }
160
+ return "".concat(this.protocol, "://").concat(this.seoName, ".api.").concat(this.API_PATH, "/v").concat(this.version, "/developer");
85
161
  };
86
162
  DrapcodeApis.prototype.getHeaders = function () {
87
163
  var headers = {
@@ -99,138 +175,152 @@ var DrapcodeApis = /** @class */ (function () {
99
175
  }
100
176
  return headers;
101
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
+ };
102
192
  DrapcodeApis.prototype.getAllItems = function (collectionName, reqQuery, query) {
103
193
  if (reqQuery === void 0) { reqQuery = null; }
104
194
  if (query === void 0) { query = []; }
105
195
  return __awaiter(this, void 0, void 0, function () {
106
196
  return __generator(this, function (_a) {
107
- 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)];
108
198
  });
109
199
  });
110
200
  };
111
201
  DrapcodeApis.prototype.createItem = function (collectionName, body) {
112
202
  return __awaiter(this, void 0, void 0, function () {
113
203
  return __generator(this, function (_a) {
114
- return [2 /*return*/, (0, methods_1.createItem)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
204
+ return [2 /*return*/, this.callApi(methods_1.createItem, collectionName, body)];
115
205
  });
116
206
  });
117
207
  };
118
208
  DrapcodeApis.prototype.getItemsWithFilter = function (collectionName, filterUuid) {
119
209
  return __awaiter(this, void 0, void 0, function () {
120
210
  return __generator(this, function (_a) {
121
- return [2 /*return*/, (0, methods_1.getItemsWithFilter)(this.getBaseUrl(), this.getHeaders(), collectionName, filterUuid)];
211
+ return [2 /*return*/, this.callApi(methods_1.getItemsWithFilter, collectionName, filterUuid)];
122
212
  });
123
213
  });
124
214
  };
125
215
  DrapcodeApis.prototype.getItemsCountWithFilter = function (collectionName, filterUuid) {
126
216
  return __awaiter(this, void 0, void 0, function () {
127
217
  return __generator(this, function (_a) {
128
- return [2 /*return*/, (0, methods_1.getItemsCountWithFilter)(this.getBaseUrl(), this.getHeaders(), collectionName, filterUuid)];
218
+ return [2 /*return*/, this.callApi(methods_1.getItemsCountWithFilter, collectionName, filterUuid)];
129
219
  });
130
220
  });
131
221
  };
132
222
  DrapcodeApis.prototype.getItemWithUuid = function (collectionName, itemUuid) {
133
223
  return __awaiter(this, void 0, void 0, function () {
134
224
  return __generator(this, function (_a) {
135
- return [2 /*return*/, (0, methods_1.getItemWithUuid)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
225
+ return [2 /*return*/, this.callApi(methods_1.getItemWithUuid, collectionName, itemUuid)];
136
226
  });
137
227
  });
138
228
  };
139
229
  DrapcodeApis.prototype.getItemOnly = function (collectionName, itemUuid) {
140
230
  return __awaiter(this, void 0, void 0, function () {
141
231
  return __generator(this, function (_a) {
142
- return [2 /*return*/, (0, methods_1.getItemOnly)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
232
+ return [2 /*return*/, this.callApi(methods_1.getItemOnly, collectionName, itemUuid)];
143
233
  });
144
234
  });
145
235
  };
146
236
  DrapcodeApis.prototype.countItemByValue = function (collectionName, fieldName, fieldValue) {
147
237
  return __awaiter(this, void 0, void 0, function () {
148
238
  return __generator(this, function (_a) {
149
- 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)];
150
240
  });
151
241
  });
152
242
  };
153
243
  DrapcodeApis.prototype.saveCSVData = function (collectionName, items) {
154
244
  return __awaiter(this, void 0, void 0, function () {
155
245
  return __generator(this, function (_a) {
156
- return [2 /*return*/, (0, methods_1.saveCSVData)(this.getBaseUrl(), this.getHeaders(), collectionName, items)];
246
+ return [2 /*return*/, this.callApi(methods_1.saveCSVData, collectionName, items)];
157
247
  });
158
248
  });
159
249
  };
160
250
  DrapcodeApis.prototype.validateItem = function (collectionName, item) {
161
251
  return __awaiter(this, void 0, void 0, function () {
162
252
  return __generator(this, function (_a) {
163
- return [2 /*return*/, (0, methods_1.validateItem)(this.getBaseUrl(), this.getHeaders(), collectionName, item)];
253
+ return [2 /*return*/, this.callApi(methods_1.validateItem, collectionName, item)];
164
254
  });
165
255
  });
166
256
  };
167
257
  DrapcodeApis.prototype.lastItem = function (collectionName) {
168
258
  return __awaiter(this, void 0, void 0, function () {
169
259
  return __generator(this, function (_a) {
170
- return [2 /*return*/, (0, methods_1.lastItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
260
+ return [2 /*return*/, this.callApi(methods_1.lastItem, collectionName)];
171
261
  });
172
262
  });
173
263
  };
174
264
  DrapcodeApis.prototype.updateItemWithUuid = function (collectionName, itemUuid, body) {
175
265
  return __awaiter(this, void 0, void 0, function () {
176
266
  return __generator(this, function (_a) {
177
- 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)];
178
268
  });
179
269
  });
180
270
  };
181
271
  DrapcodeApis.prototype.clearItem = function (collectionName) {
182
272
  return __awaiter(this, void 0, void 0, function () {
183
273
  return __generator(this, function (_a) {
184
- return [2 /*return*/, (0, methods_1.clearItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
274
+ return [2 /*return*/, this.callApi(methods_1.clearItem, collectionName)];
185
275
  });
186
276
  });
187
277
  };
188
278
  DrapcodeApis.prototype.deleteFieldItem = function (collectionName, fieldName) {
189
279
  return __awaiter(this, void 0, void 0, function () {
190
280
  return __generator(this, function (_a) {
191
- return [2 /*return*/, (0, methods_1.deleteFieldItem)(this.getBaseUrl(), this.getHeaders(), collectionName, fieldName)];
281
+ return [2 /*return*/, this.callApi(methods_1.deleteFieldItem, collectionName, fieldName)];
192
282
  });
193
283
  });
194
284
  };
195
285
  DrapcodeApis.prototype.deleteItemWithUuid = function (collectionName, itemUuid) {
196
286
  return __awaiter(this, void 0, void 0, function () {
197
287
  return __generator(this, function (_a) {
198
- return [2 /*return*/, (0, methods_1.deleteItemWithUuid)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
288
+ return [2 /*return*/, this.callApi(methods_1.deleteItemWithUuid, collectionName, itemUuid)];
199
289
  });
200
290
  });
201
291
  };
202
292
  DrapcodeApis.prototype.bulkDeleteItems = function (collectionName, body) {
203
293
  return __awaiter(this, void 0, void 0, function () {
204
294
  return __generator(this, function (_a) {
205
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
295
+ return [2 /*return*/, this.callApi(methods_1.bulkDeleteItems, collectionName, body)];
206
296
  });
207
297
  });
208
298
  };
209
299
  DrapcodeApis.prototype.removeReferenceItem = function (collectionName, body) {
210
300
  return __awaiter(this, void 0, void 0, function () {
211
301
  return __generator(this, function (_a) {
212
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
302
+ return [2 /*return*/, this.callApi(methods_1.removeReferenceItem, collectionName, body)];
213
303
  });
214
304
  });
215
305
  };
216
306
  DrapcodeApis.prototype.addReferenceItem = function (collectionName, body) {
217
307
  return __awaiter(this, void 0, void 0, function () {
218
308
  return __generator(this, function (_a) {
219
- return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
309
+ return [2 /*return*/, this.callApi(methods_1.addReferenceItem, collectionName, body)];
220
310
  });
221
311
  });
222
312
  };
223
313
  DrapcodeApis.prototype.getItemsByids = function (collectionName, body) {
224
314
  return __awaiter(this, void 0, void 0, function () {
225
315
  return __generator(this, function (_a) {
226
- return [2 /*return*/, (0, methods_1.getItemsByids)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
316
+ return [2 /*return*/, this.callApi(methods_1.getItemsByids, collectionName, body)];
227
317
  });
228
318
  });
229
319
  };
230
320
  DrapcodeApis.prototype.sendEmail = function (templateId, sendTo) {
231
321
  return __awaiter(this, void 0, void 0, function () {
232
322
  return __generator(this, function (_a) {
233
- return [2 /*return*/, (0, methods_1.sendEmail)(this.getBaseUrl(), this.getHeaders(), templateId, sendTo)];
323
+ return [2 /*return*/, this.callApi(methods_1.sendEmail, templateId, sendTo)];
234
324
  });
235
325
  });
236
326
  };