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

source

pub fn new(api_key_pair: ApiKeyPair) -> Self

Creates a new client without authentication.

source

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.

source

pub async fn authenticate( api_key_pair: ApiKeyPair, username: &str, password: &str ) -> Result<Self>

Authenticates and creates a new client from given username/password.

source

pub fn is_authenticated(&self) -> bool

Returns if the client has a token.

This method does not check that the token is valid.

source

pub fn token(&self) -> Option<&AccessToken>

Returns the token used for authentication.

source

pub fn set_token(&mut self, token: Option<AccessToken>)

Sets a new token which will be used for authentication.

Setting None disables authentication.

source

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.

source

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.

source

pub async fn film_genres(&self) -> Result<GenresResponse>

Get a list of genres supported by the films function.

Genres are returned in alphabetical order.

source

pub async fn film_languages(&self) -> Result<LanguagesResponse>

Get a list of genres supported by the films function.

Genres are returned in alphabetical order.

source

pub async fn film(&self, id: &str) -> Result<Film>

Get details about a film by ID.

source

pub async fn film_availability( &self, id: &str ) -> Result<FilmAvailabilityResponse>

Get availability data about a film by ID.

source

pub async fn film_relationship( &self, id: &str ) -> Result<FilmAvailabilityResponse>

Get details of the authenticated member’s relationship with a film by ID.

source

pub async fn update_film_relationship( &self, id: &str, request: &FilmRelationshipUpdateRequest ) -> Result<FilmRelationshipUpdateResponse>

Update the authenticated member’s relationship with a film by ID.

source

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.

source

pub async fn film_statistics(&self, id: &str) -> Result<FilmStatistics>

Get statistical data about a film by ID.

source

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.

source

pub async fn create_list( &self, request: &ListCreationRequest ) -> Result<ListCreateResponse>

Create a list.

source

pub async fn list(&self, id: &str) -> Result<List>

Get details of a list by ID.

source

pub async fn update_list( &self, id: &str, request: &ListUpdateRequest ) -> Result<ListUpdateResponse>

Update a list by ID.

source

pub async fn delete_list(&self, id: &str) -> Result<()>

Delete a list by ID.

source

pub async fn list_entries( &self, id: &str, request: &ListEntriesRequest ) -> Result<ListEntriesResponse>

Get entries for a list by ID.

source

pub async fn search(&self, request: &SearchRequest) -> Result<SearchResponse>

Search for any data.

Trait Implementations§

source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more