Struct spacetraders::client::Client[][src]

pub struct Client {
    pub username: String,
    pub token: String,
    // some fields omitted
}
Expand description

A SpaceTraders client that is associated to a specific username

Fields

username: String

The users username

token: String

The uses access token

Implementations

Create a new game with a reqwest client that has the Authorization header set

Arguments

  • username - A string containing the username of the current player
  • token - A string containing the access token for the username provided

Get all information about the current user

Get the current details of a flight plan

Arguments

  • flight_plan_id - A string containing the flight plan id

Create a flight plan.

Arguments

  • ship_id - A string containing the ship_id to create the flight plan for
  • destination - A string containing the location to send the ship to

Get any loans taken out by the current user

Pay off a loan completely

Arguments

  • loan_id - A string containing the loan_id of the loan to pay off

Request a new loan

Arguments

  • loan_type - A LoanType with the type of loan being requested for the current user

Get location info about a specific location

Arguments

  • location_symbol - A string containing the location name to get info about

Get the marketplace data about a location.

Note

You must have a ship docked at the location in order to get it’s marketplace data

Arguments

  • location_symbol - A string containing the name of the location to get marketplace data for

Create a purchase order to transfer goods from a location to your ship

Arguments

  • ship - A Ship struct that you’d like to transfer the goods into
  • good - A Good enum containing the type of good you’d like to transfer
  • quantity - An i32 containing the quantity of good you’d like transferred

Create a sell order to transfer good from your ship to a location. Your ship will automatically sell the good to whatever location it is docked at

Arguments

  • ship - A Ship struct that you’d like to transfer the goods from
  • good - A Good enum containing the type of good you’d like to transfer
  • quantity - An i32 containing the quantity of good you’d like transferred

Add a ship to the users inventory by purchasing it

Arguments

  • location_symbol - A string containing the location you’d like to purchase the ship from
  • ship_type - A string containing the type of ship you’d like to purchase

Get info about a specific ship for the current user

Arguments

  • ship_id - A string id of the ship you’d like info about

Get all your ships

Jettison cargo from a ship

Get all ships that are available for sale

Get information about all systems

Get all available loans

Attempt a warp jump

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.