createAssetFile method
Creates a file in an asset
May throw AccessDeniedException.
May throw ConflictException.
May throw ContentSizeExceededException.
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 create the file in
Parameter content :
The content of the file to create
Parameter path :
The path of the file within the asset
Parameter clientToken :
A unique, case-sensitive identifier used for idempotent asset file
creation
Parameter metadata :
Optional metadata describing this file
Implementation
Future<CreateAssetFileResponse> createAssetFile({
required String agentSpaceId,
required String assetId,
required AssetFileBody content,
required String path,
String? clientToken,
Document? metadata,
}) async {
final $payload = <String, dynamic>{
'content': content,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (metadata != null) 'metadata': metadata,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/asset/agent-space/${Uri.encodeComponent(agentSpaceId)}/assets/${Uri.encodeComponent(assetId)}/files/${path.split('/').map(Uri.encodeComponent).join('/')}',
hostPrefix: 'dp.',
exceptionFnMap: _exceptionFns,
);
return CreateAssetFileResponse.fromJson(response);
}