export type GetApiApiPvsThumbnailArgs = {pvUrl?: string | undefined}; export type GetApiApiPvsThumbnailOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /api/pvs/thumbnail */ export const getApiApiPvsThumbnail = async (args: GetApiApiPvsThumbnailArgs, options: GetApiApiPvsThumbnailOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.pvUrl != null) query.append("pvUrl", String(args.pvUrl)) const url = `${baseUrl.replace(/\/+$/, '')}/api/pvs/thumbnail${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 undefined };