Struct RequestBuilder

Source
pub struct RequestBuilder { /* private fields */ }
Expand description

Request Builder struct

Implementations§

Source§

impl RequestBuilder

Source

pub fn new() -> RequestBuilder

Creates a new Request Builder It can also be created using IGDBClient::create_request();

§Examples
use igdb_rs::request_builder::RequestBuilder;

let mut request = RequestBuilder::new();
use igdb_rs::client::IGDBClient;

let mut request = IGDBClient::create_request();
Source§

impl RequestBuilder

This struct allows creating a custom and parameterized request to IGDB endpoints by using it’s filter methods

Source

pub fn all_fields(&mut self) -> &mut Self

Requests all field for the given query

§Examples
use igdb_rs::client::IGDBClient;

let mut request = IGDBClient::create_request();
request
.all_fields()
.search("Conan")
.limit(1);
Source

pub fn add_field<S: Into<String>>(&mut self, field: S) -> &mut Self

Adds one field to be retrieved for this request Requests all field for the given query

§Examples
use igdb_rs::client::IGDBClient;

let mut request = IGDBClient::create_request();
request
.add_field("description")
.add_field("name")
.search("Borderlands");
Source

pub fn add_fields<I, T>(&mut self, iter: I) -> &mut Self
where I: IntoIterator<Item = T>, T: Into<String>,

Adds several fields for this request by using an Iterator object

§Examples
use igdb_rs::client::IGDBClient;

let mut request = IGDBClient::create_request();
request
.add_fields(vec!["description", "name", "summary"])
.contains("name", "Mass Effect");
Source

pub fn add_where_in(&mut self, field: String, values: Vec<String>) -> &mut Self

Adds a filter representing a group of elements like WHERE IN statement in SQL

§Examples
use igdb_rs::client::IGDBClient;

let mut request = IGDBClient::create_request();
request
.all_fields()
.add_where_in("name".to_owned(), vec!["5".to_owned(), "8".to_owned(), "10".to_owned()])
.limit(5);
Source

pub fn add_where<L: Into<String>, R: Into<String>>( &mut self, field: L, equality: Equality, clause: R, ) -> &mut Self

Adds a filter under using given condition

§Examples
use igdb_rs::client::IGDBClient;
use igdb_rs::request_builder::Equality;

let mut request = IGDBClient::create_request();
request
.add_where("id", Equality::GreaterOrEqual, "20")
.add_where("onlinemax", Equality::LessOrEqual, "12")
.contains("name", "Fighter");
Source

pub fn limit(&mut self, limit: usize) -> &mut Self

Limits the registries obtained from the server

§Examples
use igdb_rs::client::IGDBClient;
use igdb_rs::request_builder::Equality;

let mut request = IGDBClient::create_request();
request
.all_fields()
.limit(8);
Source

pub fn contains<S: Into<String>>(&mut self, field: S, value: S) -> &mut Self

Return the registries containing the given value for the specified field. Can start and end with anything

§Examples
use igdb_rs::client::IGDBClient;
use igdb_rs::request_builder::Equality;

let mut request = IGDBClient::create_request();
request
.all_fields()
.limit(8);
Source

pub fn search<S: Into<String>>(&mut self, search: S) -> &mut Self

Search based on name, results are sorted by similarity to the given search string. Searchable endpoints: - Characters - Collections - Games - People - Platforms - Themes

§Examples
use igdb_rs::client::IGDBClient;
use igdb_rs::request_builder::Equality;

let mut request = IGDBClient::create_request();
request
.search("Zelda")
.limit(8);
Source

pub fn sort_by<S: Into<String>>( &mut self, field: S, order: OrderBy, ) -> &mut Self

Sorts the query by the given field

§Examples
use igdb_rs::client::IGDBClient;
use igdb_rs::request_builder::{Equality, OrderBy};

let mut request = IGDBClient::create_request();
request
.add_field("name")
.sort_by("name", OrderBy::Descending)
.limit(8);

Trait Implementations§

Source§

impl Clone for RequestBuilder

Source§

fn clone(&self) -> RequestBuilder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RequestBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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> ErasedDestructor for T
where T: 'static,