getFileMetadata method
Retrieves a file's metadata from the backend.
The fileToken
argument must be provided if the resource is protected
by a storage function that checks the file's resource.Metadata.token
(https://nhost.github.io/hasura-backend-plus/docs/storage-rules).
Throws an ApiException if the metadata retrieval fails.
Implementation
Future<FileMetadata> getFileMetadata(
String filePath, {
String? fileToken,
}) async {
assert(!filePath.endsWith('/'),
'$filePath is not a valid file path, because it ends with a /');
return await _apiClient.get(
_metadataPath(filePath),
query: {
if (fileToken != null) 'token': fileToken,
},
headers: _session.authenticationHeaders,
responseDeserializer: FileMetadata.fromJson,
);
}