Skip to content

Commit ade59bd

Browse files
authored
Merge pull request #6 from gianpispi/readme
Added query example
2 parents 9e8786e + da8c2b1 commit ade59bd

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,26 @@ LetterboxdAPI.shared.getMemberWatchlist(withId: "id") { result in
138138
}
139139
```
140140

141+
### Run a query for any endpoint
142+
``` swift
143+
struct List: Decodable {
144+
var id: String
145+
var name: String
146+
}
147+
148+
LetterboxdAPI.shared.query(path: "/list/coMSs", parameters: [:]) { (result: Result<List, Error>) in
149+
switch result {
150+
case .success(let list):
151+
// list is of type List, declared a few lines above
152+
print(list.id)
153+
154+
case .failure(let error):
155+
// error may be of type LetterboxdAPIError
156+
print(error)
157+
}
158+
}
159+
```
160+
141161
## Contributing
142162

143163
- If you need help or you'd like to ask a general question, open an issue.

0 commit comments

Comments
 (0)