export type QuickConnectState = 'Unavailable' | 'Available' | 'Active'; export type CreateApiQuickConnectAvailableArgs = {status?: QuickConnectState | undefined}; export type CreateApiQuickConnectAvailableOptions = {baseUrl?: string | undefined, CustomAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Enables or disables quick connect. * * POST /QuickConnect/Available */ export const createApiQuickConnectAvailable = async (args: CreateApiQuickConnectAvailableArgs, options?: CreateApiQuickConnectAvailableOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch, CustomAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.status != null) query.append("status", String(args.status)) if (CustomAuthentication !== undefined) headers.set("X-Emby-Authorization", CustomAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/QuickConnect/Available${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };