Skip to content
Snippets Groups Projects
Commit 1f9594da authored by xuty's avatar xuty
Browse files

finish presignedGetObject

parent 01ade349
Branches
Tags
No related merge requests found
...@@ -30,7 +30,7 @@ void main() async { ...@@ -30,7 +30,7 @@ void main() async {
print('--- etag:'); print('--- etag:');
print(etag); print(etag);
final url = await minio.presignedUrl('GET', bucket, object, expires: 1000); final url = await minio.presignedGetObject(bucket, object, expires: 1000);
print('--- presigned url:'); print('--- presigned url:');
print(url); print(url);
......
...@@ -614,13 +614,40 @@ class Minio { ...@@ -614,13 +614,40 @@ class Minio {
return resp.body; return resp.body;
} }
/// Generate a presigned URL for GET
///
/// - [bucketName]: name of the bucket
/// - [objectName]: name of the object
/// - [expires]: expiry in seconds (optional, default 7 days)
/// - [respHeaders]: response headers to override (optional)
/// - [requestDate]: A date object, the url will be issued at (optional)
Future<String> presignedGetObject(
String bucket,
String object, {
int expires,
Map<String, String> respHeaders,
DateTime requestDate,
}) {
MinioInvalidBucketNameError.check(bucket);
MinioInvalidObjectNameError.check(object);
return presignedUrl(
'GET',
bucket,
object,
expires: expires,
reqParams: respHeaders,
requestDate: requestDate,
);
}
/// Generate a generic presigned URL which can be /// Generate a generic presigned URL which can be
/// used for HTTP methods GET, PUT, HEAD and DELETE /// used for HTTP methods GET, PUT, HEAD and DELETE
/// ///
/// - [method]: name of the HTTP method /// - [method]: name of the HTTP method
/// - [bucketName]: name of the bucket /// - [bucketName]: name of the bucket
/// - [objectName]: name of the object /// - [objectName]: name of the object
/// - [expiry]: expiry in seconds (optional, default 7 days) /// - [expires]: expiry in seconds (optional, default 7 days)
/// - [reqParams]: request parameters (optional) /// - [reqParams]: request parameters (optional)
/// - [requestDate]: A date object, the url will be issued at (optional) /// - [requestDate]: A date object, the url will be issued at (optional)
Future<String> presignedUrl( Future<String> presignedUrl(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment