modelFilesUploadSingleFileWithHttpInfo method

Future<Response> modelFilesUploadSingleFileWithHttpInfo(
  1. String tenantId,
  2. String region,
  3. MultipartFile file,
  4. String assetName, {
  5. String segmentName,
  6. String revision,
  7. String status,
  8. int assetId,
  9. int modelId,
  10. String originalFilename,
})

A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing

Summary:A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing.
Uploads a model File, creating a new Asset and Model as required. The model is associated with the named asset. The Asset will be created if it does not exist.
On successful upload the model will be queued for processing..
Return Type: FileUploadResult

Note: This method returns the HTTP Response.

Parameters:

  • String tenantId (required): The unique Tenant ID (UUID or Identifier string)

  • String region (required): The data center region the data resides in

  • MultipartFile file (required): A model file in the correct format (IFC / IFCZip / Zip)

  • String assetName (required): The name of the asset to associate the model upload with.

  • String segmentName: The name of the asset segment to associate the model with. The segment will be created if not present. Defaults to the Model Name if undefined

  • String revision: A version identifier for the model.

  • String status: A status identifier for the model

  • int assetId: The ID of the asset to associate the model upload with. If not defined, a new asset will be created.

  • int modelId: The ID of the model to be populated with the data. If not defined, a new model will be created.

  • String originalFilename: The original filename of the model, for zipped models

Implementation

Future<Response> modelFilesUploadSingleFileWithHttpInfo(String tenantId, String region, MultipartFile file, String assetName, { String segmentName, String revision, String status, int assetId, int modelId, String originalFilename, }) async {
  // Verify required params are set.
  if (tenantId == null) {
   throw ApiException(HttpStatus.badRequest, 'Missing required param: tenantId');
  }
  if (region == null) {
   throw ApiException(HttpStatus.badRequest, 'Missing required param: region');
  }
  if (file == null) {
   throw ApiException(HttpStatus.badRequest, 'Missing required param: file');
  }
  if (assetName == null) {
   throw ApiException(HttpStatus.badRequest, 'Missing required param: assetName');
  }

  // ignore: prefer_const_declarations
  final path = r'/{region}/aim/2.0/{tenantId}/modelfiles/upload'
    .replaceAll('{tenantId}', tenantId)
    .replaceAll('{region}', region);

  // ignore: prefer_final_locals
  Object postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const authNames = <String>['oauth2'];
  const contentTypes = <String>['multipart/form-data'];

  bool hasFields = false;
  final mp = MultipartRequest('POST', Uri.parse(path));
  if (file != null) {
    hasFields = true;
    mp.fields[r'file'] = file.field;
    mp.files.add(file);
  }
  if (assetName != null) {
    hasFields = true;
    mp.fields[r'assetName'] = parameterToString(assetName);
  }
  if (segmentName != null) {
    hasFields = true;
    mp.fields[r'segmentName'] = parameterToString(segmentName);
  }
  if (revision != null) {
    hasFields = true;
    mp.fields[r'revision'] = parameterToString(revision);
  }
  if (status != null) {
    hasFields = true;
    mp.fields[r'status'] = parameterToString(status);
  }
  if (assetId != null) {
    hasFields = true;
    mp.fields[r'assetId'] = parameterToString(assetId);
  }
  if (modelId != null) {
    hasFields = true;
    mp.fields[r'modelId'] = parameterToString(modelId);
  }
  if (originalFilename != null) {
    hasFields = true;
    mp.fields[r'originalFilename'] = parameterToString(originalFilename);
  }
  if (hasFields) {
    postBody = mp;
  }

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes[0],
    authNames,
  );
}