describeObject method

Future<DescribeObjectResponse> describeObject({
  1. required String path,
})

Gets the headers for an object at the specified path.

May throw ContainerNotFoundException. May throw ObjectNotFoundException. May throw InternalServerError.

Parameter path : The path (including the file name) where the object is stored in the container. Format: <folder name>/<folder name>/<file name>

Implementation

Future<DescribeObjectResponse> describeObject({
  required String path,
}) async {
  ArgumentError.checkNotNull(path, 'path');
  _s.validateStringLength(
    'path',
    path,
    1,
    900,
    isRequired: true,
  );
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'HEAD',
    requestUri: '/${path.split('/').map(Uri.encodeComponent).join('/')}',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return DescribeObjectResponse(
    cacheControl:
        _s.extractHeaderStringValue(response.headers, 'Cache-Control'),
    contentLength:
        _s.extractHeaderIntValue(response.headers, 'Content-Length'),
    contentType:
        _s.extractHeaderStringValue(response.headers, 'Content-Type'),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag'),
    lastModified:
        _s.extractHeaderDateTimeValue(response.headers, 'Last-Modified'),
  );
}