export type GetApiApiImagesPublicPublicResourceKeyArgs = {publicResourceKey: string, 'If-None-Match'?: string | undefined, 'Accept-Encoding'?: string | undefined}; export type GetApiApiImagesPublicPublicResourceKeyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/images/public/{publicResourceKey} */ export const getApiApiImagesPublicPublicResourceKey = async (args: GetApiApiImagesPublicPublicResourceKeyArgs, options?: GetApiApiImagesPublicPublicResourceKeyOptions) => { const {baseUrl = "https://demo.thingsboard.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/*") if (args['If-None-Match'] != null) headers.set("If-None-Match", String(args['If-None-Match'])) if (args['Accept-Encoding'] != null) headers.set("Accept-Encoding", String(args['Accept-Encoding'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/images/public/${encodeURIComponent(String(args.publicResourceKey))}${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() };