/* tslint:disable */
/* eslint-disable */
/**
 * Scraper API
 * The scraping SaaS platform provides a RESTful API for developers to perform web scraping tasks. Users can submit scraping tasks, monitor task status, retrieve scraped data, and manage their account through the API.
 *
 * The version of the OpenAPI document: 1.0.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 {
  ErrorResponse,
  UserAccountCreateResponse,
  UserAccountUpdateRequest,
} from '../models/index';
import {
    ErrorResponseFromJSON,
    ErrorResponseToJSON,
    UserAccountCreateResponseFromJSON,
    UserAccountCreateResponseToJSON,
    UserAccountUpdateRequestFromJSON,
    UserAccountUpdateRequestToJSON,
} from '../models/index';

export interface AccountPutRequest {
    body: UserAccountUpdateRequest;
}

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

    /**
     * Updates the authenticated user\'s account.
     * Update user account
     */
    async accountPutRaw(requestParameters: AccountPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserAccountCreateResponse>> {
        if (requestParameters['body'] == null) {
            throw new runtime.RequiredError(
                'body',
                'Required parameter "body" was null or undefined when calling accountPut().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
        }

        const response = await this.request({
            path: `/account`,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UserAccountUpdateRequestToJSON(requestParameters['body']),
        }, initOverrides);

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

    /**
     * Updates the authenticated user\'s account.
     * Update user account
     */
    async accountPut(requestParameters: AccountPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserAccountCreateResponse> {
        const response = await this.accountPutRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
