File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,34 @@ impl ChromaCollection {
6464 self . send :: < ( ) , u32 > ( "count" , Method :: GET , None ) . await
6565 }
6666
67+ pub async fn modify (
68+ & mut self ,
69+ new_name : Option < impl AsRef < str > > ,
70+ new_metadata : Option < Metadata > ,
71+ ) -> Result < ( ) , ChromaClientError > {
72+ self . send :: < _ , ( ) > (
73+ "modify" ,
74+ Method :: PUT ,
75+ Some ( serde_json:: json!( {
76+ "new_name" : new_name. as_ref( ) . map( |s| s. as_ref( ) ) ,
77+ "new_metadata" : new_metadata,
78+ } ) ) ,
79+ )
80+ . await ?;
81+
82+ let mut updated_collection = ( * self . collection ) . clone ( ) ;
83+ if let Some ( name) = new_name {
84+ updated_collection. name = name. as_ref ( ) . to_string ( ) ;
85+ }
86+ if let Some ( metadata) = new_metadata {
87+ updated_collection. metadata = Some ( metadata) ;
88+ }
89+
90+ self . collection = Arc :: new ( updated_collection) ;
91+
92+ Ok ( ( ) )
93+ }
94+
6795 pub async fn get (
6896 & self ,
6997 ids : Option < Vec < String > > ,
You can’t perform that action at this time.
0 commit comments