Client

Struct Client 

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

HTTP client for the mod.io API.

Implementations§

Source§

impl Client

Source

pub const fn get_terms(&self) -> GetTerms<'_>

Get text and links for user agreement and consent prior to authentication. [required: apikey]

See the mod.io docs for more information.

Source

pub const fn request_code<'a>(&'a self, email: &'a str) -> EmailRequest<'a>

Request a security code be sent to the email of the user. [required: apikey]

Source

pub const fn request_token<'a>( &'a self, security_code: &'a str, ) -> EmailExchange<'a>

Get the access token for a security code. [required: apikey]

Source

pub const fn external_auth<T: Provider>( &self, external: T, ) -> ExternalAuth<'_, T>

Authenticate via external services (Steam, GOG, Switch, Xbox, Discord, Oculus, Google etc.).

See the mod.io docs for more information.

§Examples
use modio::request::auth::external::Steam;
let response = client.external_auth(Steam::new("ticket")).await?;
let token = response.data().await?;

use modio::request::auth::external::PSN;
let response = client.external_auth(PSN::new("auth_code")).env(1).await?;
let token = response.data().await?;

use modio::request::auth::external::Discord;
let response = client
    .external_auth(Discord::new("token"))
    .email("john@example.com")
    .await?;
let token = response.data().await?;
Source

pub const fn logout(&self) -> Logout<'_>

Log out by revoking the current access token.

Source§

impl Client

Source

pub const fn get_games(&self) -> GetGames<'_>

Get all games.

Source

pub const fn get_game(&self, game_id: GameId) -> GetGame<'_>

Get a game.

Source

pub const fn get_game_stats(&self, game_id: GameId) -> GetGameStats<'_>

Return the statistics for a game.

Source

pub const fn get_game_tags(&self, game_id: GameId) -> GetGameTags<'_>

Return the tag options for a game.

Source

pub const fn add_game_tags<'a>( &'a self, game_id: GameId, name: &'a str, kind: TagType, tags: &'a [&'a str], ) -> AddGameTags<'a>

Add tags which can applied to mods. [required: token]

Source

pub const fn delete_game_tags<'a>( &'a self, game_id: GameId, name: &'a str, ) -> DeleteGameTags<'a>

Delete an entire group of tags or individual tags. [required: token]

Source

pub const fn rename_game_tag<'a>( &'a self, game_id: GameId, from: &'a str, to: &'a str, ) -> RenameGameTag<'a>

Rename an existing tag, updating all mods in the progress. [required: token]

Source

pub const fn add_game_media(&self, game_id: GameId) -> AddGameMedia<'_>

Add new media to a game. [required: token]

Source§

impl Client

Source

pub const fn get_mods(&self, game_id: GameId) -> GetMods<'_>

Get all mods for a game.

See Filters and sorting

§Examples
use modio::request::filter::prelude::*;
use modio::request::mods::filters::Name;
use modio::types::id::Id;

let list = client
    .get_mods(Id::new(51))
    .filter(Name::eq("the-x-com-files"))
    .await?
    .data()
    .await?;
Source

pub const fn get_mod(&self, game_id: GameId, mod_id: ModId) -> GetMod<'_>

Get the Modio mod object that this refers to.

Source

pub fn add_mod<'a>( &'a self, game_id: GameId, name: &'a str, summary: &'a str, logo: impl AsRef<Path>, ) -> AddMod<'a>

Add a mod and return the newly created Modio mod object. [required: token]

Source

pub const fn edit_mod(&self, game_id: GameId, mod_id: ModId) -> EditMod<'_>

Edit details for a mod. [required: token]

Source

pub const fn delete_mod(&self, game_id: GameId, mod_id: ModId) -> DeleteMod<'_>

Delete a mod. [required: token]

Source

pub const fn add_mod_media( &self, game_id: GameId, mod_id: ModId, ) -> AddModMedia<'_>

Add new media to a mod. [required: token]

Source

pub const fn delete_mod_media( &self, game_id: GameId, mod_id: ModId, ) -> DeleteModMedia<'_>

Delete media from a mod. [required: token]

Source

pub const fn reorder_mod_media( &self, game_id: GameId, mod_id: ModId, ) -> ReorderModMedia<'_>

Reorder the media of a mod. [required: token]

Source

pub const fn subscribe_to_mod( &self, game_id: GameId, mod_id: ModId, ) -> SubscribeToMod<'_>

Subscribe the authenticated user to a mod. [required: token]

Source

pub const fn unsubscribe_from_mod( &self, game_id: GameId, mod_id: ModId, ) -> UnsubscribeFromMod<'_>

Unsubscribe the authenticated user from a mod. [required: token]

Source

pub const fn rate_mod( &self, game_id: GameId, mod_id: ModId, ) -> SubmitModRating<'_>

