meilisearch-rust icon indicating copy to clipboard operation
meilisearch-rust copied to clipboard

Update task api for v0.28.0

Open bidoubiwa opened this issue 3 years ago • 0 comments

Pull Request

Related to: https://github.com/meilisearch/integration-guides/issues/205

Breaking

  • [x] Actions that create a task in Meilisearch now return a TaskInfo and not a Task object anymore. (ex: add_documents).
  • [x] get_tasks now returns a TasksResults where the tasks are contained inside the results field.
  • [x] task_id in Task andTaskInfo is now a u32 instead of a u64
  • [x] index_uid in Task and TaskInfo is now an Optionnal.
  • [x] TaskType documentAddition is replaced with DocumentAdditionOrUpdate
  • [x] Add pagination to get_tasks based of this using limit, from, next metadata in the response.
  • [x] Rename these task types:
    • documentPartial -> documentAdditionOrUpdate
    • documentAddition -> documentAdditionOrUpdate
    • clearAll -> documentDeletion
  • [x] Possibility to filter the tasks when using get_tasks on indexUid, status and type.

// get_tasks

let tasks = client.get_tasks().await.unwrap()

// get_tasks_with

let mut query = tasks::TasksQuery::new(&client);
query.with_index_uid(["get_tasks_with"]);
let tasks = client.get_tasks_with(&query).await.unwrap();

// get tasks using execute

let mut query = tasks::TasksQuery::new(&client)
   .with_index_uid(["get_tasks_with"])
   .execute()
   .await
   .unwrap();

Routes changes

  • [x] index.get_task & index.wait_for_task now use GET /tasks/:task_uid

bidoubiwa avatar Jul 11 '22 11:07 bidoubiwa