[−][src]Struct demostf_client::ApiClient
Implementations
impl ApiClient
[src]
Api client for demos.tf
Example
use demostf_client::{ListOrder, ListParams, ApiClient}; let client = ApiClient::new(); let demos = client.list(ListParams::default().with_order(ListOrder::Ascending), 1).await?; for demo in demos { println!("{}: {}", demo.id, demo.name); }
pub fn new() -> Self
[src]
Create an api client for the default demos.tf endpoint
pub fn with_base_url(base_url: impl IntoUrl) -> Result<Self, Error>
[src]
Create an api client using a different api endpoint
pub async fn list<'_>(
&'_ self,
params: ListParams,
page: u32
) -> Result<Vec<Demo>, Error>
[src]
&'_ self,
params: ListParams,
page: u32
) -> Result<Vec<Demo>, Error>
List demos with the provided options
note that the pages start counting at 1
Example
use demostf_client::{ListOrder, ListParams}; let demos = client.list(ListParams::default().with_order(ListOrder::Ascending), 1).await?; for demo in demos { println!("{}: {}", demo.id, demo.name); }
pub async fn get<'_>(&'_ self, demo_id: u32) -> Result<Demo, Error>
[src]
Get the data for a single demo
Example
let demo = client.get(9).await?; println!("{}: {}", demo.id, demo.name); println!("players:"); for player in demo.players { println!("{}", player.user.name); }
pub async fn get_user<'_>(&'_ self, user_id: u32) -> Result<User, Error>
[src]
Get user info by id
Example
let user = client.get_user(1).await?; println!("{} ({})", user.name, user.steam_id.steam3());
pub async fn get_chat<'_>(
&'_ self,
demo_id: u32
) -> Result<Vec<ChatMessage>, Error>
[src]
&'_ self,
demo_id: u32
) -> Result<Vec<ChatMessage>, Error>
List demos with the provided options
Example
let chat = client.get_chat(447678).await?; for message in chat { println!("{}: {}", message.user, message.message); }
pub async fn set_url<'_, '_, '_, '_, '_>(
&'_ self,
demo_id: u32,
backend: &'_ str,
path: &'_ str,
url: &'_ str,
hash: [u8; 16],
key: &'_ str
) -> Result<(), Error>
[src]
&'_ self,
demo_id: u32,
backend: &'_ str,
path: &'_ str,
url: &'_ str,
hash: [u8; 16],
key: &'_ str
) -> Result<(), Error>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ApiClient
impl Send for ApiClient
impl Sync for ApiClient
impl Unpin for ApiClient
impl !UnwindSafe for ApiClient
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,