export type CreateApiHubsHubHashIdProjectsProjectIdImportMetadataArgs = {fileName: string, 'Content-Length'?: number | undefined, dateFormat?: string | undefined, timeZoneId?: string | undefined, HubHashId: string, ProjectId: number}; export type CreateApiHubsHubHashIdProjectsProjectIdImportMetadataOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload metadata file * * POST /hubs/{HubHashId}/projects/{ProjectId}/import_metadata */ export const createApiHubsHubHashIdProjectsProjectIdImportMetadata = async (args: CreateApiHubsHubHashIdProjectsProjectIdImportMetadataArgs, options?: CreateApiHubsHubHashIdProjectsProjectIdImportMetadataOptions) => { const {baseUrl = "https://docs.bimtrackapp.co", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.fileName != null) headers.set("fileName", String(args.fileName)) if (args['Content-Length'] != null) headers.set("Content-Length", String(args['Content-Length'])) if (args.dateFormat != null) headers.set("dateFormat", String(args.dateFormat)) if (args.timeZoneId != null) headers.set("timeZoneId", String(args.timeZoneId)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/hubs/${encodeURIComponent(String(args.HubHashId))}/projects/${encodeURIComponent(String(args.ProjectId))}/import_metadata${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 };