Skip to content

Commit

Permalink
Update Code Samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherlouk committed Sep 28, 2023
1 parent 41d7976 commit dc3d6fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
33 changes: 21 additions & 12 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -436,14 +427,32 @@ get_task_1: |-
}
}
get_all_tasks_1: |-
client.getTasks() { (result) in
client.getTasks { (result) in
switch result {
case .success(let tasks):
print(tasks)
case .failure(let error):
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 {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit dc3d6fc

Please sign in to comment.