/* 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 {
  EndPointInfo,
  LogFile,
  PublicSystemInfo,
  SystemInfo,
  WakeOnLanInfo,
} from '../models';
import {
    EndPointInfoFromJSON,
    EndPointInfoToJSON,
    LogFileFromJSON,
    LogFileToJSON,
    PublicSystemInfoFromJSON,
    PublicSystemInfoToJSON,
    SystemInfoFromJSON,
    SystemInfoToJSON,
    WakeOnLanInfoFromJSON,
    WakeOnLanInfoToJSON,
} from '../models';

export interface GetLogFileRequest {
    name: string;
}

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

    /**
     * Gets information about the request endpoint.
     */
    async getEndpointInfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EndPointInfo>> {
        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: `/System/Endpoint`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets information about the request endpoint.
     */
    async getEndpointInfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EndPointInfo> {
        const response = await this.getEndpointInfoRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets a log file.
     */
    async getLogFileRaw(requestParameters: GetLogFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getLogFile.');
        }

        const queryParameters: any = {};

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

        const headerParameters: runtime.HTTPHeaders = {};

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

        const response = await this.request({
            path: `/System/Logs/Log`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.BlobApiResponse(response);
    }

    /**
     * Gets a log file.
     */
    async getLogFile(requestParameters: GetLogFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
        const response = await this.getLogFileRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Pings the system.
     */
    async getPingSystemRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/System/Ping`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        if (this.isJsonMime(response.headers.get('content-type'))) {
            return new runtime.JSONApiResponse<string>(response);
        } else {
            return new runtime.TextApiResponse(response) as any;
        }
    }

    /**
     * Pings the system.
     */
    async getPingSystem(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
        const response = await this.getPingSystemRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets public information about the server.
     */
    async getPublicSystemInfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PublicSystemInfo>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/System/Info/Public`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets public information about the server.
     */
    async getPublicSystemInfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PublicSystemInfo> {
        const response = await this.getPublicSystemInfoRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets a list of available server log files.
     */
    async getServerLogsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<LogFile>>> {
        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: `/System/Logs`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets a list of available server log files.
     */
    async getServerLogs(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<LogFile>> {
        const response = await this.getServerLogsRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets information about the server.
     */
    async getSystemInfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SystemInfo>> {
        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: `/System/Info`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets information about the server.
     */
    async getSystemInfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SystemInfo> {
        const response = await this.getSystemInfoRaw(initOverrides);
        return await response.value();
    }

    /**
     * Gets wake on lan information.
     */
    async getWakeOnLanInfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<WakeOnLanInfo>>> {
        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: `/System/WakeOnLanInfo`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     * Gets wake on lan information.
     */
    async getWakeOnLanInfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<WakeOnLanInfo>> {
        const response = await this.getWakeOnLanInfoRaw(initOverrides);
        return await response.value();
    }

    /**
     * Pings the system.
     */
    async postPingSystemRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/System/Ping`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        if (this.isJsonMime(response.headers.get('content-type'))) {
            return new runtime.JSONApiResponse<string>(response);
        } else {
            return new runtime.TextApiResponse(response) as any;
        }
    }

    /**
     * Pings the system.
     */
    async postPingSystem(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
        const response = await this.postPingSystemRaw(initOverrides);
        return await response.value();
    }

    /**
     * Restarts the application.
     */
    async restartApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        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: `/System/Restart`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Restarts the application.
     */
    async restartApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.restartApplicationRaw(initOverrides);
    }

    /**
     * Shuts down the application.
     */
    async shutdownApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        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: `/System/Shutdown`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Shuts down the application.
     */
    async shutdownApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.shutdownApplicationRaw(initOverrides);
    }

}
