export type CreateApiInboxThingUIDIgnoreArgs = {thingUID: string}; export type CreateApiInboxThingUIDIgnoreOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Flags a discovery result as ignored for further processing. * * POST /inbox/{thingUID}/ignore */ export const createApiInboxThingUIDIgnore = async (args: CreateApiInboxThingUIDIgnoreArgs, options: CreateApiInboxThingUIDIgnoreOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/inbox/${encodeURIComponent(String(args.thingUID))}/ignore${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 };