/* tslint:disable */
/* eslint-disable */
/**
 * HumanLayer Daemon REST API
 * REST API for HumanLayer daemon operations, providing session management, approval workflows, and real-time event streaming capabilities. 
 *
 * 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,
} from '../models/index';
import {
    ErrorResponseFromJSON,
    ErrorResponseToJSON,
} from '../models/index';

export interface ProxyAnthropicRequestRequest {
    sessionId: string;
    requestBody: { [key: string]: any; };
}

/**
 * ProxyManualApi - interface
 * 
 * @export
 * @interface ProxyManualApiInterface
 */
export interface ProxyManualApiInterface {
    /**
     * 
     * @summary Proxy Anthropic API requests for a session
     * @param {string} sessionId Session ID for per-session routing
     * @param {{ [key: string]: any; }} requestBody 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProxyManualApiInterface
     */
    proxyAnthropicRequestRaw(requestParameters: ProxyAnthropicRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>>;

    /**
     * Proxy Anthropic API requests for a session
     */
    proxyAnthropicRequest(requestParameters: ProxyAnthropicRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }>;

}

/**
 * 
 */
export class ProxyManualApi extends runtime.BaseAPI implements ProxyManualApiInterface {

    /**
     * Proxy Anthropic API requests for a session
     */
    async proxyAnthropicRequestRaw(requestParameters: ProxyAnthropicRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        if (requestParameters['sessionId'] == null) {
            throw new runtime.RequiredError(
                'sessionId',
                'Required parameter "sessionId" was null or undefined when calling proxyAnthropicRequest().'
            );
        }

        if (requestParameters['requestBody'] == null) {
            throw new runtime.RequiredError(
                'requestBody',
                'Required parameter "requestBody" was null or undefined when calling proxyAnthropicRequest().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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


        let urlPath = `/anthropic_proxy/{session_id}/v1/messages`;
        urlPath = urlPath.replace(`{${"session_id"}}`, encodeURIComponent(String(requestParameters['sessionId'])));

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

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

    /**
     * Proxy Anthropic API requests for a session
     */
    async proxyAnthropicRequest(requestParameters: ProxyAnthropicRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.proxyAnthropicRequestRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
