getAssetFile method

Future<GetAssetFileResponse> getAssetFile({
  1. required String agentSpaceId,
  2. required String assetId,
  3. required String path,
  4. int? assetVersion,
})

Gets a file from an asset

May throw AccessDeniedException. 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 containing the file

Parameter path : The path of the file within the asset to retrieve

Parameter assetVersion : The specific asset version to retrieve the file from. If omitted, the latest version is returned.

Implementation

Future<GetAssetFileResponse> getAssetFile({
  required String agentSpaceId,
  required String assetId,
  required String path,
  int? assetVersion,
}) async {
  final $query = <String, List<String>>{
    if (assetVersion != null) 'assetVersion': [assetVersion.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/asset/agent-space/${Uri.encodeComponent(agentSpaceId)}/assets/${Uri.encodeComponent(assetId)}/files/${path.split('/').map(Uri.encodeComponent).join('/')}',
    queryParams: $query,
    hostPrefix: 'dp.',
    exceptionFnMap: _exceptionFns,
  );
  return GetAssetFileResponse.fromJson(response);
}