mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 16:06:31 +00:00 
			
		
		
		
	Merge #2423
2423: Paginate the index resource r=MarinPostma a=irevoire Fix #2373 Co-authored-by: Irevoire <tamo@meilisearch.com>
This commit is contained in:
		| @@ -103,8 +103,27 @@ impl Server { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn list_indexes(&self) -> (Value, StatusCode) { | ||||
|         self.service.get("/indexes").await | ||||
|     pub async fn list_indexes( | ||||
|         &self, | ||||
|         offset: Option<usize>, | ||||
|         limit: Option<usize>, | ||||
|     ) -> (Value, StatusCode) { | ||||
|         let (offset, limit) = ( | ||||
|             offset.map(|offset| format!("offset={offset}")), | ||||
|             limit.map(|limit| format!("limit={limit}")), | ||||
|         ); | ||||
|         let query_parameter = offset | ||||
|             .as_ref() | ||||
|             .zip(limit.as_ref()) | ||||
|             .map(|(offset, limit)| format!("{offset}&{limit}")) | ||||
|             .or_else(|| offset.xor(limit)); | ||||
|         if let Some(query_parameter) = query_parameter { | ||||
|             self.service | ||||
|                 .get(format!("/indexes?{query_parameter}")) | ||||
|                 .await | ||||
|         } else { | ||||
|             self.service.get("/indexes").await | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn version(&self) -> (Value, StatusCode) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user