/* tslint:disable */
/* eslint-disable */
/**
 * Montelo
 * Documentation for the Montelo API.
 *
 * 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 {
  SubscriptionDto,
} from '../models/index';
import {
    SubscriptionDtoFromJSON,
    SubscriptionDtoToJSON,
} from '../models/index';

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

    /**
     */
    async paymentControllerCreateCheckoutSessionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<object>> {
        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}`;
            }
        }
        const response = await this.request({
            path: `/payment/checkout`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

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

    /**
     */
    async paymentControllerCreateCustomerRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<object>> {
        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}`;
            }
        }
        const response = await this.request({
            path: `/payment/customer`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

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

    /**
     */
    async paymentControllerGetUserSubscriptionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionDto>> {
        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}`;
            }
        }
        const response = await this.request({
            path: `/payment/subscription`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

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

}
