From b98632992a12f6004af7a72f6e170ad7cac990b8 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:19:54 -0800 Subject: [PATCH] updated api explanations for consistency --- .../storage/copy-files/index.mdx | 2 +- .../storage/download-files/index.mdx | 32 ++++++++++++++++++- .../storage/list-files/index.mdx | 2 +- .../storage/remove-files/index.mdx | 2 +- .../storage/upload-files/index.mdx | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx index 51b1be8ef83..9fb52b03a76 100644 --- a/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx @@ -141,7 +141,7 @@ Future copy() async { ``` ## Specify a bucket or copy across buckets / regions -You can also perform an `copy` operation to a specific bucket by providing the `CopyBuckets` option. +You can also perform a `copy` operation to a specific bucket by providing the `CopyBuckets` option. This option is an object that takes two `StorageBucket` parameters, which can be constructed by the specified name in the Amplify Backend, or the bucket name and region from the console. ```dart diff --git a/src/pages/[platform]/build-a-backend/storage/download-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/download-files/index.mdx index b022fa49097..2b4c5f67ace 100644 --- a/src/pages/[platform]/build-a-backend/storage/download-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/download-files/index.mdx @@ -1133,6 +1133,37 @@ final operation = Amplify.Storage.downloadFile( ### Example of `downloadData` with options +```dart +final operation = Amplify.Storage.downloadData( + path: const StoragePath.fromString('public/example.txt'), + options: StorageDownloadDataOptions( + pluginOptions: S3DownloadDataPluginOptions( + getProperties: true, + useAccelerateEndpoint: true, + bytesRange: S3DataBytesRange(start: 0, end: 100), + ), + ), +); +``` + +You can also perform a `downloadData` or `downloadFile` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend. + +```dart +final operation = Amplify.Storage.downloadFile( + path: const StoragePath.fromString('public/example.txt'), + localFile: AWSFile.fromPath('/path/to/local/file.txt'), + options: const StorageDownloadFileOptions( + pluginOptions: S3DownloadFilePluginOptions( + getProperties: true, + useAccelerateEndpoint: true, + ), + bucket: StorageBucket.fromOutputs('secondBucket'), + ), +); +``` + +Alternatively, you can also pass in an object by specifying the bucket name and region from the console. + ```dart final operation = Amplify.Storage.downloadData( path: const StoragePath.fromString('public/example.txt'), @@ -1151,7 +1182,6 @@ final operation = Amplify.Storage.downloadData( ), ); ``` - diff --git a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx index f775ecf9767..f37030bab64 100644 --- a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx @@ -1015,7 +1015,7 @@ Future listAllUnderPublicPath() async { ### List files from a specified bucket -You can also perform a `list` operation to a specific bucket by providing the `bucket` option. You can pass in a object representing the target bucket in Amplify Backend. +You can also perform a `list` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend. ```dart final result = await Amplify.Storage.list( diff --git a/src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx index aa3cb4787eb..f597b8d13e9 100644 --- a/src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx @@ -341,7 +341,7 @@ let removedObject = try await Amplify.Storage.remove( -You can also perform a remove operation from a specific bucket by providing the target bucket's assigned name from Amplify Backend in `bucket` option. +You can also perform a `remove` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend. ```dart final result = await Amplify.Storage.remove( diff --git a/src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx index faba90da94b..7e34649713f 100644 --- a/src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx @@ -649,7 +649,7 @@ Future upload() async { ### Upload to a specified bucket -You can also perform an `upload` operation to a specific bucket by providing the `bucket` option. You can pass in an object representing the target bucket in Amplify Backend. +You can also perform an `upload` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend. ```dart final data = 'multi bucket upload data byte'.codeUnits;