/* 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 {
  ApplySearchCriteriaRequest,
  ExternalIdInfo,
  GetBookRemoteSearchResultsRequest,
  GetBoxSetRemoteSearchResultsRequest,
  GetMovieRemoteSearchResultsRequest,
  GetMusicAlbumRemoteSearchResultsRequest,
  GetMusicArtistRemoteSearchResultsRequest,
  GetMusicVideoRemoteSearchResultsRequest,
  GetPersonRemoteSearchResultsRequest,
  GetSeriesRemoteSearchResultsRequest,
  GetTrailerRemoteSearchResultsRequest,
  ProblemDetails,
  RemoteSearchResult,
} from '../models';
import {
    ApplySearchCriteriaRequestFromJSON,
    ApplySearchCriteriaRequestToJSON,
    ExternalIdInfoFromJSON,
    ExternalIdInfoToJSON,
    GetBookRemoteSearchResultsRequestFromJSON,
    GetBookRemoteSearchResultsRequestToJSON,
    GetBoxSetRemoteSearchResultsRequestFromJSON,
    GetBoxSetRemoteSearchResultsRequestToJSON,
    GetMovieRemoteSearchResultsRequestFromJSON,
    GetMovieRemoteSearchResultsRequestToJSON,
    GetMusicAlbumRemoteSearchResultsRequestFromJSON,
    GetMusicAlbumRemoteSearchResultsRequestToJSON,
    GetMusicArtistRemoteSearchResultsRequestFromJSON,
    GetMusicArtistRemoteSearchResultsRequestToJSON,
    GetMusicVideoRemoteSearchResultsRequestFromJSON,
    GetMusicVideoRemoteSearchResultsRequestToJSON,
    GetPersonRemoteSearchResultsRequestFromJSON,
    GetPersonRemoteSearchResultsRequestToJSON,
    GetSeriesRemoteSearchResultsRequestFromJSON,
    GetSeriesRemoteSearchResultsRequestToJSON,
    GetTrailerRemoteSearchResultsRequestFromJSON,
    GetTrailerRemoteSearchResultsRequestToJSON,
    ProblemDetailsFromJSON,
    ProblemDetailsToJSON,
    RemoteSearchResultFromJSON,
    RemoteSearchResultToJSON,
} from '../models';

export interface ApplySearchCriteriaOperationRequest {
    itemId: string;
    applySearchCriteriaRequest: ApplySearchCriteriaRequest;
    replaceAllImages?: boolean;
}

export interface GetBookRemoteSearchResultsOperationRequest {
    getBookRemoteSearchResultsRequest: GetBookRemoteSearchResultsRequest;
}

export interface GetBoxSetRemoteSearchResultsOperationRequest {
    getBoxSetRemoteSearchResultsRequest: GetBoxSetRemoteSearchResultsRequest;
}

export interface GetExternalIdInfosRequest {
    itemId: string;
}

export interface GetMovieRemoteSearchResultsOperationRequest {
    getMovieRemoteSearchResultsRequest: GetMovieRemoteSearchResultsRequest;
}

export interface GetMusicAlbumRemoteSearchResultsOperationRequest {
    getMusicAlbumRemoteSearchResultsRequest: GetMusicAlbumRemoteSearchResultsRequest;
}

export interface GetMusicArtistRemoteSearchResultsOperationRequest {
    getMusicArtistRemoteSearchResultsRequest: GetMusicArtistRemoteSearchResultsRequest;
}

export interface GetMusicVideoRemoteSearchResultsOperationRequest {
    getMusicVideoRemoteSearchResultsRequest: GetMusicVideoRemoteSearchResultsRequest;
}

export interface GetPersonRemoteSearchResultsOperationRequest {
    getPersonRemoteSearchResultsRequest: GetPersonRemoteSearchResultsRequest;
}

export interface GetSeriesRemoteSearchResultsOperationRequest {
    getSeriesRemoteSearchResultsRequest: GetSeriesRemoteSearchResultsRequest;
}

export interface GetTrailerRemoteSearchResultsOperationRequest {
    getTrailerRemoteSearchResultsRequest: GetTrailerRemoteSearchResultsRequest;
}

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

    /**
     * Applies search criteria to an item and refreshes metadata.
     */
    async applySearchCriteriaRaw(requestParameters: ApplySearchCriteriaOperationRequest, 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 applySearchCriteria.');
        }

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

        const queryParameters: any = {};

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Applies search criteria to an item and refreshes metadata.
     */
    async applySearchCriteria(requestParameters: ApplySearchCriteriaOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.applySearchCriteriaRaw(requestParameters, initOverrides);
    }

    /**
     * Get book remote search.
     */
    async getBookRemoteSearchResultsRaw(requestParameters: GetBookRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getBookRemoteSearchResultsRequest === null || requestParameters.getBookRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getBookRemoteSearchResultsRequest','Required parameter requestParameters.getBookRemoteSearchResultsRequest was null or undefined when calling getBookRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/Book`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetBookRemoteSearchResultsRequestToJSON(requestParameters.getBookRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get book remote search.
     */
    async getBookRemoteSearchResults(requestParameters: GetBookRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getBookRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get box set remote search.
     */
    async getBoxSetRemoteSearchResultsRaw(requestParameters: GetBoxSetRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getBoxSetRemoteSearchResultsRequest === null || requestParameters.getBoxSetRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getBoxSetRemoteSearchResultsRequest','Required parameter requestParameters.getBoxSetRemoteSearchResultsRequest was null or undefined when calling getBoxSetRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/BoxSet`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetBoxSetRemoteSearchResultsRequestToJSON(requestParameters.getBoxSetRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get box set remote search.
     */
    async getBoxSetRemoteSearchResults(requestParameters: GetBoxSetRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getBoxSetRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get the item\'s external id info.
     */
    async getExternalIdInfosRaw(requestParameters: GetExternalIdInfosRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ExternalIdInfo>>> {
        if (requestParameters.itemId === null || requestParameters.itemId === undefined) {
            throw new runtime.RequiredError('itemId','Required parameter requestParameters.itemId was null or undefined when calling getExternalIdInfos.');
        }

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

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

    /**
     * Get the item\'s external id info.
     */
    async getExternalIdInfos(requestParameters: GetExternalIdInfosRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ExternalIdInfo>> {
        const response = await this.getExternalIdInfosRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get movie remote search.
     */
    async getMovieRemoteSearchResultsRaw(requestParameters: GetMovieRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getMovieRemoteSearchResultsRequest === null || requestParameters.getMovieRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getMovieRemoteSearchResultsRequest','Required parameter requestParameters.getMovieRemoteSearchResultsRequest was null or undefined when calling getMovieRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/Movie`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetMovieRemoteSearchResultsRequestToJSON(requestParameters.getMovieRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get movie remote search.
     */
    async getMovieRemoteSearchResults(requestParameters: GetMovieRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getMovieRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get music album remote search.
     */
    async getMusicAlbumRemoteSearchResultsRaw(requestParameters: GetMusicAlbumRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getMusicAlbumRemoteSearchResultsRequest === null || requestParameters.getMusicAlbumRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getMusicAlbumRemoteSearchResultsRequest','Required parameter requestParameters.getMusicAlbumRemoteSearchResultsRequest was null or undefined when calling getMusicAlbumRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/MusicAlbum`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetMusicAlbumRemoteSearchResultsRequestToJSON(requestParameters.getMusicAlbumRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get music album remote search.
     */
    async getMusicAlbumRemoteSearchResults(requestParameters: GetMusicAlbumRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getMusicAlbumRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get music artist remote search.
     */
    async getMusicArtistRemoteSearchResultsRaw(requestParameters: GetMusicArtistRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getMusicArtistRemoteSearchResultsRequest === null || requestParameters.getMusicArtistRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getMusicArtistRemoteSearchResultsRequest','Required parameter requestParameters.getMusicArtistRemoteSearchResultsRequest was null or undefined when calling getMusicArtistRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/MusicArtist`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetMusicArtistRemoteSearchResultsRequestToJSON(requestParameters.getMusicArtistRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get music artist remote search.
     */
    async getMusicArtistRemoteSearchResults(requestParameters: GetMusicArtistRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getMusicArtistRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get music video remote search.
     */
    async getMusicVideoRemoteSearchResultsRaw(requestParameters: GetMusicVideoRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getMusicVideoRemoteSearchResultsRequest === null || requestParameters.getMusicVideoRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getMusicVideoRemoteSearchResultsRequest','Required parameter requestParameters.getMusicVideoRemoteSearchResultsRequest was null or undefined when calling getMusicVideoRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/MusicVideo`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetMusicVideoRemoteSearchResultsRequestToJSON(requestParameters.getMusicVideoRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get music video remote search.
     */
    async getMusicVideoRemoteSearchResults(requestParameters: GetMusicVideoRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getMusicVideoRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get person remote search.
     */
    async getPersonRemoteSearchResultsRaw(requestParameters: GetPersonRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getPersonRemoteSearchResultsRequest === null || requestParameters.getPersonRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getPersonRemoteSearchResultsRequest','Required parameter requestParameters.getPersonRemoteSearchResultsRequest was null or undefined when calling getPersonRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/Person`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetPersonRemoteSearchResultsRequestToJSON(requestParameters.getPersonRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get person remote search.
     */
    async getPersonRemoteSearchResults(requestParameters: GetPersonRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getPersonRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get series remote search.
     */
    async getSeriesRemoteSearchResultsRaw(requestParameters: GetSeriesRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getSeriesRemoteSearchResultsRequest === null || requestParameters.getSeriesRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getSeriesRemoteSearchResultsRequest','Required parameter requestParameters.getSeriesRemoteSearchResultsRequest was null or undefined when calling getSeriesRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/Series`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetSeriesRemoteSearchResultsRequestToJSON(requestParameters.getSeriesRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get series remote search.
     */
    async getSeriesRemoteSearchResults(requestParameters: GetSeriesRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getSeriesRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get trailer remote search.
     */
    async getTrailerRemoteSearchResultsRaw(requestParameters: GetTrailerRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RemoteSearchResult>>> {
        if (requestParameters.getTrailerRemoteSearchResultsRequest === null || requestParameters.getTrailerRemoteSearchResultsRequest === undefined) {
            throw new runtime.RequiredError('getTrailerRemoteSearchResultsRequest','Required parameter requestParameters.getTrailerRemoteSearchResultsRequest was null or undefined when calling getTrailerRemoteSearchResults.');
        }

        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: `/Items/RemoteSearch/Trailer`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GetTrailerRemoteSearchResultsRequestToJSON(requestParameters.getTrailerRemoteSearchResultsRequest),
        }, initOverrides);

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

    /**
     * Get trailer remote search.
     */
    async getTrailerRemoteSearchResults(requestParameters: GetTrailerRemoteSearchResultsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RemoteSearchResult>> {
        const response = await this.getTrailerRemoteSearchResultsRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
