export type CreateApiAuthoringV1VersionsRestoreArgs = {projectId?: string | undefined}; export type CreateApiAuthoringV1VersionsRestoreOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Restore a versioned item - currently supported for content and assets. * * POST /authoring/v1/versions/restore */ export const createApiAuthoringV1VersionsRestore = async (args: CreateApiAuthoringV1VersionsRestoreArgs, options: CreateApiAuthoringV1VersionsRestoreOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.projectId != null) query.append("projectId", String(args.projectId)) const url = `${baseUrl.replace(/\/+$/, '')}/authoring/v1/versions/restore${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };