/* 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 {
  MetadataRefreshMode,
  ProblemDetails,
} from '../models';
import {
    MetadataRefreshModeFromJSON,
    MetadataRefreshModeToJSON,
    ProblemDetailsFromJSON,
    ProblemDetailsToJSON,
} from '../models';

export interface RefreshItemRequest {
    itemId: string;
    metadataRefreshMode?: MetadataRefreshMode;
    imageRefreshMode?: MetadataRefreshMode;
    replaceAllMetadata?: boolean;
    replaceAllImages?: boolean;
}

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

    /**
     * Refreshes metadata for an item.
     */
    async refreshItemRaw(requestParameters: RefreshItemRequest, 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 refreshItem.');
        }

        const queryParameters: any = {};

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

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

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

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

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Refreshes metadata for an item.
     */
    async refreshItem(requestParameters: RefreshItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.refreshItemRaw(requestParameters, initOverrides);
    }

}
