eveapi

package
v0.0.0-...-c83d288 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package eveapi manages fetching and posting data to the EVE Swagger API.

Index

Constants

View Source
const (
	ImageCharacterPortrait           = "Character"
	ImageItemTypeIcon                = "Type"
	ImageShipRender                  = "Render"
)
View Source
const (
	ScopeESIAlliancesReadContacts             = "esi-alliances.read_contacts.v1"                  // EVE SSO scope esi-alliances.read_contacts.v1
	ScopeESIAssetsReadAssets                  = "esi-assets.read_assets.v1"                       // EVE SSO scope esi-assets.read_assets.v1
	ScopeESIAssetsReadCorporationAssets       = "esi-assets.read_corporation_assets.v1"           // EVE SSO scope esi-assets.read_corporation_assets.v1
	ScopeESIBookmarksReadCharacterBookmarks   = "esi-bookmarks.read_character_bookmarks.v1"       // EVE SSO scope esi-bookmarks.read_character_bookmarks.v1
	ScopeESIBookmarksReadCorporationBookmarks = "esi-bookmarks.read_corporation_bookmarks.v1"     // EVE SSO scope esi-bookmarks.read_corporation_bookmarks.v1
	ScopeESICalendarReadCalendarEvents        = "esi-calendar.read_calendar_events.v1"            // EVE SSO scope esi-calendar.read_calendar_events.v1
	ScopeESICalendarRespondCalendarEvents     = "esi-calendar.respond_calendar_events.v1"         // EVE SSO scope esi-calendar.respond_calendar_events.v1
	ScopeESICharactersReadAgentsResearch      = "esi-characters.read_agents_research.v1"          // EVE SSO scope esi-characters.read_agents_research.v1
	ScopeESICharactersReadBlueprints          = "esi-characters.read_blueprints.v1"               // EVE SSO scope esi-characters.read_blueprints.v1
	ScopeESICharactersReadChatChannels        = "esi-characters.read_chat_channels.v1"            // EVE SSO scope esi-characters.read_chat_channels.v1
	ScopeESICharactersReadContacts            = "esi-characters.read_contacts.v1"                 // EVE SSO scope esi-characters.read_contacts.v1
	ScopeESICharactersReadCorporationRoles    = "esi-characters.read_corporation_roles.v1"        // EVE SSO scope esi-characters.read_corporation_roles.v1
	ScopeESICharactersReadFatique             = "esi-characters.read_fatigue.v1"                  // EVE SSO scope esi-characters.read_fatigue.v1
	ScopeESICharactersReadFWStats             = "esi-characters.read_fw_stats.v1"                 // EVE SSO scope esi-characters.read_fw_stats.v1
	ScopeESICharactersReadLoyalty             = "esi-characters.read_loyalty.v1"                  // EVE SSO scope esi-characters.read_loyalty.v1
	ScopeESICharactersReadMedals              = "esi-characters.read_medals.v1"                   // EVE SSO scope esi-characters.read_medals.v1
	ScopeESICharactersReadNotifications       = "esi-characters.read_notifications.v1"            // EVE SSO scope esi-characters.read_notifications.v1
	ScopeESICharactersReadOpportunities       = "esi-characters.read_opportunities.v1"            // EVE SSO scope esi-characters.read_opportunities.v1
	ScopeESICharactersReadStandings           = "esi-characters.read_standings.v1"                // EVE SSO scope esi-characters.read_standings.v1
	ScopeESICharactersReadTitles              = "esi-characters.read_titles.v1"                   // EVE SSO scope esi-characters.read_titles.v1
	ScopeESICharactersWriteContacts           = "esi-characters.write_contacts.v1"                // EVE SSO scope esi-characters.write_contacts.v1
	ScopeESICharactersStats                   = "esi-characterstats.read.v1"                      // EVE SSO scope esi-characterstats.read.v1
	ScopeESIClonesReadClones                  = "esi-clones.read_clones.v1"                       // EVE SSO scope esi-clones.read_clones.v1
	ScopeESIClonesReadImplants                = "esi-clones.read_implants.v1"                     // EVE SSO scope esi-clones.read_implants.v1
	ScopeESIContractsCharacterContracts       = "esi-contracts.read_character_contracts.v1"       // EVE SSO scope esi-contracts.read_character_contracts.v1
	ScopeESIContractsCorporationContracts     = "esi-contracts.read_corporation_contracts.v1"     // EVE SSO scope esi-contracts.read_corporation_contracts.v1
	ScopeESICorporationsReadBlueprints        = "esi-corporations.read_blueprints.v1"             // EVE SSO scope esi-corporations.read_blueprints.v1
	ScopeESICorporationsReadContacts          = "esi-corporations.read_contacts.v1"               // EVE SSO scope esi-corporations.read_contacts.v1
	ScopeESICorporationsReadContainerLogs     = "esi-corporations.read_container_logs.v1"         // EVE SSO scope esi-corporations.read_container_logs.v1
	ScopeESICorporationsReadMembership        = "esi-corporations.read_corporation_membership.v1" // EVE SSO scope esi-corporations.read_corporation_membership.v1
	ScopeESICorporationsReadDivisions         = "esi-corporations.read_divisions.v1"              // EVE SSO scope esi-corporations.read_divisions.v1
	ScopeESICorporationsReadFacilities        = "esi-corporations.read_facilities.v1"             // EVE SSO scope esi-corporations.read_facilities.v1
	ScopeESICorporationsReadFWStats           = "esi-corporations.read_fw_stats.v1"               // EVE SSO scope esi-corporations.read_fw_stats.v1
	ScopeESICorporationsReadMedals            = "esi-corporations.read_medals.v1"                 // EVE SSO scope esi-corporations.read_medals.v1
	ScopeESICorporationsReadOutposts          = "esi-corporations.read_outposts.v1"               // EVE SSO scope esi-corporations.read_outposts.v1
	ScopeESICorporationsReadStandings         = "esi-corporations.read_standings.v1"              // EVE SSO scope esi-corporations.read_standings.v1
	ScopeESICorporationsReadStarbases         = "esi-corporations.read_starbases.v1"              // EVE SSO scope esi-corporations.read_starbases.v1
	ScopeESICorporationsReadStructures        = "esi-corporations.read_structures.v1"             // EVE SSO scope esi-corporations.read_structures.v1
	ScopeESICorporationsReadTitles            = "esi-corporations.read_titles.v1"                 // EVE SSO scope esi-corporations.read_titles.v1
	ScopeESICorporationsTrackMembers          = "esi-corporations.track_members.v1"               // EVE SSO scope esi-corporations.track_members.v1
	ScopeESIFittingsReadFittings              = "esi-fittings.read_fittings.v1"                   // EVE SSO scope esi-fittings.read_fittings.v1
	ScopeESIFittingsWriteFittings             = "esi-fittings.write_fittings.v1"                  // EVE SSO scope esi-fittings.write_fittings.v1
	ScopeESIFleetsReadFleets                  = "esi-fleets.read_fleet.v1"                        // EVE SSO scope esi-fleets.read_fleet.v1
	ScopeESIFleetsWriteFleets                 = "esi-fleets.write_fleet.v1"                       // EVE SSO scope esi-fleets.write_fleet.v1
	ScopeESIIndustryReadCharacterJobs         = "esi-industry.read_character_jobs.v1"             // EVE SSO scope esi-industry.read_character_jobs.v1
	ScopeESIIndustryReadCharacterMining       = "esi-industry.read_character_mining.v1"           // EVE SSO scope esi-industry.read_character_mining.v1
	ScopeESIIndustryReadCorporationJobs       = "esi-industry.read_corporation_jobs.v1"           // EVE SSO scope esi-industry.read_corporation_jobs.v1
	ScopeESIIndustryReadCorporationMining     = "esi-industry.read_corporation_mining.v1"         // EVE SSO scope esi-industry.read_corporation_mining.v1
	ScopeESIKillmailsReadCorporationKillmails = "esi-killmails.read_corporation_killmails.v1"     // EVE SSO scope esi-killmails.read_corporation_killmails.v1
	ScopeESIKillmailsReadKillmails            = "esi-killmails.read_killmails.v1"                 // EVE SSO scope esi-killmails.read_killmails.v1
	ScopeESILocationsReadLocation             = "esi-location.read_location.v1"                   // EVE SSO scope esi-location.read_location.v1
	ScopeESILocationsReadOnline               = "esi-location.read_online.v1"                     // EVE SSO scope esi-location.read_online.v1
	ScopeESILocationsReadShipType             = "esi-location.read_ship_type.v1"                  // EVE SSO scope esi-location.read_ship_type.v1
	ScopeESIMailOrganizeMail                  = "esi-mail.organize_mail.v1"                       // EVE SSO scope esi-mail.organize_mail.v1
	ScopeESIMailReadMail                      = "esi-mail.read_mail.v1"                           // EVE SSO scope esi-mail.read_mail.v1
	ScopeESIMailSendMail                      = "esi-mail.send_mail.v1"                           // EVE SSO scope esi-mail.send_mail.v1
	ScopeESIMarketReadCharacterOrders         = "esi-markets.read_character_orders.v1"            // EVE SSO scope esi-markets.read_character_orders.v1
	ScopeESIMarketReadCorporationOrders       = "esi-markets.read_corporation_orders.v1"          // EVE SSO scope esi-markets.read_corporation_orders.v1
	ScopeESIMarketReadStructureMarkets        = "esi-markets.structure_markets.v1"                // EVE SSO scope esi-markets.structure_markets.v1
	ScopeESIPlanetsManagePlanets              = "esi-planets.manage_planets.v1"                   // EVE SSO scope esi-planets.manage_planets.v1
	ScopeESIPlanetsReadCustomsOffices         = "esi-planets.read_customs_offices.v1"             // EVE SSO scope esi-planets.read_customs_offices.v1
	ScopeESISearchSearchStructures            = "esi-search.search_structures.v1"                 // EVE SSO scope esi-search.search_structures.v1
	ScopeESISkillsReadSkillqueue              = "esi-skills.read_skillqueue.v1"                   // EVE SSO scope esi-skills.read_skillqueue.v1
	ScopeESISkillsReadSkills                  = "esi-skills.read_skills.v1"                       // EVE SSO scope esi-skills.read_skills.v1
	ScopeESIUIOpenWindow                      = "esi-ui.open_window.v1"                           // EVE SSO scope esi-ui.open_window.v1
	ScopeESIUIWriteWaypoint                   = "esi-ui.write_waypoint.v1"                        // EVE SSO scope esi-ui.write_waypoint.v1
	ScopeESIUniverseReadStructures            = "esi-universe.read_structures.v1"                 // EVE SSO scope esi-universe.read_structures.v1
	ScopeESIWalletReadCharacterWallet         = "esi-wallet.read_character_wallet.v1"             // EVE SSO scope esi-wallet.read_character_wallet.v1
	ScopeESIWalletReadCorporationWallet       = "esi-wallet.read_corporation_wallets.v1"          // EVE SSO scope esi-wallet.read_corporation_wallets.v1
)

