Struct letterboxd::Client
source · pub struct Client { /* private fields */ }
Expand description
Letterboxd asynchronous client.
Client is created from given api key pair either
- by authenticating using a username/password,
- with a token (all API calls will be authenticated),
- without a token (no API calls will be authenticated; calls that require authentication will fail).
Note: Not all APIs are implemented. Feel free to contribute implementation for missing endpoints. The implementation is usually very straight forward.
Implementations§
source§impl Client
impl Client
sourcepub fn new(api_key_pair: ApiKeyPair) -> Self
pub fn new(api_key_pair: ApiKeyPair) -> Self
Creates a new client without authentication.
sourcepub fn with_token(api_key_pair: ApiKeyPair, token: AccessToken) -> Self
pub fn with_token(api_key_pair: ApiKeyPair, token: AccessToken) -> Self
Crates a new client from a given token.
It is not checked that the token is valid.
sourcepub async fn authenticate(
api_key_pair: ApiKeyPair,
username: &str,
password: &str
) -> Result<Self>
pub async fn authenticate( api_key_pair: ApiKeyPair, username: &str, password: &str ) -> Result<Self>
Authenticates and creates a new client from given username/password.
sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Returns if the client has a token.
This method does not check that the token is valid.
sourcepub fn token(&self) -> Option<&AccessToken>
pub fn token(&self) -> Option<&AccessToken>
Returns the token used for authentication.
sourcepub fn set_token(&mut self, token: Option<AccessToken>)
pub fn set_token(&mut self, token: Option<AccessToken>)
Sets a new token which will be used for authentication.
Setting None
disables authentication.
sourcepub async fn films(&self, request: &FilmsRequest) -> Result<FilmsResponse>
pub async fn films(&self, request: &FilmsRequest) -> Result<FilmsResponse>
A cursored window over the list of films.
Use the ‘next’ cursor to move through the list. The response will include the film relationships for the signed-in member and the member indicated by the member LID if specified.
sourcepub async fn film_services(&self) -> Result<FilmServicesResponse>
pub async fn film_services(&self) -> Result<FilmServicesResponse>
Get a list of services supported by the /films endpoint.
Services are returned in alphabetical order. Some services are only available to paying members, so results will vary based on the authenticated member’s status.
sourcepub async fn film_genres(&self) -> Result<GenresResponse>
pub async fn film_genres(&self) -> Result<GenresResponse>
Get a list of genres supported by the films
function.
Genres are returned in alphabetical order.
sourcepub async fn film_languages(&self) -> Result<LanguagesResponse>
pub async fn film_languages(&self) -> Result<LanguagesResponse>
Get a list of genres supported by the films
function.
Genres are returned in alphabetical order.
sourcepub async fn film_availability(
&self,
id: &str
) -> Result<FilmAvailabilityResponse>
pub async fn film_availability( &self, id: &str ) -> Result<FilmAvailabilityResponse>
Get availability data about a film by ID.
sourcepub async fn film_relationship(
&self,
id: &str
) -> Result<FilmAvailabilityResponse>
pub async fn film_relationship( &self, id: &str ) -> Result<FilmAvailabilityResponse>
Get details of the authenticated member’s relationship with a film by ID.
sourcepub async fn update_film_relationship(
&self,
id: &str,
request: &FilmRelationshipUpdateRequest
) -> Result<FilmRelationshipUpdateResponse>
pub async fn update_film_relationship( &self, id: &str, request: &FilmRelationshipUpdateRequest ) -> Result<FilmRelationshipUpdateResponse>
Update the authenticated member’s relationship with a film by ID.
sourcepub async fn film_relationship_members(
&self,
id: &str,
request: &MemberFilmRelationshipsRequest
) -> Result<MemberFilmRelationshipsResponse>
pub async fn film_relationship_members( &self, id: &str, request: &MemberFilmRelationshipsRequest ) -> Result<MemberFilmRelationshipsResponse>
Get details of the authenticated member’s relationship with a film by ID.
sourcepub async fn film_statistics(&self, id: &str) -> Result<FilmStatistics>
pub async fn film_statistics(&self, id: &str) -> Result<FilmStatistics>
Get statistical data about a film by ID.
sourcepub async fn lists(&self, request: &ListsRequest) -> Result<ListsResponse>
pub async fn lists(&self, request: &ListsRequest) -> Result<ListsResponse>
A cursored window over a list of lists.
Use the ‘next’ cursor to move through the list.
sourcepub async fn create_list(
&self,
request: &ListCreationRequest
) -> Result<ListCreateResponse>
pub async fn create_list( &self, request: &ListCreationRequest ) -> Result<ListCreateResponse>
Create a list.
sourcepub async fn update_list(
&self,
id: &str,
request: &ListUpdateRequest
) -> Result<ListUpdateResponse>
pub async fn update_list( &self, id: &str, request: &ListUpdateRequest ) -> Result<ListUpdateResponse>
Update a list by ID.
sourcepub async fn delete_list(&self, id: &str) -> Result<()>
pub async fn delete_list(&self, id: &str) -> Result<()>
Delete a list by ID.
sourcepub async fn list_entries(
&self,
id: &str,
request: &ListEntriesRequest
) -> Result<ListEntriesResponse>
pub async fn list_entries( &self, id: &str, request: &ListEntriesRequest ) -> Result<ListEntriesResponse>
Get entries for a list by ID.
sourcepub async fn search(&self, request: &SearchRequest) -> Result<SearchResponse>
pub async fn search(&self, request: &SearchRequest) -> Result<SearchResponse>
Search for any data.