Documentation ¶
Index ¶
- Constants
- type AccountRes
- type BuyRes
- type BuyShipRes
- type Cache
- func (c *Cache) Add(key CacheKey, data string)
- func (c *Cache) ClearObjs(key CacheObjKey)
- func (c *Cache) Extend(key CacheKey, data []string, shorts []string)
- func (c *Cache) RegisterUpdate(key CacheKey, f func() error)
- func (c *Cache) Restore(key CacheKey) []string
- func (c *Cache) RestoreObjs(key CacheObjKey) []interface{}
- func (c *Cache) Store(key CacheKey, data []string, shorts []string)
- func (c *Cache) StoreObjs(key CacheObjKey, data []interface{})
- type CacheItem
- type CacheKey
- type CacheObjKey
- type Cargo
- type ClaimRes
- type Client
- func (c *Client) Account() (*User, error)
- func (c *Client) AvailableLoans() ([]Loan, error)
- func (c *Client) BuyCargo(shipID, good string, qty int) (*Order, error)
- func (c *Client) BuyShip(location, kind string) (*Ship, error)
- func (c *Client) Claim(username string) (string, *User, error)
- func (c *Client) CreateFlight(shipID, destination string) (*FlightPlan, error)
- func (c *Client) DoPost(method, base string, args map[string]string) (string, error)
- func (c *Client) Get(base string, args map[string]string) (string, error)
- func (c *Client) ListLocations(system string, kind string) ([]Location, error)
- func (c *Client) ListShips(system string) ([]Ship, error)
- func (c *Client) ListSystems() ([]System, error)
- func (c *Client) Load(path string) error
- func (c *Client) Logout() error
- func (c *Client) Marketplace(loc string) ([]Offer, error)
- func (c *Client) MyLoans() ([]Loan, error)
- func (c *Client) MyShips() ([]Ship, error)
- func (c *Client) PayLoan(loanID string) error
- func (c *Client) Post(base string, args map[string]string) (string, error)
- func (c *Client) Put(base string, args map[string]string) (string, error)
- func (c *Client) SellCargo(shipID, good string, qty int) (*Order, error)
- func (c *Client) ShowFlight(flightID string) (*FlightPlan, error)
- func (c *Client) Status() error
- func (c *Client) TakeLoan(name string) (*Loan, error)
- type FlightPlan
- type FlightPlanRes
- type Loan
- type LoanRes
- type Location
- type LocationsRes
- type MarketplaceRes
- type MyLoansRes
- type MyShipsRes
- type Offer
- type Order
- type PayLoanRes
- type SellRes
- type Ship
- type ShipListingRes
- type StatusRes
- type Structure
- type System
- type SystemsRes
- type TakeLoanRes
- type User
Constants ¶
const ( LOANS CacheKey = "loans" SHIPS CacheKey = "ships" MYLOCATIONS CacheKey = "my locations" LOCATIONS CacheKey = "all locations" SYSTEMS CacheKey = "systems" FLIGHTS CacheKey = "flights" FLIGHTDESTS CacheKey = "flight destinations" CARGO CacheKey = "cargo" USEROBJ CacheObjKey = "user" SHIPOBJ CacheObjKey = "ship" ROUTEOBJ CacheObjKey = "route" MARKETOBJ CacheObjKey = "market" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountRes ¶
type AccountRes struct {
User User `json:"user"`
}
type BuyShipRes ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) Extend ¶
Add multiple new values (both long and short) to a key Note: not creating shorts if they aren't provided
func (*Cache) RegisterUpdate ¶
Define a new type, and how to update it
func (*Cache) RestoreObjs ¶
func (c *Cache) RestoreObjs(key CacheObjKey) []interface{}
Get an arbitrary list of objects from the cache
func (*Cache) StoreObjs ¶
func (c *Cache) StoreObjs(key CacheObjKey, data []interface{})
Store an arbitrary list of objects
type CacheObjKey ¶
type CacheObjKey string
type Cargo ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AvailableLoans ¶
Loans ##ENDPOINT Available loans - `/types/loans`
func (*Client) CreateFlight ¶
func (c *Client) CreateFlight(shipID, destination string) (*FlightPlan, error)
##ENDPOINT Create flight plan - `/my/flight-plans`
func (*Client) ListLocations ¶
##ENDPOINT List locations in a system - `/systems/SYSTEM/locations`
func (*Client) ListShips ¶
Ships ##ENDPOINT List ships for purchase - `/systems/LOCATION/ship-listing`
func (*Client) ListSystems ¶
Systems ##ENDPOINT List all systems - `/game/systems`
func (*Client) Marketplace ¶
##ENDPOINT Available offers - `/locations/LOCATION/marketplace`
func (*Client) ShowFlight ¶
func (c *Client) ShowFlight(flightID string) (*FlightPlan, error)
##ENDPOINT Show flight plans - `/my/flight-plans/FLIGHTID`
type FlightPlan ¶
type FlightPlan struct { ArrivesAt time.Time `json:"arrivesAt"` CreatedAt time.Time `json:"createdAt"` Departure string `json:"departure"` Destination string `json:"destination"` Distance int `json:"distance"` FuelConsumed int `json:"fuelConsumed"` FuelRemaining int `json:"fuelRemaining"` ID string `json:"id"` ShortID string ShipID string `json:"shipId"` ShortShipID string TerminatedAt time.Time `json:"terminatedAt"` TimeRemainingInSeconds int `json:"timeRemainingInSeconds"` }
func (*FlightPlan) Short ¶
func (f *FlightPlan) Short() string
func (*FlightPlan) String ¶
func (f *FlightPlan) String() string
type FlightPlanRes ¶
type FlightPlanRes struct {
FlightPlan FlightPlan `json:"flightPlan"`
}
type Loan ¶
type Loan struct { Due time.Time `json:"due"` ID string `json:"id"` ShortID string RepaymentAmount int `json:"repaymentAmount"` Status string `json:"status"` Amount int `json:"amount"` CollateralRequired bool `json:"collateralRequired"` Rate int `json:"rate"` TermInDays int `json:"termInDays"` Type string `json:"type"` }
Core types
type Location ¶
type Location struct { Symbol string `json:"symbol"` Type string `json:"type"` Name string `json:"name"` SystemSymbol string X int `json:"x"` Y int `json:"y"` AllowsConstruction bool `json:"allowsConstruction"` Structures []Structure `json:"structures"` Traits []string `json:"traits"` Messages []string `json:"messages,omitempty"` }
type LocationsRes ¶
type LocationsRes struct {
Locations []Location `json:"locations"`
}
type MarketplaceRes ¶
type MarketplaceRes struct {
Offers []Offer `json:"marketplace"`
}
type MyLoansRes ¶
type MyLoansRes struct {
Loans []Loan `json:"loans"`
}
type MyShipsRes ¶
type Offer ¶
type Offer struct { Symbol string `json:"symbol"` VolumePerUnit int `json:"volumePerUnit"` PricePerUnit int `json:"pricePerUnit"` Spread int `json:"spread"` PurchasePricePerUnit int `json:"purchasePricePerUnit"` SellPricePerUnit int `json:"sellPricePerUnit"` QuantityAvailable int `json:"quantityAvailable"` }
type PayLoanRes ¶
type Ship ¶
type Ship struct { Cargo []Cargo `json:"cargo"` Class string `json:"class"` FlightPlanID string `json:"flightPlanId,omitempty"` ShortFlightPlanID string FlightPlanDest string ID string `json:"id"` ShortID string LocationName string `json:"location"` Manufacturer string `json:"manufacturer"` MaxCargo int `json:"maxCargo"` LoadingSpeed int `json:"loadingSpeed"` Plating int `json:"plating"` SpaceAvailable int `json:"spaceAvailable"` Speed int `json:"speed"` Type string `json:"type"` Weapons int `json:"weapons"` X int `json:"x"` Y int `json:"y"` PurchaseLocations []struct { System string `json:"system"` LocationName string `json:"location"` Price int `json:"price"` } `json:"purchaseLocations"` RestrictedGoods []string `json:"restrictedGoods,omitempty"` }
func (*Ship) FuelNeeded ¶
type ShipListingRes ¶
type ShipListingRes struct {
Ships []Ship `json:"shipListings"`
}
type Structure ¶
type System ¶
type SystemsRes ¶
type SystemsRes struct {
Systems []System `json:"systems"`
}