modelsSupercedeByKeyAndTenantidWithHttpInfo method
Supercede an existing model with a new version
Summary:Supercede an existing model with a new version.
Return Type: FileUploadResult
Note: This method returns the HTTP Response.
Parameters:
-
int key (required): The ID of the model to supercede.
-
String tenantId (required): The unique Tenant ID (UUID or Identifier string)
-
String region (required): The data center region the data resides in
-
MultipartFilefile (required): A model file in the correct format (IFC / IFCZip / Zip) -
String revision: A version identifier for the model.
-
String status: A status identifier for the model
-
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> modelsSupercedeByKeyAndTenantidWithHttpInfo(int key, String tenantId, String region, MultipartFile file, { String revision, String status, int modelId, String originalFilename, }) async {
// Verify required params are set.
if (key == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: key');
}
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');
}
// ignore: prefer_const_declarations
final path = r'/{region}/aim/2.0/{tenantId}/Models({key})/Supercede()'
.replaceAll('{key}', key.toString())
.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 (revision != null) {
hasFields = true;
mp.fields[r'revision'] = parameterToString(revision);
}
if (status != null) {
hasFields = true;
mp.fields[r'status'] = parameterToString(status);
}
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,
);
}