/* 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,
  ProblemDetails,
  SpecialViewOptionDto,
} from '../models';
import {
    BaseItemDtoQueryResultFromJSON,
    BaseItemDtoQueryResultToJSON,
    ProblemDetailsFromJSON,
    ProblemDetailsToJSON,
    SpecialViewOptionDtoFromJSON,
    SpecialViewOptionDtoToJSON,
} from '../models';

export interface GetGroupingOptionsRequest {
    userId: string;
}

export interface GetUserViewsRequest {
    userId: string;
    includeExternalContent?: boolean;
    presetViews?: Array<string>;
    includeHidden?: boolean;
}

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

    /**
     * Get user view grouping options.
     */
    async getGroupingOptionsRaw(requestParameters: GetGroupingOptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SpecialViewOptionDto>>> {
        if (requestParameters.userId === null || requestParameters.userId === undefined) {
            throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getGroupingOptions.');
        }

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

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

    /**
     * Get user view grouping options.
     */
    async getGroupingOptions(requestParameters: GetGroupingOptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SpecialViewOptionDto>> {
        const response = await this.getGroupingOptionsRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get user views.
     */
    async getUserViewsRaw(requestParameters: GetUserViewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseItemDtoQueryResult>> {
        if (requestParameters.userId === null || requestParameters.userId === undefined) {
            throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserViews.');
        }

        const queryParameters: any = {};

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

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

    /**
     * Get user views.
     */
    async getUserViews(requestParameters: GetUserViewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseItemDtoQueryResult> {
        const response = await this.getUserViewsRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
