Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Required
- Swift 5.3
- iOS 13
- tvOS 13
- watchOS 6
- macOS 10.15


## Installation
Expand Down Expand Up @@ -58,6 +62,82 @@ LetterboxdAPI.shared.getLID(for: url) { result in
}
```

### Get a film providing the film ID
Just provide the film id, and get the response right away.
``` swift
LetterboxdAPI.shared.getFilm(withId: "id") { result in
switch result {
case .success(let film):
// film is of type Film
print(film.originalName)

case .failure(let error):
// error may be of type LetterboxdAPIError
print(error)
}
}
```

### Get a film providing the film ID
Just provide the film id, and get the response right away.
``` swift
LetterboxdAPI.shared.getFilmAvailability(withId: "id") { result in
switch result {
case .success(let availability):
// availability is of type FilmAvailabilityResponse
print(film.items.map({ $0.displayName }))

case .failure(let error):
// error may be of type LetterboxdAPIError
print(error)
}
}
```

### Get a member providing the member's ID
``` swift
LetterboxdAPI.shared.getMember(withId: "id") { result in
switch result {
case .success(let member):
// member is of type Member
print(member.username)

case .failure(let error):
// error may be of type LetterboxdAPIError
print(error)
}
}
```

### Get a member's statistics providing the member's ID
``` swift
LetterboxdAPI.shared.getMemberStatistics(withId: "id") { result in
switch result {
case .success(let statistics):
// statistics is of type MemberStatistics
print(statistics.counts.watches)

case .failure(let error):
// error may be of type LetterboxdAPIError
print(error)
}
}
```
### Get a member's watchlist providing the member's ID
``` swift
LetterboxdAPI.shared.getMemberWatchlist(withId: "id") { result in
switch result {
case .success(let watchlist):
// watchlist is of type FilmResponse
print(watchlist.items.map({ $0.name }))

case .failure(let error):
// error may be of type LetterboxdAPIError
print(error)
}
}
```

## Contributing

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