Struct demostf_client::ApiClient [−][src]
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 list_uploads(
&self,
uploader: SteamID,
params: ListParams,
page: u32
) -> Result<Vec<Demo>, Error>[src]
&self,
uploader: SteamID,
params: ListParams,
page: u32
) -> Result<Vec<Demo>, Error>
List demos uploaded by a user with the provided options
note that the pages start counting at 1
Example
use demostf_client::{ListOrder, ListParams}; let client = ApiClient::default(); let demos = client.list_uploads(SteamID::from(76561198024494988), 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]
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>
pub async fn upload_demo(
&self,
file_name: String,
body: Vec<u8>,
red: String,
blue: String,
key: String
) -> Result<u32, Error>[src]
&self,
file_name: String,
body: Vec<u8>,
red: String,
blue: String,
key: String
) -> Result<u32, 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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,