@tennac-booking/sdk 1.0.0 → 1.0.2

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/api.ts ADDED
@@ -0,0 +1,668 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Pickle Ball API
5
+ * API for managing pickle ball games and players
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
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 type { Configuration } from './configuration';
17
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
18
+ import globalAxios from 'axios';
19
+ // Some imports not used depending on template conditions
20
+ // @ts-ignore
21
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
22
+ import type { RequestArgs } from './base';
23
+ // @ts-ignore
24
+ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
25
+
26
+ /**
27
+ *
28
+ * @export
29
+ * @interface Booking
30
+ */
31
+ export interface Booking {
32
+ /**
33
+ *
34
+ * @type {string}
35
+ * @memberof Booking
36
+ */
37
+ 'userId': string;
38
+ /**
39
+ *
40
+ * @type {Array<string>}
41
+ * @memberof Booking
42
+ */
43
+ 'playersIds'?: Array<string>;
44
+ /**
45
+ *
46
+ * @type {BookingStatus}
47
+ * @memberof Booking
48
+ */
49
+ 'status': BookingStatus;
50
+ /**
51
+ *
52
+ * @type {StripeStatus}
53
+ * @memberof Booking
54
+ */
55
+ 'stripeStatus': StripeStatus;
56
+ /**
57
+ *
58
+ * @type {string}
59
+ * @memberof Booking
60
+ */
61
+ 'stripePaymentIntentId': string;
62
+ /**
63
+ *
64
+ * @type {number}
65
+ * @memberof Booking
66
+ */
67
+ 'totalPrice': number;
68
+ /**
69
+ *
70
+ * @type {string}
71
+ * @memberof Booking
72
+ */
73
+ 'slotId': string;
74
+ }
75
+
76
+
77
+ /**
78
+ *
79
+ * @export
80
+ * @enum {string}
81
+ */
82
+
83
+ export const BookingStatus = {
84
+ Active: 'active',
85
+ Inactive: 'inactive'
86
+ } as const;
87
+
88
+ export type BookingStatus = typeof BookingStatus[keyof typeof BookingStatus];
89
+
90
+
91
+ /**
92
+ *
93
+ * @export
94
+ * @interface Court
95
+ */
96
+ export interface Court {
97
+ /**
98
+ *
99
+ * @type {string}
100
+ * @memberof Court
101
+ */
102
+ 'name': string;
103
+ /**
104
+ *
105
+ * @type {CourtStatus}
106
+ * @memberof Court
107
+ */
108
+ 'status': CourtStatus;
109
+ /**
110
+ *
111
+ * @type {string}
112
+ * @memberof Court
113
+ */
114
+ 'comments'?: string;
115
+ /**
116
+ *
117
+ * @type {number}
118
+ * @memberof Court
119
+ */
120
+ 'pricePerSlot': number;
121
+ /**
122
+ *
123
+ * @type {number}
124
+ * @memberof Court
125
+ */
126
+ 'slotDefaultDuration': number;
127
+ /**
128
+ *
129
+ * @type {number}
130
+ * @memberof Court
131
+ */
132
+ 'startTimeInTheDayInMinutes': number;
133
+ /**
134
+ *
135
+ * @type {number}
136
+ * @memberof Court
137
+ */
138
+ 'endTimeInTheDayInMinutes': number;
139
+ }
140
+
141
+
142
+ /**
143
+ *
144
+ * @export
145
+ * @enum {string}
146
+ */
147
+
148
+ export const CourtStatus = {
149
+ Available: 'available',
150
+ Unavailable: 'unavailable'
151
+ } as const;
152
+
153
+ export type CourtStatus = typeof CourtStatus[keyof typeof CourtStatus];
154
+
155
+
156
+ /**
157
+ *
158
+ * @export
159
+ * @interface Slot
160
+ */
161
+ export interface Slot {
162
+ /**
163
+ *
164
+ * @type {string}
165
+ * @memberof Slot
166
+ */
167
+ 'startDate': string;
168
+ /**
169
+ *
170
+ * @type {string}
171
+ * @memberof Slot
172
+ */
173
+ 'endDate': string;
174
+ /**
175
+ *
176
+ * @type {string}
177
+ * @memberof Slot
178
+ */
179
+ 'courtId': string;
180
+ }
181
+ /**
182
+ *
183
+ * @export
184
+ * @interface SlotException
185
+ */
186
+ export interface SlotException {
187
+ /**
188
+ *
189
+ * @type {string}
190
+ * @memberof SlotException
191
+ */
192
+ 'startDate': string;
193
+ /**
194
+ *
195
+ * @type {string}
196
+ * @memberof SlotException
197
+ */
198
+ 'endDate': string;
199
+ /**
200
+ *
201
+ * @type {string}
202
+ * @memberof SlotException
203
+ */
204
+ 'courtId': string;
205
+ /**
206
+ *
207
+ * @type {string}
208
+ * @memberof SlotException
209
+ */
210
+ 'reason': string;
211
+ }
212
+ /**
213
+ *
214
+ * @export
215
+ * @enum {string}
216
+ */
217
+
218
+ export const StripeStatus = {
219
+ Pending: 'pending',
220
+ Paid: 'paid',
221
+ Failed: 'failed',
222
+ Refunded: 'refunded',
223
+ Canceled: 'canceled'
224
+ } as const;
225
+
226
+ export type StripeStatus = typeof StripeStatus[keyof typeof StripeStatus];
227
+
228
+
229
+ /**
230
+ *
231
+ * @export
232
+ * @interface User
233
+ */
234
+ export interface User {
235
+ /**
236
+ *
237
+ * @type {string}
238
+ * @memberof User
239
+ */
240
+ 'username'?: string;
241
+ /**
242
+ *
243
+ * @type {string}
244
+ * @memberof User
245
+ */
246
+ 'firstName': string;
247
+ /**
248
+ *
249
+ * @type {string}
250
+ * @memberof User
251
+ */
252
+ 'lastName': string;
253
+ /**
254
+ *
255
+ * @type {string}
256
+ * @memberof User
257
+ */
258
+ 'email': string;
259
+ /**
260
+ *
261
+ * @type {boolean}
262
+ * @memberof User
263
+ */
264
+ 'isAccountVerified'?: boolean;
265
+ /**
266
+ *
267
+ * @type {string}
268
+ * @memberof User
269
+ */
270
+ 'level'?: string;
271
+ /**
272
+ *
273
+ * @type {string}
274
+ * @memberof User
275
+ */
276
+ 'stripeCustomerId'?: string;
277
+ /**
278
+ *
279
+ * @type {string}
280
+ * @memberof User
281
+ */
282
+ 'phone'?: string;
283
+ /**
284
+ *
285
+ * @type {string}
286
+ * @memberof User
287
+ */
288
+ 'password': string;
289
+ /**
290
+ *
291
+ * @type {string}
292
+ * @memberof User
293
+ */
294
+ 'profilePicture'?: string;
295
+ /**
296
+ *
297
+ * @type {boolean}
298
+ * @memberof User
299
+ */
300
+ 'isAdmin'?: boolean;
301
+ }
302
+
303
+ /**
304
+ * AuthApi - axios parameter creator
305
+ * @export
306
+ */
307
+ export const AuthApiAxiosParamCreator = function (configuration?: Configuration) {
308
+ return {
309
+ /**
310
+ *
311
+ * @summary Register a new user
312
+ * @param {string} firstName
313
+ * @param {string} lastName
314
+ * @param {string} email
315
+ * @param {string} password
316
+ * @param {string} [username]
317
+ * @param {boolean} [isAccountVerified]
318
+ * @param {string} [level]
319
+ * @param {string} [stripeCustomerId]
320
+ * @param {string} [phone]
321
+ * @param {string} [profilePicture]
322
+ * @param {boolean} [isAdmin]
323
+ * @param {*} [options] Override http request option.
324
+ * @throws {RequiredError}
325
+ */
326
+ apiAuthRegisterPost: async (firstName: string, lastName: string, email: string, password: string, username?: string, isAccountVerified?: boolean, level?: string, stripeCustomerId?: string, phone?: string, profilePicture?: string, isAdmin?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
327
+ // verify required parameter 'firstName' is not null or undefined
328
+ assertParamExists('apiAuthRegisterPost', 'firstName', firstName)
329
+ // verify required parameter 'lastName' is not null or undefined
330
+ assertParamExists('apiAuthRegisterPost', 'lastName', lastName)
331
+ // verify required parameter 'email' is not null or undefined
332
+ assertParamExists('apiAuthRegisterPost', 'email', email)
333
+ // verify required parameter 'password' is not null or undefined
334
+ assertParamExists('apiAuthRegisterPost', 'password', password)
335
+ const localVarPath = `/api/auth/register`;
336
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
337
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
338
+ let baseOptions;
339
+ if (configuration) {
340
+ baseOptions = configuration.baseOptions;
341
+ }
342
+
343
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
344
+ const localVarHeaderParameter = {} as any;
345
+ const localVarQueryParameter = {} as any;
346
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
347
+
348
+
349
+ if (username !== undefined) {
350
+ localVarFormParams.append('username', username as any);
351
+ }
352
+
353
+ if (firstName !== undefined) {
354
+ localVarFormParams.append('firstName', firstName as any);
355
+ }
356
+
357
+ if (lastName !== undefined) {
358
+ localVarFormParams.append('lastName', lastName as any);
359
+ }
360
+
361
+ if (email !== undefined) {
362
+ localVarFormParams.append('email', email as any);
363
+ }
364
+
365
+ if (isAccountVerified !== undefined) {
366
+ localVarFormParams.append('isAccountVerified', String(isAccountVerified) as any);
367
+ }
368
+
369
+ if (level !== undefined) {
370
+ localVarFormParams.append('level', level as any);
371
+ }
372
+
373
+ if (stripeCustomerId !== undefined) {
374
+ localVarFormParams.append('stripeCustomerId', stripeCustomerId as any);
375
+ }
376
+
377
+ if (phone !== undefined) {
378
+ localVarFormParams.append('phone', phone as any);
379
+ }
380
+
381
+ if (password !== undefined) {
382
+ localVarFormParams.append('password', password as any);
383
+ }
384
+
385
+ if (profilePicture !== undefined) {
386
+ localVarFormParams.append('profilePicture', profilePicture as any);
387
+ }
388
+
389
+ if (isAdmin !== undefined) {
390
+ localVarFormParams.append('isAdmin', String(isAdmin) as any);
391
+ }
392
+
393
+
394
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
395
+
396
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
397
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
398
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
399
+ localVarRequestOptions.data = localVarFormParams;
400
+
401
+ return {
402
+ url: toPathString(localVarUrlObj),
403
+ options: localVarRequestOptions,
404
+ };
405
+ },
406
+ }
407
+ };
408
+
409
+ /**
410
+ * AuthApi - functional programming interface
411
+ * @export
412
+ */
413
+ export const AuthApiFp = function(configuration?: Configuration) {
414
+ const localVarAxiosParamCreator = AuthApiAxiosParamCreator(configuration)
415
+ return {
416
+ /**
417
+ *
418
+ * @summary Register a new user
419
+ * @param {string} firstName
420
+ * @param {string} lastName
421
+ * @param {string} email
422
+ * @param {string} password
423
+ * @param {string} [username]
424
+ * @param {boolean} [isAccountVerified]
425
+ * @param {string} [level]
426
+ * @param {string} [stripeCustomerId]
427
+ * @param {string} [phone]
428
+ * @param {string} [profilePicture]
429
+ * @param {boolean} [isAdmin]
430
+ * @param {*} [options] Override http request option.
431
+ * @throws {RequiredError}
432
+ */
433
+ async apiAuthRegisterPost(firstName: string, lastName: string, email: string, password: string, username?: string, isAccountVerified?: boolean, level?: string, stripeCustomerId?: string, phone?: string, profilePicture?: string, isAdmin?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<User>> {
434
+ const localVarAxiosArgs = await localVarAxiosParamCreator.apiAuthRegisterPost(firstName, lastName, email, password, username, isAccountVerified, level, stripeCustomerId, phone, profilePicture, isAdmin, options);
435
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
436
+ const localVarOperationServerBasePath = operationServerMap['AuthApi.apiAuthRegisterPost']?.[localVarOperationServerIndex]?.url;
437
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
438
+ },
439
+ }
440
+ };
441
+
442
+ /**
443
+ * AuthApi - factory interface
444
+ * @export
445
+ */
446
+ export const AuthApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
447
+ const localVarFp = AuthApiFp(configuration)
448
+ return {
449
+ /**
450
+ *
451
+ * @summary Register a new user
452
+ * @param {AuthApiApiAuthRegisterPostRequest} requestParameters Request parameters.
453
+ * @param {*} [options] Override http request option.
454
+ * @throws {RequiredError}
455
+ */
456
+ apiAuthRegisterPost(requestParameters: AuthApiApiAuthRegisterPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<User> {
457
+ return localVarFp.apiAuthRegisterPost(requestParameters.firstName, requestParameters.lastName, requestParameters.email, requestParameters.password, requestParameters.username, requestParameters.isAccountVerified, requestParameters.level, requestParameters.stripeCustomerId, requestParameters.phone, requestParameters.profilePicture, requestParameters.isAdmin, options).then((request) => request(axios, basePath));
458
+ },
459
+ };
460
+ };
461
+
462
+ /**
463
+ * Request parameters for apiAuthRegisterPost operation in AuthApi.
464
+ * @export
465
+ * @interface AuthApiApiAuthRegisterPostRequest
466
+ */
467
+ export interface AuthApiApiAuthRegisterPostRequest {
468
+ /**
469
+ *
470
+ * @type {string}
471
+ * @memberof AuthApiApiAuthRegisterPost
472
+ */
473
+ readonly firstName: string
474
+
475
+ /**
476
+ *
477
+ * @type {string}
478
+ * @memberof AuthApiApiAuthRegisterPost
479
+ */
480
+ readonly lastName: string
481
+
482
+ /**
483
+ *
484
+ * @type {string}
485
+ * @memberof AuthApiApiAuthRegisterPost
486
+ */
487
+ readonly email: string
488
+
489
+ /**
490
+ *
491
+ * @type {string}
492
+ * @memberof AuthApiApiAuthRegisterPost
493
+ */
494
+ readonly password: string
495
+
496
+ /**
497
+ *
498
+ * @type {string}
499
+ * @memberof AuthApiApiAuthRegisterPost
500
+ */
501
+ readonly username?: string
502
+
503
+ /**
504
+ *
505
+ * @type {boolean}
506
+ * @memberof AuthApiApiAuthRegisterPost
507
+ */
508
+ readonly isAccountVerified?: boolean
509
+
510
+ /**
511
+ *
512
+ * @type {string}
513
+ * @memberof AuthApiApiAuthRegisterPost
514
+ */
515
+ readonly level?: string
516
+
517
+ /**
518
+ *
519
+ * @type {string}
520
+ * @memberof AuthApiApiAuthRegisterPost
521
+ */
522
+ readonly stripeCustomerId?: string
523
+
524
+ /**
525
+ *
526
+ * @type {string}
527
+ * @memberof AuthApiApiAuthRegisterPost
528
+ */
529
+ readonly phone?: string
530
+
531
+ /**
532
+ *
533
+ * @type {string}
534
+ * @memberof AuthApiApiAuthRegisterPost
535
+ */
536
+ readonly profilePicture?: string
537
+
538
+ /**
539
+ *
540
+ * @type {boolean}
541
+ * @memberof AuthApiApiAuthRegisterPost
542
+ */
543
+ readonly isAdmin?: boolean
544
+ }
545
+
546
+ /**
547
+ * AuthApi - object-oriented interface
548
+ * @export
549
+ * @class AuthApi
550
+ * @extends {BaseAPI}
551
+ */
552
+ export class AuthApi extends BaseAPI {
553
+ /**
554
+ *
555
+ * @summary Register a new user
556
+ * @param {AuthApiApiAuthRegisterPostRequest} requestParameters Request parameters.
557
+ * @param {*} [options] Override http request option.
558
+ * @throws {RequiredError}
559
+ * @memberof AuthApi
560
+ */
561
+ public apiAuthRegisterPost(requestParameters: AuthApiApiAuthRegisterPostRequest, options?: RawAxiosRequestConfig) {
562
+ return AuthApiFp(this.configuration).apiAuthRegisterPost(requestParameters.firstName, requestParameters.lastName, requestParameters.email, requestParameters.password, requestParameters.username, requestParameters.isAccountVerified, requestParameters.level, requestParameters.stripeCustomerId, requestParameters.phone, requestParameters.profilePicture, requestParameters.isAdmin, options).then((request) => request(this.axios, this.basePath));
563
+ }
564
+ }
565
+
566
+
567
+
568
+ /**
569
+ * UsersApi - axios parameter creator
570
+ * @export
571
+ */
572
+ export const UsersApiAxiosParamCreator = function (configuration?: Configuration) {
573
+ return {
574
+ /**
575
+ *
576
+ * @summary Retrieve all users
577
+ * @param {*} [options] Override http request option.
578
+ * @throws {RequiredError}
579
+ */
580
+ apiUsersGet: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
581
+ const localVarPath = `/api/users`;
582
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
583
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
584
+ let baseOptions;
585
+ if (configuration) {
586
+ baseOptions = configuration.baseOptions;
587
+ }
588
+
589
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
590
+ const localVarHeaderParameter = {} as any;
591
+ const localVarQueryParameter = {} as any;
592
+
593
+
594
+
595
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
596
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
597
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
598
+
599
+ return {
600
+ url: toPathString(localVarUrlObj),
601
+ options: localVarRequestOptions,
602
+ };
603
+ },
604
+ }
605
+ };
606
+
607
+ /**
608
+ * UsersApi - functional programming interface
609
+ * @export
610
+ */
611
+ export const UsersApiFp = function(configuration?: Configuration) {
612
+ const localVarAxiosParamCreator = UsersApiAxiosParamCreator(configuration)
613
+ return {
614
+ /**
615
+ *
616
+ * @summary Retrieve all users
617
+ * @param {*} [options] Override http request option.
618
+ * @throws {RequiredError}
619
+ */
620
+ async apiUsersGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<User>>> {
621
+ const localVarAxiosArgs = await localVarAxiosParamCreator.apiUsersGet(options);
622
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
623
+ const localVarOperationServerBasePath = operationServerMap['UsersApi.apiUsersGet']?.[localVarOperationServerIndex]?.url;
624
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
625
+ },
626
+ }
627
+ };
628
+
629
+ /**
630
+ * UsersApi - factory interface
631
+ * @export
632
+ */
633
+ export const UsersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
634
+ const localVarFp = UsersApiFp(configuration)
635
+ return {
636
+ /**
637
+ *
638
+ * @summary Retrieve all users
639
+ * @param {*} [options] Override http request option.
640
+ * @throws {RequiredError}
641
+ */
642
+ apiUsersGet(options?: RawAxiosRequestConfig): AxiosPromise<Array<User>> {
643
+ return localVarFp.apiUsersGet(options).then((request) => request(axios, basePath));
644
+ },
645
+ };
646
+ };
647
+
648
+ /**
649
+ * UsersApi - object-oriented interface
650
+ * @export
651
+ * @class UsersApi
652
+ * @extends {BaseAPI}
653
+ */
654
+ export class UsersApi extends BaseAPI {
655
+ /**
656
+ *
657
+ * @summary Retrieve all users
658
+ * @param {*} [options] Override http request option.
659
+ * @throws {RequiredError}
660
+ * @memberof UsersApi
661
+ */
662
+ public apiUsersGet(options?: RawAxiosRequestConfig) {
663
+ return UsersApiFp(this.configuration).apiUsersGet(options).then((request) => request(this.axios, this.basePath));
664
+ }
665
+ }
666
+
667
+
668
+