/* 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 {
  BaseItemDto,
  BaseItemDtoQueryResult,
  BaseItemKind,
  ImageType,
  ItemFields,
  ItemFilter,
  SortOrder,
} from '../models';
import {
    BaseItemDtoFromJSON,
    BaseItemDtoToJSON,
    BaseItemDtoQueryResultFromJSON,
    BaseItemDtoQueryResultToJSON,
    BaseItemKindFromJSON,
    BaseItemKindToJSON,
    ImageTypeFromJSON,
    ImageTypeToJSON,
    ItemFieldsFromJSON,
    ItemFieldsToJSON,
    ItemFilterFromJSON,
    ItemFilterToJSON,
    SortOrderFromJSON,
    SortOrderToJSON,
} from '../models';

export interface GetAlbumArtistsRequest {
    minCommunityRating?: number;
    startIndex?: number;
    limit?: number;
    searchTerm?: string;
    parentId?: string;
    fields?: Array<ItemFields>;
    excludeItemTypes?: Array<BaseItemKind>;
    includeItemTypes?: Array<BaseItemKind>;
    filters?: Array<ItemFilter>;
    isFavorite?: boolean;
    mediaTypes?: Array<string>;
    genres?: Array<string>;
    genreIds?: 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>;
    studioIds?: Array<string>;
    userId?: string;
    nameStartsWithOrGreater?: string;
    nameStartsWith?: string;
    nameLessThan?: string;
    sortBy?: Array<string>;
    sortOrder?: Array<SortOrder>;
    enableImages?: boolean;
    enableTotalRecordCount?: boolean;
}

export interface GetArtistByNameRequest {
    name: string;
    userId?: string;
}

export interface GetArtistsRequest {
    minCommunityRating?: number;
    startIndex?: number;
    limit?: number;
    searchTerm?: string;
    parentId?: string;
    fields?: Array<ItemFields>;
    excludeItemTypes?: Array<BaseItemKind>;
    includeItemTypes?: Array<BaseItemKind>;
    filters?: Array<ItemFilter>;
    isFavorite?: boolean;
    mediaTypes?: Array<string>;
    genres?: Array<string>;
    genreIds?: 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>;
    studioIds?: Array<string>;
    userId?: string;
    nameStartsWithOrGreater?: string;
    nameStartsWith?: string;
    nameLessThan?: string;
    sortBy?: Array<string>;
    sortOrder?: Array<SortOrder>;
    enableImages?: boolean;
    enableTotalRecordCount?: boolean;
}

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

    /**
     * Gets all album artists from a given item, folder, or the entire library.
     */
    async getAlbumArtistsRaw(requestParameters: GetAlbumArtistsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

        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.studioIds) {
            queryParameters['studioIds'] = requestParameters.studioIds;
        }

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

        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.sortBy) {
            queryParameters['sortBy'] = requestParameters.sortBy;
        }

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

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

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

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

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

    /**
     * Gets all album artists from a given item, folder, or the entire library.
     */
    async getAlbumArtists(requestParameters: GetAlbumArtistsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getAlbumArtistsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets an artist by name.
     */
    async getArtistByNameRaw(requestParameters: GetArtistByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDto>> {
        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getArtistByName.');
        }

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

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

    /**
     * Gets an artist by name.
     */
    async getArtistByName(requestParameters: GetArtistByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDto> {
        const response = await this.getArtistByNameRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Gets all artists from a given item, folder, or the entire library.
     */
    async getArtistsRaw(requestParameters: GetArtistsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

        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.studioIds) {
            queryParameters['studioIds'] = requestParameters.studioIds;
        }

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

        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.sortBy) {
            queryParameters['sortBy'] = requestParameters.sortBy;
        }

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

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

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

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

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

    /**
     * Gets all artists from a given item, folder, or the entire library.
     */
    async getArtists(requestParameters: GetArtistsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getArtistsRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
