updateEntity method

Future<UpdateEntityResponse> updateEntity({
  1. required String entityId,
  2. required String workspaceId,
  3. Map<String, ComponentUpdateRequest>? componentUpdates,
  4. Map<String, CompositeComponentUpdateRequest>? compositeComponentUpdates,
  5. String? description,
  6. String? entityName,
  7. ParentEntityUpdateRequest? parentEntityUpdate,
})

Updates an entity.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter entityId : The ID of the entity.

Parameter workspaceId : The ID of the workspace that contains the entity.

Parameter componentUpdates : An object that maps strings to the component updates in the request. Each string in the mapping must be unique to this object.

Parameter compositeComponentUpdates : This is an object that maps strings to compositeComponent updates in the request. Each key of the map represents the componentPath of the compositeComponent.

Parameter description : The description of the entity.

Parameter entityName : The name of the entity.

Parameter parentEntityUpdate : An object that describes the update request for a parent entity.

Implementation

Future<UpdateEntityResponse> updateEntity({
  required String entityId,
  required String workspaceId,
  Map<String, ComponentUpdateRequest>? componentUpdates,
  Map<String, CompositeComponentUpdateRequest>? compositeComponentUpdates,
  String? description,
  String? entityName,
  ParentEntityUpdateRequest? parentEntityUpdate,
}) async {
  final $payload = <String, dynamic>{
    if (componentUpdates != null) 'componentUpdates': componentUpdates,
    if (compositeComponentUpdates != null)
      'compositeComponentUpdates': compositeComponentUpdates,
    if (description != null) 'description': description,
    if (entityName != null) 'entityName': entityName,
    if (parentEntityUpdate != null) 'parentEntityUpdate': parentEntityUpdate,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceId)}/entities/${Uri.encodeComponent(entityId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateEntityResponse.fromJson(response);
}