@@ -281,23 +281,46 @@ public Task<string> Update(byte[] data, string supabasePath, FileOptions? option
281
281
}
282
282
283
283
/// <summary>
284
- /// Moves an existing file, optionally renaming it at the same time .
284
+ /// Moves an existing file to a new location, optionally allowing renaming .
285
285
/// </summary>
286
- /// <param name="fromPath">The original file path, including the current file name. For example `folder/image.png`.</param>
287
- /// <param name="toPath">The new file path, including the new file name. For example `folder/image-copy.png`.</param>
288
- /// <returns></returns>
289
- public async Task < bool > Move ( string fromPath , string toPath )
286
+ /// <param name="fromPath">The original file path, including the current file name (e.g., `folder/image.png`).</param>
287
+ /// <param name="toPath">The target file path, including the new file name (e.g., `folder/image-copy.png`).</param>
288
+ /// <param name="options">Optional parameters for specifying the destination bucket and other settings.</param>
289
+ /// <returns>Returns a boolean value indicating whether the operation was successful.</returns>
290
+ public async Task < bool > Move ( string fromPath , string toPath , DestinationOptions ? options = null )
290
291
{
291
292
var body = new Dictionary < string , string ? >
292
293
{
293
294
{ "bucketId" , BucketId } ,
294
295
{ "sourceKey" , fromPath } ,
295
- { "destinationKey" , toPath }
296
+ { "destinationKey" , toPath } ,
297
+ { "destinationBucket" , options ? . DestinationBucket }
296
298
} ;
297
299
await Helpers . MakeRequest < GenericResponse > ( HttpMethod . Post , $ "{ Url } /object/move", body , Headers ) ;
298
300
return true ;
299
301
}
300
302
303
+ /// <summary>
304
+ /// Copies a file/object from one path to another within a bucket or across buckets.
305
+ /// </summary>
306
+ /// <param name="fromPath">The source path of the file/object to copy.</param>
307
+ /// <param name="toPath">The destination path for the copied file/object.</param>
308
+ /// <param name="options">Optional parameters such as the destination bucket.</param>
309
+ /// <returns>True if the copy operation was successful.</returns>
310
+ public async Task < bool > Copy ( string fromPath , string toPath , DestinationOptions ? options = null )
311
+ {
312
+ var body = new Dictionary < string , string ? >
313
+ {
314
+ { "bucketId" , BucketId } ,
315
+ { "sourceKey" , fromPath } ,
316
+ { "destinationKey" , toPath } ,
317
+ { "destinationBucket" , options ? . DestinationBucket }
318
+ } ;
319
+
320
+ await Helpers . MakeRequest < GenericResponse > ( HttpMethod . Post , $ "{ Url } /object/copy", body , Headers ) ;
321
+ return true ;
322
+ }
323
+
301
324
/// <summary>
302
325
/// Downloads a file from a private bucket. For public buckets, use <see cref="DownloadPublicFile(string, string, TransformOptions?, EventHandler{float}?)"/>
303
326
/// </summary>
0 commit comments