export type GetApiOrdersOrderIdPublicUrlArgs = {order_id: number}; export type GetApiOrdersOrderIdPublicUrlOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Order Public Page Url * * GET /orders/{order_id}/public-url */ export const getApiOrdersOrderIdPublicUrl = async (args: GetApiOrdersOrderIdPublicUrlArgs, options?: GetApiOrdersOrderIdPublicUrlOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.order_id))}/public-url${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 (await res.json()) as unknown };