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>, ReqwestError>
pub async fn account(&self) -> Result<Response<AccountResponse>, ReqwestError>
sourcepub async fn annotation(
&self,
id: u32
) -> Result<Response<AnnotationResponse>, ReqwestError>
pub async fn annotation( &self, id: u32 ) -> Result<Response<AnnotationResponse>, ReqwestError>
sourcepub async fn artist(
&self,
id: u32
) -> Result<Response<ArtistResponse>, ReqwestError>
pub async fn artist( &self, id: u32 ) -> Result<Response<ArtistResponse>, ReqwestError>
sourcepub async fn referents(
&self,
created_by: Option<u32>,
associated: Option<ReferentAssociation>,
per_page: Option<u8>,
page: Option<u8>
) -> Result<Response<ReferentsResponse>, ReqwestError>
pub async fn referents( &self, created_by: Option<u32>, associated: Option<ReferentAssociation>, per_page: Option<u8>, page: Option<u8> ) -> Result<Response<ReferentsResponse>, ReqwestError>
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(
&self,
query: &str
) -> Result<Response<SearchResponse>, ReqwestError>
pub async fn search( &self, query: &str ) -> Result<Response<SearchResponse>, ReqwestError>
sourcepub async fn song(
&self,
id: u32
) -> Result<Response<SongResponse>, ReqwestError>
pub async fn song( &self, id: u32 ) -> Result<Response<SongResponse>, ReqwestError>
sourcepub async fn user(
&self,
id: u32
) -> Result<Response<UserResponse>, ReqwestError>
pub async fn user( &self, id: u32 ) -> Result<Response<UserResponse>, ReqwestError>
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