export type RefProgram = string; export type CreateApiTransfersAccountAccountIdentifierProgramProgramCodeActionRejectArgs = {AccountIdentifier: string, ProgramCode: RefProgram, body: {dryRun?: boolean | undefined, notes?: string | undefined, transfers?: Array | undefined}}; export type CreateApiTransfersAccountAccountIdentifierProgramProgramCodeActionRejectOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reject transfers * * POST /transfers/account/{AccountIdentifier}/program/{ProgramCode}/action/reject */ export const createApiTransfersAccountAccountIdentifierProgramProgramCodeActionReject = async (args: CreateApiTransfersAccountAccountIdentifierProgramProgramCodeActionRejectArgs, options?: CreateApiTransfersAccountAccountIdentifierProgramProgramCodeActionRejectOptions) => { const {baseUrl = "https://sandbox.preprod.connect.xpansiv.com/app/api/v1", fetch: fetchFn = fetch, bearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerToken !== undefined) headers.set('authorization', `Bearer ${bearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/transfers/account/${encodeURIComponent(String(args.AccountIdentifier))}/program/${encodeURIComponent(String(args.ProgramCode))}/action/reject${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };