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

export interface GetMusicGenreRequest {
    genreName: string;
    userId?: string;
}

export interface GetMusicGenresRequest {
    startIndex?: number;
    limit?: number;
    searchTerm?: string;
    parentId?: string;
    fields?: Array<ItemFields>;
    excludeItemTypes?: Array<BaseItemKind>;
    includeItemTypes?: Array<BaseItemKind>;
    isFavorite?: boolean;
    imageTypeLimit?: number;
    enableImageTypes?: Array<ImageType>;
    userId?: string;
    nameStartsWithOrGreater?: string;
    nameStartsWith?: string;
    nameLessThan?: string;
    sortBy?: Array<string>;
    sortOrder?: Array<SortOrder>;
    enableImages?: boolean;
    enableTotalRecordCount?: boolean;
}

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

    /**
     * Gets a music genre, by name.
     */
    async getMusicGenreRaw(requestParameters: GetMusicGenreRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDto>> {
        if (requestParameters.genreName === null || requestParameters.genreName === undefined) {
            throw new runtime.RequiredError('genreName','Required parameter requestParameters.genreName was null or undefined when calling getMusicGenre.');
        }

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

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

    /**
     * Gets a music genre, by name.
     */
    async getMusicGenre(requestParameters: GetMusicGenreRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDto> {
        const response = await this.getMusicGenreRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

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

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

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

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

}
