Struct spacetraders::client::Client [−][src]
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 playertoken
- A string containing the access token for the username provided
Get all information about the current user
pub async fn get_flight_plan(
&self,
flight_plan_id: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]
pub async fn get_flight_plan(
&self,
flight_plan_id: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]Get the current details of a flight plan
Arguments
flight_plan_id
- A string containing the flight plan id
pub async fn create_flight_plan(
&self,
ship_id: String,
destination: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]
pub async fn create_flight_plan(
&self,
ship_id: String,
destination: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]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
Get any loans taken out by the current user
pub async fn pay_off_loan(
&self,
loan_id: &str
) -> Result<PayLoanResponse, SpaceTradersClientError>
[src]
pub async fn pay_off_loan(
&self,
loan_id: &str
) -> Result<PayLoanResponse, SpaceTradersClientError>
[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, SpaceTradersClientError>
[src]
pub async fn request_new_loan(
&self,
loan_type: LoanType
) -> Result<RequestLoan, SpaceTradersClientError>
[src]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_symbol: String
) -> Result<LocationInfo, SpaceTradersClientError>
[src]
pub async fn get_location_info(
&self,
location_symbol: String
) -> Result<LocationInfo, SpaceTradersClientError>
[src]Get location info about a specific location
Arguments
location_symbol
- A string containing the location name to get info about
pub async fn get_location_marketplace(
&self,
location_symbol: &str
) -> Result<LocationMarketplace, SpaceTradersClientError>
[src]
pub async fn get_location_marketplace(
&self,
location_symbol: &str
) -> Result<LocationMarketplace, SpaceTradersClientError>
[src]pub async fn create_purchase_order(
&self,
ship_id: String,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, SpaceTradersClientError>
[src]
pub async fn create_purchase_order(
&self,
ship_id: String,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, SpaceTradersClientError>
[src]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, SpaceTradersClientError>
[src]
pub async fn create_sell_order(
&self,
ship_id: String,
good: Good,
quantity: i32
) -> Result<PurchaseOrder, SpaceTradersClientError>
[src]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_symbol: String,
ship_type: String
) -> Result<PurchaseShip, SpaceTradersClientError>
[src]
pub async fn purchase_ship(
&self,
location_symbol: String,
ship_type: String
) -> Result<PurchaseShip, SpaceTradersClientError>
[src]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 fromship_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
pub async fn jettison_cargo(
&self,
ship_id: &str,
good: Good,
quantity: i32
) -> Result<JettisonCargo, SpaceTradersClientError>
[src]
pub async fn jettison_cargo(
&self,
ship_id: &str,
good: Good,
quantity: i32
) -> Result<JettisonCargo, SpaceTradersClientError>
[src]Jettison cargo from a ship
Get all ships that are available for sale
Get information about all systems
Get all available loans
pub async fn attempt_warp_jump(
&self,
ship_id: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]
pub async fn attempt_warp_jump(
&self,
ship_id: String
) -> Result<FlightPlan, SpaceTradersClientError>
[src]Attempt a warp jump
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more