export type IdentifierType = 'SUPPLIER_ID' | 'CUSTOMER_ID' | 'OWN_ID'; export type DeleteApiPublicV2SuppliersSitesIdentifiersArgs = {type: IdentifierType, id: string, source?: string | undefined}; export type DeleteApiPublicV2SuppliersSitesIdentifiersOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an identifier for a supplier * * DELETE /public/v2/suppliers/sites/identifiers */ export const deleteApiPublicV2SuppliersSitesIdentifiers = async (args: DeleteApiPublicV2SuppliersSitesIdentifiersArgs, options?: DeleteApiPublicV2SuppliersSitesIdentifiersOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.type != null) query.append("type", String(args.type)) if (args.id != null) query.append("id", String(args.id)) if (args.source != null) query.append("source", String(args.source)) if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v2/suppliers/sites/identifiers${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 (await res.json()) as unknown };