export type GetApiStrategyApyArgs = {all: boolean, strategy_id?: string | undefined}; export type GetApiStrategyApyOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /strategy/apy */ export const getApiStrategyApy = async (args: GetApiStrategyApyArgs, options?: GetApiStrategyApyOptions) => { const {baseUrl = "https://api.breeze.baby", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.all != null) query.append("all", String(args.all)) if (args.strategy_id != null) query.append("strategy_id", String(args.strategy_id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/strategy/apy${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };