@@ -132,6 +132,19 @@ await Helpers.MakeRequest<List<FileObject>>(HttpMethod.Post, $"{Url}/object/list
132132
133133 return response ;
134134 }
135+
136+ /// <summary>
137+ /// Retrieves the details of an existing file.
138+ /// </summary>
139+ /// <param name="path"></param>
140+ /// <returns></returns>
141+ public async Task < FileObjectV2 ? > Find ( string path )
142+ {
143+ var response =
144+ await Helpers . MakeRequest < FileObjectV2 > ( HttpMethod . Get , $ "{ Url } /object/info/{ BucketId } /{ path } ", null , Headers ) ;
145+
146+ return response ;
147+ }
135148
136149 /// <summary>
137150 /// Uploads a file to an existing bucket.
@@ -464,6 +477,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
464477 if ( options . Upsert )
465478 headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
466479
480+ if ( options . Metadata != null )
481+ headers . Add ( "x-metadata" , ParseMetadata ( options . Metadata ) ) ;
482+
483+ options . Headers ? . ToList ( ) . ForEach ( x => headers . Add ( x . Key , x . Value ) ) ;
484+
485+ // if (options.Duplex != null)
486+ // headers.Add("x-duplex", options.Duplex.ToLower());
487+
467488 var progress = new Progress < float > ( ) ;
468489
469490 if ( onProgress != null )
@@ -474,6 +495,14 @@ private async Task<string> UploadOrUpdate(string localPath, string supabasePath,
474495 return GetFinalPath ( supabasePath ) ;
475496 }
476497
498+ private static string ParseMetadata ( Dictionary < string , string > metadata )
499+ {
500+ var json = JsonConvert . SerializeObject ( metadata ) ;
501+ var base64 = Convert . ToBase64String ( System . Text . Encoding . UTF8 . GetBytes ( json ) ) ;
502+
503+ return base64 ;
504+ }
505+
477506 private async Task < string > UploadOrUpdate ( byte [ ] data , string supabasePath , FileOptions options ,
478507 EventHandler < float > ? onProgress = null )
479508 {
@@ -488,6 +517,14 @@ private async Task<string> UploadOrUpdate(byte[] data, string supabasePath, File
488517 if ( options . Upsert )
489518 headers . Add ( "x-upsert" , options . Upsert . ToString ( ) . ToLower ( ) ) ;
490519
520+ if ( options . Metadata != null )
521+ headers . Add ( "x-metadata" , ParseMetadata ( options . Metadata ) ) ;
522+
523+ options . Headers ? . ToList ( ) . ForEach ( x => headers . Add ( x . Key , x . Value ) ) ;
524+
525+ if ( options . Duplex != null )
526+ headers . Add ( "x-duplex" , options . Duplex . ToLower ( ) ) ;
527+
491528 var progress = new Progress < float > ( ) ;
492529
493530 if ( onProgress != null )
0 commit comments