File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @thatopen/services " : minor
3+ ---
4+
5+ Add ` EngineServicesClient.createHiddenFilesBatch() ` to upload many hidden files
6+ in a single request, for large 3D-tile sets (point clouds / gaussian splats)
7+ without hitting the per-file upload throttle. Exports the
8+ ` CreateHiddenItemsBatchResult ` type.
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818import { CreateItemResponse , UpdateItemResponse } from '../types/response' ;
1919import {
2020 CreateHiddenItemResult ,
21+ CreateHiddenItemsBatchResult ,
2122 HiddenFileEntity ,
2223 Metadata ,
2324} from '../types/files' ;
@@ -1181,6 +1182,30 @@ export class EngineServicesClient {
11811182 ) ;
11821183 }
11831184
1185+ /**
1186+ * Creates many hidden files attached to a parent item in a single request.
1187+ * Use this instead of many `createHiddenFile` calls when uploading large sets
1188+ * (e.g. 3D Tiles); upload in chunks of up to 100 files per call.
1189+ * @param files - The files to upload.
1190+ * @param parentFileId - The parent item's unique identifier.
1191+ * @returns One result per uploaded file, in order, each with its hidden file ID.
1192+ */
1193+ async createHiddenFilesBatch ( files : ( File | Blob ) [ ] , parentFileId : string ) {
1194+ const formData = new FormData ( ) ;
1195+ for ( const file of files ) {
1196+ formData . append ( 'files' , file ) ;
1197+ }
1198+ formData . append ( 'parentItemId' , parentFileId ) ;
1199+
1200+ return await this . #requestApi< CreateHiddenItemsBatchResult > (
1201+ 'POST' ,
1202+ `${ ITEM_PATH } /${ HIDDEN_PATH } /batch` ,
1203+ {
1204+ body : formData ,
1205+ } ,
1206+ ) ;
1207+ }
1208+
11841209 /**
11851210 * Deletes a hidden file by its ID.
11861211 * @param hiddenId - The hidden file's unique identifier.
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export type CreateHiddenItemResult = {
1313 hiddenFileId : string ;
1414} ;
1515
16+ export type CreateHiddenItemsBatchResult = {
17+ results : { originalName : string ; hiddenFileId : string } [ ] ;
18+ } ;
19+
1620export type MetadataValue = string | number | boolean | null ;
1721
1822export type Metadata = Record < string , MetadataValue > ;
You can’t perform that action at this time.
0 commit comments