tuix-email-service-client 0.0.1

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.
Files changed (82) hide show
  1. package/.openapi-generator/FILES +37 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +48 -0
  5. package/apis/ClientApi.js +684 -0
  6. package/apis/ClientApi.js.map +1 -0
  7. package/apis/ClientApi.ts +1037 -0
  8. package/apis/index.js +20 -0
  9. package/apis/index.js.map +1 -0
  10. package/apis/index.ts +3 -0
  11. package/docs/APIKeyDTO.md +40 -0
  12. package/docs/AccountDTO.md +34 -0
  13. package/docs/ApplicationDTO.md +42 -0
  14. package/docs/ApplicationWithApplicationCountDTO.md +44 -0
  15. package/docs/ClientApi.md +1235 -0
  16. package/docs/CreateAPIKeyRequestDTO.md +34 -0
  17. package/docs/CreateAPIKeyResponseDTO.md +42 -0
  18. package/docs/CreateAccountDTO.md +36 -0
  19. package/docs/CreateApplicationDTO.md +36 -0
  20. package/docs/EmailTemplateDTO.md +42 -0
  21. package/docs/ErrorDTO.md +34 -0
  22. package/docs/GetAPIKeysResponseDTO.md +42 -0
  23. package/docs/PaginatedApplicationsDTO.md +42 -0
  24. package/docs/PaginatedEmailTemplateDTO.md +42 -0
  25. package/docs/UpdateApplicationDTO.md +36 -0
  26. package/docs/UpdateEmailTemplateDTO.md +42 -0
  27. package/index.js +22 -0
  28. package/index.js.map +1 -0
  29. package/index.ts +5 -0
  30. package/models/APIKeyDTO.js +55 -0
  31. package/models/APIKeyDTO.js.map +1 -0
  32. package/models/APIKeyDTO.ts +89 -0
  33. package/models/AccountDTO.js +49 -0
  34. package/models/AccountDTO.js.map +1 -0
  35. package/models/AccountDTO.ts +65 -0
  36. package/models/ApplicationDTO.js +57 -0
  37. package/models/ApplicationDTO.js.map +1 -0
  38. package/models/ApplicationDTO.ts +97 -0
  39. package/models/ApplicationWithApplicationCountDTO.js +59 -0
  40. package/models/ApplicationWithApplicationCountDTO.js.map +1 -0
  41. package/models/ApplicationWithApplicationCountDTO.ts +105 -0
  42. package/models/CreateAPIKeyRequestDTO.js +51 -0
  43. package/models/CreateAPIKeyRequestDTO.js.map +1 -0
  44. package/models/CreateAPIKeyRequestDTO.ts +66 -0
  45. package/models/CreateAPIKeyResponseDTO.js +57 -0
  46. package/models/CreateAPIKeyResponseDTO.js.map +1 -0
  47. package/models/CreateAPIKeyResponseDTO.ts +97 -0
  48. package/models/CreateAccountDTO.js +55 -0
  49. package/models/CreateAccountDTO.js.map +1 -0
  50. package/models/CreateAccountDTO.ts +75 -0
  51. package/models/CreateApplicationDTO.js +55 -0
  52. package/models/CreateApplicationDTO.js.map +1 -0
  53. package/models/CreateApplicationDTO.ts +75 -0
  54. package/models/EmailTemplateDTO.js +57 -0
  55. package/models/EmailTemplateDTO.js.map +1 -0
  56. package/models/EmailTemplateDTO.ts +97 -0
  57. package/models/ErrorDTO.js +49 -0
  58. package/models/ErrorDTO.js.map +1 -0
  59. package/models/ErrorDTO.ts +65 -0
  60. package/models/GetAPIKeysResponseDTO.js +58 -0
  61. package/models/GetAPIKeysResponseDTO.js.map +1 -0
  62. package/models/GetAPIKeysResponseDTO.ts +105 -0
  63. package/models/PaginatedApplicationsDTO.js +68 -0
  64. package/models/PaginatedApplicationsDTO.js.map +1 -0
  65. package/models/PaginatedApplicationsDTO.ts +110 -0
  66. package/models/PaginatedEmailTemplateDTO.js +68 -0
  67. package/models/PaginatedEmailTemplateDTO.js.map +1 -0
  68. package/models/PaginatedEmailTemplateDTO.ts +110 -0
  69. package/models/UpdateApplicationDTO.js +51 -0
  70. package/models/UpdateApplicationDTO.js.map +1 -0
  71. package/models/UpdateApplicationDTO.ts +73 -0
  72. package/models/UpdateEmailTemplateDTO.js +57 -0
  73. package/models/UpdateEmailTemplateDTO.js.map +1 -0
  74. package/models/UpdateEmailTemplateDTO.ts +97 -0
  75. package/models/index.js +34 -0
  76. package/models/index.js.map +1 -0
  77. package/models/index.ts +17 -0
  78. package/package.json +17 -0
  79. package/runtime.js +330 -0
  80. package/runtime.js.map +1 -0
  81. package/runtime.ts +432 -0
  82. package/tsconfig.build.tsbuildinfo +1 -0
