Struct imdb_async::Client
source · pub struct Client { /* private fields */ }
Expand description
A client to IMDB’s dataset
Implementations§
source§impl Client
impl Client
sourcepub async fn new(
cache_invalidation_time: Duration,
cache_directory: impl AsRef<Path> + Send + Sync
) -> Result<Self, Error>
pub async fn new( cache_invalidation_time: Duration, cache_directory: impl AsRef<Path> + Send + Sync ) -> Result<Self, Error>
Instantiates a new Client
sourcepub async fn get_title(&mut self, id: u32) -> Result<Title, Error>
pub async fn get_title(&mut self, id: u32) -> Result<Title, Error>
Returns a single Title by ID.
sourcepub async fn get_titles(&mut self, ids: &[u32]) -> Result<Vec<Title>, Error>
pub async fn get_titles(&mut self, ids: &[u32]) -> Result<Vec<Title>, Error>
Returns a list of Titles given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn stream_titles(
&mut self
) -> Result<impl Stream<Item = Result<Title, Error>>, Error>
pub async fn stream_titles( &mut self ) -> Result<impl Stream<Item = Result<Title, Error>>, Error>
Streams all Titles from persistent storage. In relational database parlance, this is analogous to a tablescan.
sourcepub async fn get_movie_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Movie>, Error>
pub async fn get_movie_by_name_and_year( &mut self, name: &str, year: u16 ) -> Result<Option<Movie>, Error>
Looks up a Movie by name and year. This is slow, as the cache is not keyed on those fields; a tablescan is performed. Returns Ok(None) if no match is found, not Error::NotFound.
sourcepub async fn get_movie(&mut self, id: u32) -> Result<Movie, Error>
pub async fn get_movie(&mut self, id: u32) -> Result<Movie, Error>
Returns a single Movie by ID.
sourcepub async fn get_movies(&mut self, ids: &[u32]) -> Result<Vec<Movie>, Error>
pub async fn get_movies(&mut self, ids: &[u32]) -> Result<Vec<Movie>, Error>
Returns a list of Movies given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn stream_movies(
&mut self
) -> Result<impl Stream<Item = Result<Movie, Error>>, Error>
pub async fn stream_movies( &mut self ) -> Result<impl Stream<Item = Result<Movie, Error>>, Error>
Streams all Movies from persistnet storage. In relational database parlance, this is analogous to a tablescan.
sourcepub async fn get_show_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Show>, Error>
pub async fn get_show_by_name_and_year( &mut self, name: &str, year: u16 ) -> Result<Option<Show>, Error>
Looks up a Show by name and year. This is slow, as the cache is not keyed on those fields; a tablescan is performed. Returns Ok(None) if not match is found, not Error::NotFound.
sourcepub async fn get_shows(&mut self, ids: &[u32]) -> Result<Vec<Show>, Error>
pub async fn get_shows(&mut self, ids: &[u32]) -> Result<Vec<Show>, Error>
Returns a list of Shows given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn get_shows_by_id(
&mut self,
ids: &[u32]
) -> Result<HashMap<u32, Show, FnvBuildHasher>, Error>
pub async fn get_shows_by_id( &mut self, ids: &[u32] ) -> Result<HashMap<u32, Show, FnvBuildHasher>, Error>
Returns a map<ID, Show> given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn get_episodes_by_show(
&mut self,
show_ids: &[u32]
) -> Result<HashMap<u32, Vec<Episode>, FnvBuildHasher>, Error>
pub async fn get_episodes_by_show( &mut self, show_ids: &[u32] ) -> Result<HashMap<u32, Vec<Episode>, FnvBuildHasher>, Error>
Returns a map<Show ID, Vec<Episode>> given a list of Show IDs. Missing IDs are ignored; Error::NotFound is not returned.