export type DeleteApiPayoutLoadUserTokenArgs = {'Idempotency-Key'?: string | undefined, load_token: string}; export type DeleteApiPayoutLoadUserTokenOptions = {baseUrl?: string | undefined, AUTHORIZERNAME?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reverse a user load * * DELETE /payout/load/{user_token} * * Also accepts auth: api_key */ export const deleteApiPayoutLoadUserToken = async (args: DeleteApiPayoutLoadUserTokenArgs, options?: DeleteApiPayoutLoadUserTokenOptions) => { const {baseUrl = "https://api.masspay.io/v1.0.0", fetch: fetchFn = fetch, AUTHORIZERNAME} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (args.load_token != null) query.append("load_token", String(args.load_token)) if (AUTHORIZERNAME !== undefined) headers.set("Authorization", AUTHORIZERNAME) const url = `${baseUrl.replace(/\/+$/, '')}/payout/load/${encodeURIComponent(String(args.user_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 };