[][src]Struct screeps_api::sync::SyncApi

pub struct SyncApi<C = HttpsConnector<HttpConnector>> { /* fields omitted */ }

API structure mirroring Api, but providing utilities for synchronous connection.

This structure owns both the hyper client and the tokio runtime. If this is not wanted, please use Api instead.

Methods

impl SyncApi<HttpsConnector<HttpConnector>>[src]

pub fn new() -> Result<Self, SyncError>[src]

Creates a sync API client using an Https connector.

Use SyncApi::new_with_connector to set another backend, such as an HTTP only backend.

impl<C: Connect + 'static> SyncApi<C>[src]

pub fn new_with_connector(connector: C) -> Result<Self, Error>[src]

Creates a sync API client using a custom connector.

impl<C: Connect + 'static> SyncApi<C>[src]

pub fn with_url<U: AsRef<str>>(self, url: U) -> Result<Self, ParseError>[src]

Sets the server url this api client will use, and returns the client.

See also Api::set_url.

pub fn with_token<T: Into<Token>>(self, token: T) -> Self[src]

Sets the auth token this api client will use, and returns the client.

See the screeps docs page for information on tokens.

See also Api::set_token.

pub fn login<'b, U, V>(&mut self, username: U, password: V) -> Result<(), Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Logs in with the given username and password and stores the authenticated token in self.

Note: since the official server implemented auth tokens, this method has only worked for private servers with the screepsmod-auth mod.

Use Api::set_token instead for the official server.

pub fn register(
    &mut self,
    details: RegistrationArgs
) -> Result<RegistrationSuccess, Error>
[src]

Registers a new account with the given username, password and optional email and returns a result. Successful results contain no information other than that of success.

This is primarily for private servers with screepsmod-auth installed. Unknown if this works on the official server.

pub fn my_info(&mut self) -> Result<MyInfo, Error>[src]

Gets user information on the user currently logged in, including username and user id.

See Api::my_info for more information.

pub fn world_start_room(&mut self) -> Result<WorldStartRoom, Error>[src]

Gets the world shard and room name the server thinks the client should start with viewing.

See Api::world_start_room for more information.

pub fn shard_start_room<'b, U>(
    &mut self,
    shard: U
) -> Result<WorldStartRoom, Error> where
    U: Into<Cow<'b, str>>, 
[src]

Gets the room name the server thinks the client should start with viewing for a particular shard.

See Api::world_start_room for more information.

pub fn map_stats<'a, U, V>(
    &mut self,
    shard: &'a str,
    rooms: &'a V
) -> Result<MapStats, Error> where
    U: AsRef<str>,
    &'a V: IntoIterator<Item = U>, 
[src]

Get information on a number of rooms.

See Api::map_stats for more information.

pub fn room_overview<'b, U, V>(
    &mut self,
    shard: U,
    room_name: V,
    request_interval: u32
) -> Result<RoomOverview, Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Gets the overview of a room, returning totals for usually 3 intervals, 8, 180 and 1440, representing data for the past hour, data for the past 24 hours, and data for the past week respectively.

See Api::room_overview for more information.

pub fn room_terrain<'b, U, V>(
    &mut self,
    shard: Option<U>,
    room_name: V
) -> Result<RoomTerrain, Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Gets the terrain of a room, returning a 2d array of 50x50 points.

See Api::room_terrain for more information.

pub fn shard_list(&mut self) -> Result<Vec<ShardInfo>, Error>[src]

Gets a list of shards available on this server. Errors with a 404 error when connected to a non-sharded server.

See Api::shard_list for more information.

pub fn room_status<'b, U>(&mut self, room_name: U) -> Result<RoomStatus, Error> where
    U: Into<Cow<'b, str>>, 
[src]

Gets the "status" of a room: if it is open, if it is in a novice area, if it exists.

See Api::room_status for more information.

pub fn recent_pvp(&mut self, details: RecentPvpArgs) -> Result<RecentPvp, Error>[src]

Experimental endpoint to get all rooms in which PvP has recently occurred.

See Api::recent_pvp for more information.

