/* 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';
import type {
  BaseItemDtoQueryResult,
  EncodingContext,
  ProblemDetails,
  SubtitleDeliveryMethod,
} from '../models';
import {
    BaseItemDtoQueryResultFromJSON,
    BaseItemDtoQueryResultToJSON,
    EncodingContextFromJSON,
    EncodingContextToJSON,
    ProblemDetailsFromJSON,
    ProblemDetailsToJSON,
    SubtitleDeliveryMethodFromJSON,
    SubtitleDeliveryMethodToJSON,
} from '../models';

export interface DeleteAlternateSourcesRequest {
    itemId: string;
}

export interface GetAdditionalPartRequest {
    itemId: string;
    userId?: string;
}

export interface GetVideoStreamRequest {
    itemId: string;
    container?: string;
    _static?: boolean;
    params?: string;
    tag?: string;
    deviceProfileId?: string;
    playSessionId?: string;
    segmentContainer?: string;
    segmentLength?: number;
    minSegments?: number;
    mediaSourceId?: string;
    deviceId?: string;
    audioCodec?: string;
    enableAutoStreamCopy?: boolean;
    allowVideoStreamCopy?: boolean;
    allowAudioStreamCopy?: boolean;
    breakOnNonKeyFrames?: boolean;
    audioSampleRate?: number;
    maxAudioBitDepth?: number;
    audioBitRate?: number;
    audioChannels?: number;
    maxAudioChannels?: number;
    profile?: string;
    level?: string;
    framerate?: number;
    maxFramerate?: number;
    copyTimestamps?: boolean;
    startTimeTicks?: number;
    width?: number;
    height?: number;
    maxWidth?: number;
    maxHeight?: number;
    videoBitRate?: number;
    subtitleStreamIndex?: number;
    subtitleMethod?: SubtitleDeliveryMethod;
    maxRefFrames?: number;
    maxVideoBitDepth?: number;
    requireAvc?: boolean;
    deInterlace?: boolean;
    requireNonAnamorphic?: boolean;
    transcodingMaxAudioChannels?: number;
    cpuCoreLimit?: number;
    liveStreamId?: string;
    enableMpegtsM2TsMode?: boolean;
    videoCodec?: string;
    subtitleCodec?: string;
    transcodeReasons?: string;
    audioStreamIndex?: number;
    videoStreamIndex?: number;
    context?: EncodingContext;
    streamOptions?: { [key: string]: string; };
}

export interface GetVideoStreamByContainerRequest {
    itemId: string;
    container: string;
    _static?: boolean;
    params?: string;
    tag?: string;
    deviceProfileId?: string;
    playSessionId?: string;
    segmentContainer?: string;
    segmentLength?: number;
    minSegments?: number;
    mediaSourceId?: string;
    deviceId?: string;
    audioCodec?: string;
    enableAutoStreamCopy?: boolean;
    allowVideoStreamCopy?: boolean;
    allowAudioStreamCopy?: boolean;
    breakOnNonKeyFrames?: boolean;
    audioSampleRate?: number;
    maxAudioBitDepth?: number;
    audioBitRate?: number;
    audioChannels?: number;
    maxAudioChannels?: number;
    profile?: string;
    level?: string;
    framerate?: number;
    maxFramerate?: number;
    copyTimestamps?: boolean;
    startTimeTicks?: number;
    width?: number;
    height?: number;
    maxWidth?: number;
    maxHeight?: number;
    videoBitRate?: number;
    subtitleStreamIndex?: number;
    subtitleMethod?: SubtitleDeliveryMethod;
    maxRefFrames?: number;
    maxVideoBitDepth?: number;
    requireAvc?: boolean;
    deInterlace?: boolean;
    requireNonAnamorphic?: boolean;
    transcodingMaxAudioChannels?: number;
    cpuCoreLimit?: number;
    liveStreamId?: string;
    enableMpegtsM2TsMode?: boolean;
    videoCodec?: string;
    subtitleCodec?: string;
    transcodeReasons?: string;
    audioStreamIndex?: number;
    videoStreamIndex?: number;
    context?: EncodingContext;
    streamOptions?: { [key: string]: string; };
}

export interface HeadVideoStreamRequest {
    itemId: string;
    container?: string;
    _static?: boolean;
    params?: string;
    tag?: string;
    deviceProfileId?: string;
    playSessionId?: string;
    segmentContainer?: string;
    segmentLength?: number;
    minSegments?: number;
    mediaSourceId?: string;
    deviceId?: string;
    audioCodec?: string;
    enableAutoStreamCopy?: boolean;
    allowVideoStreamCopy?: boolean;
    allowAudioStreamCopy?: boolean;
    breakOnNonKeyFrames?: boolean;
    audioSampleRate?: number;
    maxAudioBitDepth?: number;
    audioBitRate?: number;
    audioChannels?: number;
    maxAudioChannels?: number;
    profile?: string;
    level?: string;
    framerate?: number;
    maxFramerate?: number;
    copyTimestamps?: boolean;
    startTimeTicks?: number;
    width?: number;
    height?: number;
    maxWidth?: number;
    maxHeight?: number;
    videoBitRate?: number;
    subtitleStreamIndex?: number;
    subtitleMethod?: SubtitleDeliveryMethod;
    maxRefFrames?: number;
    maxVideoBitDepth?: number;
    requireAvc?: boolean;
    deInterlace?: boolean;
    requireNonAnamorphic?: boolean;
    transcodingMaxAudioChannels?: number;
    cpuCoreLimit?: number;
    liveStreamId?: string;
    enableMpegtsM2TsMode?: boolean;
    videoCodec?: string;
    subtitleCodec?: string;
    transcodeReasons?: string;
    audioStreamIndex?: number;
    videoStreamIndex?: number;
    context?: EncodingContext;
    streamOptions?: { [key: string]: string; };
}

export interface HeadVideoStreamByContainerRequest {
    itemId: string;
    container: string;
    _static?: boolean;
    params?: string;
    tag?: string;
    deviceProfileId?: string;
    playSessionId?: string;
    segmentContainer?: string;
    segmentLength?: number;
    minSegments?: number;
    mediaSourceId?: string;
    deviceId?: string;
    audioCodec?: string;
    enableAutoStreamCopy?: boolean;
    allowVideoStreamCopy?: boolean;
    allowAudioStreamCopy?: boolean;
    breakOnNonKeyFrames?: boolean;
    audioSampleRate?: number;
    maxAudioBitDepth?: number;
    audioBitRate?: number;
    audioChannels?: number;
    maxAudioChannels?: number;
    profile?: string;
    level?: string;
    framerate?: number;
    maxFramerate?: number;
    copyTimestamps?: boolean;
    startTimeTicks?: number;
    width?: number;
    height?: number;
    maxWidth?: number;
    maxHeight?: number;
    videoBitRate?: number;
    subtitleStreamIndex?: number;
    subtitleMethod?: SubtitleDeliveryMethod;
    maxRefFrames?: number;
    maxVideoBitDepth?: number;
    requireAvc?: boolean;
    deInterlace?: boolean;
    requireNonAnamorphic?: boolean;
    transcodingMaxAudioChannels?: number;
    cpuCoreLimit?: number;
    liveStreamId?: string;
    enableMpegtsM2TsMode?: boolean;
    videoCodec?: string;
    subtitleCodec?: string;
    transcodeReasons?: string;
    audioStreamIndex?: number;
    videoStreamIndex?: number;
    context?: EncodingContext;
    streamOptions?: { [key: string]: string; };
}

export interface MergeVersionsRequest {
    ids: Array<string>;
}

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

    /**
     * Removes alternate video sources.
     */
    async deleteAlternateSourcesRaw(requestParameters: DeleteAlternateSourcesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling deleteAlternateSources.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Removes alternate video sources.
     */
    async deleteAlternateSources(requestParameters: DeleteAlternateSourcesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.deleteAlternateSourcesRaw(requestParameters, initOverrides);
    }

    /**
     * Gets additional parts for a video.
     */
    async getAdditionalPartRaw(requestParameters: GetAdditionalPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getAdditionalPart.');
        }

        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets additional parts for a video.
     */
    async getAdditionalPart(requestParameters: GetAdditionalPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getAdditionalPartRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets a video stream.
     */
    async getVideoStreamRaw(requestParameters: GetVideoStreamRequest, 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 getVideoStream.');
        }

        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets a video stream.
     */
    async getVideoStream(requestParameters: GetVideoStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getVideoStreamRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets a video stream.
     */
    async getVideoStreamByContainerRaw(requestParameters: GetVideoStreamByContainerRequest, 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 getVideoStreamByContainer.');
        }

        if (requestParameters.container === null || requestParameters.container === undefined) {
            throw new runtime.RequiredError('container','Required parameter requestParameters.container was null or undefined when calling getVideoStreamByContainer.');
        }

        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets a video stream.
     */
    async getVideoStreamByContainer(requestParameters: GetVideoStreamByContainerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getVideoStreamByContainerRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets a video stream.
     */
    async headVideoStreamRaw(requestParameters: HeadVideoStreamRequest, 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 headVideoStream.');
        }

        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets a video stream.
     */
    async headVideoStream(requestParameters: HeadVideoStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.headVideoStreamRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets a video stream.
     */
    async headVideoStreamByContainerRaw(requestParameters: HeadVideoStreamByContainerRequest, 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 headVideoStreamByContainer.');
        }

        if (requestParameters.container === null || requestParameters.container === undefined) {
            throw new runtime.RequiredError('container','Required parameter requestParameters.container was null or undefined when calling headVideoStreamByContainer.');
        }

        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets a video stream.
     */
    async headVideoStreamByContainer(requestParameters: HeadVideoStreamByContainerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.headVideoStreamByContainerRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Merges videos into a single record.
     */
    async mergeVersionsRaw(requestParameters: MergeVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.ids === null || requestParameters.ids === undefined) {
            throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling mergeVersions.');
        }

        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        const response = await this.request({
            path: `/Videos/MergeVersions`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Merges videos into a single record.
     */
    async mergeVersions(requestParameters: MergeVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.mergeVersionsRaw(requestParameters, initOverrides);
    }

}
