Struct screeps_api::Api [] [src]

pub struct Api<C, H = Client<C>, T = RcTokenStorage> {
    pub url: Url,
    pub tokens: T,
    // some fields omitted
}

API Object, stores the current API token and allows access to making requests.

Fields

The base URL for this API instance.

The stored authentication tokens.

Methods

impl<C, H, T: Default> Api<C, H, T>
[src]

[src]

Creates a new API instance for the official server with the https://screeps.com/api/ base url.

The returned instance can be used to make anonymous calls, or API.login can be used to allow for authenticated API calls.

[src]

Creates a new API instance with the given url as the base instead of https://screeps.com/api/.

The returned instance can be used to make anonymous calls, or API.login can be used to allow for authenticated API calls.

impl<C, H, T> Api<C, H, T>
[src]

[src]

Creates a new API instance for the official server with a stored token.

The returned instance can be used to make both anonymous calls, and authenticated calls, provided the token is valid.

[src]

Creates a new API instance with the given url as the base instead of https://screeps.com/api/, and with a stored token for that url.

The returned instance can be used to make anonymous calls and will be allowed to make authenticated calls if the token is valid.

impl<C: Connect, H: HyperClient<C>, T: TokenStorage> Api<C, H, T>
[src]

[src]

Logs in with the given username and password and returns a result containing the token.

Use logged_in.return_to(client.tokens) to let the client use the token from logging in.

[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.

[src]

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

[src]

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

[src]

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

[src]

Get information on a number of rooms.

[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).

[src]

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

Does not require authentication.

[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.

[src]

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

[src]

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

[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.

[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.

[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).

[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.

Trait Implementations

impl<C: Debug, H: Debug, T: Debug> Debug for Api<C, H, T>
[src]

[src]

Formats the value using the given formatter.

impl<C, H: Clone, T: Clone> Clone for Api<C, H, T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more