export type DeleteApiProviderAuthorizationsIdArgs = {id: number}; export type DeleteApiProviderAuthorizationsIdOptions = {baseUrl?: string | undefined, userJwtRequired?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revoke iNat's authorization to access the user's account on this provider's service * * DELETE /provider_authorizations/{id} */ export const deleteApiProviderAuthorizationsId = async (args: DeleteApiProviderAuthorizationsIdArgs, options?: DeleteApiProviderAuthorizationsIdOptions) => { const {baseUrl = "https://api.inaturalist.org/v2", fetch: fetchFn = fetch, userJwtRequired} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (userJwtRequired !== undefined) headers.set("Authorization", userJwtRequired) const url = `${baseUrl.replace(/\/+$/, '')}/provider_authorizations/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };