esi

package
v0.0.0-...-f1c6d0e Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchEveOnlineImage

func FetchEveOnlineImage(u *url.URL) (i image.Image, expires time.Time, err error)

FetchEveOnlineImage fetches an image from EvE Online.

It is able to decode JPEG, PNG, and GIF images.

The expires determines the ability to cache for our server. It is possible it is the zero Time, in which case we could not determine the cacheability.

func Random

func Random(n int) (string, error)

func ValidateEveClaims

func ValidateEveClaims(c *jwt.Claims) error

Types

type Alliance

type Alliance struct {
	ID       int32 `json:"id,omitempty"`
	Hydrated bool  `json:"-"`
	// Only set if hydrated
	Name         string       `json:"name,omitempty"`
	Ticker       string       `json:"ticker,omitempty"`
	CreationCorp *Corporation `json:"creation_corporation,omitempty"`
	Creator      *Character   `json:"creator,omitempty"`
	Founded      time.Time    `json:"founded,omitempty"`
	Executor     *Corporation `json:"executor_corproration,omitempty"`
	Faction      *Faction     `json:"faction,omitempty"`
}

type AllianceIconURLs

type AllianceIconURLs struct {
	Icon64x64   *url.URL
	Icon128x128 *url.URL
}

type Ancestry

type Ancestry struct {
	ID int32 `json:"id,omitempty"`
}

type Bloodline

type Bloodline struct {
	ID int32 `json:"id,omitempty"`
}

type Character

type Character struct {
	ID       int32 `json:"id,omitempty"`
	Hydrated bool  `json:"-"`
	// Only set if hydrated
	Name           string       `json:"name,omitempty"`
	Title          string       `json:"title,omitempty"`
	Corporation    *Corporation `json:"corporation,omitempty"`
	Alliance       *Alliance    `json:"alliance,omitempty"`
	Birthday       time.Time    `json:"birthday,omitempty"`
	Description    string       `json:"description,omitempty"`
	SecurityStatus float64      `json:"security_status,omitempty"`
	Faction        *Faction     `json:"faction,omitempty"`
	Gender         string       `json:"gender,omitempty"`
	Ancestry       *Ancestry    `json:"ancestry,omitempty"`
	Bloodline      *Bloodline   `json:"bloodline,omitempty"`
	Race           *Race        `json:"race,omitempty"`
}

type Client

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

func New

func New(t *ThinClient) *Client

func (*Client) Character

func (x *Client) Character(ctx context.Context, id int32) (*Character, error)

Character obtains information about the character.

Hydrates the Corporation, and any associated alliance.

func (*Client) Characters

func (x *Client) Characters(ctx context.Context, ids []int32) ([]*Character, error)

Characters is the same as Character but in parallel for multiple.

func (*Client) Corporation

func (x *Client) Corporation(ctx context.Context, id int32) (*Corporation, error)

Corporation obtains information about the Corporation.

Hydrates the CEO, Creator, and any associated alliance.

func (*Client) GetAllianceIcon

func (x *Client) GetAllianceIcon(ctx context.Context, id int32) (*AllianceIconURLs, error)

GetAllianceIcon returns the icon URLs for the specified Alliance.

Does not fetch the image payloads.

func (*Client) GetCorporationIcon

func (x *Client) GetCorporationIcon(ctx context.Context, id int32) (*CorpIconURLs, error)

GetCorporationIcon returns the icon URLs for the specified Corporation.

Does not fetch the image payloads.

func (*Client) GetPortrait

func (x *Client) GetPortrait(ctx context.Context, id int32) (*PortraitURLs, error)

GetPortrait returns the portrait URLs for the specified Character.

Does not fetch the image payloads.

func (*Client) SearchCorp

func (x *Client) SearchCorp(ctx context.Context, q string, l language.Tag) ([]*Corporation, error)

SearchCorp returns a slice of Corporations matching the search query

Hydrates the Corporation, any associated alliance, the CEO, and Creator.

type CorpIconURLs

type CorpIconURLs struct {
	Icon64x64   *url.URL
	Icon128x128 *url.URL
	Icon256x256 *url.URL
}

type Corporation

type Corporation struct {
	ID       int32 `json:"id,omitempty"`
	Hydrated bool  `json:"-"`
	// Only set if hydrated
	Name        string     `json:"name,omitempty"`
	Ticker      string     `json:"ticker,omitempty"`
	CEO         *Character `json:"ceo,omitempty"`
	Creator     *Character `json:"creator,omitempty"`
	Alliance    *Alliance  `json:"alliance,omitempty"`
	Founded     time.Time  `json:"founded,omitempty"`
	Description string     `json:"description,omitempty"`
	Faction     *Faction   `json:"faction,omitempty"`
	Home        *Station   `json:"home_station,omitempty"`
	NMembers    int32      `json:"number_members,omitempty"`
	Shares      int64      `json:"shares,omitempty"`
	TaxRate     float64    `json:"tax_rate,omitempty"`
	URL         *url.URL   `json:"url,omitempty"`
	WarEligible bool       `json:"war_eligible,omitempty"`
}

type Faction

type Faction struct {
	ID int32 `json:"id,omitempty"`
}

type JWTResponse

type JWTResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
}

type KeysMetadata

type KeysMetadata struct {
	Alg string `json:"alg"`
	Id  string `json:"kid"`
	Kty string `json:"kty"`
	Use string `json:"use"`
	// RS
	N string `json:"n"`
	E string `json:"e"`
	// ES
	Crv string `json:"crv"`
	X   string `json:"x"`
	Y   string `json:"y"`
}

func (*KeysMetadata) ValidateToken

func (k *KeysMetadata) ValidateToken(b []byte) (*jwt.Claims, error)

type OAuth2Client

type OAuth2Client struct {
	RedirectURI string
	ClientID    string
	Secret      string
	Client      *http.Client
}

func (*OAuth2Client) GetAuthorization

func (o *OAuth2Client) GetAuthorization(code string) (*JWTResponse, error)

func (*OAuth2Client) GetRefresh

func (o *OAuth2Client) GetRefresh(refresh string) (*JWTResponse, error)

func (*OAuth2Client) GetURL

func (o *OAuth2Client) GetURL(state string, scopes []features.Scope) *url.URL

type OAuthKeysMetadata

type OAuthKeysMetadata struct {
	Keys []*KeysMetadata `json:"keys"`
}

func FetchEveOnlineKeys

func FetchEveOnlineKeys() (*OAuthKeysMetadata, error)

func (*OAuthKeysMetadata) JWTKey

func (o *OAuthKeysMetadata) JWTKey() *KeysMetadata

func (*OAuthKeysMetadata) Scan

func (o *OAuthKeysMetadata) Scan(src interface{}) error

func (OAuthKeysMetadata) Value

func (o OAuthKeysMetadata) Value() (driver.Value, error)

type PortraitURLs

type PortraitURLs struct {
	Portrait64x64   *url.URL
	Portrait128x128 *url.URL
	Portrait256x256 *url.URL
	Portrait512x512 *url.URL
}

type Race

type Race struct {
	ID int32 `json:"id,omitempty"`
}

type Station

type Station struct {
	ID int32 `json:"id,omitempty"`
}

type ThinClient

type ThinClient struct {
	ESIClient *client.ESI
	Timeout   time.Duration
	Client    *http.Client
}

type Tokens

type Tokens struct {
	Access        string    `json:"access"`
	Refresh       string    `json:"refresh"`
	AccessExpires time.Time `json:"access_expires"`
	CID           int       `json:"character_id"`
	CName         string    `json:"character_name"`
}

func NewTokens

func NewTokens(jwt *JWTResponse, c *jwt.Claims) (*Tokens, error)

func (*Tokens) Scan

func (t *Tokens) Scan(src interface{}) error

func (*Tokens) Value

func (t *Tokens) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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