/* 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,
  BaseItemKind,
  ImageType,
  ItemFields,
  ItemFilter,
  LocationType,
  SeriesStatus,
  SortOrder,
  VideoType,
} from '../models';
import {
    BaseItemDtoQueryResultFromJSON,
    BaseItemDtoQueryResultToJSON,
    BaseItemKindFromJSON,
    BaseItemKindToJSON,
    ImageTypeFromJSON,
    ImageTypeToJSON,
    ItemFieldsFromJSON,
    ItemFieldsToJSON,
    ItemFilterFromJSON,
    ItemFilterToJSON,
    LocationTypeFromJSON,
    LocationTypeToJSON,
    SeriesStatusFromJSON,
    SeriesStatusToJSON,
    SortOrderFromJSON,
    SortOrderToJSON,
    VideoTypeFromJSON,
    VideoTypeToJSON,
} from '../models';

export interface GetTrailersRequest {
    userId?: string;
    maxOfficialRating?: string;
    hasThemeSong?: boolean;
    hasThemeVideo?: boolean;
    hasSubtitles?: boolean;
    hasSpecialFeature?: boolean;
    hasTrailer?: boolean;
    adjacentTo?: string;
    parentIndexNumber?: number;
    hasParentalRating?: boolean;
    isHd?: boolean;
    is4K?: boolean;
    locationTypes?: Array<LocationType>;
    excludeLocationTypes?: Array<LocationType>;
    isMissing?: boolean;
    isUnaired?: boolean;
    minCommunityRating?: number;
    minCriticRating?: number;
    minPremiereDate?: Date;
    minDateLastSaved?: Date;
    minDateLastSavedForUser?: Date;
    maxPremiereDate?: Date;
    hasOverview?: boolean;
    hasImdbId?: boolean;
    hasTmdbId?: boolean;
    hasTvdbId?: boolean;
    isMovie?: boolean;
    isSeries?: boolean;
    isNews?: boolean;
    isKids?: boolean;
    isSports?: boolean;
    excludeItemIds?: Array<string>;
    startIndex?: number;
    limit?: number;
    recursive?: boolean;
    searchTerm?: string;
    sortOrder?: Array<SortOrder>;
    parentId?: string;
    fields?: Array<ItemFields>;
    excludeItemTypes?: Array<BaseItemKind>;
    filters?: Array<ItemFilter>;
    isFavorite?: boolean;
    mediaTypes?: Array<string>;
    imageTypes?: Array<ImageType>;
    sortBy?: Array<string>;
    isPlayed?: boolean;
    genres?: Array<string>;
    officialRatings?: Array<string>;
    tags?: Array<string>;
    years?: Array<number>;
    enableUserData?: boolean;
    imageTypeLimit?: number;
    enableImageTypes?: Array<ImageType>;
    person?: string;
    personIds?: Array<string>;
    personTypes?: Array<string>;
    studios?: Array<string>;
    artists?: Array<string>;
    excludeArtistIds?: Array<string>;
    artistIds?: Array<string>;
    albumArtistIds?: Array<string>;
    contributingArtistIds?: Array<string>;
    albums?: Array<string>;
    albumIds?: Array<string>;
    ids?: Array<string>;
    videoTypes?: Array<VideoType>;
    minOfficialRating?: string;
    isLocked?: boolean;
    isPlaceHolder?: boolean;
    hasOfficialRating?: boolean;
    collapseBoxSetItems?: boolean;
    minWidth?: number;
    minHeight?: number;
    maxWidth?: number;
    maxHeight?: number;
    is3D?: boolean;
    seriesStatus?: Array<SeriesStatus>;
    nameStartsWithOrGreater?: string;
    nameStartsWith?: string;
    nameLessThan?: string;
    studioIds?: Array<string>;
    genreIds?: Array<string>;
    enableTotalRecordCount?: boolean;
    enableImages?: boolean;
}

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

    /**
     * Finds movies and trailers similar to a given trailer.
     */
    async getTrailersRaw(requestParameters: GetTrailersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if (requestParameters.minPremiereDate !== undefined) {
            queryParameters['minPremiereDate'] = (requestParameters.minPremiereDate as any).toISOString();
        }

        if (requestParameters.minDateLastSaved !== undefined) {
            queryParameters['minDateLastSaved'] = (requestParameters.minDateLastSaved as any).toISOString();
        }

        if (requestParameters.minDateLastSavedForUser !== undefined) {
            queryParameters['minDateLastSavedForUser'] = (requestParameters.minDateLastSavedForUser as any).toISOString();
        }

        if (requestParameters.maxPremiereDate !== undefined) {
            queryParameters['maxPremiereDate'] = (requestParameters.maxPremiereDate as any).toISOString();
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        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`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Finds movies and trailers similar to a given trailer.
     */
    async getTrailers(requestParameters: GetTrailersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getTrailersRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
