/* tslint:disable */
/* eslint-disable */
/**
 * OmsorgCore.Api
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0
 * 
 *
 * 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 {
  ChangePasswordRequest,
  ForgotPasswordRequestRequest,
  ForgotPasswordRequestResponse,
  ForgotPasswordResetRequest,
  ForgotPasswordVerifyRequest,
  ForgotPasswordVerifyResponse,
  LoginRequest,
  LoginResponse,
  LogoutRequest,
  MeResponse,
  PasswordPolicyResponse,
  RefreshRequest,
} from '../models/index';
import {
    ChangePasswordRequestFromJSON,
    ChangePasswordRequestToJSON,
    ForgotPasswordRequestRequestFromJSON,
    ForgotPasswordRequestRequestToJSON,
    ForgotPasswordRequestResponseFromJSON,
    ForgotPasswordRequestResponseToJSON,
    ForgotPasswordResetRequestFromJSON,
    ForgotPasswordResetRequestToJSON,
    ForgotPasswordVerifyRequestFromJSON,
    ForgotPasswordVerifyRequestToJSON,
    ForgotPasswordVerifyResponseFromJSON,
    ForgotPasswordVerifyResponseToJSON,
    LoginRequestFromJSON,
    LoginRequestToJSON,
    LoginResponseFromJSON,
    LoginResponseToJSON,
    LogoutRequestFromJSON,
    LogoutRequestToJSON,
    MeResponseFromJSON,
    MeResponseToJSON,
    PasswordPolicyResponseFromJSON,
    PasswordPolicyResponseToJSON,
    RefreshRequestFromJSON,
    RefreshRequestToJSON,
} from '../models/index';

export interface ApiAuthChangePasswordPostRequest {
    changePasswordRequest?: ChangePasswordRequest;
}

export interface ApiAuthForgotPasswordRequestPostRequest {
    forgotPasswordRequestRequest?: ForgotPasswordRequestRequest;
}

export interface ApiAuthForgotPasswordResetPostRequest {
    forgotPasswordResetRequest?: ForgotPasswordResetRequest;
}

export interface ApiAuthForgotPasswordVerifyPostRequest {
    forgotPasswordVerifyRequest?: ForgotPasswordVerifyRequest;
}

export interface ApiAuthLoginPostRequest {
    loginRequest?: LoginRequest;
}

export interface ApiAuthLogoutPostRequest {
    logoutRequest?: LogoutRequest;
}

export interface ApiAuthRefreshPostRequest {
    refreshRequest?: RefreshRequest;
}

/**
 * 
 */
export class AuthApi extends runtime.BaseAPI {

    /**
     */
    async apiAuthChangePasswordPostRaw(requestParameters: ApiAuthChangePasswordPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/change-password`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ChangePasswordRequestToJSON(requestParameters['changePasswordRequest']),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async apiAuthChangePasswordPost(requestParameters: ApiAuthChangePasswordPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiAuthChangePasswordPostRaw(requestParameters, initOverrides);
    }

    /**
     */
    async apiAuthForgotPasswordRequestPostRaw(requestParameters: ApiAuthForgotPasswordRequestPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ForgotPasswordRequestResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/forgot-password/request`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ForgotPasswordRequestRequestToJSON(requestParameters['forgotPasswordRequestRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => ForgotPasswordRequestResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthForgotPasswordRequestPost(requestParameters: ApiAuthForgotPasswordRequestPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ForgotPasswordRequestResponse> {
        const response = await this.apiAuthForgotPasswordRequestPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiAuthForgotPasswordResetPostRaw(requestParameters: ApiAuthForgotPasswordResetPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/forgot-password/reset`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ForgotPasswordResetRequestToJSON(requestParameters['forgotPasswordResetRequest']),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async apiAuthForgotPasswordResetPost(requestParameters: ApiAuthForgotPasswordResetPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiAuthForgotPasswordResetPostRaw(requestParameters, initOverrides);
    }

    /**
     */
    async apiAuthForgotPasswordVerifyPostRaw(requestParameters: ApiAuthForgotPasswordVerifyPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ForgotPasswordVerifyResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/forgot-password/verify`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ForgotPasswordVerifyRequestToJSON(requestParameters['forgotPasswordVerifyRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => ForgotPasswordVerifyResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthForgotPasswordVerifyPost(requestParameters: ApiAuthForgotPasswordVerifyPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ForgotPasswordVerifyResponse> {
        const response = await this.apiAuthForgotPasswordVerifyPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiAuthLoginPostRaw(requestParameters: ApiAuthLoginPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LoginResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/login`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: LoginRequestToJSON(requestParameters['loginRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => LoginResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthLoginPost(requestParameters: ApiAuthLoginPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LoginResponse> {
        const response = await this.apiAuthLoginPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiAuthLogoutPostRaw(requestParameters: ApiAuthLogoutPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/logout`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: LogoutRequestToJSON(requestParameters['logoutRequest']),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async apiAuthLogoutPost(requestParameters: ApiAuthLogoutPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiAuthLogoutPostRaw(requestParameters, initOverrides);
    }

    /**
     */
    async apiAuthMeGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MeResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/me`;

        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => MeResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthMeGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MeResponse> {
        const response = await this.apiAuthMeGetRaw(initOverrides);
        return await response.value();
    }

    /**
     */
    async apiAuthPasswordPolicyGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PasswordPolicyResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/password-policy`;

        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => PasswordPolicyResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthPasswordPolicyGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PasswordPolicyResponse> {
        const response = await this.apiAuthPasswordPolicyGetRaw(initOverrides);
        return await response.value();
    }

    /**
     */
    async apiAuthRefreshPostRaw(requestParameters: ApiAuthRefreshPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LoginResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/auth/refresh`;

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: RefreshRequestToJSON(requestParameters['refreshRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => LoginResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiAuthRefreshPost(requestParameters: ApiAuthRefreshPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LoginResponse> {
        const response = await this.apiAuthRefreshPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
