pub struct Client { /* private fields */ }
Expand description
An HTTP client for interacting with the Genius API.
Essentially just a thin wrapper around reqwest::Client
,
meaning that if you want more control/need to access a missing endpoint
then you can just use the data models with Reqwest directly.
This also means that you can clone this client freely
and should not use std::sync::Arc
or std::rc::Rc
, much like reqwest::Client
.
Implementations§
source§impl Client
impl Client
sourcepub async fn account(&self) -> Result<Response<AccountResponse>, ClientError>
pub async fn account(&self) -> Result<Response<AccountResponse>, ClientError>
sourcepub async fn annotation(
&self,
id: u32
) -> Result<Response<AnnotationResponse>, ClientError>
pub async fn annotation( &self, id: u32 ) -> Result<Response<AnnotationResponse>, ClientError>
sourcepub async fn artist(
&self,
id: u32
) -> Result<Response<ArtistResponse>, ClientError>
pub async fn artist( &self, id: u32 ) -> Result<Response<ArtistResponse>, ClientError>
sourcepub async fn referents(
&self,
created_by: Option<u32>,
associated: Option<ReferentAssociation>,
per_page: Option<u8>,
page: Option<u8>
) -> Result<Response<ReferentsResponse>, ClientError>
pub async fn referents( &self, created_by: Option<u32>, associated: Option<ReferentAssociation>, per_page: Option<u8>, page: Option<u8> ) -> Result<Response<ReferentsResponse>, ClientError>
Get referents.
Args
created_by
- A Genius ID.associated
- The associated web page or song.per_page
- A per-page limit.page
- A page offset, starting at 1.
Returns
The referents that are associated with the web page or song
and/or are created by a user with the given Genius ID.
Results follow the per_page
and page
rules, and there are
some failure cases that the argument types can’t prevent so please
visit the Genius documentation for more information.
sourcepub async fn search<S: AsRef<str>>(
&self,
query: S
) -> Result<Response<SearchResponse>, ClientError>
pub async fn search<S: AsRef<str>>( &self, query: S ) -> Result<Response<SearchResponse>, ClientError>
sourcepub async fn song(&self, id: u32) -> Result<Response<SongResponse>, ClientError>
pub async fn song(&self, id: u32) -> Result<Response<SongResponse>, ClientError>
sourcepub async fn user(&self, id: u32) -> Result<Response<UserResponse>, ClientError>
pub async fn user(&self, id: u32) -> Result<Response<UserResponse>, ClientError>
Trait Implementations§
Auto Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more