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,1037 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Tuix Email Service
5
+ * Service to manage Tuix Email
6
+ *
7
+ * The version of the OpenAPI document: 0.0.1
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ AccountDTO,
19
+ ApplicationDTO,
20
+ CreateAPIKeyRequestDTO,
21
+ CreateAPIKeyResponseDTO,
22
+ CreateAccountDTO,
23
+ CreateApplicationDTO,
24
+ EmailTemplateDTO,
25
+ ErrorDTO,
26
+ GetAPIKeysResponseDTO,
27
+ PaginatedApplicationsDTO,
28
+ PaginatedEmailTemplateDTO,
29
+ UpdateApplicationDTO,
30
+ UpdateEmailTemplateDTO,
31
+ } from '../models/index';
32
+ import {
33
+ AccountDTOFromJSON,
34
+ AccountDTOToJSON,
35
+ ApplicationDTOFromJSON,
36
+ ApplicationDTOToJSON,
37
+ CreateAPIKeyRequestDTOFromJSON,
38
+ CreateAPIKeyRequestDTOToJSON,
39
+ CreateAPIKeyResponseDTOFromJSON,
40
+ CreateAPIKeyResponseDTOToJSON,
41
+ CreateAccountDTOFromJSON,
42
+ CreateAccountDTOToJSON,
43
+ CreateApplicationDTOFromJSON,
44
+ CreateApplicationDTOToJSON,
45
+ EmailTemplateDTOFromJSON,
46
+ EmailTemplateDTOToJSON,
47
+ ErrorDTOFromJSON,
48
+ ErrorDTOToJSON,
49
+ GetAPIKeysResponseDTOFromJSON,
50
+ GetAPIKeysResponseDTOToJSON,
51
+ PaginatedApplicationsDTOFromJSON,
52
+ PaginatedApplicationsDTOToJSON,
53
+ PaginatedEmailTemplateDTOFromJSON,
54
+ PaginatedEmailTemplateDTOToJSON,
55
+ UpdateApplicationDTOFromJSON,
56
+ UpdateApplicationDTOToJSON,
57
+ UpdateEmailTemplateDTOFromJSON,
58
+ UpdateEmailTemplateDTOToJSON,
59
+ } from '../models/index';
60
+
61
+ export interface ApiKeysGetRequest {
62
+ page?: number;
63
+ pageSize?: number;
64
+ }
65
+
66
+ export interface ApiKeysIdDeleteRequest {
67
+ id: string;
68
+ }
69
+
70
+ export interface ApiKeysPostRequest {
71
+ createAPIKeyRequestDTO: CreateAPIKeyRequestDTO;
72
+ }
73
+
74
+ export interface ApiSendEmailRequest {
75
+ applicationId: string;
76
+ from: string;
77
+ subject: string;
78
+ templateUUID: string;
79
+ to: string;
80
+ body?: string;
81
+ data?: string;
82
+ file?: Blob;
83
+ }
84
+
85
+ export interface CreateAccountRequest {
86
+ createAccountDTO: CreateAccountDTO;
87
+ }
88
+
89
+ export interface CreateApplicationRequest {
90
+ createApplicationDTO: CreateApplicationDTO;
91
+ }
92
+
93
+ export interface DeleteApplicationRequest {
94
+ applicationId: string;
95
+ }
96
+
97
+ export interface DeleteTemplateRequest {
98
+ id: string;
99
+ applicationId: string;
100
+ }
101
+
102
+ export interface GetApplicationByIDRequest {
103
+ applicationId: string;
104
+ }
105
+
106
+ export interface GetApplicationsRequest {
107
+ page?: number;
108
+ pageSize?: number;
109
+ }
110
+
111
+ export interface GetTemplateRequest {
112
+ id: string;
113
+ applicationId: string;
114
+ }
115
+
116
+ export interface GetTemplatesRequest {
117
+ applicationId: string;
118
+ page?: number;
119
+ pageSize?: number;
120
+ }
121
+
122
+ export interface SendEmailRequest {
123
+ applicationId: string;
124
+ from: string;
125
+ subject: string;
126
+ templateUUID: string;
127
+ to: string;
128
+ body?: string;
129
+ data?: string;
130
+ file?: Blob;
131
+ }
132
+
133
+ export interface UpdateApplicationRequest {
134
+ applicationId: string;
135
+ updateApplicationDTO: UpdateApplicationDTO;
136
+ }
137
+
138
+ export interface UpdateTemplateRequest {
139
+ applicationId: string;
140
+ id: string;
141
+ file?: Blob;
142
+ name?: string;
143
+ }
144
+
145
+ export interface UploadTemplateRequest {
146
+ applicationId: string;
147
+ file: Blob;
148
+ name: string;
149
+ }
150
+
151
+ /**
152
+ *
153
+ */
154
+ export class ClientApi extends runtime.BaseAPI {
155
+
156
+ /**
157
+ * Retrieve all API keys associated with the authenticated user\'s account with pagination.
158
+ * Get all API keys for the authenticated user
159
+ */
160
+ async apiKeysGetRaw(requestParameters: ApiKeysGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetAPIKeysResponseDTO>> {
161
+ const queryParameters: any = {};
162
+
163
+ if (requestParameters['page'] != null) {
164
+ queryParameters['page'] = requestParameters['page'];
165
+ }
166
+
167
+ if (requestParameters['pageSize'] != null) {
168
+ queryParameters['page_size'] = requestParameters['pageSize'];
169
+ }
170
+
171
+ const headerParameters: runtime.HTTPHeaders = {};
172
+
173
+
174
+ let urlPath = `/api-keys`;
175
+
176
+ const response = await this.request({
177
+ path: urlPath,
178
+ method: 'GET',
179
+ headers: headerParameters,
180
+ query: queryParameters,
181
+ }, initOverrides);
182
+
183
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetAPIKeysResponseDTOFromJSON(jsonValue));
184
+ }
185
+
186
+ /**
187
+ * Retrieve all API keys associated with the authenticated user\'s account with pagination.
188
+ * Get all API keys for the authenticated user
189
+ */
190
+ async apiKeysGet(requestParameters: ApiKeysGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetAPIKeysResponseDTO> {
191
+ const response = await this.apiKeysGetRaw(requestParameters, initOverrides);
192
+ return await response.value();
193
+ }
194
+
195
+ /**
196
+ * Delete a specific API key belonging to the authenticated user.
197
+ * Delete an API key
198
+ */
199
+ async apiKeysIdDeleteRaw(requestParameters: ApiKeysIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
200
+ if (requestParameters['id'] == null) {
201
+ throw new runtime.RequiredError(
202
+ 'id',
203
+ 'Required parameter "id" was null or undefined when calling apiKeysIdDelete().'
204
+ );
205
+ }
206
+
207
+ const queryParameters: any = {};
208
+
209
+ const headerParameters: runtime.HTTPHeaders = {};
210
+
211
+
212
+ let urlPath = `/api-keys/{id}`;
213
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
214
+
215
+ const response = await this.request({
216
+ path: urlPath,
217
+ method: 'DELETE',
218
+ headers: headerParameters,
219
+ query: queryParameters,
220
+ }, initOverrides);
221
+
222
+ return new runtime.VoidApiResponse(response);
223
+ }
224
+
225
+ /**
226
+ * Delete a specific API key belonging to the authenticated user.
227
+ * Delete an API key
228
+ */
229
+ async apiKeysIdDelete(requestParameters: ApiKeysIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
230
+ await this.apiKeysIdDeleteRaw(requestParameters, initOverrides);
231
+ }
232
+
233
+ /**
234
+ * Create a new API key for accessing the RAG service.
235
+ * Create a new API key
236
+ */
237
+ async apiKeysPostRaw(requestParameters: ApiKeysPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateAPIKeyResponseDTO>> {
238
+ if (requestParameters['createAPIKeyRequestDTO'] == null) {
239
+ throw new runtime.RequiredError(
240
+ 'createAPIKeyRequestDTO',
241
+ 'Required parameter "createAPIKeyRequestDTO" was null or undefined when calling apiKeysPost().'
242
+ );
243
+ }
244
+
245
+ const queryParameters: any = {};
246
+
247
+ const headerParameters: runtime.HTTPHeaders = {};
248
+
249
+ headerParameters['Content-Type'] = 'application/json';
250
+
251
+
252
+ let urlPath = `/api-keys`;
253
+
254
+ const response = await this.request({
255
+ path: urlPath,
256
+ method: 'POST',
257
+ headers: headerParameters,
258
+ query: queryParameters,
259
+ body: CreateAPIKeyRequestDTOToJSON(requestParameters['createAPIKeyRequestDTO']),
260
+ }, initOverrides);
261
+
262
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateAPIKeyResponseDTOFromJSON(jsonValue));
263
+ }
264
+
265
+ /**
266
+ * Create a new API key for accessing the RAG service.
267
+ * Create a new API key
268
+ */
269
+ async apiKeysPost(requestParameters: ApiKeysPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateAPIKeyResponseDTO> {
270
+ const response = await this.apiKeysPostRaw(requestParameters, initOverrides);
271
+ return await response.value();
272
+ }
273
+
274
+ /**
275
+ * Send an email
276
+ * Send an email
277
+ */
278
+ async apiSendEmailRaw(requestParameters: ApiSendEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
279
+ if (requestParameters['applicationId'] == null) {
280
+ throw new runtime.RequiredError(
281
+ 'applicationId',
282
+ 'Required parameter "applicationId" was null or undefined when calling apiSendEmail().'
283
+ );
284
+ }
285
+
286
+ if (requestParameters['from'] == null) {
287
+ throw new runtime.RequiredError(
288
+ 'from',
289
+ 'Required parameter "from" was null or undefined when calling apiSendEmail().'
290
+ );
291
+ }
292
+
293
+ if (requestParameters['subject'] == null) {
294
+ throw new runtime.RequiredError(
295
+ 'subject',
296
+ 'Required parameter "subject" was null or undefined when calling apiSendEmail().'
297
+ );
298
+ }
299
+
300
+ if (requestParameters['templateUUID'] == null) {
301
+ throw new runtime.RequiredError(
302
+ 'templateUUID',
303
+ 'Required parameter "templateUUID" was null or undefined when calling apiSendEmail().'
304
+ );
305
+ }
306
+
307
+ if (requestParameters['to'] == null) {
308
+ throw new runtime.RequiredError(
309
+ 'to',
310
+ 'Required parameter "to" was null or undefined when calling apiSendEmail().'
311
+ );
312
+ }
313
+
314
+ const queryParameters: any = {};
315
+
316
+ const headerParameters: runtime.HTTPHeaders = {};
317
+
318
+ const consumes: runtime.Consume[] = [
319
+ { contentType: 'multipart/form-data' },
320
+ ];
321
+ // @ts-ignore: canConsumeForm may be unused
322
+ const canConsumeForm = runtime.canConsumeForm(consumes);
323
+
324
+ let formParams: { append(param: string, value: any): any };
325
+ let useForm = false;
326
+ // use FormData to transmit files using content-type "multipart/form-data"
327
+ useForm = canConsumeForm;
328
+ if (useForm) {
329
+ formParams = new FormData();
330
+ } else {
331
+ formParams = new URLSearchParams();
332
+ }
333
+
334
+ if (requestParameters['body'] != null) {
335
+ formParams.append('body', requestParameters['body'] as any);
336
+ }
337
+
338
+ if (requestParameters['data'] != null) {
339
+ formParams.append('data', requestParameters['data'] as any);
340
+ }
341
+
342
+ if (requestParameters['file'] != null) {
343
+ formParams.append('file', requestParameters['file'] as any);
344
+ }
345
+
346
+ if (requestParameters['from'] != null) {
347
+ formParams.append('from', requestParameters['from'] as any);
348
+ }
349
+
350
+ if (requestParameters['subject'] != null) {
351
+ formParams.append('subject', requestParameters['subject'] as any);
352
+ }
353
+
354
+ if (requestParameters['templateUUID'] != null) {
355
+ formParams.append('templateUUID', requestParameters['templateUUID'] as any);
356
+ }
357
+
358
+ if (requestParameters['to'] != null) {
359
+ formParams.append('to', requestParameters['to'] as any);
360
+ }
361
+
362
+
363
+ let urlPath = `/api/applications/{applicationId}/emails/send`;
364
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
365
+
366
+ const response = await this.request({
367
+ path: urlPath,
368
+ method: 'POST',
369
+ headers: headerParameters,
370
+ query: queryParameters,
371
+ body: formParams,
372
+ }, initOverrides);
373
+
374
+ return new runtime.VoidApiResponse(response);
375
+ }
376
+
377
+ /**
378
+ * Send an email
379
+ * Send an email
380
+ */
381
+ async apiSendEmail(requestParameters: ApiSendEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
382
+ await this.apiSendEmailRaw(requestParameters, initOverrides);
383
+ }
384
+
385
+ /**
386
+ * Create an account
387
+ * Creates a new account
388
+ */
389
+ async createAccountRaw(requestParameters: CreateAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountDTO>> {
390
+ if (requestParameters['createAccountDTO'] == null) {
391
+ throw new runtime.RequiredError(
392
+ 'createAccountDTO',
393
+ 'Required parameter "createAccountDTO" was null or undefined when calling createAccount().'
394
+ );
395
+ }
396
+
397
+ const queryParameters: any = {};
398
+
399
+ const headerParameters: runtime.HTTPHeaders = {};
400
+
401
+ headerParameters['Content-Type'] = 'application/json';
402
+
403
+
404
+ let urlPath = `/accounts`;
405
+
406
+ const response = await this.request({
407
+ path: urlPath,
408
+ method: 'POST',
409
+ headers: headerParameters,
410
+ query: queryParameters,
411
+ body: CreateAccountDTOToJSON(requestParameters['createAccountDTO']),
412
+ }, initOverrides);
413
+
414
+ return new runtime.JSONApiResponse(response, (jsonValue) => AccountDTOFromJSON(jsonValue));
415
+ }
416
+
417
+ /**
418
+ * Create an account
419
+ * Creates a new account
420
+ */
421
+ async createAccount(requestParameters: CreateAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountDTO> {
422
+ const response = await this.createAccountRaw(requestParameters, initOverrides);
423
+ return await response.value();
424
+ }
425
+
426
+ /**
427
+ * Create a new application for the authenticated account
428
+ * Create a new application
429
+ */
430
+ async createApplicationRaw(requestParameters: CreateApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationDTO>> {
431
+ if (requestParameters['createApplicationDTO'] == null) {
432
+ throw new runtime.RequiredError(
433
+ 'createApplicationDTO',
434
+ 'Required parameter "createApplicationDTO" was null or undefined when calling createApplication().'
435
+ );
436
+ }
437
+
438
+ const queryParameters: any = {};
439
+
440
+ const headerParameters: runtime.HTTPHeaders = {};
441
+
442
+ headerParameters['Content-Type'] = 'application/json';
443
+
444
+
445
+ let urlPath = `/applications`;
446
+
447
+ const response = await this.request({
448
+ path: urlPath,
449
+ method: 'POST',
450
+ headers: headerParameters,
451
+ query: queryParameters,
452
+ body: CreateApplicationDTOToJSON(requestParameters['createApplicationDTO']),
453
+ }, initOverrides);
454
+
455
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationDTOFromJSON(jsonValue));
456
+ }
457
+
458
+ /**
459
+ * Create a new application for the authenticated account
460
+ * Create a new application
461
+ */
462
+ async createApplication(requestParameters: CreateApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationDTO> {
463
+ const response = await this.createApplicationRaw(requestParameters, initOverrides);
464
+ return await response.value();
465
+ }
466
+
467
+ /**
468
+ * Delete an application belonging to the authenticated account
469
+ * Delete an application
470
+ */
471
+ async deleteApplicationRaw(requestParameters: DeleteApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
472
+ if (requestParameters['applicationId'] == null) {
473
+ throw new runtime.RequiredError(
474
+ 'applicationId',
475
+ 'Required parameter "applicationId" was null or undefined when calling deleteApplication().'
476
+ );
477
+ }
478
+
479
+ const queryParameters: any = {};
480
+
481
+ const headerParameters: runtime.HTTPHeaders = {};
482
+
483
+
484
+ let urlPath = `/applications/{applicationId}`;
485
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
486
+
487
+ const response = await this.request({
488
+ path: urlPath,
489
+ method: 'DELETE',
490
+ headers: headerParameters,
491
+ query: queryParameters,
492
+ }, initOverrides);
493
+
494
+ return new runtime.VoidApiResponse(response);
495
+ }
496
+
497
+ /**
498
+ * Delete an application belonging to the authenticated account
499
+ * Delete an application
500
+ */
501
+ async deleteApplication(requestParameters: DeleteApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
502
+ await this.deleteApplicationRaw(requestParameters, initOverrides);
503
+ }
504
+
505
+ /**
506
+ * Delete an template
507
+ * Delete an template
508
+ */
509
+ async deleteTemplateRaw(requestParameters: DeleteTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
510
+ if (requestParameters['id'] == null) {
511
+ throw new runtime.RequiredError(
512
+ 'id',
513
+ 'Required parameter "id" was null or undefined when calling deleteTemplate().'
514
+ );
515
+ }
516
+
517
+ if (requestParameters['applicationId'] == null) {
518
+ throw new runtime.RequiredError(
519
+ 'applicationId',
520
+ 'Required parameter "applicationId" was null or undefined when calling deleteTemplate().'
521
+ );
522
+ }
523
+
524
+ const queryParameters: any = {};
525
+
526
+ const headerParameters: runtime.HTTPHeaders = {};
527
+
528
+
529
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
530
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
531
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
532
+
533
+ const response = await this.request({
534
+ path: urlPath,
535
+ method: 'DELETE',
536
+ headers: headerParameters,
537
+ query: queryParameters,
538
+ }, initOverrides);
539
+
540
+ return new runtime.VoidApiResponse(response);
541
+ }
542
+
543
+ /**
544
+ * Delete an template
545
+ * Delete an template
546
+ */
547
+ async deleteTemplate(requestParameters: DeleteTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
548
+ await this.deleteTemplateRaw(requestParameters, initOverrides);
549
+ }
550
+
551
+ /**
552
+ * Get a specific application belonging to the authenticated account
553
+ * Get an application by applicationId
554
+ */
555
+ async getApplicationByIDRaw(requestParameters: GetApplicationByIDRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationDTO>> {
556
+ if (requestParameters['applicationId'] == null) {
557
+ throw new runtime.RequiredError(
558
+ 'applicationId',
559
+ 'Required parameter "applicationId" was null or undefined when calling getApplicationByID().'
560
+ );
561
+ }
562
+
563
+ const queryParameters: any = {};
564
+
565
+ const headerParameters: runtime.HTTPHeaders = {};
566
+
567
+
568
+ let urlPath = `/applications/{applicationId}`;
569
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
570
+
571
+ const response = await this.request({
572
+ path: urlPath,
573
+ method: 'GET',
574
+ headers: headerParameters,
575
+ query: queryParameters,
576
+ }, initOverrides);
577
+
578
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationDTOFromJSON(jsonValue));
579
+ }
580
+
581
+ /**
582
+ * Get a specific application belonging to the authenticated account
583
+ * Get an application by applicationId
584
+ */
585
+ async getApplicationByID(requestParameters: GetApplicationByIDRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationDTO> {
586
+ const response = await this.getApplicationByIDRaw(requestParameters, initOverrides);
587
+ return await response.value();
588
+ }
589
+
590
+ /**
591
+ * Get all applications belonging to the authenticated account
592
+ * Get all applications for the account
593
+ */
594
+ async getApplicationsRaw(requestParameters: GetApplicationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedApplicationsDTO>> {
595
+ const queryParameters: any = {};
596
+
597
+ if (requestParameters['page'] != null) {
598
+ queryParameters['page'] = requestParameters['page'];
599
+ }
600
+
601
+ if (requestParameters['pageSize'] != null) {
602
+ queryParameters['pageSize'] = requestParameters['pageSize'];
603
+ }
604
+
605
+ const headerParameters: runtime.HTTPHeaders = {};
606
+
607
+
608
+ let urlPath = `/applications`;
609
+
610
+ const response = await this.request({
611
+ path: urlPath,
612
+ method: 'GET',
613
+ headers: headerParameters,
614
+ query: queryParameters,
615
+ }, initOverrides);
616
+
617
+ return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedApplicationsDTOFromJSON(jsonValue));
618
+ }
619
+
620
+ /**
621
+ * Get all applications belonging to the authenticated account
622
+ * Get all applications for the account
623
+ */
624
+ async getApplications(requestParameters: GetApplicationsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedApplicationsDTO> {
625
+ const response = await this.getApplicationsRaw(requestParameters, initOverrides);
626
+ return await response.value();
627
+ }
628
+
629
+ /**
630
+ * Return a template
631
+ * Return a template
632
+ */
633
+ async getTemplateRaw(requestParameters: GetTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
634
+ if (requestParameters['id'] == null) {
635
+ throw new runtime.RequiredError(
636
+ 'id',
637
+ 'Required parameter "id" was null or undefined when calling getTemplate().'
638
+ );
639
+ }
640
+
641
+ if (requestParameters['applicationId'] == null) {
642
+ throw new runtime.RequiredError(
643
+ 'applicationId',
644
+ 'Required parameter "applicationId" was null or undefined when calling getTemplate().'
645
+ );
646
+ }
647
+
648
+ const queryParameters: any = {};
649
+
650
+ const headerParameters: runtime.HTTPHeaders = {};
651
+
652
+
653
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
654
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
655
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
656
+
657
+ const response = await this.request({
658
+ path: urlPath,
659
+ method: 'GET',
660
+ headers: headerParameters,
661
+ query: queryParameters,
662
+ }, initOverrides);
663
+
664
+ if (this.isJsonMime(response.headers.get('content-type'))) {
665
+ return new runtime.JSONApiResponse<string>(response);
666
+ } else {
667
+ return new runtime.TextApiResponse(response) as any;
668
+ }
669
+ }
670
+
671
+ /**
672
+ * Return a template
673
+ * Return a template
674
+ */
675
+ async getTemplate(requestParameters: GetTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
676
+ const response = await this.getTemplateRaw(requestParameters, initOverrides);
677
+ return await response.value();
678
+ }
679
+
680
+ /**
681
+ * Return all templates
682
+ * Return all templates
683
+ */
684
+ async getTemplatesRaw(requestParameters: GetTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedEmailTemplateDTO>> {
685
+ if (requestParameters['applicationId'] == null) {
686
+ throw new runtime.RequiredError(
687
+ 'applicationId',
688
+ 'Required parameter "applicationId" was null or undefined when calling getTemplates().'
689
+ );
690
+ }
691
+
692
+ const queryParameters: any = {};
693
+
694
+ if (requestParameters['page'] != null) {
695
+ queryParameters['page'] = requestParameters['page'];
696
+ }
697
+
698
+ if (requestParameters['pageSize'] != null) {
699
+ queryParameters['pageSize'] = requestParameters['pageSize'];
700
+ }
701
+
702
+ const headerParameters: runtime.HTTPHeaders = {};
703
+
704
+
705
+ let urlPath = `/applications/{applicationId}/templates`;
706
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
707
+
708
+ const response = await this.request({
709
+ path: urlPath,
710
+ method: 'GET',
711
+ headers: headerParameters,
712
+ query: queryParameters,
713
+ }, initOverrides);
714
+
715
+ return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedEmailTemplateDTOFromJSON(jsonValue));
716
+ }
717
+
718
+ /**
719
+ * Return all templates
720
+ * Return all templates
721
+ */
722
+ async getTemplates(requestParameters: GetTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedEmailTemplateDTO> {
723
+ const response = await this.getTemplatesRaw(requestParameters, initOverrides);
724
+ return await response.value();
725
+ }
726
+
727
+ /**
728
+ * Send an email
729
+ * Send an email
730
+ */
731
+ async sendEmailRaw(requestParameters: SendEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
732
+ if (requestParameters['applicationId'] == null) {
733
+ throw new runtime.RequiredError(
734
+ 'applicationId',
735
+ 'Required parameter "applicationId" was null or undefined when calling sendEmail().'
736
+ );
737
+ }
738
+
739
+ if (requestParameters['from'] == null) {
740
+ throw new runtime.RequiredError(
741
+ 'from',
742
+ 'Required parameter "from" was null or undefined when calling sendEmail().'
743
+ );
744
+ }
745
+
746
+ if (requestParameters['subject'] == null) {
747
+ throw new runtime.RequiredError(
748
+ 'subject',
749
+ 'Required parameter "subject" was null or undefined when calling sendEmail().'
750
+ );
751
+ }
752
+
753
+ if (requestParameters['templateUUID'] == null) {
754
+ throw new runtime.RequiredError(
755
+ 'templateUUID',
756
+ 'Required parameter "templateUUID" was null or undefined when calling sendEmail().'
757
+ );
758
+ }
759
+
760
+ if (requestParameters['to'] == null) {
761
+ throw new runtime.RequiredError(
762
+ 'to',
763
+ 'Required parameter "to" was null or undefined when calling sendEmail().'
764
+ );
765
+ }
766
+
767
+ const queryParameters: any = {};
768
+
769
+ const headerParameters: runtime.HTTPHeaders = {};
770
+
771
+ const consumes: runtime.Consume[] = [
772
+ { contentType: 'multipart/form-data' },
773
+ ];
774
+ // @ts-ignore: canConsumeForm may be unused
775
+ const canConsumeForm = runtime.canConsumeForm(consumes);
776
+
777
+ let formParams: { append(param: string, value: any): any };
778
+ let useForm = false;
779
+ // use FormData to transmit files using content-type "multipart/form-data"
780
+ useForm = canConsumeForm;
781
+ if (useForm) {
782
+ formParams = new FormData();
783
+ } else {
784
+ formParams = new URLSearchParams();
785
+ }
786
+
787
+ if (requestParameters['body'] != null) {
788
+ formParams.append('body', requestParameters['body'] as any);
789
+ }
790
+
791
+ if (requestParameters['data'] != null) {
792
+ formParams.append('data', requestParameters['data'] as any);
793
+ }
794
+
795
+ if (requestParameters['file'] != null) {
796
+ formParams.append('file', requestParameters['file'] as any);
797
+ }
798
+
799
+ if (requestParameters['from'] != null) {
800
+ formParams.append('from', requestParameters['from'] as any);
801
+ }
802
+
803
+ if (requestParameters['subject'] != null) {
804
+ formParams.append('subject', requestParameters['subject'] as any);
805
+ }
806
+
807
+ if (requestParameters['templateUUID'] != null) {
808
+ formParams.append('templateUUID', requestParameters['templateUUID'] as any);
809
+ }
810
+
811
+ if (requestParameters['to'] != null) {
812
+ formParams.append('to', requestParameters['to'] as any);
813
+ }
814
+
815
+
816
+ let urlPath = `/applications/{applicationId}/emails/send`;
817
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
818
+
819
+ const response = await this.request({
820
+ path: urlPath,
821
+ method: 'POST',
822
+ headers: headerParameters,
823
+ query: queryParameters,
824
+ body: formParams,
825
+ }, initOverrides);
826
+
827
+ return new runtime.VoidApiResponse(response);
828
+ }
829
+
830
+ /**
831
+ * Send an email
832
+ * Send an email
833
+ */
834
+ async sendEmail(requestParameters: SendEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
835
+ await this.sendEmailRaw(requestParameters, initOverrides);
836
+ }
837
+
838
+ /**
839
+ * Update an application belonging to the authenticated account
840
+ * Update an application
841
+ */
842
+ async updateApplicationRaw(requestParameters: UpdateApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationDTO>> {
843
+ if (requestParameters['applicationId'] == null) {
844
+ throw new runtime.RequiredError(
845
+ 'applicationId',
846
+ 'Required parameter "applicationId" was null or undefined when calling updateApplication().'
847
+ );
848
+ }
849
+
850
+ if (requestParameters['updateApplicationDTO'] == null) {
851
+ throw new runtime.RequiredError(
852
+ 'updateApplicationDTO',
853
+ 'Required parameter "updateApplicationDTO" was null or undefined when calling updateApplication().'
854
+ );
855
+ }
856
+
857
+ const queryParameters: any = {};
858
+
859
+ const headerParameters: runtime.HTTPHeaders = {};
860
+
861
+ headerParameters['Content-Type'] = 'application/json';
862
+
863
+
864
+ let urlPath = `/applications/{applicationId}`;
865
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
866
+
867
+ const response = await this.request({
868
+ path: urlPath,
869
+ method: 'PATCH',
870
+ headers: headerParameters,
871
+ query: queryParameters,
872
+ body: UpdateApplicationDTOToJSON(requestParameters['updateApplicationDTO']),
873
+ }, initOverrides);
874
+
875
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationDTOFromJSON(jsonValue));
876
+ }
877
+
878
+ /**
879
+ * Update an application belonging to the authenticated account
880
+ * Update an application
881
+ */
882
+ async updateApplication(requestParameters: UpdateApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationDTO> {
883
+ const response = await this.updateApplicationRaw(requestParameters, initOverrides);
884
+ return await response.value();
885
+ }
886
+
887
+ /**
888
+ * Update a template
889
+ * Update a template
890
+ */
891
+ async updateTemplateRaw(requestParameters: UpdateTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UpdateEmailTemplateDTO>> {
892
+ if (requestParameters['applicationId'] == null) {
893
+ throw new runtime.RequiredError(
894
+ 'applicationId',
895
+ 'Required parameter "applicationId" was null or undefined when calling updateTemplate().'
896
+ );
897
+ }
898
+
899
+ if (requestParameters['id'] == null) {
900
+ throw new runtime.RequiredError(
901
+ 'id',
902
+ 'Required parameter "id" was null or undefined when calling updateTemplate().'
903
+ );
904
+ }
905
+
906
+ const queryParameters: any = {};
907
+
908
+ const headerParameters: runtime.HTTPHeaders = {};
909
+
910
+ const consumes: runtime.Consume[] = [
911
+ { contentType: 'multipart/form-data' },
912
+ ];
913
+ // @ts-ignore: canConsumeForm may be unused
914
+ const canConsumeForm = runtime.canConsumeForm(consumes);
915
+
916
+ let formParams: { append(param: string, value: any): any };
917
+ let useForm = false;
918
+ // use FormData to transmit files using content-type "multipart/form-data"
919
+ useForm = canConsumeForm;
920
+ if (useForm) {
921
+ formParams = new FormData();
922
+ } else {
923
+ formParams = new URLSearchParams();
924
+ }
925
+
926
+ if (requestParameters['file'] != null) {
927
+ formParams.append('file', requestParameters['file'] as any);
928
+ }
929
+
930
+ if (requestParameters['name'] != null) {
931
+ formParams.append('name', requestParameters['name'] as any);
932
+ }
933
+
934
+
935
+ let urlPath = `/applications/{applicationId}/templates/{id}`;
936
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
937
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
938
+
939
+ const response = await this.request({
940
+ path: urlPath,
941
+ method: 'PATCH',
942
+ headers: headerParameters,
943
+ query: queryParameters,
944
+ body: formParams,
945
+ }, initOverrides);
946
+
947
+ return new runtime.JSONApiResponse(response, (jsonValue) => UpdateEmailTemplateDTOFromJSON(jsonValue));
948
+ }
949
+
950
+ /**
951
+ * Update a template
952
+ * Update a template
953
+ */
954
+ async updateTemplate(requestParameters: UpdateTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UpdateEmailTemplateDTO> {
955
+ const response = await this.updateTemplateRaw(requestParameters, initOverrides);
956
+ return await response.value();
957
+ }
958
+
959
+ /**
960
+ * Upload a template
961
+ * Upload a template
962
+ */
963
+ async uploadTemplateRaw(requestParameters: UploadTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmailTemplateDTO>> {
964
+ if (requestParameters['applicationId'] == null) {
965
+ throw new runtime.RequiredError(
966
+ 'applicationId',
967
+ 'Required parameter "applicationId" was null or undefined when calling uploadTemplate().'
968
+ );
969
+ }
970
+
971
+ if (requestParameters['file'] == null) {
972
+ throw new runtime.RequiredError(
973
+ 'file',
974
+ 'Required parameter "file" was null or undefined when calling uploadTemplate().'
975
+ );
976
+ }
977
+
978
+ if (requestParameters['name'] == null) {
979
+ throw new runtime.RequiredError(
980
+ 'name',
981
+ 'Required parameter "name" was null or undefined when calling uploadTemplate().'
982
+ );
983
+ }
984
+
985
+ const queryParameters: any = {};
986
+
987
+ const headerParameters: runtime.HTTPHeaders = {};
988
+
989
+ const consumes: runtime.Consume[] = [
990
+ { contentType: 'multipart/form-data' },
991
+ ];
992
+ // @ts-ignore: canConsumeForm may be unused
993
+ const canConsumeForm = runtime.canConsumeForm(consumes);
994
+
995
+ let formParams: { append(param: string, value: any): any };
996
+ let useForm = false;
997
+ // use FormData to transmit files using content-type "multipart/form-data"
998
+ useForm = canConsumeForm;
999
+ if (useForm) {
1000
+ formParams = new FormData();
1001
+ } else {
1002
+ formParams = new URLSearchParams();
1003
+ }
1004
+
1005
+ if (requestParameters['file'] != null) {
1006
+ formParams.append('file', requestParameters['file'] as any);
1007
+ }
1008
+
1009
+ if (requestParameters['name'] != null) {
1010
+ formParams.append('name', requestParameters['name'] as any);
1011
+ }
1012
+
1013
+
1014
+ let urlPath = `/applications/{applicationId}/templates`;
1015
+ urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
1016
+
1017
+ const response = await this.request({
1018
+ path: urlPath,
1019
+ method: 'POST',
1020
+ headers: headerParameters,
1021
+ query: queryParameters,
1022
+ body: formParams,
1023
+ }, initOverrides);
1024
+
1025
+ return new runtime.JSONApiResponse(response, (jsonValue) => EmailTemplateDTOFromJSON(jsonValue));
1026
+ }
1027
+
1028
+ /**
1029
+ * Upload a template
1030
+ * Upload a template
1031
+ */
1032
+ async uploadTemplate(requestParameters: UploadTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmailTemplateDTO> {
1033
+ const response = await this.uploadTemplateRaw(requestParameters, initOverrides);
1034
+ return await response.value();
1035
+ }
1036
+
1037
+ }