Variables

View Source
var ErrNoToken = errors.New("unable to get token from context")

Functions

func ImageURL

func ImageURL(kind imageKind, id int, width int) string

func TokenFromContext

func TokenFromContext(ctx context.Context) (oauth2.TokenSource, error)

Types

type Alliance

type Alliance struct {
	AllianceID  int
	Name        string
	DateFounded time.Time
	Ticker      string
}

type Asset

type Asset struct {
	ItemID       int
	LocationID   int
	LocationType string
	LocationFlag string
	TypeID       int
	Quantity     int
	Singleton    bool
}

type Blueprint

type Blueprint struct {
	ItemID             int64
	LocationID         int64
	TypeID             int64
	LocationFlag       string
	TimeEfficiency     int64
	MaterialEfficiency int64

	// -2 = BPC (and always qty 1), else BPO
	Quantity int64

	// -1 = infinite runs (a BPO)
	Runs int64
}

type Character

type Character struct {
	CharacterID   int
	Name          string
	BloodlineID   int
	RaceID        int
	AncestryID    int
	CorporationID int
	AllianceID    int
	BirthDate     time.Time
	Description   string
}

type Config

type Config struct {
	ClientID  string `toml:"client_id"`
	SecretKey string `toml:"secret_key"`
	ReturnURL string `toml:"return_url"`
	UserAgent string `toml:"user_agent"`
}

