@@ -406,16 +406,16 @@ pub struct TasksQuery<'a> {
406
406
pub client : & ' a Client ,
407
407
// Index uids array to only retrieve the tasks of the indexes.
408
408
#[ serde( skip_serializing_if = "Option::is_none" ) ]
409
- pub index_uid : Option < Vec < & ' a str > > ,
409
+ pub index_uids : Option < Vec < & ' a str > > ,
410
410
// Statuses array to only retrieve the tasks with these statuses.
411
411
#[ serde( skip_serializing_if = "Option::is_none" ) ]
412
- pub status : Option < Vec < & ' a str > > ,
412
+ pub statuses : Option < Vec < & ' a str > > ,
413
413
// Types array to only retrieve the tasks with these [TaskType].
414
- #[ serde( skip_serializing_if = "Option::is_none" , rename = "type " ) ]
415
- pub task_type : Option < Vec < & ' a str > > ,
414
+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "types " ) ]
415
+ pub task_types : Option < Vec < & ' a str > > ,
416
416
// Uids of the tasks to retrieve
417
417
#[ serde( skip_serializing_if = "Option::is_none" ) ]
418
- pub uid : Option < Vec < & ' a u32 > > ,
418
+ pub uids : Option < Vec < & ' a u32 > > ,
419
419
// Date to retrieve all tasks that were enqueued before it.
420
420
#[ serde(
421
421
skip_serializing_if = "Option::is_none" ,
@@ -465,12 +465,12 @@ impl<'a> TasksQuery<'a> {
465
465
pub fn new ( client : & ' a Client ) -> TasksQuery < ' a > {
466
466
TasksQuery {
467
467
client,
468
- index_uid : None ,
469
- status : None ,
470
- task_type : None ,
468
+ index_uids : None ,
469
+ statuses : None ,
470
+ task_types : None ,
471
471
limit : None ,
472
472
from : None ,
473
- uid : None ,
473
+ uids : None ,
474
474
before_enqueued_at : None ,
475
475
after_enqueued_at : None ,
476
476
before_started_at : None ,
@@ -479,32 +479,32 @@ impl<'a> TasksQuery<'a> {
479
479
after_finished_at : None ,
480
480
}
481
481
}
482
- pub fn with_index_uid < ' b > (
482
+ pub fn with_index_uids < ' b > (
483
483
& ' b mut self ,
484
- index_uid : impl IntoIterator < Item = & ' a str > ,
484
+ index_uids : impl IntoIterator < Item = & ' a str > ,
485
485
) -> & ' b mut TasksQuery < ' a > {
486
- self . index_uid = Some ( index_uid . into_iter ( ) . collect ( ) ) ;
486
+ self . index_uids = Some ( index_uids . into_iter ( ) . collect ( ) ) ;
487
487
self
488
488
}
489
- pub fn with_status < ' b > (
489
+ pub fn with_statuses < ' b > (
490
490
& ' b mut self ,
491
- status : impl IntoIterator < Item = & ' a str > ,
491
+ statuses : impl IntoIterator < Item = & ' a str > ,
492
492
) -> & ' b mut TasksQuery < ' a > {
493
- self . status = Some ( status . into_iter ( ) . collect ( ) ) ;
493
+ self . statuses = Some ( statuses . into_iter ( ) . collect ( ) ) ;
494
494
self
495
495
}
496
- pub fn with_type < ' b > (
496
+ pub fn with_types < ' b > (
497
497
& ' b mut self ,
498
- task_type : impl IntoIterator < Item = & ' a str > ,
498
+ task_types : impl IntoIterator < Item = & ' a str > ,
499
499
) -> & ' b mut TasksQuery < ' a > {
500
- self . task_type = Some ( task_type . into_iter ( ) . collect ( ) ) ;
500
+ self . task_types = Some ( task_types . into_iter ( ) . collect ( ) ) ;
501
501
self
502
502
}
503
- pub fn with_uid < ' b > (
503
+ pub fn with_uids < ' b > (
504
504
& ' b mut self ,
505
- index_uid : impl IntoIterator < Item = & ' a u32 > ,
505
+ uids : impl IntoIterator < Item = & ' a u32 > ,
506
506
) -> & ' b mut TasksQuery < ' a > {
507
- self . uid = Some ( index_uid . into_iter ( ) . collect ( ) ) ;
507
+ self . uids = Some ( uids . into_iter ( ) . collect ( ) ) ;
508
508
self
509
509
}
510
510
pub fn with_before_enqueued_at < ' b > (
@@ -735,18 +735,18 @@ mod test {
735
735
let mock_server_url = & mockito:: server_url ( ) ;
736
736
let client = Client :: new ( mock_server_url, "masterKey" ) ;
737
737
let path =
738
- "/tasks?indexUid =movies,test&status =equeued&type =documentDeletion&uid =1&limit=0&from=1" ;
738
+ "/tasks?indexUids =movies,test&statuses =equeued&types =documentDeletion&uids =1&limit=0&from=1" ;
739
739
740
740
let mock_res = mock ( "GET" , path) . with_status ( 200 ) . create ( ) ;
741
741
742
742
let mut query = TasksQuery :: new ( & client) ;
743
743
query
744
- . with_index_uid ( [ "movies" , "test" ] )
745
- . with_status ( [ "equeued" ] )
746
- . with_type ( [ "documentDeletion" ] )
744
+ . with_index_uids ( [ "movies" , "test" ] )
745
+ . with_statuses ( [ "equeued" ] )
746
+ . with_types ( [ "documentDeletion" ] )
747
747
. with_from ( 1 )
748
748
. with_limit ( 0 )
749
- . with_uid ( [ & 1 ] ) ;
749
+ . with_uids ( [ & 1 ] ) ;
750
750
751
751
let _ = client. get_tasks_with ( & query) . await ;
752
752
@@ -821,15 +821,15 @@ mod test {
821
821
async fn test_get_tasks_on_struct_with_params ( ) -> Result < ( ) , Error > {
822
822
let mock_server_url = & mockito:: server_url ( ) ;
823
823
let client = Client :: new ( mock_server_url, "masterKey" ) ;
824
- let path = "/tasks?indexUid =movies,test&status =equeued&type =documentDeletion" ;
824
+ let path = "/tasks?indexUids =movies,test&statuses =equeued&types =documentDeletion" ;
825
825
826
826
let mock_res = mock ( "GET" , path) . with_status ( 200 ) . create ( ) ;
827
827
828
828
let mut query = TasksQuery :: new ( & client) ;
829
829
let _ = query
830
- . with_index_uid ( [ "movies" , "test" ] )
831
- . with_status ( [ "equeued" ] )
832
- . with_type ( [ "documentDeletion" ] )
830
+ . with_index_uids ( [ "movies" , "test" ] )
831
+ . with_statuses ( [ "equeued" ] )
832
+ . with_types ( [ "documentDeletion" ] )
833
833
. execute ( )
834
834
. await ;
835
835
@@ -839,9 +839,9 @@ mod test {
839
839
}
840
840
841
841
#[ meilisearch_test]
842
- async fn test_get_tasks_with_none_existant_index_uid ( client : Client ) -> Result < ( ) , Error > {
842
+ async fn test_get_tasks_with_none_existant_index_uids ( client : Client ) -> Result < ( ) , Error > {
843
843
let mut query = TasksQuery :: new ( & client) ;
844
- query. with_index_uid ( [ "no_name" ] ) ;
844
+ query. with_index_uids ( [ "no_name" ] ) ;
845
845
let tasks = client. get_tasks_with ( & query) . await . unwrap ( ) ;
846
846
847
847
assert_eq ! ( tasks. results. len( ) , 0 ) ;
@@ -851,7 +851,7 @@ mod test {
851
851
#[ meilisearch_test]
852
852
async fn test_get_tasks_with_execute ( client : Client ) -> Result < ( ) , Error > {
853
853
let tasks = TasksQuery :: new ( & client)
854
- . with_index_uid ( [ "no_name" ] )
854
+ . with_index_uids ( [ "no_name" ] )
855
855
. execute ( )
856
856
. await
857
857
. unwrap ( ) ;
0 commit comments