Expand description
This crate wraps the Letterboxd API which provides easy and flexible access to data on the Letterboxd.com website.
The client’s API follows the following rules:
- All Letterboxd API calls are asynchronous.
- A client is always created from API key and secret. If auth token, is provided, client calls will be authenticated. Client can be created from username/password. A token can be set after client was created.
- API key and secret can be created from default environment variables.
- Except GET calls all methods include a path parameter.
Further, most of the Client’s methods take a request struct, which is then serialized to url encoded parameters, and return a response type, which is deserialized from JSON. However, some methods omit the request or/and the response struct.
Entities are identified in the API by Letterboxd ID (or LID), an alpha-numeric string value that is returned where appropriate. For films, lists and reviews, the LID can also be found through the Letterboxd website as the path portion of the entity’s shareable boxd.it link.
For more information, cf. API docs at http://api-docs.letterboxd.com.
§Examples
Client without authentication:
async fn list_films() -> letterboxd::Result<()> {
let api_key_pair = letterboxd::ApiKeyPair::from_env().unwrap();
let client = letterboxd::Client::new(api_key_pair);
let req = letterboxd::FilmsRequest {
per_page: Some(1),
..Default::default()
};
let resp = client.films(&req).await?;
println!("{:?}", resp);
Ok(())
}
Create and authenticate client with username/password:
async fn update_film_relationship() -> letterboxd::Result<()> {
let api_key_pair = letterboxd::ApiKeyPair::from_env().unwrap();
let username = std::env::var("LETTERBOXD_USERNAME").unwrap();
let password = std::env::var("LETTERBOXD_PASSWORD").unwrap();
let client = letterboxd::Client::authenticate(api_key_pair, &username, &password).await?;
// token can be retrieved after authentication for e.g. caching it on disk
println!("{:?}", client.token().unwrap());
let req = letterboxd::FilmRelationshipUpdateRequest {
watched: Some(true),
..Default::default()
};
client.update_film_relationship("2a9q", &req).await?; // Fight Club
Ok(())
}
Structs§
- Access
Token - ApiKey
Pair - API key/secret pair.
- Client
- Letterboxd asynchronous client.
- Comment
Creation Request - Contributor
- Contributor
Summary - Diary
Details - Error
- Error type returned by
Client
. - Film
- Film
Availability - Film
Availability Response - Film
Contributions - Film
Identifier - Film
Relationship - Film
Relationship Update Request - When PATCHing a film relationship, you may send all of the current property struct values, or just those you wish to change. Properties that violate business rules (see watched below) or contain invalid values will be ignored.
- Film
Relationship Update Response - Film
Services Response - Film
Statistics - Film
Statistics Counts - Film
Summary - Film
Trailer - Films
Request - Films
Response - Genre
- Genres
Response - Image
- Image
Size - Language
- Languages
Response - List
- List
Create Entry - List
Create Response - List
Creation Request - List
Entries Request - List
Entries Response - List
Entry - List
Entry Summary - List
Identifier - List
Summary - List
Update Entry - List
Update Request - List
Update Response - Lists
Request - Lists
Response - LogEntry
- Member
Film Relationship - Member
Film Relationships Request - Member
Film Relationships Response - Member
Summary - Pronoun
- Ratings
Histogram Bar - Review
- Search
Request - Search
Response - Service
- Tag
Enums§
- Abstract
Search Item - Contribution
Type - Country
- Film
Availability Service - Film
Relationship Type - Film
Relationship Update Message - Film
Relationship Update Message Code - Film
Request Sort - Film
Status - Include
Friends - Link
- List
Create Message - List
Create Message Code - List
Entries Request Sort - List
Member Relationship - List
Request Filter - List
Request Sort - List
Status - List
Update Message - List
Update Message Code - Member
Film Relationships Request Sort - Member
Status - Search
Method - Search
Result Type - Third
Party Service - Watchlist
Sort