/* tslint:disable */ /* eslint-disable */ /** * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { RespGetPushNotifSettings, ResultCode, } from '../models/index'; import { RespGetPushNotifSettingsFromJSON, RespGetPushNotifSettingsToJSON, ResultCodeFromJSON, ResultCodeToJSON, } from '../models/index'; export interface PushnotifRegisterRequest { account_index: number; expo_token: string; platform: PushnotifRegisterPlatformEnum; auth?: string; app_version?: string; } export interface PushnotifSettingsGetRequest { account_index: number; expo_token: string; authorization?: string; auth?: string; } export interface PushnotifSettingsPostRequest { account_index: number; expo_token: string; enabled: boolean; auth?: string; } export interface PushnotifUnregisterRequest { account_index: number; expo_token: string; auth?: string; } /** * */ export class PushnotifApi extends runtime.BaseAPI { /** * Register device for push notifications * pushnotif_register */ async pushnotifRegisterRaw(requestParameters: PushnotifRegisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['account_index'] == null) { throw new runtime.RequiredError( 'account_index', 'Required parameter "account_index" was null or undefined when calling pushnotifRegister().' ); } if (requestParameters['expo_token'] == null) { throw new runtime.RequiredError( 'expo_token', 'Required parameter "expo_token" was null or undefined when calling pushnotifRegister().' ); } if (requestParameters['platform'] == null) { throw new runtime.RequiredError( 'platform', 'Required parameter "platform" was null or undefined when calling pushnotifRegister().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; const consumes: runtime.Consume[] = [ { contentType: 'multipart/form-data' }, ]; // @ts-ignore: canConsumeForm may be unused const canConsumeForm = runtime.canConsumeForm(consumes); let formParams: { append(param: string, value: any): any }; let useForm = false; if (useForm) { formParams = new FormData(); } else { formParams = new URLSearchParams(); } if (requestParameters['auth'] != null) { formParams.append('auth', requestParameters['auth'] as any); } if (requestParameters['account_index'] != null) { formParams.append('account_index', requestParameters['account_index'] as any); } if (requestParameters['expo_token'] != null) { formParams.append('expo_token', requestParameters['expo_token'] as any); } if (requestParameters['platform'] != null) { formParams.append('platform', requestParameters['platform'] as any); } if (requestParameters['app_version'] != null) { formParams.append('app_version', requestParameters['app_version'] as any); } const response = await this.request({ path: `/api/v1/pushnotif/register`, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue)); } /** * Register device for push notifications * pushnotif_register */ async pushnotifRegister(requestParameters: PushnotifRegisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.pushnotifRegisterRaw(requestParameters, initOverrides); return await response.value(); } /** * Get push notification settings * pushnotif_settings */ async pushnotifSettingsGetRaw(requestParameters: PushnotifSettingsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['account_index'] == null) { throw new runtime.RequiredError( 'account_index', 'Required parameter "account_index" was null or undefined when calling pushnotifSettingsGet().' ); } if (requestParameters['expo_token'] == null) { throw new runtime.RequiredError( 'expo_token', 'Required parameter "expo_token" was null or undefined when calling pushnotifSettingsGet().' ); } const queryParameters: any = {}; if (requestParameters['authorization'] != null) { queryParameters['authorization'] = requestParameters['authorization']; } if (requestParameters['auth'] != null) { queryParameters['auth'] = requestParameters['auth']; } if (requestParameters['account_index'] != null) { queryParameters['account_index'] = requestParameters['account_index']; } if (requestParameters['expo_token'] != null) { queryParameters['expo_token'] = requestParameters['expo_token']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ path: `/api/v1/pushnotif/settings`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RespGetPushNotifSettingsFromJSON(jsonValue)); } /** * Get push notification settings * pushnotif_settings */ async pushnotifSettingsGet(requestParameters: PushnotifSettingsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.pushnotifSettingsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Update push notification settings * pushnotif_settings */ async pushnotifSettingsPostRaw(requestParameters: PushnotifSettingsPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['account_index'] == null) { throw new runtime.RequiredError( 'account_index', 'Required parameter "account_index" was null or undefined when calling pushnotifSettingsPost().' ); } if (requestParameters['expo_token'] == null) { throw new runtime.RequiredError( 'expo_token', 'Required parameter "expo_token" was null or undefined when calling pushnotifSettingsPost().' ); } if (requestParameters['enabled'] == null) { throw new runtime.RequiredError( 'enabled', 'Required parameter "enabled" was null or undefined when calling pushnotifSettingsPost().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; const consumes: runtime.Consume[] = [ { contentType: 'multipart/form-data' }, ]; // @ts-ignore: canConsumeForm may be unused const canConsumeForm = runtime.canConsumeForm(consumes); let formParams: { append(param: string, value: any): any }; let useForm = false; if (useForm) { formParams = new FormData(); } else { formParams = new URLSearchParams(); } if (requestParameters['auth'] != null) { formParams.append('auth', requestParameters['auth'] as any); } if (requestParameters['account_index'] != null) { formParams.append('account_index', requestParameters['account_index'] as any); } if (requestParameters['expo_token'] != null) { formParams.append('expo_token', requestParameters['expo_token'] as any); } if (requestParameters['enabled'] != null) { formParams.append('enabled', requestParameters['enabled'] as any); } const response = await this.request({ path: `/api/v1/pushnotif/settings`, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue)); } /** * Update push notification settings * pushnotif_settings */ async pushnotifSettingsPost(requestParameters: PushnotifSettingsPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.pushnotifSettingsPostRaw(requestParameters, initOverrides); return await response.value(); } /** * Unregister device from push notifications * pushnotif_unregister */ async pushnotifUnregisterRaw(requestParameters: PushnotifUnregisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['account_index'] == null) { throw new runtime.RequiredError( 'account_index', 'Required parameter "account_index" was null or undefined when calling pushnotifUnregister().' ); } if (requestParameters['expo_token'] == null) { throw new runtime.RequiredError( 'expo_token', 'Required parameter "expo_token" was null or undefined when calling pushnotifUnregister().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; const consumes: runtime.Consume[] = [ { contentType: 'multipart/form-data' }, ]; // @ts-ignore: canConsumeForm may be unused const canConsumeForm = runtime.canConsumeForm(consumes); let formParams: { append(param: string, value: any): any }; let useForm = false; if (useForm) { formParams = new FormData(); } else { formParams = new URLSearchParams(); } if (requestParameters['auth'] != null) { formParams.append('auth', requestParameters['auth'] as any); } if (requestParameters['account_index'] != null) { formParams.append('account_index', requestParameters['account_index'] as any); } if (requestParameters['expo_token'] != null) { formParams.append('expo_token', requestParameters['expo_token'] as any); } const response = await this.request({ path: `/api/v1/pushnotif/unregister`, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue)); } /** * Unregister device from push notifications * pushnotif_unregister */ async pushnotifUnregister(requestParameters: PushnotifUnregisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.pushnotifUnregisterRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const PushnotifRegisterPlatformEnum = { Ios: 'ios', Android: 'android' } as const; export type PushnotifRegisterPlatformEnum = typeof PushnotifRegisterPlatformEnum[keyof typeof PushnotifRegisterPlatformEnum];