export type TradingHoursDTO = {fri?: string | undefined, id?: number | undefined, mon?: string | undefined, name?: string | undefined, publicHolidays?: string | undefined, sat?: string | undefined, sun?: string | undefined, thu?: string | undefined, tue?: string | undefined, wed?: string | undefined}; export type CreateApiApiTradingHoursArgs = {body: TradingHoursDTO}; export type CreateApiApiTradingHoursOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * createTradingHours * * POST /api/trading-hours */ export const createApiApiTradingHours = async (args: CreateApiApiTradingHoursArgs, options: CreateApiApiTradingHoursOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/api/trading-hours${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 res.blob() };