getSecureStorageToken method
Implementation
Future<AttachmentCredentialsModel> getSecureStorageToken({
required String tenantId,
required String storageId,
required String fileName,
}) async {
try {
String url =
'${constants.API_HOST}/api/tenant/$tenantId/file/credentials?filename=$fileName&storageId=$storageId';
var response = await http.get(Uri.parse(url), headers: {
"Authorization": token,
});
if (response.statusCode == 200) {
final jsonResponse = jsonDecode(response.body);
AttachmentCredentialsModel creds =
AttachmentCredentialsModel.fromJson(jsonResponse);
return creds;
} else {
throw Exception(response.reasonPhrase);
}
} catch (e) {
throw Exception(e.toString());
}
}