diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index ddff43bd..c607f114 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -133,7 +133,7 @@ async_guide_filter_by_ids_1: |- } } async_guide_filter_by_statuses_1: |- - client.getTasks(params: TasksQuery(statuses: ["failed", "canceled"])) { result in + client.getTasks(params: TasksQuery(statuses: [.failed, .canceled])) { result in switch result { case .success(let taskResult): print(taskResult) @@ -142,7 +142,7 @@ async_guide_filter_by_statuses_1: |- } } async_guide_filter_by_types_1: |- - client.getTasks(params: TasksQuery(types: ["dumpCreation", "indexSwap"])) { result in + client.getTasks(params: TasksQuery(types: [.dumpCreation, .indexSwap])) { result in switch result { case .success(let taskResult): print(taskResult) @@ -417,15 +417,6 @@ search_post_1: |- print(error) } } -get_task_by_index_1: |- - client.index("movies").getTask(taskUid: 1) { (result) in - switch result { - case .success(let task): - print(task) - case .failure(let error): - print(error) - } - } get_task_1: |- client.getTask(taskUid: 1) { (result) in switch result { @@ -436,7 +427,7 @@ get_task_1: |- } } get_all_tasks_1: |- - client.getTasks() { (result) in + client.getTasks { (result) in switch result { case .success(let tasks): print(tasks) @@ -444,6 +435,24 @@ get_all_tasks_1: |- print(error) } } +delete_tasks_1: |- + client.deleteTasks(filter: DeleteTasksQuery(uids: [1, 2])) { (result) in + switch result { + case .success(let taskInfo): + print(taskInfo) + case .failure(let error): + print(error) + } + } +cancel_tasks_1: |- + client.cancelTasks(filter: CancelTasksQuery(uids: [1, 2])) { (result) in + switch result { + case .success(let taskInfo): + print(taskInfo) + case .failure(let error): + print(error) + } + } get_one_key_1: |- client.getKey(keyOrUid: "6062abda-a5aa-4414-ac91-ecd7944c0f8d") { result in switch result { diff --git a/README.md b/README.md index c245ed87..c9b48ecc 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ To do a simple search using the client, you can create a Swift script like this: ) { result in switch result { case .success(let task): - print(task) // => Task(uid: 0, status: "enqueued", ...) + print(task) // => Task(uid: 0, status: Task.Status.enqueued, ...) case .failure(let error): print(error.localizedDescription) }