export type GetApiApiV2ChannelUuidSpotArgs = {uuid: string}; export type GetApiApiV2ChannelUuidSpotOptions = {baseUrl?: string | undefined, Hawk?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get channel spot rate * * GET /api/v2/channel/{uuid}/spot */ export const getApiApiV2ChannelUuidSpot = async (args: GetApiApiV2ChannelUuidSpotArgs, options?: GetApiApiV2ChannelUuidSpotOptions) => { const {baseUrl = "https://api.sandbox.bvnk.com", fetch: fetchFn = fetch, Hawk} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Hawk !== undefined) headers.set("Authorization", Hawk) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/channel/${encodeURIComponent(String(args.uuid))}/spot${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 };