export type PublishInfo = {version_to?: string | undefined, status?: string | undefined, assigned_to?: string | undefined, ids?: Array | undefined, description?: string | undefined}; export type CreateApiRestGlossaryVersionPublishArgs = {version: string, body: PublishInfo}; export type CreateApiRestGlossaryVersionPublishOptions = {baseUrl?: string | undefined, apiKeyScheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Publish the specified glossary items into the associated production database * * POST /rest/glossary/{version}/publish */ export const createApiRestGlossaryVersionPublish = async (args: CreateApiRestGlossaryVersionPublishArgs, options?: CreateApiRestGlossaryVersionPublishOptions) => { 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/glossary/${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 };