Config represents the configuration for a EVE Swagger API client.

type Corporation

type Corporation struct {
	CorporationID int
	Name          string
	AllianceID    int
	CreationDate  time.Time
	Description   string
	Ticker        string
}

type CorporationSheet

type CorporationSheet struct {
	CorporationID   int
	CorporationName string
	Ticker          string
	CEOID           int
	CEOName         string
	StationID       int
	StationName     string
	Description     string
	AllianceID      int
	AllianceName    string
	FactionID       int
	URL             string
	MemberCount     int
	Shares          int
}

type CorporationSheetDetail

type CorporationSheetDetail struct {
	CorporationSheet
	Wallets Divisions
	Hangars Divisions
}

type CorporationStructure

type CorporationStructure struct {
	Structure
	ProfileID            int64
	Services             []string
	FuelExpires          time.Time
	StateStart           time.Time
	StateEnd             time.Time
	UnanchorsAt          time.Time
	State                string
	ReinforceWeekday     int32
	ReinforceHour        int32
	NextReinforceWeekday int32
	NextReinforceHour    int32
	NextReinforceTime    time.Time
}

A CorporationStructure contains additional, sensitive information about a citadel.

type Divisions

type Divisions map[string]string

Divisions is a map of division key to division name.

func (Divisions) GetName