@@ -0,0 +1,684 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Tuix Email Service
6
+ * Service to manage Tuix Email
7
+ *
8
+ * The version of the OpenAPI document: 0.0.1
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.ClientApi = void 0;
50
+ const runtime = __importStar(require("../runtime"));
51
+ const index_1 = require("../models/index");
52
+ /**
53
+ *
54
+ */
55
+ class ClientApi extends runtime.BaseAPI {
56
+ /**
57
+ * Retrieve all API keys associated with the authenticated user\'s account with pagination.
58
+ * Get all API keys for the authenticated user
59
+ */
60
+ async apiKeysGetRaw(requestParameters, initOverrides) {
61
+ const queryParameters = {};
62
+ if (requestParameters['page'] != null) {
63
+ queryParameters['page'] = requestParameters['page'];
64
+ }
65
+ if (requestParameters['pageSize'] != null) {
66
+ queryParameters['page_size'] = requestParameters['pageSize'];
67
+ }
68
+ const headerParameters = {};
69
+ let urlPath = `/api-keys`;
70
+ const response = await this.request({
71
+ path: urlPath,
72
+ method: 'GET',
73
+ headers: headerParameters,
74
+ query: queryParameters,
75
+ }, initOverrides);
76
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetAPIKeysResponseDTOFromJSON)(jsonValue));
77
+ }
78
+ /**
79
+ * Retrieve all API keys associated with the authenticated user\'s account with pagination.
80
+ * Get all API keys for the authenticated user
81
+ */
82
+ async apiKeysGet(requestParameters = {}, initOverrides) {
83
+ const response = await this.apiKeysGetRaw(requestParameters, initOverrides);
84
+ return await response.value();
85
+ }
86
+ /**
87
+ * Delete a specific API key belonging to the authenticated user.
88
+ * Delete an API key
89
+ */
90
+ async apiKeysIdDeleteRaw(requestParameters, initOverrides) {
91
+ if (requestParameters['id'] == null) {
92
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiKeysIdDelete().');
93
+ }
94
+ const queryParameters = {};
95
+ const headerParameters = {};
96
+ let urlPath = `/api-keys/{id}`;
97
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
98
+ const response = await this.request({
99
+ path: urlPath,
100
+ method: 'DELETE',
101
+ headers: headerParameters,
102
+ query: queryParameters,
103
+ }, initOverrides);
104
+ return new runtime.VoidApiResponse(response);
105
+ }
106
+ /**
107
+ * Delete a specific API key belonging to the authenticated user.
108
+ * Delete an API key
109
+ */
110
+ async apiKeysIdDelete(requestParameters, initOverrides) {
111
+ await this.apiKeysIdDeleteRaw(requestParameters, initOverrides);
112
+ }
113
+ /**
114
+ * Create a new API key for accessing the RAG service.
115
+ * Create a new API key
116
+ */
117
+ async apiKeysPostRaw(requestParameters, initOverrides) {
118
+ if (requestParameters['createAPIKeyRequestDTO'] == null) {
119
+ throw new runtime.RequiredError('createAPIKeyRequestDTO', 'Required parameter "createAPIKeyRequestDTO" was null or undefined when calling apiKeysPost().');
120
+ }
121
+ const queryParameters = {};
122
+ const headerParameters = {};
123
+ headerParameters['Content-Type'] = 'application/json';
124
+ let urlPath = `/api-keys`;
125
+ const response = await this.request({
126
+ path: urlPath,
127
+ method: 'POST',
128
+ headers: headerParameters,
129
+ query: queryParameters,
130
+ body: (0, index_1.CreateAPIKeyRequestDTOToJSON)(requestParameters['createAPIKeyRequestDTO']),
131
+ }, initOverrides);
132
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CreateAPIKeyResponseDTOFromJSON)(jsonValue));
133
+ }
134
+ /**
135
+ * Create a new API key for accessing the RAG service.
136
+ * Create a new API key
137
+ */
138
+ async apiKeysPost(requestParameters, initOverrides) {
139
+ const response = await this.apiKeysPostRaw(requestParameters, initOverrides);
140
+ return await response.value();
141
+ }
142
+ /**
143
+ * Send an email
144
+ * Send an email
145
+ */
146
+ async apiSendEmailRaw(requestParameters, initOverrides) {
147
+ if (requestParameters['applicationId'] == null) {
148
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling apiSendEmail().');
149
+ }
150
+ if (requestParameters['from'] == null) {
151
+ throw new runtime.RequiredError('from', 'Required parameter "from" was null or undefined when calling apiSendEmail().');
152
+ }
153
+ if (requestParameters['subject'] == null) {
154
+ throw new runtime.RequiredError('subject', 'Required parameter "subject" was null or undefined when calling apiSendEmail().');
155
+ }
156
+ if (requestParameters['templateUUID'] == null) {
157
+ throw new runtime.RequiredError('templateUUID', 'Required parameter "templateUUID" was null or undefined when calling apiSendEmail().');
158
+ }
159
+ if (requestParameters['to'] == null) {
160
+ throw new runtime.RequiredError('to', 'Required parameter "to" was null or undefined when calling apiSendEmail().');
161
+ }
162
+ const queryParameters = {};
163
+ const headerParameters = {};
164
+ const consumes = [
165
+ { contentType: 'multipart/form-data' },
166
+ ];
167
+ // @ts-ignore: canConsumeForm may be unused
168
+ const canConsumeForm = runtime.canConsumeForm(consumes);
169
+ let formParams;
170
+ let useForm = false;
171
+ // use FormData to transmit files using content-type "multipart/form-data"
172
+ useForm = canConsumeForm;
173
+ if (useForm) {
174
+ formParams = new FormData();
175
+ }
176
+ else {
177
+ formParams = new URLSearchParams();
178
+ }
179
+ if (requestParameters['body'] != null) {
180
+ formParams.append('body', requestParameters['body']);
181
+ }
182
+ if (requestParameters['data'] != null) {
183
+ formParams.append('data', requestParameters['data']);
184
+ }
185
+ if (requestParameters['file'] != null) {
186
+ formParams.append('file', requestParameters['file']);
187
+ }
188
+ if (requestParameters['from'] != null) {
189
+ formParams.append('from', requestParameters['from']);
190
+ }
191
+ if (requestParameters['subject'] != null) {
192
+ formParams.append('subject', requestParameters['subject']);
193
+ }
194
+ if (requestParameters['templateUUID'] != null) {
195
+ formParams.append('templateUUID', requestParameters['templateUUID']);
196
+ }
197
+ if (requestParameters['to'] != null) {
198
+ formParams.append('to', requestParameters['to']);
199
+ }
200
+ let urlPath = `/api/applications/{applicationId}/emails/send`;
201
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
202
+ const response = await this.request({
203
+ path: urlPath,
204
+ method: 'POST',
205
+ headers: headerParameters,
206
+ query: queryParameters,
207
+ body: formParams,
208
+ }, initOverrides);
209
+ return new runtime.VoidApiResponse(response);
210
+ }
211
+ /**
212
+ * Send an email
213
+ * Send an email
214
+ */
215
+ async apiSendEmail(requestParameters, initOverrides) {
216
+ await this.apiSendEmailRaw(requestParameters, initOverrides);
217
+ }
218
+ /**
219
+ * Create an account
220
+ * Creates a new account
221
+ */
222
+ async createAccountRaw(requestParameters, initOverrides) {
223
+ if (requestParameters['createAccountDTO'] == null) {
224
+ throw new runtime.RequiredError('createAccountDTO', 'Required parameter "createAccountDTO" was null or undefined when calling createAccount().');
225
+ }
226
+ const queryParameters = {};
227
+ const headerParameters = {};
228
+ headerParameters['Content-Type'] = 'application/json';
229
+ let urlPath = `/accounts`;
230
+ const response = await this.request({
231
+ path: urlPath,
232
+ method: 'POST',
233
+ headers: headerParameters,
234
+ query: queryParameters,
235
+ body: (0, index_1.CreateAccountDTOToJSON)(requestParameters['createAccountDTO']),
236
+ }, initOverrides);
237
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AccountDTOFromJSON)(jsonValue));
238
+ }
239
+ /**
240
+ * Create an account
241
+ * Creates a new account
242
+ */
243
+ async createAccount(requestParameters, initOverrides) {
244
+ const response = await this.createAccountRaw(requestParameters, initOverrides);
245
+ return await response.value();
246
+ }
247
+ /**
248
+ * Create a new application for the authenticated account
249
+ * Create a new application
250
+ */
251
+ async createApplicationRaw(requestParameters, initOverrides) {
252
+ if (requestParameters['createApplicationDTO'] == null) {
253
+ throw new runtime.RequiredError('createApplicationDTO', 'Required parameter "createApplicationDTO" was null or undefined when calling createApplication().');
254
+ }
255
+ const queryParameters = {};
256
+ const headerParameters = {};
257
+ headerParameters['Content-Type'] = 'application/json';
258
+ let urlPath = `/applications`;
259
+ const response = await this.request({
260
+ path: urlPath,
261
+ method: 'POST',
262
+ headers: headerParameters,
263
+ query: queryParameters,
264
+ body: (0, index_1.CreateApplicationDTOToJSON)(requestParameters['createApplicationDTO']),
265
+ }, initOverrides);
266
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ApplicationDTOFromJSON)(jsonValue));
267
+ }
268
+ /**
269
+ * Create a new application for the authenticated account
270
+ * Create a new application
271
+ */
272
+ async createApplication(requestParameters, initOverrides) {
273
+ const response = await this.createApplicationRaw(requestParameters, initOverrides);
274
+ return await response.value();
275
+ }
276
+ /**
277
+ * Delete an application belonging to the authenticated account
278
+ * Delete an application
279
+ */
280
+ async deleteApplicationRaw(requestParameters, initOverrides) {
281
+ if (requestParameters['applicationId'] == null) {
282
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling deleteApplication().');
283
+ }
284
+ const queryParameters = {};
285
+ const headerParameters = {};
286
+ let urlPath = `/applications/{applicationId}`;
287
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
288
+ const response = await this.request({
289
+ path: urlPath,
290
+ method: 'DELETE',
291
+ headers: headerParameters,
292
+ query: queryParameters,
293
+ }, initOverrides);
294
+ return new runtime.VoidApiResponse(response);
295
+ }
296
+ /**
297
+ * Delete an application belonging to the authenticated account
298
+ * Delete an application
299
+ */
300
+ async deleteApplication(requestParameters, initOverrides) {
301
+ await this.deleteApplicationRaw(requestParameters, initOverrides);
302
+ }
303
+ /**
304
+ * Delete an template
305
+ * Delete an template
306
+ */
307
+ async deleteTemplateRaw(requestParameters, initOverrides) {
308
+ if (requestParameters['id'] == null) {
309
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteTemplate().');
310
+ }
311
+ if (requestParameters['applicationId'] == null) {
312
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling deleteTemplate().');
313
+ }
314
+ const queryParameters = {};
315
+ const headerParameters = {};
316
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
317
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
318
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
319
+ const response = await this.request({
320
+ path: urlPath,
321
+ method: 'DELETE',
322
+ headers: headerParameters,
323
+ query: queryParameters,
324
+ }, initOverrides);
325
+ return new runtime.VoidApiResponse(response);
326
+ }
327
+ /**
328
+ * Delete an template
329
+ * Delete an template
330
+ */
331
+ async deleteTemplate(requestParameters, initOverrides) {
332
+ await this.deleteTemplateRaw(requestParameters, initOverrides);
333
+ }
334
+ /**
335
+ * Get a specific application belonging to the authenticated account
336
+ * Get an application by applicationId
337
+ */
338
+ async getApplicationByIDRaw(requestParameters, initOverrides) {
339
+ if (requestParameters['applicationId'] == null) {
340
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling getApplicationByID().');
341
+ }
342
+ const queryParameters = {};
343
+ const headerParameters = {};
344
+ let urlPath = `/applications/{applicationId}`;
345
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
346
+ const response = await this.request({
347
+ path: urlPath,
348
+ method: 'GET',
349
+ headers: headerParameters,
350
+ query: queryParameters,
351
+ }, initOverrides);
352
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ApplicationDTOFromJSON)(jsonValue));
353
+ }
354
+ /**
355
+ * Get a specific application belonging to the authenticated account
356
+ * Get an application by applicationId
357
+ */
358
+ async getApplicationByID(requestParameters, initOverrides) {
359
+ const response = await this.getApplicationByIDRaw(requestParameters, initOverrides);
360
+ return await response.value();
361
+ }
362
+ /**
363
+ * Get all applications belonging to the authenticated account
364
+ * Get all applications for the account
365
+ */
366
+ async getApplicationsRaw(requestParameters, initOverrides) {
367
+ const queryParameters = {};
368
+ if (requestParameters['page'] != null) {
369
+ queryParameters['page'] = requestParameters['page'];
370
+ }
371
+ if (requestParameters['pageSize'] != null) {
372
+ queryParameters['pageSize'] = requestParameters['pageSize'];
373
+ }
374
+ const headerParameters = {};
375
+ let urlPath = `/applications`;
376
+ const response = await this.request({
377
+ path: urlPath,
378
+ method: 'GET',
379
+ headers: headerParameters,
380
+ query: queryParameters,
381
+ }, initOverrides);
382
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedApplicationsDTOFromJSON)(jsonValue));
383
+ }
384
+ /**
385
+ * Get all applications belonging to the authenticated account
386
+ * Get all applications for the account
387
+ */
388
+ async getApplications(requestParameters = {}, initOverrides) {
389
+ const response = await this.getApplicationsRaw(requestParameters, initOverrides);
390
+ return await response.value();
391
+ }
392
+ /**
393
+ * Return a template
394
+ * Return a template
395
+ */
396
+ async getTemplateRaw(requestParameters, initOverrides) {
397
+ if (requestParameters['id'] == null) {
398
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getTemplate().');
399
+ }
400
+ if (requestParameters['applicationId'] == null) {
401
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling getTemplate().');
402
+ }
403
+ const queryParameters = {};
404
+ const headerParameters = {};
405
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
406
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
407
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
408
+ const response = await this.request({
409
+ path: urlPath,
410
+ method: 'GET',
411
+ headers: headerParameters,
412
+ query: queryParameters,
413
+ }, initOverrides);
414
+ if (this.isJsonMime(response.headers.get('content-type'))) {
415
+ return new runtime.JSONApiResponse(response);
416
+ }
417
+ else {
418
+ return new runtime.TextApiResponse(response);
419
+ }
420
+ }
421
+ /**
422
+ * Return a template
423
+ * Return a template
424
+ */
425
+ async getTemplate(requestParameters, initOverrides) {
426
+ const response = await this.getTemplateRaw(requestParameters, initOverrides);
427
+ return await response.value();
428
+ }
429
+ /**
430
+ * Return all templates
431
+ * Return all templates
432
+ */
433
+ async getTemplatesRaw(requestParameters, initOverrides) {
434
+ if (requestParameters['applicationId'] == null) {
435
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling getTemplates().');
436
+ }
437
+ const queryParameters = {};
438
+ if (requestParameters['page'] != null) {
439
+ queryParameters['page'] = requestParameters['page'];
440
+ }
441
+ if (requestParameters['pageSize'] != null) {
442
+ queryParameters['pageSize'] = requestParameters['pageSize'];
443
+ }
444
+ const headerParameters = {};
445
+ let urlPath = `/applications/{applicationId}/templates`;
446
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
447
+ const response = await this.request({
448
+ path: urlPath,
449
+ method: 'GET',
450
+ headers: headerParameters,
451
+ query: queryParameters,
452
+ }, initOverrides);
453
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedEmailTemplateDTOFromJSON)(jsonValue));
454
+ }
455
+ /**
456
+ * Return all templates
457
+ * Return all templates
458
+ */
459
+ async getTemplates(requestParameters, initOverrides) {
460
+ const response = await this.getTemplatesRaw(requestParameters, initOverrides);
461
+ return await response.value();
462
+ }
463
+ /**
464
+ * Send an email
465
+ * Send an email
466
+ */
467
+ async sendEmailRaw(requestParameters, initOverrides) {
468
+ if (requestParameters['applicationId'] == null) {
469
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling sendEmail().');
470
+ }
471
+ if (requestParameters['from'] == null) {
472
+ throw new runtime.RequiredError('from', 'Required parameter "from" was null or undefined when calling sendEmail().');
473
+ }
474
+ if (requestParameters['subject'] == null) {
475
+ throw new runtime.RequiredError('subject', 'Required parameter "subject" was null or undefined when calling sendEmail().');
476
+ }
477
+ if (requestParameters['templateUUID'] == null) {
478
+ throw new runtime.RequiredError('templateUUID', 'Required parameter "templateUUID" was null or undefined when calling sendEmail().');
479
+ }
480
+ if (requestParameters['to'] == null) {
481
+ throw new runtime.RequiredError('to', 'Required parameter "to" was null or undefined when calling sendEmail().');
482
+ }
483
+ const queryParameters = {};
484
+ const headerParameters = {};
485
+ const consumes = [
486
+ { contentType: 'multipart/form-data' },
487
+ ];
488
+ // @ts-ignore: canConsumeForm may be unused
489
+ const canConsumeForm = runtime.canConsumeForm(consumes);
490
+ let formParams;
491
+ let useForm = false;
492
+ // use FormData to transmit files using content-type "multipart/form-data"
493
+ useForm = canConsumeForm;
494
+ if (useForm) {
495
+ formParams = new FormData();
496
+ }
497
+ else {
498
+ formParams = new URLSearchParams();
499
+ }
500
+ if (requestParameters['body'] != null) {
501
+ formParams.append('body', requestParameters['body']);
502
+ }
503
+ if (requestParameters['data'] != null) {
504
+ formParams.append('data', requestParameters['data']);
505
+ }
506
+ if (requestParameters['file'] != null) {
507
+ formParams.append('file', requestParameters['file']);
508
+ }
509
+ if (requestParameters['from'] != null) {
510
+ formParams.append('from', requestParameters['from']);
511
+ }
512
+ if (requestParameters['subject'] != null) {
513
+ formParams.append('subject', requestParameters['subject']);
514
+ }
515
+ if (requestParameters['templateUUID'] != null) {
516
+ formParams.append('templateUUID', requestParameters['templateUUID']);
517
+ }
518
+ if (requestParameters['to'] != null) {
519
+ formParams.append('to', requestParameters['to']);
520
+ }
521
+ let urlPath = `/applications/{applicationId}/emails/send`;
522
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
523
+ const response = await this.request({
524
+ path: urlPath,
525
+ method: 'POST',
526
+ headers: headerParameters,
527
+ query: queryParameters,
528
+ body: formParams,
529
+ }, initOverrides);
530
+ return new runtime.VoidApiResponse(response);
531
+ }
532
+ /**
533
+ * Send an email
534
+ * Send an email
535
+ */
536
+ async sendEmail(requestParameters, initOverrides) {
537
+ await this.sendEmailRaw(requestParameters, initOverrides);
538
+ }
539
+ /**
540
+ * Update an application belonging to the authenticated account
541
+ * Update an application
542
+ */
543
+ async updateApplicationRaw(requestParameters, initOverrides) {
544
+ if (requestParameters['applicationId'] == null) {
545
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling updateApplication().');
546
+ }
547
+ if (requestParameters['updateApplicationDTO'] == null) {
548
+ throw new runtime.RequiredError('updateApplicationDTO', 'Required parameter "updateApplicationDTO" was null or undefined when calling updateApplication().');
549
+ }
550
+ const queryParameters = {};
551
+ const headerParameters = {};
552
+ headerParameters['Content-Type'] = 'application/json';
553
+ let urlPath = `/applications/{applicationId}`;
554
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
555
+ const response = await this.request({
556
+ path: urlPath,
557
+ method: 'PATCH',
558
+ headers: headerParameters,
559
+ query: queryParameters,
560
+ body: (0, index_1.UpdateApplicationDTOToJSON)(requestParameters['updateApplicationDTO']),
561
+ }, initOverrides);
562
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ApplicationDTOFromJSON)(jsonValue));
563
+ }
564
+ /**
565
+ * Update an application belonging to the authenticated account
566
+ * Update an application
567
+ */
568
+ async updateApplication(requestParameters, initOverrides) {
569
+ const response = await this.updateApplicationRaw(requestParameters, initOverrides);
570
+ return await response.value();
571
+ }
572
+ /**
573
+ * Update a template
574
+ * Update a template
575
+ */
576
+ async updateTemplateRaw(requestParameters, initOverrides) {
577
+ if (requestParameters['applicationId'] == null) {
578
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling updateTemplate().');
579
+ }
580
+ if (requestParameters['id'] == null) {
581
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateTemplate().');
582
+ }
583
+ const queryParameters = {};
584
+ const headerParameters = {};
585
+ const consumes = [
586
+ { contentType: 'multipart/form-data' },
587
+ ];
588
+ // @ts-ignore: canConsumeForm may be unused
589
+ const canConsumeForm = runtime.canConsumeForm(consumes);
590
+ let formParams;
591
+ let useForm = false;
592
+ // use FormData to transmit files using content-type "multipart/form-data"
593
+ useForm = canConsumeForm;
594
+ if (useForm) {
595
+ formParams = new FormData();
596
+ }
597
+ else {
598
+ formParams = new URLSearchParams();
599
+ }
600
+ if (requestParameters['file'] != null) {
601
+ formParams.append('file', requestParameters['file']);
602
+ }
603
+ if (requestParameters['name'] != null) {
604
+ formParams.append('name', requestParameters['name']);
605
+ }
606
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
607
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
608
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
609
+ const response = await this.request({
610
+ path: urlPath,
611
+ method: 'PATCH',
612
+ headers: headerParameters,
613
+ query: queryParameters,
614
+ body: formParams,
615
+ }, initOverrides);
616
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UpdateEmailTemplateDTOFromJSON)(jsonValue));
617
+ }
618
+ /**
619
+ * Update a template
620
+ * Update a template
621
+ */
622
+ async updateTemplate(requestParameters, initOverrides) {
623
+ const response = await this.updateTemplateRaw(requestParameters, initOverrides);
624
+ return await response.value();
625
+ }
626
+ /**
627
+ * Upload a template
628
+ * Upload a template
629
+ */
630
+ async uploadTemplateRaw(requestParameters, initOverrides) {
631
+ if (requestParameters['applicationId'] == null) {
632
+ throw new runtime.RequiredError('applicationId', 'Required parameter "applicationId" was null or undefined when calling uploadTemplate().');
633
+ }
634
+ if (requestParameters['file'] == null) {
635
+ throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling uploadTemplate().');
636
+ }
637
+ if (requestParameters['name'] == null) {
638
+ throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling uploadTemplate().');
639
+ }
640
+ const queryParameters = {};
641
+ const headerParameters = {};
642
+ const consumes = [
643
+ { contentType: 'multipart/form-data' },
644
+ ];
645
+ // @ts-ignore: canConsumeForm may be unused
646
+ const canConsumeForm = runtime.canConsumeForm(consumes);
647
+ let formParams;
648
+ let useForm = false;
649
+ // use FormData to transmit files using content-type "multipart/form-data"
650
+ useForm = canConsumeForm;
651
+ if (useForm) {
652
+ formParams = new FormData();
653
+ }
654
+ else {
655
+ formParams = new URLSearchParams();
656
+ }
657
+ if (requestParameters['file'] != null) {
658
+ formParams.append('file', requestParameters['file']);
659
+ }
660
+ if (requestParameters['name'] != null) {
661
+ formParams.append('name', requestParameters['name']);
662
+ }
663
+ let urlPath = `/applications/{applicationId}/templates`;
664
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
665
+ const response = await this.request({
666
+ path: urlPath,
667
+ method: 'POST',
668
+ headers: headerParameters,
669
+ query: queryParameters,
670
+ body: formParams,
671
+ }, initOverrides);
672
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.EmailTemplateDTOFromJSON)(jsonValue));
673
+ }
674
+ /**
675
+ * Upload a template
676
+ * Upload a template
677
+ */
678
+ async uploadTemplate(requestParameters, initOverrides) {
679
+ const response = await this.uploadTemplateRaw(requestParameters, initOverrides);
680
+ return await response.value();
681
+ }
682
+ }
683
+ exports.ClientApi = ClientApi;
684
+ //# sourceMappingURL=ClientApi.js.map