Submit a rating for a mod. [required: token]

Source

pub const fn get_mod_team_members( &self, game_id: GameId, mod_id: ModId, ) -> GetModTeamMembers<'_>

Get all users that are part of a mod team.

Source§

impl Client

Source

pub const fn get_mod_tags( &self, game_id: GameId, mod_id: ModId, ) -> GetModTags<'_>

Get all tags for a mod.

Source

pub const fn add_mod_tags<'a>( &'a self, game_id: GameId, mod_id: ModId, tags: &'a [&'a str], ) -> AddModTags<'a>

Add tags to a mod. [required: token]

Source

pub const fn delete_mod_tags<'a>( &'a self, game_id: GameId, mod_id: ModId, tags: &'a [&'a str], ) -> DeleteModTags<'a>

Delete tags from a mod. [required: token]

Source§

impl Client

Source

pub const fn get_mods_events(&self, game_id: GameId) -> GetModsEvents<'_>

Get all mod events for a game sorted by latest first.

Source

pub const fn get_mods_stats(&self, game_id: GameId) -> GetModsStats<'_>

Get all mod statistics for a game.

Source

pub const fn get_mod_events( &self, game_id: GameId, mod_id: ModId, ) -> GetModEvents<'_>

Get the event log for a mod, showing changes made sorted by latest first.

Source

pub const fn get_mod_stats( &self, game_id: GameId, mod_id: ModId, ) -> GetModStats<'_>

Get the statistics for a mod.

Source§

impl Client

Source

pub const fn get_mod_metadata( &self, game_id: GameId, mod_id: ModId, ) -> GetModMetadata<'_>

Get all metadata key value pairs.

Source

pub const fn add_mod_metadata( &self, game_id: GameId, mod_id: ModId, metadata: MetadataMap, ) -> AddModMetadata<'_>

Add metadata for a mod as key value pairs. [required: token]

Source

pub const fn delete_mod_metadata( &self, game_id: GameId, mod_id: ModId, metadata: MetadataMap, ) -> DeleteModMetadata<'_>

Delete metadata key value pairs for a mod. [required: token]

Source§

impl Client

Source

pub const fn get_mod_dependencies( &self, game_id: GameId, mod_id: ModId, ) -> GetModDependencies<'_>

Get all dependencies a mod has selected.

Source

pub const fn add_mod_dependencies<'a>( &'a self, game_id: GameId, mod_id: ModId, deps: &'a [ModId], ) -> AddModDependencies<'a>

Add mod dependencies required by a mod. [required: token]

Source

pub const fn delete_mod_dependencies<'a>( &'a self, game_id: GameId, mod_id: ModId, deps: &'a [ModId], ) -> DeleteModDependencies<'a>

Delete mod dependencies a mod requires. [required: token]

Source§

impl Client

Source

pub const fn get_mod_comments( &self, game_id: GameId, mod_id: ModId, ) -> GetModComments<'_>

Get all comments posted on a mod’s profile.

Source

pub const fn get_mod_comment( &self, game_id: GameId, mod_id: ModId, comment_id: CommentId, ) -> GetModComment<'_>

Get a comment posted on a mod’s profile.

Source

pub const fn add_mod_comment<'a>( &'a self, game_id: GameId, mod_id: ModId, content: &'a str, ) -> AddModComment<'a>

Add a comment on a mod’s profile. [required: token]

Source

pub const fn edit_mod_comment<'a>( &'a self, game_id: GameId, mod_id: ModId, comment_id: CommentId, content: &'a str, ) -> EditModComment<'a>

Edit a comment on a mod’s profile. [required: token]

Source

pub const fn delete_mod_comment( &self, game_id: GameId, mod_id: ModId, comment_id: CommentId, ) -> DeleteModComment<'_>

Delete a comment from a mod’s profile. [required: token]

Source

pub const fn update_mod_comment_karma( &self, game_id: GameId, mod_id: ModId, comment_id: CommentId, ) -> UpdateModCommentKarma<'_>

Update the karma rating for a comment. [required: token]

Source§

impl Client

Source

pub const fn get_files(&self, game_id: GameId, mod_id: ModId) -> GetFiles<'_>

Get all files from a mod.

Source

pub const fn get_file( &self, game_id: GameId, mod_id: ModId, file_id: FileId, ) -> GetFile<'_>

Get a file from a mod.

Source

pub const fn add_file(&self, game_id: GameId, mod_id: ModId) -> AddFile<'_>

Add file to a mod. [required: token]

Source

pub const fn edit_file( &self, game_id: GameId, mod_id: ModId, file_id: FileId, ) -> EditFile<'_>

Edit the details of a published file. [required: token]

Source

pub const fn delete_file( &self, game_id: GameId, mod_id: ModId, file_id: FileId, ) -> DeleteFile<'_>

