Skip to content

Commit 1a184ae

Browse files
committed
Rename filters to plural form
1 parent 564fd90 commit 1a184ae

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ impl Client {
744744
/// # let client = client::Client::new(MEILISEARCH_URL, MEILISEARCH_API_KEY);
745745
///
746746
/// let mut query = tasks::TasksSearchQuery::new(&client);
747-
/// query.with_index_uid(["get_tasks_with"]);
747+
/// query.with_index_uids(["get_tasks_with"]);
748748
/// let tasks = client.get_tasks_with(&query).await.unwrap();
749749
/// # });
750750
/// ```

src/indexes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ impl Index {
903903
/// ```
904904
pub async fn get_tasks(&self) -> Result<TasksResults, Error> {
905905
let mut query = TasksSearchQuery::new(&self.client);
906-
query.with_index_uid([self.uid.as_str()]);
906+
query.with_index_uids([self.uid.as_str()]);
907907

908908
self.client.get_tasks_with(&query).await
909909
}
@@ -924,7 +924,7 @@ impl Index {
924924
/// # let index = client.create_index("get_tasks_with", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap().try_make_index(&client).unwrap();
925925
///
926926
/// let mut query = TasksSearchQuery::new(&client);
927-
/// query.with_index_uid(["none_existant"]);
927+
/// query.with_index_uids(["none_existant"]);
928928
/// let tasks = index.get_tasks_with(&query).await.unwrap();
929929
///
930930
/// assert!(tasks.results.len() > 0);
@@ -936,7 +936,7 @@ impl Index {
936936
tasks_query: &TasksQuery<'_, TasksPagination>,
937937
) -> Result<TasksResults, Error> {
938938
let mut query = tasks_query.clone();
939-
query.with_index_uid([self.uid.as_str()]);
939+
query.with_index_uids([self.uid.as_str()]);
940940

941941
self.client.get_tasks_with(&query).await
942942
}

src/tasks.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -422,16 +422,16 @@ pub struct TasksQuery<'a, T> {
422422
client: &'a Client,
423423
// Index uids array to only retrieve the tasks of the indexes.
424424
#[serde(skip_serializing_if = "Option::is_none")]
425-
index_uid: Option<Vec<&'a str>>,
425+
index_uids: Option<Vec<&'a str>>,
426426
// Statuses array to only retrieve the tasks with these statuses.
427427
#[serde(skip_serializing_if = "Option::is_none")]
428-
status: Option<Vec<&'a str>>,
428+
statuses: Option<Vec<&'a str>>,
429429
// Types array to only retrieve the tasks with these [TaskType].
430430
#[serde(skip_serializing_if = "Option::is_none", rename = "type")]
431-
task_type: Option<Vec<&'a str>>,
431+
task_types: Option<Vec<&'a str>>,
432432
// Uids of the tasks to retrieve
433433
#[serde(skip_serializing_if = "Option::is_none")]
434-
uid: Option<Vec<&'a u32>>,
434+
uids: Option<Vec<&'a u32>>,
435435
// Date to retrieve all tasks that were enqueued before it.
436436
#[serde(
437437
skip_serializing_if = "Option::is_none",
@@ -475,32 +475,32 @@ pub struct TasksQuery<'a, T> {
475475

476476
#[allow(missing_docs)]
477477
impl<'a, T> TasksQuery<'a, T> {
478-
pub fn with_index_uid<'b>(
478+
pub fn with_index_uids<'b>(
479479
&'b mut self,
480480
index_uid: impl IntoIterator<Item = &'a str>,
481481
) -> &'b mut TasksQuery<'a, T> {
482-
self.index_uid = Some(index_uid.into_iter().collect());
482+
self.index_uids = Some(index_uid.into_iter().collect());
483483
self
484484
}
485-
pub fn with_status<'b>(
485+
pub fn with_statuses<'b>(
486486
&'b mut self,
487487
status: impl IntoIterator<Item = &'a str>,
488488
) -> &'b mut TasksQuery<'a, T> {
489-
self.status = Some(status.into_iter().collect());
489+
self.statuses = Some(status.into_iter().collect());
490490
self
491491
}
492-
pub fn with_type<'b>(
492+
pub fn with_types<'b>(
493493
&'b mut self,
494494
task_type: impl IntoIterator<Item = &'a str>,
495495
) -> &'b mut TasksQuery<'a, T> {
496-
self.task_type = Some(task_type.into_iter().collect());
496+
self.task_types = Some(task_type.into_iter().collect());
497497
self
498498
}
499-
pub fn with_uid<'b>(
499+
pub fn with_uids<'b>(
500500
&'b mut self,
501501
index_uid: impl IntoIterator<Item = &'a u32>,
502502
) -> &'b mut TasksQuery<'a, T> {
503-
self.uid = Some(index_uid.into_iter().collect());
503+
self.uids = Some(index_uid.into_iter().collect());
504504
self
505505
}
506506
pub fn with_before_enqueued_at<'b>(
@@ -551,10 +551,10 @@ impl<'a> TasksQuery<'a, TasksDefault> {
551551
pub fn new(client: &'a Client) -> TasksQuery<'a, TasksDefault> {
552552
TasksQuery {
553553
client,
554-
index_uid: None,
555-
status: None,
556-
task_type: None,
557-
uid: None,
554+
index_uids: None,
555+
statuses: None,
556+
task_types: None,
557+
uids: None,
558558
before_enqueued_at: None,
559559
after_enqueued_at: None,
560560
before_started_at: None,
@@ -574,10 +574,10 @@ impl<'a> TasksQuery<'a, TasksPagination> {
574574
pub fn new(client: &'a Client) -> TasksQuery<'a, TasksPagination> {
575575
TasksQuery {
576576
client,
577-
index_uid: None,
578-
status: None,
579-
task_type: None,
580-
uid: None,
577+
index_uids: None,
578+
statuses: None,
579+
task_types: None,
580+
uids: None,
581581
before_enqueued_at: None,
582582
after_enqueued_at: None,
583583
before_started_at: None,
@@ -781,12 +781,12 @@ mod test {
781781

782782
let mut query = TasksSearchQuery::new(&client);
783783
query
784-
.with_index_uid(["movies", "test"])
785-
.with_status(["equeued"])
786-
.with_type(["documentDeletion"])
784+
.with_index_uids(["movies", "test"])
785+
.with_statuses(["equeued"])
786+
.with_types(["documentDeletion"])
787787
.with_from(1)
788788
.with_limit(0)
789-
.with_uid([&1]);
789+
.with_uids([&1]);
790790

791791
let _ = client.get_tasks_with(&query).await;
792792

@@ -867,9 +867,9 @@ mod test {
867867

868868
let mut query = TasksSearchQuery::new(&client);
869869
let _ = query
870-
.with_index_uid(["movies", "test"])
871-
.with_status(["equeued"])
872-
.with_type(["documentDeletion"])
870+
.with_index_uids(["movies", "test"])
871+
.with_statuses(["equeued"])
872+
.with_types(["documentDeletion"])
873873
.execute()
874874
.await;
875875

@@ -881,7 +881,7 @@ mod test {
881881
#[meilisearch_test]
882882
async fn test_get_tasks_with_none_existant_index_uid(client: Client) -> Result<(), Error> {
883883
let mut query = TasksSearchQuery::new(&client);
884-
query.with_index_uid(["no_name"]);
884+
query.with_index_uids(["no_name"]);
885885
let tasks = client.get_tasks_with(&query).await.unwrap();
886886

887887
assert_eq!(tasks.results.len(), 0);
@@ -891,7 +891,7 @@ mod test {
891891
#[meilisearch_test]
892892
async fn test_get_tasks_with_execute(client: Client) -> Result<(), Error> {
893893
let tasks = TasksSearchQuery::new(&client)
894-
.with_index_uid(["no_name"])
894+
.with_index_uids(["no_name"])
895895
.execute()
896896
.await
897897
.unwrap();

0 commit comments

Comments
 (0)