export type SimulateYieldPayout = {id: string, type: 'SimulateYieldPayout', attributes: {amount: number}}; export type CreateApiApiV1SimulationYieldPayoutsArgs = {'Client-ID': string, Authorization: string, body: {data: SimulateYieldPayout}}; export type CreateApiApiV1SimulationYieldPayoutsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Simulate Float Revenue Payout * * POST /api/v1/simulation/yield-payouts */ export const createApiApiV1SimulationYieldPayouts = async (args: CreateApiApiV1SimulationYieldPayoutsArgs, options?: CreateApiApiV1SimulationYieldPayoutsOptions) => { const {baseUrl = "https://merchant-api.accruesavings.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") if (args['Client-ID'] != null) headers.set("Client-ID", String(args['Client-ID'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/simulation/yield-payouts${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 };