func (d Divisions) GetName(idx int) (string, bool)

type EveAPI

type EveAPI struct {
	// contains filtered or unexported fields
}

EveAPI is the entry point for interacting with the EVE Swagger API.

func New

func New(c Config, l log.Logger) *EveAPI

New creates a new EveAPI with the given configuration.

func (*EveAPI) AuthorizeURL

func (api *EveAPI) AuthorizeURL(state string, scopes ...string) string

func (*EveAPI) GetAlliance

func (api *EveAPI) GetAlliance(allianceID int) (alliance *Alliance, err error)

func (*EveAPI) GetCharacter

func (api *EveAPI) GetCharacter(characterID int) (char *Character, err error)

func (*EveAPI) GetCorporation

func (api *EveAPI) GetCorporation(corpID int) (corp *Corporation, err error)

func (*EveAPI) GetCorporationAssets

func (api *EveAPI) GetCorporationAssets(ctx context.Context, corpID int) ([]*Asset, error)

func (*EveAPI) GetCorporationBlueprints

func (api *EveAPI) GetCorporationBlueprints(ctx context.Context, corpID int) ([]*Blueprint, error)

func (*EveAPI) GetCorporationIndustryJobHistory

func (api *EveAPI) GetCorporationIndustryJobHistory(ctx context.Context, corpID int) (jobs []*IndustryJob, err error)

func (*EveAPI) GetCorporationIndustryJobs

func (api *EveAPI) GetCorporationIndustryJobs(ctx context.Context, corpID int) (jobs []*IndustryJob, err error)

func (*EveAPI) GetCorporationOrders

func (api *EveAPI) GetCorporationOrders(ctx context.Context, corpID int) (orders []*MarketOrder, err error)

func (*EveAPI) GetCorporationOrdersHistory

func (api *EveAPI) GetCorporationOrdersHistory(ctx context.Context, corpID int) (orders []*MarketOrder, err error)

