export type FeaturesSharesShareDocumentsShareDocumentsCommandSharedDocument = {id?: (string | null) | undefined, revisionId?: (string | null) | undefined}; export type BIMOneBIMTrackDocumentControlDataEntitiesSharePurpose = 1 | 2; export type FeaturesSharesShareDocumentsShareDocumentsCommandShareDocumentsCommandBody = {emails?: (Array | null) | undefined, remark?: (string | null) | undefined, documents?: (Array | null) | undefined, name?: (string | null) | undefined, sharePurpose?: BIMOneBIMTrackDocumentControlDataEntitiesSharePurpose | undefined}; export type CreateApiHubsHubHashIdProjectsProjectIdShareArgs = {HubHashId: string, ProjectId: number, body: FeaturesSharesShareDocumentsShareDocumentsCommandShareDocumentsCommandBody}; export type CreateApiHubsHubHashIdProjectsProjectIdShareOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Share documents * * POST /hubs/{HubHashId}/projects/{ProjectId}/share */ export const createApiHubsHubHashIdProjectsProjectIdShare = async (args: CreateApiHubsHubHashIdProjectsProjectIdShareArgs, options?: CreateApiHubsHubHashIdProjectsProjectIdShareOptions) => { 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))}/share${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 };