/* 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 {
  AllThemeMediaResult,
  BaseItemDto,
  BaseItemDtoQueryResult,
  ItemCounts,
  ItemFields,
  LibraryOptionsResultDto,
  PostUpdatedMediaRequest,
  ProblemDetails,
  ThemeMediaResult,
} from '../models';
import {
    AllThemeMediaResultFromJSON,
    AllThemeMediaResultToJSON,
    BaseItemDtoFromJSON,
    BaseItemDtoToJSON,
    BaseItemDtoQueryResultFromJSON,
    BaseItemDtoQueryResultToJSON,
    ItemCountsFromJSON,
    ItemCountsToJSON,
    ItemFieldsFromJSON,
    ItemFieldsToJSON,
    LibraryOptionsResultDtoFromJSON,
    LibraryOptionsResultDtoToJSON,
    PostUpdatedMediaRequestFromJSON,
    PostUpdatedMediaRequestToJSON,
    ProblemDetailsFromJSON,
    ProblemDetailsToJSON,
    ThemeMediaResultFromJSON,
    ThemeMediaResultToJSON,
} from '../models';

export interface DeleteItemRequest {
    itemId: string;
}

export interface DeleteItemsRequest {
    ids?: Array<string>;
}

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

export interface GetCriticReviewsRequest {
    itemId: string;
}

export interface GetDownloadRequest {
    itemId: string;
}

export interface GetFileRequest {
    itemId: string;
}

export interface GetItemCountsRequest {
    userId?: string;
    isFavorite?: boolean;
}

export interface GetLibraryOptionsInfoRequest {
    libraryContentType?: string;
    isNewLibrary?: boolean;
}

export interface GetMediaFoldersRequest {
    isHidden?: boolean;
}

export interface GetSimilarAlbumsRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetSimilarArtistsRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetSimilarItemsRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetSimilarMoviesRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetSimilarShowsRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetSimilarTrailersRequest {
    itemId: string;
    excludeArtistIds?: Array<string>;
    userId?: string;
    limit?: number;
    fields?: Array<ItemFields>;
}

export interface GetThemeMediaRequest {
    itemId: string;
    userId?: string;
    inheritFromParent?: boolean;
}

export interface GetThemeSongsRequest {
    itemId: string;
    userId?: string;
    inheritFromParent?: boolean;
}

export interface GetThemeVideosRequest {
    itemId: string;
    userId?: string;
    inheritFromParent?: boolean;
}

export interface PostAddedMoviesRequest {
    tmdbId?: string;
    imdbId?: string;
}

export interface PostAddedSeriesRequest {
    tvdbId?: string;
}

export interface PostUpdatedMediaOperationRequest {
    postUpdatedMediaRequest: PostUpdatedMediaRequest;
}

export interface PostUpdatedMoviesRequest {
    tmdbId?: string;
    imdbId?: string;
}

export interface PostUpdatedSeriesRequest {
    tvdbId?: string;
}

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

    /**
     * Deletes an item from the library and filesystem.
     */
    async deleteItemRaw(requestParameters: DeleteItemRequest, 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 deleteItem.');
        }

        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: `/Items/{itemId}`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Deletes an item from the library and filesystem.
     */
    async deleteItem(requestParameters: DeleteItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.deleteItemRaw(requestParameters, initOverrides);
    }

    /**
     * Deletes items from the library and filesystem.
     */
    async deleteItemsRaw(requestParameters: DeleteItemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        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: `/Items`,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Deletes items from the library and filesystem.
     */
    async deleteItems(requestParameters: DeleteItemsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.deleteItemsRaw(requestParameters, initOverrides);
    }

    /**
     * Gets all parents of an item.
     */
    async getAncestorsRaw(requestParameters: GetAncestorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<BaseItemDto>>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getAncestors.');
        }

        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: `/Items/{itemId}/Ancestors`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets all parents of an item.
     */
    async getAncestors(requestParameters: GetAncestorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<BaseItemDto>> {
        const response = await this.getAncestorsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets critic review for an item.
     */
    async getCriticReviewsRaw(requestParameters: GetCriticReviewsRequest, 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 getCriticReviews.');
        }

        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: `/Items/{itemId}/CriticReviews`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets critic review for an item.
     */
    async getCriticReviews(requestParameters: GetCriticReviewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getCriticReviewsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Downloads item media.
     */
    async getDownloadRaw(requestParameters: GetDownloadRequest, 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 getDownload.');
        }

        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: `/Items/{itemId}/Download`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Downloads item media.
     */
    async getDownload(requestParameters: GetDownloadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getDownloadRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get the original file of an item.
     */
    async getFileRaw(requestParameters: GetFileRequest, 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 getFile.');
        }

        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: `/Items/{itemId}/File`.replace(`{${"itemId"}}`, encodeURIComponent(String(requestParameters.itemId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Get the original file of an item.
     */
    async getFile(requestParameters: GetFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getFileRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get item counts.
     */
    async getItemCountsRaw(requestParameters: GetItemCountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ItemCounts>> {
        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Get item counts.
     */
    async getItemCounts(requestParameters: GetItemCountsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ItemCounts> {
        const response = await this.getItemCountsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets the library options info.
     */
    async getLibraryOptionsInfoRaw(requestParameters: GetLibraryOptionsInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LibraryOptionsResultDto>> {
        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets the library options info.
     */
    async getLibraryOptionsInfo(requestParameters: GetLibraryOptionsInfoRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LibraryOptionsResultDto> {
        const response = await this.getLibraryOptionsInfoRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets all user media folders.
     */
    async getMediaFoldersRaw(requestParameters: GetMediaFoldersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets all user media folders.
     */
    async getMediaFolders(requestParameters: GetMediaFoldersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getMediaFoldersRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets a list of physical paths from virtual folders.
     */
    async getPhysicalPathsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>> {
        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: `/Library/PhysicalPaths`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets a list of physical paths from virtual folders.
     */
    async getPhysicalPaths(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>> {
        const response = await this.getPhysicalPathsRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarAlbumsRaw(requestParameters: GetSimilarAlbumsRequest, 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 getSimilarAlbums.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarAlbums(requestParameters: GetSimilarAlbumsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarAlbumsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarArtistsRaw(requestParameters: GetSimilarArtistsRequest, 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 getSimilarArtists.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarArtists(requestParameters: GetSimilarArtistsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarArtistsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarItemsRaw(requestParameters: GetSimilarItemsRequest, 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 getSimilarItems.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarItems(requestParameters: GetSimilarItemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarItemsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarMoviesRaw(requestParameters: GetSimilarMoviesRequest, 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 getSimilarMovies.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarMovies(requestParameters: GetSimilarMoviesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarMoviesRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarShowsRaw(requestParameters: GetSimilarShowsRequest, 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 getSimilarShows.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarShows(requestParameters: GetSimilarShowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarShowsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets similar items.
     */
    async getSimilarTrailersRaw(requestParameters: GetSimilarTrailersRequest, 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 getSimilarTrailers.');
        }

        const queryParameters: any = {};

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

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Gets similar items.
     */
    async getSimilarTrailers(requestParameters: GetSimilarTrailersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getSimilarTrailersRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get theme songs and videos for an item.
     */
    async getThemeMediaRaw(requestParameters: GetThemeMediaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AllThemeMediaResult>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getThemeMedia.');
        }

        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Get theme songs and videos for an item.
     */
    async getThemeMedia(requestParameters: GetThemeMediaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AllThemeMediaResult> {
        const response = await this.getThemeMediaRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get theme songs for an item.
     */
    async getThemeSongsRaw(requestParameters: GetThemeSongsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ThemeMediaResult>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getThemeSongs.');
        }

        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Get theme songs for an item.
     */
    async getThemeSongs(requestParameters: GetThemeSongsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ThemeMediaResult> {
        const response = await this.getThemeSongsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get theme videos for an item.
     */
    async getThemeVideosRaw(requestParameters: GetThemeVideosRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ThemeMediaResult>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getThemeVideos.');
        }

        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Get theme videos for an item.
     */
    async getThemeVideos(requestParameters: GetThemeVideosRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ThemeMediaResult> {
        const response = await this.getThemeVideosRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postAddedMoviesRaw(requestParameters: PostAddedMoviesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postAddedMovies(requestParameters: PostAddedMoviesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.postAddedMoviesRaw(requestParameters, initOverrides);
    }

    /**
     * Reports that new episodes of a series have been added by an external source.
     */
    async postAddedSeriesRaw(requestParameters: PostAddedSeriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Reports that new episodes of a series have been added by an external source.
     */
    async postAddedSeries(requestParameters: PostAddedSeriesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.postAddedSeriesRaw(requestParameters, initOverrides);
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postUpdatedMediaRaw(requestParameters: PostUpdatedMediaOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.postUpdatedMediaRequest === null || requestParameters.postUpdatedMediaRequest === undefined) {
            throw new runtime.RequiredError('postUpdatedMediaRequest','Required parameter requestParameters.postUpdatedMediaRequest was null or undefined when calling postUpdatedMedia.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        const response = await this.request({
            path: `/Library/Media/Updated`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: PostUpdatedMediaRequestToJSON(requestParameters.postUpdatedMediaRequest),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postUpdatedMedia(requestParameters: PostUpdatedMediaOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.postUpdatedMediaRaw(requestParameters, initOverrides);
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postUpdatedMoviesRaw(requestParameters: PostUpdatedMoviesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Reports that new movies have been added by an external source.
     */
    async postUpdatedMovies(requestParameters: PostUpdatedMoviesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.postUpdatedMoviesRaw(requestParameters, initOverrides);
    }

    /**
     * Reports that new episodes of a series have been added by an external source.
     */
    async postUpdatedSeriesRaw(requestParameters: PostUpdatedSeriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Reports that new episodes of a series have been added by an external source.
     */
    async postUpdatedSeries(requestParameters: PostUpdatedSeriesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.postUpdatedSeriesRaw(requestParameters, initOverrides);
    }

    /**
     * Starts a library scan.
     */
    async refreshLibraryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        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: `/Library/Refresh`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Starts a library scan.
     */
    async refreshLibrary(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.refreshLibraryRaw(initOverrides);
    }

}