pub fn leaderboard_season_list(
    &mut self
) -> Result<Vec<LeaderboardSeason>, Error>
[src]

Gets a list of all past leaderboard seasons, with end dates, display names, and season ids for each season.

See Api::leaderboard_season_list for more information.

pub fn find_season_leaderboard_rank<'b, U, V>(
    &mut self,
    leaderboard_type: LeaderboardType,
    username: U,
    season: V
) -> Result<FoundUserRank, Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Finds the rank of a user in a specific season for a specific leaderboard type.

See Api::find_season_leaderboard_rank for more information.

pub fn find_leaderboard_ranks<'b, U>(
    &mut self,
    leaderboard_type: LeaderboardType,
    username: U
) -> Result<Vec<FoundUserRank>, Error> where
    U: Into<Cow<'b, str>>, 
[src]

Finds the rank of a user for all seasons for a specific leaderboard type.

See Api::leaderboard_page for more information.

pub fn leaderboard_page<'b, U>(
    &mut self,
    leaderboard_type: LeaderboardType,
    season: U,
    limit: u32,
    offset: u32
) -> Result<LeaderboardPage, Error> where
    U: Into<Cow<'b, str>>, 
[src]

Gets a page of the leaderboard for a given season.

See Api::leaderboard_page for more information.

pub fn memory_segment<'b, U>(
    &mut self,
    shard: Option<U>,
    segment: u32
) -> Result<String, Error> where
    U: Into<Cow<'b, str>>, 
[src]

Gets a player's memory segment

pub fn set_memory_segment<'b, U, V>(
    &mut self,
    shard: Option<U>,
    segment: u32,
    data: V
) -> Result<(), Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Sets a player's memory segment

Methods from Deref<Target = Api<C>>

pub fn set_url<U: AsRef<str>>(&mut self, url: U) -> Result<(), ParseError>[src]

Sets the server url this api client will use.

See also Api::with_url.

pub fn set_token<T: Into<Token>>(&mut self, token: T)[src]

Sets the auth token this api client will use.

See the screeps docs page for information on tokens.

See also Api::with_token.

pub fn token_storage(&self) -> &TokenStorage[src]

Retrieves the token storage for this client.

pub fn login<'b, U, V>(
    &self,
    username: U,
    password: V
) -> impl Future<Item = LoggedIn, Error = Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Logs in with the given username and password and stores the authenticated token in self.

Note: since the official server implemented auth tokens, this method has only worked for private servers with the screepsmod-auth mod.

Use Api::set_token instead for the official server.

pub fn register(
    &self,
    details: RegistrationArgs
) -> impl Future<Item = RegistrationSuccess, Error = Error>
[src]

Registers a new account with the given username, password and optional email and returns a result. Successful results contain no information other than that of success.

This is primarily for private servers with screepsmod-auth installed. Unknown if this works on the official server.

pub fn my_info(
    &self
) -> Result<impl Future<Item = MyInfo, Error = Error>, NoToken>
[src]

Gets user information on the user currently logged in, including username and user id.

pub fn world_start_room(
    &self
) -> Result<impl Future<Item = WorldStartRoom, Error = Error>, NoToken>
[src]

Gets the world shard and room name the server thinks the client should start with viewing.

pub fn shard_start_room<'b, U>(
    &self,
    shard: U
) -> Result<impl Future<Item = WorldStartRoom, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>, 
[src]

Gets the room name the server thinks the client should start with viewing for a particular shard.

pub fn map_stats<'a, U, V>(
    &self,
    shard: &'a str,
    rooms: &'a V
) -> Result<impl Future<Item = MapStats, Error = Error>, NoToken> where
    U: AsRef<str>,
    &'a V: IntoIterator<Item = U>, 
[src]

Get information on a number of rooms.

pub fn room_overview<'b, U, V>(
    &self,
    shard: U,
    room_name: V,
    request_interval: u32
) -> Result<impl Future<Item = RoomOverview, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Gets the overview of a room, returning totals for usually 3 intervals, 8, 180 and 1440, representing data for the past hour, data for the past 24 hours, and data for the past week respectively.

