documentFilesUploadSingleFile method
Uploads a document file related to a specific model
Summary:Uploads a document file related to a specific model.
The document will be associated with the asset and model provided in the Form data parameters.
Return Type: FileUploadResult
Parameters:
-
String tenantId (required): The unique Tenant ID (UUID or Identifier string)
-
String region (required): The data center region the data resides in
-
MultipartFilefile (required): An arbitrary document which will get associated to the model or its parts. -
String documentName (required): The name of the Document
-
int assetId (required): Asset which should contain the document
-
int modelId (required): Asset model which should contain the document
-
String externalId: External identity of the document. This will be used for versioning.
Implementation
Future<FileUploadResult> documentFilesUploadSingleFile(String tenantId, String region, MultipartFile file, String documentName, int assetId, int modelId, { String externalId, }) async {
final response = await documentFilesUploadSingleFileWithHttpInfo(tenantId, region, file, documentName, assetId, modelId, externalId: externalId, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FileUploadResult',) as FileUploadResult;
}
return Future<FileUploadResult>.value();
}