@@ -148,6 +148,19 @@ await Helpers.MakeRequest<List<FileObject>>(HttpMethod.Post, $"{Url}/object/list
148
148
149
149
return response ;
150
150
}
151
+
152
+ /// <summary>
153
+ /// Retrieves the details of an existing file.
154
+ /// </summary>
155
+ /// <param name="path"></param>
156
+ /// <returns></returns>
157
+ public async Task < FileObjectV2 ? > Info ( string path )
158
+ {
159
+ var response =
160
+ await Helpers . MakeRequest < FileObjectV2 > ( HttpMethod . Get , $ "{ Url } /object/info/{ BucketId } /{ path } ", null , Headers ) ;
161
+
162
+ return response ;
163
+ }
151
164
152
165
/// <summary>
153
166
/// Uploads a file to an existing bucket.
@@ -480,6 +493,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
480
493
if ( options . Upsert )
481
494
headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
482
495
496
+ if ( options . Metadata != null )
497
+ headers . Add ( "x-metadata" , ParseMetadata ( options . Metadata ) ) ;
498
+
499
+ options . Headers ? . ToList ( ) . ForEach ( x => headers . Add ( x . Key , x . Value ) ) ;
500
+
501
+ if ( options . Duplex != null )
502
+ headers . Add ( "x-duplex" , options . Duplex . ToLower ( ) ) ;
503
+
483
504
var progress = new Progress < float > ( ) ;
484
505
485
506
if ( onProgress != null )
@@ -490,6 +511,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
490
511
return GetFinalPath ( supabasePath ) ;
491
512
}
492
513
514
+ private static string ParseMetadata ( Dictionary < string , string > metadata )
515
+ {
516
+ var json = JsonConvert . SerializeObject ( metadata ) ;
517
+ var base64 = Convert . ToBase64String ( System . Text . Encoding . UTF8 . GetBytes ( json ) ) ;
518
+
519
+ return base64 ;
520
+ }
521
+
493
522
private async Task < string > UploadOrUpdate ( byte [ ] data , string supabasePath , FileOptions options ,
494
523
EventHandler < float > ? onProgress = null )
495
524
{
@@ -504,6 +533,14 @@ private async Task<string> UploadOrUpdate(byte[] data, string supabasePath, File
504
533
if ( options . Upsert )
505
534
headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
506
535
536
+ if ( options . Metadata != null )
537
+ headers . Add ( "x-metadata" , ParseMetadata ( options . Metadata ) ) ;
538
+
539
+ options . Headers ? . ToList ( ) . ForEach ( x => headers . Add ( x . Key , x . Value ) ) ;
540
+
541
+ if ( options . Duplex != null )
542
+ headers . Add ( "x-duplex" , options . Duplex . ToLower ( ) ) ;
543
+
507
544
var progress = new Progress < float > ( ) ;
508
545
509
546
if ( onProgress != null )
0 commit comments