export type GetApiItemsRemoteSearchImageArgs = {imageUrl: string, providerName: string}; export type GetApiItemsRemoteSearchImageOptions = {baseUrl?: string | undefined, CustomAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets a remote image. * * GET /Items/RemoteSearch/Image */ export const getApiItemsRemoteSearchImage = async (args: GetApiItemsRemoteSearchImageArgs, options?: GetApiItemsRemoteSearchImageOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch, CustomAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/*") if (args.imageUrl != null) query.append("imageUrl", String(args.imageUrl)) if (args.providerName != null) query.append("providerName", String(args.providerName)) if (CustomAuthentication !== undefined) headers.set("X-Emby-Authorization", CustomAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/Items/RemoteSearch/Image${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };