mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Merge branch 'feat/401' of https://github.com/streamyfin/streamyfin into feat/401
This commit is contained in:
@@ -1,30 +1,46 @@
|
||||
import {Api, AUTHORIZATION_HEADER} from "@jellyfin/sdk";
|
||||
import {AxiosRequestConfig, AxiosResponse} from "axios";
|
||||
import {StreamyfinPluginConfig} from "@/utils/atoms/settings";
|
||||
import { Api, AUTHORIZATION_HEADER } from "@jellyfin/sdk";
|
||||
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
||||
import { StreamyfinPluginConfig } from "@/utils/atoms/settings";
|
||||
|
||||
declare module '@jellyfin/sdk' {
|
||||
declare module "@jellyfin/sdk" {
|
||||
interface Api {
|
||||
get<T, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<AxiosResponse<T>>
|
||||
post<T, D = any>(url: string, data: D, config?: AxiosRequestConfig<D>): Promise<AxiosResponse<T>>
|
||||
getStreamyfinPluginConfig(): Promise<AxiosResponse<StreamyfinPluginConfig>>
|
||||
get<T, D = any>(
|
||||
url: string,
|
||||
config?: AxiosRequestConfig<D>
|
||||
): Promise<AxiosResponse<T>>;
|
||||
post<T, D = any>(
|
||||
url: string,
|
||||
data: D,
|
||||
config?: AxiosRequestConfig<D>
|
||||
): Promise<AxiosResponse<T>>;
|
||||
getStreamyfinPluginConfig(): Promise<AxiosResponse<StreamyfinPluginConfig>>;
|
||||
}
|
||||
}
|
||||
|
||||
Api.prototype.get = function <T, D = any> (url: string, config: AxiosRequestConfig<D> = {}): Promise<AxiosResponse<T>> {
|
||||
return this.axiosInstance.get<T>(url, {
|
||||
...(config ?? {}),
|
||||
headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader }
|
||||
})
|
||||
}
|
||||
|
||||
Api.prototype.post = function <T, D = any> (url: string, data: D, config: AxiosRequestConfig<D>): Promise<AxiosResponse<T>> {
|
||||
Api.prototype.get = function <T, D = any>(
|
||||
url: string,
|
||||
config: AxiosRequestConfig<D> = {}
|
||||
): Promise<AxiosResponse<T>> {
|
||||
return this.axiosInstance.get<T>(`${this.basePath}${url}`, {
|
||||
...(config ?? {}),
|
||||
headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader },
|
||||
});
|
||||
};
|
||||
|
||||
Api.prototype.post = function <T, D = any>(
|
||||
url: string,
|
||||
data: D,
|
||||
config: AxiosRequestConfig<D>
|
||||
): Promise<AxiosResponse<T>> {
|
||||
return this.axiosInstance.post<T>(`${this.basePath}${url}`, {
|
||||
...(config || {}),
|
||||
data,
|
||||
headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader }}
|
||||
)
|
||||
}
|
||||
headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader },
|
||||
});
|
||||
};
|
||||
|
||||
Api.prototype.getStreamyfinPluginConfig = function (): Promise<AxiosResponse<StreamyfinPluginConfig>> {
|
||||
return this.get<StreamyfinPluginConfig>("/Streamyfin/config")
|
||||
}
|
||||
Api.prototype.getStreamyfinPluginConfig = function (): Promise<
|
||||
AxiosResponse<StreamyfinPluginConfig>
|
||||
> {
|
||||
return this.get<StreamyfinPluginConfig>("/Streamyfin/config");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user