@jugarhoy/api 1.0.2 → 1.0.3

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/apis/UsersApi.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
18
  CreateUserNotificationDto,
19
+ SavePushTokenRequest,
19
20
  Sport,
20
21
  UpdateUserNotificationDto,
21
22
  User,
@@ -28,6 +29,8 @@ import type {
28
29
  import {
29
30
  CreateUserNotificationDtoFromJSON,
30
31
  CreateUserNotificationDtoToJSON,
32
+ SavePushTokenRequestFromJSON,
33
+ SavePushTokenRequestToJSON,
31
34
  SportFromJSON,
32
35
  SportToJSON,
33
36
  UpdateUserNotificationDtoFromJSON,
@@ -71,6 +74,10 @@ export interface RemoveUserSportProfileRequest {
71
74
  sport: Sport;
72
75
  }
73
76
 
77
+ export interface SavePushTokenOperationRequest {
78
+ savePushTokenRequest: SavePushTokenRequest;
79
+ }
80
+
74
81
  export interface ToggleUserNotificationRequest {
75
82
  notificationId: string;
76
83
  }
@@ -393,6 +400,50 @@ export class UsersApi extends runtime.BaseAPI {
393
400
  return await response.value();
394
401
  }
395
402
 
403
+ /**
404
+ * Save or update push notification token for the current user
405
+ */
406
+ async savePushTokenRaw(requestParameters: SavePushTokenOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserNotificationDto>> {
407
+ if (requestParameters['savePushTokenRequest'] == null) {
408
+ throw new runtime.RequiredError(
409
+ 'savePushTokenRequest',
410
+ 'Required parameter "savePushTokenRequest" was null or undefined when calling savePushToken().'
411
+ );
412
+ }
413
+
414
+ const queryParameters: any = {};
415
+
416
+ const headerParameters: runtime.HTTPHeaders = {};
417
+
418
+ headerParameters['Content-Type'] = 'application/json';
419
+
420
+ if (this.configuration && this.configuration.accessToken) {
421
+ const token = this.configuration.accessToken;
422
+ const tokenString = await token("bearerAuth", []);
423
+
424
+ if (tokenString) {
425
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
426
+ }
427
+ }
428
+ const response = await this.request({
429
+ path: `/api/users/push-token`,
430
+ method: 'POST',
431
+ headers: headerParameters,
432
+ query: queryParameters,
433
+ body: SavePushTokenRequestToJSON(requestParameters['savePushTokenRequest']),
434
+ }, initOverrides);
435
+
436
+ return new runtime.JSONApiResponse(response, (jsonValue) => UserNotificationDtoFromJSON(jsonValue));
437
+ }
438
+
439
+ /**
440
+ * Save or update push notification token for the current user
441
+ */
442
+ async savePushToken(requestParameters: SavePushTokenOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserNotificationDto> {
443
+ const response = await this.savePushTokenRaw(requestParameters, initOverrides);
444
+ return await response.value();
445
+ }
446
+
396
447
  /**
397
448
  * Toggle the enabled state of a notification preference
398
449
  */
@@ -0,0 +1,66 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Jugar Hoy - API
5
+ * API documentation for Jugar Hoy application
6
+ *
7
+ * The version of the OpenAPI document: 1.5.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
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface SavePushTokenRequest
20
+ */
21
+ export interface SavePushTokenRequest {
22
+ /**
23
+ * The Expo push token to save
24
+ * @type {string}
25
+ * @memberof SavePushTokenRequest
26
+ */
27
+ token: string;
28
+ }
29
+
30
+ /**
31
+ * Check if a given object implements the SavePushTokenRequest interface.
32
+ */
33
+ export function instanceOfSavePushTokenRequest(value: object): value is SavePushTokenRequest {
34
+ if (!('token' in value) || value['token'] === undefined) return false;
35
+ return true;
36
+ }
37
+
38
+ export function SavePushTokenRequestFromJSON(json: any): SavePushTokenRequest {
39
+ return SavePushTokenRequestFromJSONTyped(json, false);
40
+ }
41
+
42
+ export function SavePushTokenRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SavePushTokenRequest {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+
48
+ 'token': json['token'],
49
+ };
50
+ }
51
+
52
+ export function SavePushTokenRequestToJSON(json: any): SavePushTokenRequest {
53
+ return SavePushTokenRequestToJSONTyped(json, false);
54
+ }
55
+
56
+ export function SavePushTokenRequestToJSONTyped(value?: SavePushTokenRequest | null, ignoreDiscriminator: boolean = false): any {
57
+ if (value == null) {
58
+ return value;
59
+ }
60
+
61
+ return {
62
+
63
+ 'token': value['token'],
64
+ };
65
+ }
66
+
package/models/index.ts CHANGED
@@ -123,6 +123,7 @@ export * from './ReserveDto';
123
123
  export * from './ReserveSlotDto';
124
124
  export * from './ReserveStatus';
125
125
  export * from './ReserveType';
126
+ export * from './SavePushTokenRequest';
126
127
  export * from './SearchClubs400Response';
127
128
  export * from './SearchClubs500Response';
128
129
  export * from './SetAuthCodeDto';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jugarhoy/api",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "TypeScript SDK for Jugar Hoy API",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",