updateAsset method

Future<UpdateAssetResponse> updateAsset({
  1. required String agentSpaceId,
  2. required String assetId,
  3. String? clientToken,
  4. AssetContent? content,
  5. Document? metadata,
})

Updates an asset in the specified agent space

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

Parameter agentSpaceId : The unique identifier for the agent space containing the asset

Parameter assetId : The unique identifier of the asset to update

Parameter clientToken : A unique, case-sensitive identifier used for idempotent asset update

Parameter content : Optional content update. A single file adds or replaces one file; a zip replaces all files; a sourceUrl re-syncs from the original source.

Parameter metadata : Metadata fields to update. Only the fields present in this document are updated. Omitted fields retain their current values.

Implementation

Future<UpdateAssetResponse> updateAsset({
  required String agentSpaceId,
  required String assetId,
  String? clientToken,
  AssetContent? content,
  Document? metadata,
}) async {
  final $payload = <String, dynamic>{
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (content != null) 'content': content,
    if (metadata != null) 'metadata': metadata,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/asset/agent-space/${Uri.encodeComponent(agentSpaceId)}/assets/${Uri.encodeComponent(assetId)}',
    hostPrefix: 'dp.',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAssetResponse.fromJson(response);
}