export type GetApiPublicV1NetworkTreeCommodityTreeIdCommodityGraphArgs = {commodityTreeId: number}; export type GetApiPublicV1NetworkTreeCommodityTreeIdCommodityGraphOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get commodity graph for a commodity tree * * GET /public/v1/network/tree/{commodityTreeId}/commodity-graph */ export const getApiPublicV1NetworkTreeCommodityTreeIdCommodityGraph = async (args: GetApiPublicV1NetworkTreeCommodityTreeIdCommodityGraphArgs, options?: GetApiPublicV1NetworkTreeCommodityTreeIdCommodityGraphOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/network/tree/${encodeURIComponent(String(args.commodityTreeId))}/commodity-graph${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 res.blob() };