import { Api, AUTHORIZATION_HEADER } from "@jellyfin/sdk"; import type { AxiosRequestConfig, AxiosResponse } from "axios"; import type { StreamyfinPluginConfig } from "@/utils/atoms/settings"; declare module "@jellyfin/sdk" { interface Api { get( url: string, config?: AxiosRequestConfig, ): Promise>; post( url: string, data: D, config?: AxiosRequestConfig, ): Promise>; delete( url: string, config?: AxiosRequestConfig, ): Promise>; getStreamyfinPluginConfig(): Promise>; } } Api.prototype.get = function ( url: string, config: AxiosRequestConfig = {}, ): Promise> { return this.axiosInstance.get(`${this.basePath}${url}`, { ...(config ?? {}), headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader }, }); }; Api.prototype.post = function ( url: string, data: D, config: AxiosRequestConfig, ): Promise> { return this.axiosInstance.post(`${this.basePath}${url}`, data, { ...(config || {}), headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader }, }); }; Api.prototype.delete = function ( url: string, config: AxiosRequestConfig, ): Promise> { return this.axiosInstance.delete(`${this.basePath}${url}`, { ...(config || {}), headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader }, }); }; Api.prototype.getStreamyfinPluginConfig = function (): Promise< AxiosResponse > { return this.get("/Streamyfin/config"); };