/* tslint:disable */
/* eslint-disable */
/**
 * Jellyfin API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 10.8.9
 * 
 *
 * 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';

export interface GetUniversalAudioStreamRequest {
    itemId: string;
    container?: Array<string>;
    mediaSourceId?: string;
    deviceId?: string;
    userId?: string;
    audioCodec?: string;
    maxAudioChannels?: number;
    transcodingAudioChannels?: number;
    maxStreamingBitrate?: number;
    audioBitRate?: number;
    startTimeTicks?: number;
    transcodingContainer?: string;
    transcodingProtocol?: string;
    maxAudioSampleRate?: number;
    maxAudioBitDepth?: number;
    enableRemoteMedia?: boolean;
    breakOnNonKeyFrames?: boolean;
    enableRedirection?: boolean;
}

export interface HeadUniversalAudioStreamRequest {
    itemId: string;
    container?: Array<string>;
    mediaSourceId?: string;
    deviceId?: string;
    userId?: string;
    audioCodec?: string;
    maxAudioChannels?: number;
    transcodingAudioChannels?: number;
    maxStreamingBitrate?: number;
    audioBitRate?: number;
    startTimeTicks?: number;
    transcodingContainer?: string;
    transcodingProtocol?: string;
    maxAudioSampleRate?: number;
    maxAudioBitDepth?: number;
    enableRemoteMedia?: boolean;
    breakOnNonKeyFrames?: boolean;
    enableRedirection?: boolean;
}

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

    /**
     * Gets an audio stream.
     */
    async getUniversalAudioStreamRaw(requestParameters: GetUniversalAudioStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getUniversalAudioStream.');
        }

        const queryParameters: any = {};

        if (requestParameters.container) {
            queryParameters['container'] = requestParameters.container;
        }

        if (requestParameters.mediaSourceId !== undefined) {
            queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
        }

        if (requestParameters.deviceId !== undefined) {
            queryParameters['deviceId'] = requestParameters.deviceId;
        }

        if (requestParameters.userId !== undefined) {
            queryParameters['userId'] = requestParameters.userId;
        }

        if (requestParameters.audioCodec !== undefined) {
            queryParameters['audioCodec'] = requestParameters.audioCodec;
        }

        if (requestParameters.maxAudioChannels !== undefined) {
            queryParameters['maxAudioChannels'] = requestParameters.maxAudioChannels;
        }

        if (requestParameters.transcodingAudioChannels !== undefined) {
            queryParameters['transcodingAudioChannels'] = requestParameters.transcodingAudioChannels;
        }

        if (requestParameters.maxStreamingBitrate !== undefined) {
            queryParameters['maxStreamingBitrate'] = requestParameters.maxStreamingBitrate;
        }

        if (requestParameters.audioBitRate !== undefined) {
            queryParameters['audioBitRate'] = requestParameters.audioBitRate;
        }

        if (requestParameters.startTimeTicks !== undefined) {
            queryParameters['startTimeTicks'] = requestParameters.startTimeTicks;
        }

        if (requestParameters.transcodingContainer !== undefined) {
            queryParameters['transcodingContainer'] = requestParameters.transcodingContainer;
        }

        if (requestParameters.transcodingProtocol !== undefined) {
            queryParameters['transcodingProtocol'] = requestParameters.transcodingProtocol;
        }

        if (requestParameters.maxAudioSampleRate !== undefined) {
            queryParameters['maxAudioSampleRate'] = requestParameters.maxAudioSampleRate;
        }

        if (requestParameters.maxAudioBitDepth !== undefined) {
            queryParameters['maxAudioBitDepth'] = requestParameters.maxAudioBitDepth;
        }

        if (requestParameters.enableRemoteMedia !== undefined) {
            queryParameters['enableRemoteMedia'] = requestParameters.enableRemoteMedia;
        }

        if (requestParameters.breakOnNonKeyFrames !== undefined) {
            queryParameters['breakOnNonKeyFrames'] = requestParameters.breakOnNonKeyFrames;
        }

        if (requestParameters.enableRedirection !== undefined) {
            queryParameters['enableRedirection'] = requestParameters.enableRedirection;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
        }

        const response = await this.request({
            path: `/Audio/{itemId}/universal`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets an audio stream.
     */
    async getUniversalAudioStream(requestParameters: GetUniversalAudioStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getUniversalAudioStreamRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets an audio stream.
     */
    async headUniversalAudioStreamRaw(requestParameters: HeadUniversalAudioStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling headUniversalAudioStream.');
        }

        const queryParameters: any = {};

        if (requestParameters.container) {
            queryParameters['container'] = requestParameters.container;
        }

        if (requestParameters.mediaSourceId !== undefined) {
            queryParameters['mediaSourceId'] = requestParameters.mediaSourceId;
        }

        if (requestParameters.deviceId !== undefined) {
            queryParameters['deviceId'] = requestParameters.deviceId;
        }

        if (requestParameters.userId !== undefined) {
            queryParameters['userId'] = requestParameters.userId;
        }

        if (requestParameters.audioCodec !== undefined) {
            queryParameters['audioCodec'] = requestParameters.audioCodec;
        }

        if (requestParameters.maxAudioChannels !== undefined) {
            queryParameters['maxAudioChannels'] = requestParameters.maxAudioChannels;
        }

        if (requestParameters.transcodingAudioChannels !== undefined) {
            queryParameters['transcodingAudioChannels'] = requestParameters.transcodingAudioChannels;
        }

        if (requestParameters.maxStreamingBitrate !== undefined) {
            queryParameters['maxStreamingBitrate'] = requestParameters.maxStreamingBitrate;
        }

        if (requestParameters.audioBitRate !== undefined) {
            queryParameters['audioBitRate'] = requestParameters.audioBitRate;
        }

        if (requestParameters.startTimeTicks !== undefined) {
            queryParameters['startTimeTicks'] = requestParameters.startTimeTicks;
        }

        if (requestParameters.transcodingContainer !== undefined) {
            queryParameters['transcodingContainer'] = requestParameters.transcodingContainer;
        }

        if (requestParameters.transcodingProtocol !== undefined) {
            queryParameters['transcodingProtocol'] = requestParameters.transcodingProtocol;
        }

        if (requestParameters.maxAudioSampleRate !== undefined) {
            queryParameters['maxAudioSampleRate'] = requestParameters.maxAudioSampleRate;
        }

        if (requestParameters.maxAudioBitDepth !== undefined) {
            queryParameters['maxAudioBitDepth'] = requestParameters.maxAudioBitDepth;
        }

        if (requestParameters.enableRemoteMedia !== undefined) {
            queryParameters['enableRemoteMedia'] = requestParameters.enableRemoteMedia;
        }

        if (requestParameters.breakOnNonKeyFrames !== undefined) {
            queryParameters['breakOnNonKeyFrames'] = requestParameters.breakOnNonKeyFrames;
        }

        if (requestParameters.enableRedirection !== undefined) {
            queryParameters['enableRedirection'] = requestParameters.enableRedirection;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
        }

        const response = await this.request({
            path: `/Audio/{itemId}/universal`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'HEAD',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets an audio stream.
     */
    async headUniversalAudioStream(requestParameters: HeadUniversalAudioStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.headUniversalAudioStreamRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