Delete a mod file. [required: token]

Source

pub const fn manage_platform_status( &self, game_id: GameId, mod_id: ModId, file_id: FileId, ) -> ManagePlatformStatus<'_>

Manage the platform status of a particular mod file. [required: token]

Source§

impl Client

Source

pub const fn get_multipart_upload_sessions( &self, game_id: GameId, mod_id: ModId, ) -> GetMultipartUploadSessions<'_>

Get all upload sessions. [required: token]

Source

pub const fn create_multipart_upload_session<'a>( &'a self, game_id: GameId, mod_id: ModId, filename: &'a str, ) -> CreateMultipartUploadSession<'a>

Create a new multipart upload session. [required: token]

Source

pub const fn get_multipart_upload_parts( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, ) -> GetMultipartUploadParts<'_>

Get the upload parts of the session. [required: token]

Source

pub const fn add_multipart_upload_part<S>( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, range: ContentRange, stream: S, ) -> AddMultipartUploadPart<'_, S>
where S: TryStream + Send + 'static, S::Ok: Into<Bytes>, S::Error: Into<Box<dyn Error + Send + Sync>>,

Add a new part to an existing upload session. [required: token]

Source

pub const fn complete_multipart_upload_session( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, ) -> CompleteMultipartUploadSession<'_>

Complete an active upload session after uploading all parts with Client::add_multipart_upload_part. [required: token]

Source

pub const fn delete_multipart_upload_session( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, ) -> DeleteMultipartUploadSession<'_>

Terminate an active upload session. [required: token]

Source

pub const fn add_multipart_upload_file( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, ) -> AddMultipartUploadFile<'_>

Finalize the upload with file details. [required: token]

§Example
use modio::types::files::File;
use modio::types::id::Id;

let game_id = Id::new(51);
let mod_id = Id::new(1041);
let UploadSession { id: upload_id, .. } = session;

let file: File = client
    .add_multipart_upload_file(game_id, mod_id, upload_id)
    .version("1.0")
    .active(true)
    .await?
    .data()
    .await?;
Source§

impl Client

Source

pub const fn get_authenticated_user(&self) -> GetAuthenticatedUser<'_>

Get the authenticated user details. [required: token]

Source

pub const fn get_user_games(&self) -> GetUserGames<'_>

Get all games the authenticated user added or is a team member of. [required: token]

Source

pub const fn get_user_mods(&self) -> GetUserMods<'_>

Get all mods the authenticated user added or is a team member of. [required: token]

Source

pub const fn get_user_files(&self) -> GetUserFiles<'_>

Get all mod files the authenticated user uploaded. [required: token]

Source

pub const fn get_user_ratings(&self) -> GetUserRatings<'_>

Get all mod ratings the authenticated user submitted. [required: token]

Source

pub const fn get_user_subscriptions(&self) -> GetUserSubscriptions<'_>

Get all mods the authenticated user is subscribed to. [required: token]

Source

pub const fn get_user_events(&self) -> GetUserEvents<'_>

Get events that have been fired specific to the user. [required: token]

Source§

impl Client

Source

pub const fn get_muted_users(&self) -> GetMutedUsers<'_>

Get all user muted by the authenticated user. [required: token]

Source

pub const fn mute_user(&self, user_id: UserId) -> MuteUser<'_>

Mute a user. [required: token]

Source

pub const fn unmute_user(&self, user_id: UserId) -> UnmuteUser<'_>

Unmute a previously muted user. [required: token]

Source§

impl Client

Source

pub fn report<'a>( &'a self, resource: &'a str, id: ResourceId, kind: u8, summary: &'a str, ) -> SubmitReport<'a>

Report a resource (game, guide, mod or user) on mod.io.

Source§

impl Client

Source

pub fn builder(api_key: String) -> Builder

Create a new builder with an API key.

Source

pub fn api_key(&self) -> &str

Retrieve the API key used by the client.

Source

pub fn token(&self) -> Option<&str>

Retrieve the token used by the client.

Source

pub fn with_token(&self, token: String) -> Self

Create a new client from the current instance with the given token.

Trait Implementations§

Source§

impl Download for Client

Source§

fn download<A>(&self, action: A) -> Downloader<'_, Init<'_>>
where DownloadAction: From<A>,

Returns Downloader for saving to file or retrieving the data chunked as Bytes. Read more
Source§

impl MultipartUpload for Client

Source§

fn upload<'a>( &'a self, game_id: GameId, mod_id: ModId, filename: &'a str, ) -> MultipartUploader<'a, Init<'a>>

Returns MultipartUploader for uploading files in multiple parts. Read more
Source§

fn upload_for( &self, game_id: GameId, mod_id: ModId, upload_id: UploadId, ) -> MultipartUploader<'_, Started<'_>>

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> ServiceExt for T

§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,