export type GetApiV1PoliciesIdPdfUrlArgs = {'X-Organization-Id'?: string | undefined, id: string, versionId?: string | undefined}; export type GetApiV1PoliciesIdPdfUrlOptions = {baseUrl?: string | undefined, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get signed URL for policy PDF (alternate path) * * GET /v1/policies/{id}/pdf-url */ export const getApiV1PoliciesIdPdfUrl = async (args: GetApiV1PoliciesIdPdfUrlArgs, options?: GetApiV1PoliciesIdPdfUrlOptions) => { const {baseUrl = "https://api.betayum.com", fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Organization-Id'] != null) headers.set("X-Organization-Id", String(args['X-Organization-Id'])) if (args.versionId != null) query.append("versionId", String(args.versionId)) if (apikey !== undefined) headers.set("X-API-Key", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/policies/${encodeURIComponent(String(args.id))}/pdf-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 undefined };