export type DeleteApiApiV21TokensTokenArgs = {token: string, 'Content-Type': string, Authorization: string}; export type DeleteApiApiV21TokensTokenOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Token * * DELETE /api/v2_1/tokens/{token} */ export const deleteApiApiV21TokensToken = async (args: DeleteApiApiV21TokensTokenArgs, options?: DeleteApiApiV21TokensTokenOptions) => { const {baseUrl = "https://secure.payu.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2_1/tokens/${encodeURIComponent(String(args.token))}${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 };