/* 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 { AuthenticationInfoQueryResult, } from '../models'; import { AuthenticationInfoQueryResultFromJSON, AuthenticationInfoQueryResultToJSON, } from '../models'; export interface CreateKeyRequest { app: string; } export interface RevokeKeyRequest { key: string; } /** * */ export class ApiKeyApi extends runtime.BaseAPI { /** * Create a new api key. */ async createKeyRaw(requestParameters: CreateKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.app === null || requestParameters.app === undefined) { throw new runtime.RequiredError('app','Required parameter requestParameters.app was null or undefined when calling createKey.'); } const queryParameters: any = {}; if (requestParameters.app !== undefined) { queryParameters['app'] = requestParameters.app; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Auth/Keys`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Create a new api key. */ async createKey(requestParameters: CreateKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.createKeyRaw(requestParameters, initOverrides); } /** * Get all keys. */ async getKeysRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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: `/Auth/Keys`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AuthenticationInfoQueryResultFromJSON(jsonValue)); } /** * Get all keys. */ async getKeys(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getKeysRaw(initOverrides); return await response.value(); } /** * Remove an api key. */ async revokeKeyRaw(requestParameters: RevokeKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.key === null || requestParameters.key === undefined) { throw new runtime.RequiredError('key','Required parameter requestParameters.key was null or undefined when calling revokeKey.'); } 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: `/Auth/Keys/{key}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters.key))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Remove an api key. */ async revokeKey(requestParameters: RevokeKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.revokeKeyRaw(requestParameters, initOverrides); } }