sparesAddDocumentByAssetmodelidAndEntityidAndTenantidWithHttpInfo method
Future<Response>
sparesAddDocumentByAssetmodelidAndEntityidAndTenantidWithHttpInfo(
- int assetModelId,
- int entityId,
- String tenantId,
- String region,
- DocumentCreate document,
Adds a new document to a model entity
Summary:Adds a new document to a model entity.
Return Type: Document
Note: This method returns the HTTP Response.
Parameters:
-
int assetModelId (required): The model Id
-
int entityId (required): The unique identifier for the target entity (Entity Label)
-
String tenantId (required): The unique Tenant ID (UUID or Identifier string)
-
String region (required): The data center region the data resides in
-
DocumentCreate document (required): A document to create
Implementation
Future<Response> sparesAddDocumentByAssetmodelidAndEntityidAndTenantidWithHttpInfo(int assetModelId, int entityId, String tenantId, String region, DocumentCreate document,) async {
// Verify required params are set.
if (assetModelId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: assetModelId');
}
if (entityId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: entityId');
}
if (tenantId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: tenantId');
}
if (region == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: region');
}
if (document == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: document');
}
// ignore: prefer_const_declarations
final path = r'/{region}/aim/2.0/{tenantId}/Spares(AssetModelId={assetModelId}, EntityId={entityId})/DocumentEntities'
.replaceAll('{assetModelId}', assetModelId.toString())
.replaceAll('{entityId}', entityId.toString())
.replaceAll('{tenantId}', tenantId)
.replaceAll('{region}', region);
// ignore: prefer_final_locals
Object postBody = document;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const authNames = <String>['oauth2'];
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes[0],
authNames,
);
}