func (*EveAPI) GetCorporationSheet

func (api *EveAPI) GetCorporationSheet(ctx context.Context, corpID int) (*CorporationSheetDetail, error)

func (*EveAPI) GetCorporationStructures

func (api *EveAPI) GetCorporationStructures(ctx context.Context, corpID int) ([]*CorporationStructure, error)

func (*EveAPI) GetMarketHistoryRegionTypeID

func (api *EveAPI) GetMarketHistoryRegionTypeID(regionID, typeID int) ([]*MarketStat, error)

func (*EveAPI) GetMarketOrdersRegionTypeID

func (api *EveAPI) GetMarketOrdersRegionTypeID(regionID, typeID int) ([]*MarketStat, error)

func (*EveAPI) GetMarketPrices

func (api *EveAPI) GetMarketPrices() (prices chan MarketPrice, cancelFn func(), err error)

func (*EveAPI) GetPublicCorporationSheet

func (api *EveAPI) GetPublicCorporationSheet(corpID int) (*CorporationSheet, error)

func (*EveAPI) GetStructure

func (api *EveAPI) GetStructure(ctx context.Context, structureID int64) (*Structure, error)

func (*EveAPI) TokenExchange

func (api *EveAPI) TokenExchange(code string) (*oauth2.Token, error)

func (*EveAPI) TokenSource

func (api *EveAPI) TokenSource(tok *oauth2.Token) (oauth2.TokenSource, error)

func (*EveAPI) Verify

func (api *EveAPI) Verify(source oauth2.TokenSource) (*goesi.VerifyResponse, error)

type IndustryJob

type IndustryJob struct {
	JobID                int             `json:"job_id"`
	InstallerID          int             `json:"installer_id"`
	FacilityID           int             `json:"facility_id"`
	LocationID           int             `json:"location_id"`
	ActivityID           int             `json:"activity_id"`
	BlueprintID          int             `json:"blueprint_id"`
	BlueprintTypeID      int             `json:"blueprint_type_id"`
	BlueprintLocationID  int             `json:"blueprint_location_id"`
	OutputLocationID     int             `json:"output_location_id"`
	ProductTypeID        int             `json:"product_type_id"`
	Runs                 int             `json:"runs"`
	Cost                 decimal.Decimal `json:"cost"`
	LicensedRuns         int             `json:"licensed_runs"`
	Probability          decimal.Decimal `json:"probability"`
	Status               string          `json:"status"`
	StartDate            time.Time       `json:"start_date"`
	EndDate              time.Time       `json:"end_date"`
	PauseDate            time.Time       `json:"pause_date"`
	CompletedDate        time.Time       `json:"completed_date"`
	CompletedCharacterID int             `json:"completed_character_id"`
	SuccessfulRuns       int             `json:"successful_runs"`
}

type MarketOrder

type MarketOrder struct {
	OrderID      int
	CharID       int // TODO: Doesn't exist in the ESI response
	LocationID   int
	TypeID       int
	VolEntered   int
	VolRemaining int
	MinVolume    int
	OrderState   string
	Range        string
	AccountKey   int
	Duration     int
	Escrow       decimal.Decimal
	Price        decimal.Decimal
	Bid          bool
	Issued       time.Time
}

type MarketPrice

type MarketPrice struct {
	TypeID       int
	AveragePrice decimal.Decimal
	BasePrice    decimal.Decimal
}

type MarketStat

type MarketStat struct {
	TypeID      int
	Volume      int
	WAvg        decimal.Decimal
	Avg         decimal.Decimal
	Variance    decimal.Decimal
	StdDev      decimal.Decimal
	Median      decimal.Decimal
	FivePercent decimal.Decimal
	Max         decimal.Decimal
	Min         decimal.Decimal
	Timestamp   time.Time
}

MarketStat is reported price information for the given type.

type Structure

type Structure struct {
	StructureID int64
	Name        string
	SystemID    int64
	TypeID      int64
}

A Structure is a player-owned citadel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL