Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif authored Dec 17, 2022
1 parent e708339 commit f0ef1e4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,20 @@ struct Post: Codable {

// GET Request

o.url.in(
url: URL(string: "api/posts")!,
successHandler: { (posts: [Post], response) in
print(posts)
}
let (data, response) = try await o.url.get(
url: URL(string: "api/posts")!
)

// POST Request

let post = Post(userId: 1, id: 1, title: "First!", body: "")

try o.url.out(
let (_, response) = try await o.url.post(
url: URL(string: "api/posts/\(post.id)")!,
value: post,
successHandler: { data, response in
print(response)
}
body: try? JSONEncoder().encode(post)
)

print(response)
```

### o.notification
Expand Down

0 comments on commit f0ef1e4

Please sign in to comment.