attributesChangeDataTypeByAssetmodelidAndDefinitionidAndTenantidWithHttpInfo method
Change the underlying data type for the attribute, migrating any existing data where possible
Summary:Change the underlying data type for the attribute, migrating any existing data where possible.
This operation will attempt to generate new typed data values from the current value. Note this may result in an empty value if no conversion can be made - however the original values will be kept allowing the process to be reversed, so this is not permanently lossy.
E.g. converting Text value '15' to a Real or Integer will produce expected results, but an original value of 'FIVE' would fail to parse.
Equally, some conversions make little sense, such as Logical converting to Date, and will be rejected..
Return Type: ODataResponseOfBoolean
For more information about OData responses link.
Note: This method returns the HTTP Response.
Parameters:
Implementation
Future<Response> attributesChangeDataTypeByAssetmodelidAndDefinitionidAndTenantidWithHttpInfo(int assetModelId, int definitionId, String dataType, String tenantId, String region,) async {
// Verify required params are set.
if (assetModelId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: assetModelId');
}
if (definitionId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: definitionId');
}
if (dataType == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: dataType');
}
if (tenantId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: tenantId');
}
if (region == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: region');
}
// ignore: prefer_const_declarations
final path = r'/{region}/aim/2.0/{tenantId}/Attributes(AssetModelId={assetModelId},AttributeDefinitionId={definitionId})/ChangeDataType()'
.replaceAll('{assetModelId}', assetModelId.toString())
.replaceAll('{definitionId}', definitionId.toString())
.replaceAll('{tenantId}', tenantId)
.replaceAll('{region}', region);
// ignore: prefer_final_locals
Object postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
queryParams.addAll(_convertParametersForCollectionFormat('', 'dataType', dataType));
const authNames = <String>['oauth2'];
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes[0],
authNames,
);
}