export type StringNoEdgeSpaces = string; export type CountryCodeForRequest = string; export type SubdivisionCodeForRequest = string; export type DeleteApiCoreEntityEntityIdMetadataArgs = {entity: 'accounts' | 'external-accounts' | 'files' | 'transactions' | 'users', entityId: string, 'If-Match'?: string | undefined, 'X-On-Behalf-Of'?: string | undefined, 'X-Uphold-User-Ip'?: (string | string) | undefined, 'X-Uphold-User-Agent'?: StringNoEdgeSpaces | undefined, 'X-Uphold-User-Origin'?: StringNoEdgeSpaces | undefined, 'X-Uphold-User-Country'?: CountryCodeForRequest | undefined, 'X-Uphold-User-Subdivision'?: SubdivisionCodeForRequest | undefined, 'X-Uphold-User-City'?: StringNoEdgeSpaces | undefined}; export type DeleteApiCoreEntityEntityIdMetadataOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete metadata * * DELETE /core/{entity}/{entityId}/metadata */ export const deleteApiCoreEntityEntityIdMetadata = async (args: DeleteApiCoreEntityEntityIdMetadataArgs, options?: DeleteApiCoreEntityEntityIdMetadataOptions) => { const {baseUrl = "https://api.enterprise.sandbox.uphold.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['If-Match'] != null) headers.set("If-Match", String(args['If-Match'])) if (args['X-On-Behalf-Of'] != null) headers.set("X-On-Behalf-Of", String(args['X-On-Behalf-Of'])) if (args['X-Uphold-User-Ip'] != null) headers.set("X-Uphold-User-Ip", String(args['X-Uphold-User-Ip'])) if (args['X-Uphold-User-Agent'] != null) headers.set("X-Uphold-User-Agent", String(args['X-Uphold-User-Agent'])) if (args['X-Uphold-User-Origin'] != null) headers.set("X-Uphold-User-Origin", String(args['X-Uphold-User-Origin'])) if (args['X-Uphold-User-Country'] != null) headers.set("X-Uphold-User-Country", String(args['X-Uphold-User-Country'])) if (args['X-Uphold-User-Subdivision'] != null) headers.set("X-Uphold-User-Subdivision", String(args['X-Uphold-User-Subdivision'])) if (args['X-Uphold-User-City'] != null) headers.set("X-Uphold-User-City", String(args['X-Uphold-User-City'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/core/${encodeURIComponent(String(args.entity))}/${encodeURIComponent(String(args.entityId))}/metadata${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 };