export type DeleteApiTrustedDestinationsTrustedDestinationIdArgs = {trustedDestinationId: string, ownerType?: string | undefined, ownerId?: string | undefined}; export type DeleteApiTrustedDestinationsTrustedDestinationIdOptions = {baseUrl?: string | undefined, ApiAccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Trusted Destination * * DELETE /trusted_destinations/{trustedDestinationId} */ export const deleteApiTrustedDestinationsTrustedDestinationId = async (args: DeleteApiTrustedDestinationsTrustedDestinationIdArgs, options?: DeleteApiTrustedDestinationsTrustedDestinationIdOptions) => { const {baseUrl = "https://api.anchorage-staging.com/v2", fetch: fetchFn = fetch, ApiAccessKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ownerType != null) query.append("ownerType", String(args.ownerType)) if (args.ownerId != null) query.append("ownerId", String(args.ownerId)) if (ApiAccessKey !== undefined) headers.set("Api-Access-Key", ApiAccessKey) const url = `${baseUrl.replace(/\/+$/, '')}/trusted_destinations/${encodeURIComponent(String(args.trustedDestinationId))}${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 };