pub struct Client { /* private fields */ }
Expand description
The IGDB API client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_endpoint(self, endpoint: &str) -> Self
pub fn with_endpoint(self, endpoint: &str) -> Self
Set a custom endpoint for use with the CORS proxy or your own proxy.
use igdb_api_rust::client::Client;
let mut client = Client::new("test","test").with_endpoint("https://example.com/v4");
Sourcepub async fn request<M: Message + Default>(
&mut self,
query: &ApicalypseBuilder,
) -> Result<M, IGDBApiError>
pub async fn request<M: Message + Default>( &mut self, query: &ApicalypseBuilder, ) -> Result<M, IGDBApiError>
Request the IGDB API for a protobuf response.
Sourcepub async fn request_raw<M: Message + Default>(
&mut self,
query: &str,
) -> Result<M, IGDBApiError>
pub async fn request_raw<M: Message + Default>( &mut self, query: &str, ) -> Result<M, IGDBApiError>
Request the IGDB API for a protobuf response. This is the raw version of the request method. It allows you to pass a query string directly.
#[tokio::main]
async fn main() {
use igdb_api_rust::client::Client;
let mut client = Client::new("test","test");
let query = "fields name; limit 5;";
let response = client.request_raw::<igdb_api_rust::igdb::Game>(query).await;
}
Sourcepub async fn request_count<M: Message + Default>(
&mut self,
query: &ApicalypseBuilder,
) -> Result<Count, IGDBApiError>
pub async fn request_count<M: Message + Default>( &mut self, query: &ApicalypseBuilder, ) -> Result<Count, IGDBApiError>
Request the IGDB API for a protobuf response for the count endpoint.
#[tokio::main]
async fn main() {
use igdb_api_rust::apicalypse_builder::ApicalypseBuilder;
use igdb_api_rust::client::Client;
let mut client = Client::new("test","test");
let query = ApicalypseBuilder::default().filter("id > 1337").clone();
let response = client.request_count::<igdb_api_rust::igdb::Game>(&query).await;
println!("{:?}", response);
}
Sourcepub async fn request_count_raw<M: Message + Default>(
&mut self,
query: &str,
) -> Result<Count, IGDBApiError>
pub async fn request_count_raw<M: Message + Default>( &mut self, query: &str, ) -> Result<Count, IGDBApiError>
Request the IGDB API for a protobuf response for the count endpoint. This is the raw version of the request_count method. It allows you to pass a query string directly.
#[tokio::main]
async fn main() {
use igdb_api_rust::client::Client;
let mut client = Client::new("test","test");
let query = "w id > 1337";
let response = client.request_count_raw::<igdb_api_rust::igdb::Game>(query).await;
}
Trait Implementations§
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> 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