[−][src]Struct modio::Modio
Endpoint interface to interacting with the mod.io API.
Implementations
impl Modio
[src]
pub fn builder<C: Into<Credentials>>(credentials: C) -> Builder
[src]
Constructs a new Builder
to configure a Modio
client.
This is the same as Builder::new(credentials)
.
pub fn new<C>(credentials: C) -> Result<Self> where
C: Into<Credentials>,
[src]
C: Into<Credentials>,
Create an endpoint to https://api.mod.io/v1.
pub fn host<H, C>(host: H, credentials: C) -> Result<Self> where
H: Into<String>,
C: Into<Credentials>,
[src]
H: Into<String>,
C: Into<Credentials>,
Create an endpoint to a different host.
pub fn with_credentials<CR>(&self, credentials: CR) -> Self where
CR: Into<Credentials>,
[src]
CR: Into<Credentials>,
Return an endpoint with new credentials.
pub fn with_token<T>(&self, token: T) -> Self where
T: Into<Token>,
[src]
T: Into<Token>,
Return an endpoint with a new token.
pub fn auth(&self) -> Auth
[src]
Return a reference to an interface for requesting access tokens.
pub fn games(&self) -> Games
[src]
Return a reference to an interface that provides access to game information.
pub fn game(&self, game_id: u32) -> GameRef
[src]
Return a reference to a game.
pub fn mod_(&self, game_id: u32, mod_id: u32) -> ModRef
[src]
Return a reference to a mod.
pub fn download<A>(&self, action: A) -> Downloader where
DownloadAction: From<A>,
[src]
DownloadAction: From<A>,
Returns Downloader
for saving to file or retrieving
the data via Stream
.
The download fails with modio::download::Error
as source
if a primary file, a specific file or a specific version is not found.
Example
use futures_util::{future, TryStreamExt}; use modio::download::{DownloadAction, ResolvePolicy}; // Download the primary file of a mod. let action = DownloadAction::Primary { game_id: 5, mod_id: 19, }; modio.download(action).save_to_file("mod.zip").await?; // Download the specific file of a mod. let action = DownloadAction::File { game_id: 5, mod_id: 19, file_id: 101, }; modio.download(action).save_to_file("mod.zip").await?; // 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 // `modio::download::Error::MultipleFilesFound` as source error. let action = DownloadAction::Version { game_id: 5, mod_id: 19, version: "0.1".to_string(), policy: ResolvePolicy::Latest, }; modio .download(action) .stream() .try_for_each(|bytes| { println!("Bytes: {:?}", bytes); future::ok(()) }) .await?;
pub fn user(&self) -> Me
[src]
Return a reference to an interface that provides access to resources owned by the user associated with the current authentication credentials.
pub fn reports(&self) -> Reports
[src]
Return a reference to an interface to report games, mods and users.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Modio
[src]
impl Send for Modio
[src]
impl Sync for Modio
[src]
impl Unpin for Modio
[src]
impl !UnwindSafe for Modio
[src]
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>,