export type PublishInfo = {version_to?: string | undefined, status?: string | undefined, assigned_to?: string | undefined, ids?: Array | undefined, description?: string | undefined}; export type CreateApiRestRxVersionPublishArgs = {version: string, body: PublishInfo}; export type CreateApiRestRxVersionPublishOptions = {baseUrl?: string | undefined, apiKeyScheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Publish the specified Rx entities into the associated production database * * POST /rest/rx/{version}/publish */ export const createApiRestRxVersionPublish = async (args: CreateApiRestRxVersionPublishArgs, options?: CreateApiRestRxVersionPublishOptions) => { const {baseUrl = "https://api.seer.cancer.gov", fetch: fetchFn = fetch, apiKeyScheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyScheme !== undefined) headers.set("X-SEERAPI-Key", apiKeyScheme) const url = `${baseUrl.replace(/\/+$/, '')}/rest/rx/${encodeURIComponent(String(args.version))}/publish${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };