mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
add the front end tests on the batches routes
This commit is contained in:
parent
62646af7b9
commit
f1d38581e5
6 changed files with 1157 additions and 0 deletions
|
@ -136,6 +136,11 @@ impl<'a> Index<'a, Owned> {
|
|||
self.service.get(url).await
|
||||
}
|
||||
|
||||
pub async fn list_batches(&self) -> (Value, StatusCode) {
|
||||
let url = format!("/batches?indexUids={}", self.uid);
|
||||
self.service.get(url).await
|
||||
}
|
||||
|
||||
pub async fn delete_document(&self, id: u64) -> (Value, StatusCode) {
|
||||
let url = format!("/indexes/{}/documents/{}", urlencode(self.uid.as_ref()), id);
|
||||
self.service.delete(url).await
|
||||
|
@ -374,6 +379,30 @@ impl<State> Index<'_, State> {
|
|||
self.service.get(url).await
|
||||
}
|
||||
|
||||
pub async fn get_batch(&self, batch_id: u32) -> (Value, StatusCode) {
|
||||
let url = format!("/batches/{}", batch_id);
|
||||
self.service.get(url).await
|
||||
}
|
||||
|
||||
pub async fn filtered_batches(
|
||||
&self,
|
||||
types: &[&str],
|
||||
statuses: &[&str],
|
||||
canceled_by: &[&str],
|
||||
) -> (Value, StatusCode) {
|
||||
let mut url = format!("/batches?indexUids={}", self.uid);
|
||||
if !types.is_empty() {
|
||||
let _ = write!(url, "&types={}", types.join(","));
|
||||
}
|
||||
if !statuses.is_empty() {
|
||||
let _ = write!(url, "&statuses={}", statuses.join(","));
|
||||
}
|
||||
if !canceled_by.is_empty() {
|
||||
let _ = write!(url, "&canceledBy={}", canceled_by.join(","));
|
||||
}
|
||||
self.service.get(url).await
|
||||
}
|
||||
|
||||
pub async fn get_document(&self, id: u64, options: Option<Value>) -> (Value, StatusCode) {
|
||||
let mut url = format!("/indexes/{}/documents/{}", urlencode(self.uid.as_ref()), id);
|
||||
if let Some(options) = options {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue