File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -98,13 +98,35 @@ impl Client {
9898 /// # });
9999 /// ```
100100 pub async fn get_index ( & self , uid : impl AsRef < str > ) -> Result < Index , Error > {
101+ match self . get_raw_index ( uid) . await {
102+ Ok ( raw_idx) => Ok ( raw_idx. into_index ( self ) ) ,
103+ Err ( error) => Err ( error) ,
104+ }
105+ }
106+
107+ /// Get a raw JSON [index](../indexes/struct.Index.html).
108+ ///
109+ /// # Example
110+ ///
111+ /// ```
112+ /// # use meilisearch_sdk::{client::*, indexes::*};
113+ ///
114+ /// # futures::executor::block_on(async move {
115+ /// // create the client
116+ /// let client = Client::new("http://localhost:7700", "masterKey");
117+ /// # client.create_index("movies", None).await;
118+ ///
119+ /// // get the index named "movies"
120+ /// let movies = client.get_raw_index("movies").await.unwrap();
121+ /// # });
122+ /// ```
123+ pub async fn get_raw_index ( & self , uid : impl AsRef < str > ) -> Result < JsonIndex , Error > {
101124 Ok ( request :: < ( ) , JsonIndex > (
102125 & format ! ( "{}/indexes/{}" , self . host, uid. as_ref( ) ) ,
103126 & self . api_key ,
104127 Method :: Get ,
105128 200 ,
106- ) . await ?
107- . into_index ( self ) )
129+ ) . await ?)
108130 }
109131
110132 /// Assume that an [index](../indexes/struct.Index.html) exist and create a corresponding object without any check.
You can’t perform that action at this time.
0 commit comments