export type DeleteApiV1CustomersCustomerIdAssociatedEntitiesIdArgs = {'X-API-Key'?: string | undefined, customerId: string, id: string}; export type DeleteApiV1CustomersCustomerIdAssociatedEntitiesIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an associated entity * * DELETE /v1/customers/{customerId}/associated_entities/{id} */ export const deleteApiV1CustomersCustomerIdAssociatedEntitiesId = async (args: DeleteApiV1CustomersCustomerIdAssociatedEntitiesIdArgs, options?: DeleteApiV1CustomersCustomerIdAssociatedEntitiesIdOptions) => { const {baseUrl = "https://sandbox.api.infinite.dev", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/customers/${encodeURIComponent(String(args.customerId))}/associated_entities/${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 };