Struct spacetraders::client::Client [−][src]
A SpaceTraders client that is associated to a specific username
Fields
username: String
The users username
token: String
The uses access token
Implementations
impl Client
[src]
impl Client
[src]pub fn new(http_client: HttpClient, username: String, token: String) -> Client
[src]
Create a new game with a reqwest client that has the Authorization header set
Arguments
username
- A string containing the username of the current playertoken
- A string containing the access token for the username provided
pub async fn get_flight_plan(&self, id: String) -> Result<FlightPlan, Error>
[src]
pub async fn create_flight_plan(
&self,
ship_id: String,
destination: String
) -> Result<FlightPlan, Error>
[src]
&self,
ship_id: String,
destination: String
) -> Result<FlightPlan, Error>
Create a flight plan.
Arguments
ship_id
- A string containing the ship_id to create the flight plan fordestination
- A string containing the location to send the ship to
pub async fn get_game_status(&self) -> Result<GameStatus, Error>
[src]
Get the status of the game API.
pub async fn get_available_loans(&self) -> Result<AvailableLoans, Error>
[src]
Get all available loans
pub async fn get_your_loans(&self) -> Result<LoanInfo, Error>
[src]
Get any loans taken out by the current user
pub async fn pay_off_loan(&self, loan_id: String) -> Result<UserInfo, Error>
[src]
Pay off a loan completely
Arguments
loan_id
- A string containing the loan_id of the loan to pay off
pub async fn request_new_loan(
&self,
loan_type: LoanType
) -> Result<RequestLoan, Error>
[src]
&self,
loan_type: LoanType
) -> Result<RequestLoan, Error>
Request a new loan
Arguments
loan_type
- A LoanType with the type of loan being requested for the current user
pub async fn get_location_info(
&self,
location: String
) -> Result<LocationInfo, Error>
[src]
&self,
location: String
) -> Result<LocationInfo, Error>
Get location info about a specific location
Arguments
location
- A string containing the location name to get info about
pub async fn get_locations_in_system(
&self,
system: String,
location_type: Option<LocationType>
) -> Result<AvailableLocations, Error>
[src]
&self,
system: String,
location_type: Option<LocationType>
) -> Result<AvailableLocations, Error>
Get all the locations in a particular system
Arguments
system
- A string containing the system name to get the locations fromlocation_type
- An optional LocationType if you want to filter the locations by type
pub async fn get_location_marketplace(
&self,
location: String
) -> Result<LocationMarketplace, Error>
[src]
&self,
location: String
) -> Result<LocationMarketplace, Error>
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
- A string containing the name of the location to get marketplace data for
pub async fn create_purchase_order(
&self,
ship: Ship,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, Error>
[src]
&self,
ship: Ship,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, Error>
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 intogood
- A Good enum containing the type of good you’d like to transferquantity
- An i32 containing the quantity of good you’d like transferred
pub async fn create_sell_order(
&self,
ship_id: String,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, Error>
[src]
&self,
ship_id: String,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, Error>
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 fromgood
- A Good enum containing the type of good you’d like to transferquantity
- An i32 containing the quantity of good you’d like transferred
pub async fn purchase_ship(
&self,
location: String,
ship_type: String
) -> Result<PurchaseShip, Error>
[src]
&self,
location: String,
ship_type: String
) -> Result<PurchaseShip, Error>
Add a ship to the users inventory by purchasing it
Arguments
location
- A string containing the location you’d like to purchase the ship fromship_type
- A string containing the type of ship you’d like to purchase
pub async fn get_ships_for_sale(&self) -> Result<ShipsForSale, Error>
[src]
Get all ships that are available for sale
pub async fn get_your_ships(&self) -> Result<YourShips, Error>
[src]
Get all your ships
pub async fn get_systems_info(&self) -> Result<SystemsInfo, Error>
[src]
Get information about all systems
pub async fn get_user_info(&self) -> Result<UserInfo, Error>
[src]
Get all information about the current user
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]