diff --git a/README.md b/README.md index 46a7b5e..0a04671 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ ## Required - Swift 5.3 +- iOS 13 +- tvOS 13 +- watchOS 6 +- macOS 10.15 ## Installation @@ -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.