export type GetApiMacroEconomicEventsByUidArgs = {uid: string}; export type GetApiMacroEconomicEventsByUidOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Chi tiết sự kiện theo uid (uid có dấu ":" nên truyền qua query string) * * GET /macro-economic/events/by-uid */ export const getApiMacroEconomicEventsByUid = async (args: GetApiMacroEconomicEventsByUidArgs, options?: GetApiMacroEconomicEventsByUidOptions) => { const {baseUrl = "https://api.fireant.vn", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.uid != null) query.append("uid", String(args.uid)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/macro-economic/events/by-uid${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 };