export type FeaturesDocumentsRenameDocumentRenameDocumentCommandRenameDocumentCommandBody = {name?: (string | null) | undefined}; export type CreateApiHubsHubHashIdProjectsProjectIdDocumentsDocumentIdRenameArgs = {DocumentId: string, HubHashId: string, ProjectId: number, body: FeaturesDocumentsRenameDocumentRenameDocumentCommandRenameDocumentCommandBody}; export type CreateApiHubsHubHashIdProjectsProjectIdDocumentsDocumentIdRenameOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rename document * * POST /hubs/{HubHashId}/projects/{ProjectId}/documents/{DocumentId}/rename */ export const createApiHubsHubHashIdProjectsProjectIdDocumentsDocumentIdRename = async (args: CreateApiHubsHubHashIdProjectsProjectIdDocumentsDocumentIdRenameArgs, options?: CreateApiHubsHubHashIdProjectsProjectIdDocumentsDocumentIdRenameOptions) => { const {baseUrl = "https://docs.bimtrackapp.co", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/hubs/${encodeURIComponent(String(args.HubHashId))}/projects/${encodeURIComponent(String(args.ProjectId))}/documents/${encodeURIComponent(String(args.DocumentId))}/rename${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 };