All Allowed request_intervals are not known, but at least 8, 180 and 1440 are allowed. The returned data, at the time of writing, includes 8 data points of each type, representing equal portions of the time period requested (hour for 8, day for 180, week for 1440).

pub fn room_terrain<'b, U, V>(
    &self,
    shard: Option<U>,
    room_name: V
) -> impl Future<Item = RoomTerrain, Error = Error> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Gets the terrain of a room, returning a 2d array of 50x50 points.

Does not require authentication.

pub fn shard_list(&self) -> impl Future<Item = Vec<ShardInfo>, Error = Error>[src]

Gets a list of shards available on this server. Errors with a 404 error when connected to a non-sharded server.

Does not require authentication.

pub fn room_status<'b, U>(
    &self,
    room_name: U
) -> Result<impl Future<Item = RoomStatus, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>, 
[src]

Gets the "status" of a room: if it is open, if it is in a novice area, if it exists.

pub fn recent_pvp(
    &self,
    details: RecentPvpArgs
) -> impl Future<Item = RecentPvp, Error = Error>
[src]

Experimental endpoint to get all rooms in which PvP has recently occurred, or where PvP has occurred since a certain game tick.

pub fn leaderboard_season_list(
    &self
) -> Result<impl Future<Item = Vec<LeaderboardSeason>, Error = Error>, NoToken>
[src]

Gets a list of all past leaderboard seasons, with end dates, display names, and season ids for each season.

Seasons are a way of having limited time periods (usually one month) in which all rankings are reset at the beginning of, and points earned during the time period contribute to a player's rank in that season.

This method does not return any actual data, but rather just a list of valid past season, any of the ids of which can then be used to retrieve more information.

pub fn find_season_leaderboard_rank<'b, U, V>(
    &self,
    leaderboard_type: LeaderboardType,
    username: U,
    season: V
) -> Result<impl Future<Item = FoundUserRank, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Finds the rank of a user in a specific season for a specific leaderboard type.

Will return ApiError::UserNotFound when the username does not exist, and ApiError::ResultNotFound when the user exists but does not have a rank for the given season. The user will not have a rank when either the account did not exist when the season ended, or the user either processed no power or upgraded no controllers, during the specific leaderboard season.

This is technically the same API endpoint as find_leaderboard_rank, but the result format differs when requesting a specific season from when requesting all season ranks.

pub fn find_leaderboard_ranks<'b, U>(
    &self,
    leaderboard_type: LeaderboardType,
    username: U
) -> Result<impl Future<Item = Vec<FoundUserRank>, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>, 
[src]

Finds the rank of a user for all seasons for a specific leaderboard type.

This will return ApiError::UserNotFound if a username does not exist, and may also return an empty Vec as the result if the user does not have any ranks in the given leaderboard type (they have never contributed any global control points, or processed power, depending on the type).

pub fn leaderboard_page<'b, U>(
    &self,
    leaderboard_type: LeaderboardType,
    season: U,
    limit: u32,
    offset: u32
) -> Result<impl Future<Item = LeaderboardPage, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>, 
[src]

Gets a page of the leaderboard for a given season.

Limit dictates how many users will be returned, maximum is 20. Higher than that will cause an InvalidParameters error message.

Offset doesn't have to be a multiple of limit, but it's most likely most useful that it is. Offset 0 will get you the start/top of the ranked list.

pub fn memory_segment<'b, U>(
    &self,
    shard: Option<U>,
    segment: u32
) -> Result<impl Future<Item = String, Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>, 
[src]

Gets the player's memory segment on a given shard

pub fn set_memory_segment<'b, U, V>(
    &self,
    shard: Option<U>,
    segment: u32,
    data: V
) -> Result<impl Future<Item = (), Error = Error>, NoToken> where
    U: Into<Cow<'b, str>>,
    V: Into<Cow<'b, str>>, 
[src]

Sets the player's memory segment on a given shard

Trait Implementations

impl<C> DerefMut for SyncApi<C>[src]

impl<C> Deref for SyncApi<C>[src]

type Target = Api<C>

The resulting type after dereferencing.

impl<C: Debug> Debug for SyncApi<C>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,