Struct modio::Modio [−][src]
Endpoint interface to interacting with the mod.io API.
Methods
impl Modio<HttpsConnector<HttpConnector>>
[src]
impl Modio<HttpsConnector<HttpConnector>>
pub fn new<A, C>(agent: A, credentials: C) -> Self where
A: Into<String>,
C: Into<Credentials>,
[src]
pub fn new<A, C>(agent: A, credentials: C) -> Self where
A: Into<String>,
C: Into<Credentials>,
Create an endpoint to https://api.mod.io/v1.
pub fn host<H, A, C>(host: H, agent: A, credentials: C) -> Self where
H: Into<String>,
A: Into<String>,
C: Into<Credentials>,
[src]
pub fn host<H, A, C>(host: H, agent: A, credentials: C) -> Self where
H: Into<String>,
A: Into<String>,
C: Into<Credentials>,
Create an endpoint to a different host.
impl<C> Modio<C> where
C: Clone + Connect + 'static,
[src]
impl<C> Modio<C> where
C: Clone + Connect + 'static,
pub fn custom<H, A, CR>(
host: H,
agent: A,
credentials: CR,
client: Client<C>
) -> Self where
H: Into<String>,
A: Into<String>,
CR: Into<Credentials>,
[src]
pub fn custom<H, A, CR>(
host: H,
agent: A,
credentials: CR,
client: Client<C>
) -> Self where
H: Into<String>,
A: Into<String>,
CR: Into<Credentials>,
Create an endpoint with a custom hyper client.
pub fn with_credentials<CR>(self, credentials: CR) -> Self where
CR: Into<Credentials>,
[src]
pub fn with_credentials<CR>(self, credentials: CR) -> Self where
CR: Into<Credentials>,
Consume the endpoint and create an endpoint with new credentials.
pub fn auth(&self) -> Auth<C>
[src]
pub fn auth(&self) -> Auth<C>
Return a reference to an interface for requesting access tokens.
pub fn games(&self) -> Games<C>
[src]
pub fn games(&self) -> Games<C>
Return a reference to an interface that provides access to game informations.
pub fn game(&self, game_id: u32) -> GameRef<C>
[src]
pub fn game(&self, game_id: u32) -> GameRef<C>
Return a reference to a game.
pub fn mod_(&self, game_id: u32, mod_id: u32) -> ModRef<C>
[src]
pub fn mod_(&self, game_id: u32, mod_id: u32) -> ModRef<C>
Return a reference to a mod.
pub fn download<A, W>(&self, action: A, w: W) -> Future<(u64, W)> where
A: Into<DownloadAction>,
W: Write + 'static + Send,
[src]
pub fn download<A, W>(&self, action: A, w: W) -> Future<(u64, W)> where
A: Into<DownloadAction>,
W: Write + 'static + Send,
Performs a download into a writer.
Fails with ErrorKind::Download
if a primary file,
a specific file or a specific version is not found.
Example
extern crate modio; extern crate tokio; use std::fs::File; use modio::download::ResolvePolicy; use modio::{Credentials, DownloadAction, Error, Modio}; use tokio::runtime::Runtime; fn main() -> Result<(), Error> { let mut rt = Runtime::new()?; let modio = Modio::new( "user-agent-name/1.0", Credentials::ApiKey(String::from("user-or-game-api-key")), ); let out = File::open("mod.zip")?; // Download the primary file of a mod. let action = DownloadAction::Primary { game_id: 5, mod_id: 19, }; let (len, out) = rt.block_on(modio.download(action, out))?; // Download the specific file of a mod. let action = DownloadAction::File { game_id: 5, mod_id: 19, file_id: 101, }; let (len, out) = rt.block_on(modio.download(action, out))?; // Download the specific version of a mod. // if multiple files are found then the latest file is downloaded. // Set policy to `ResolvePolicy::Fail` to return with // `ErrorKind::Download(DownloadError::MultipleFilesFound)`. let action = DownloadAction::Version { game_id: 5, mod_id: 19, version: "0.1".to_string(), policy: ResolvePolicy::Latest, }; let (len, out) = rt.block_on(modio.download(action, out))?; Ok(()) }
pub fn me(&self) -> Me<C>
[src]
pub fn me(&self) -> Me<C>
Return a reference to an interface that provides access to resources owned by the user associated with the current authentication credentials.
pub fn users(&self) -> Users<C>
[src]
pub fn users(&self) -> Users<C>
Return a reference to an interface that provides access to user informations.
pub fn reports(&self) -> Reports<C>
[src]
pub fn reports(&self) -> Reports<C>
Return a reference to an interface to report games, mods and users.
Trait Implementations
impl<C: Clone> Clone for Modio<C> where
C: Clone + Connect + 'static,
[src]
impl<C: Clone> Clone for Modio<C> where
C: Clone + Connect + 'static,
fn clone(&self) -> Modio<C>
[src]
fn clone(&self) -> Modio<C>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<C: Debug> Debug for Modio<C> where
C: Clone + Connect + 'static,
[src]
impl<C: Debug> Debug for Modio<C> where
C: Clone + Connect + 'static,