@@ -148,6 +148,19 @@ await Helpers.MakeRequest<List<FileObject>>(HttpMethod.Post, $"{Url}/object/list
148148
149149 return response ;
150150 }
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+ }
151164
152165 /// <summary>
153166 /// Uploads a file to an existing bucket.
@@ -480,6 +493,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
480493 if ( options . Upsert )
481494 headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
482495
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+
483504 var progress = new Progress < float > ( ) ;
484505
485506 if ( onProgress != null )
@@ -490,6 +511,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
490511 return GetFinalPath ( supabasePath ) ;
491512 }
492513
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+
493522 private async Task < string > UploadOrUpdate ( byte [ ] data , string supabasePath , FileOptions options ,
494523 EventHandler < float > ? onProgress = null )
495524 {
@@ -504,6 +533,14 @@ private async Task<string> UploadOrUpdate(byte[] data, string supabasePath, File
504533 if ( options . Upsert )
505534 headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
506535
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+
507544 var progress = new Progress < float > ( ) ;
508545
509546 if ( onProgress != null )
0 commit comments