Documentation ¶
Index ¶
- Variables
- func GetErrorFromStatus(status protos.ResponseEnvelope_StatusCode) error
- type CellIDs
- type Crypto
- type DefaultCrypto
- type ErrResponse
- type Feed
- type Location
- type RPC
- type Session
- func (s *Session) Announce(ctx context.Context) (mapObjects *protos.GetMapObjectsResponse, err error)
- func (s *Session) Call(ctx context.Context, requests []*protos.Request) (*protos.ResponseEnvelope, error)
- func (s *Session) GetInventory(ctx context.Context) (*protos.GetInventoryResponse, error)
- func (s *Session) GetPlayer(ctx context.Context) (*protos.GetPlayerResponse, error)
- func (s *Session) GetPlayerMap(ctx context.Context) (*protos.GetMapObjectsResponse, error)
- func (s *Session) Init(ctx context.Context) error
- func (s *Session) MoveTo(location *Location)
- func (s *Session) SetTimeout(d time.Duration)
- type VoidFeed
Constants ¶
This section is empty.
Variables ¶
var ErrBadRequest = errors.New("The remote service responded but appear to think the request is malformatted")
ErrBadRequest happens when the remote service thinks the request is malformatted
var ErrFormatting = errors.New("Request was malformatted and could not be performed")
ErrFormatting happens when the something in the request body was not right
var ErrInvalidAuthToken = errors.New("The auth token used is not vailid")
ErrInvalidAuthToken happens when the currently used auth token is not vailid
var ErrInvalidPlatformRequest = errors.New("A platform specific request is invalid")
ErrInvalidPlatformRequest happens when a platform specific request like the request signature being incorrect
var ErrInvalidRequest = errors.New("The remote service responded but appear to think the request is invalid")
ErrInvalidRequest happens when the request is invalid
var ErrNewRPCURL = errors.New("There is a new RPC url in the response, please use the new URL for future requests")
ErrNewRPCURL happens when there is a new RPC url available in the response body
var ErrNoURL = errors.New("The remote service did not respond with a remote URL when expected")
ErrNoURL happens when the remote service is expected to respond with a remote URL but doesn't
var ErrRedirect = errors.New("The request was redirected")
ErrRedirect happens when an invalid session endpoint has been used
var ErrRequest = errors.New("The remote service responded but the request could not be completed for unknown reasons")
ErrRequest happens when there is an unknown issue with the request
var ErrSessionInvalidated = errors.New("The session has been invalidated")
ErrSessionInvalidated happens when the session has been invalidated by the remote service
Functions ¶
func GetErrorFromStatus ¶
func GetErrorFromStatus(status protos.ResponseEnvelope_StatusCode) error
GetErrorFromStatus will, depending on the status code, give you an error or nil if there is no error
Types ¶
type Crypto ¶
type Crypto interface { CreateIV() []byte Encrypt(in []byte, iv []byte) ([]byte, error) Enabled() bool }
Crypto is a common interface for allowing pluggable signature
type DefaultCrypto ¶
type DefaultCrypto struct{}
DefaultCrypto is a minimally implemented version of the Crypto interface
func (*DefaultCrypto) CreateIV ¶
func (c *DefaultCrypto) CreateIV() []byte
CreateIV creates a random initialization vector to be used with the Encrypt function
func (*DefaultCrypto) Enabled ¶
func (c *DefaultCrypto) Enabled() bool
Enabled returns wether or not crypto is enabled
type ErrResponse ¶
type ErrResponse struct {
// contains filtered or unexported fields
}
ErrResponse happens when there's something wrong with the response object
func (*ErrResponse) Error ¶
func (e *ErrResponse) Error() string
type Feed ¶
type Feed interface {
// Push is used to put response messages on to the feed
Push(entry interface{})
}
Feed is a common interface to act on encountered
type Location ¶
Location consists of coordinates in longitude, latitude and altitude
func (*Location) DistanceToFort ¶
DistanceToFort returns distance between the location and a fort using the Haversine formula Reference: https://gist.github.com/cdipaolo/d3f8db3848278b49db68
func (*Location) GetCellIDs ¶
GetCellIDs will return a slice of the closed neighbourhood cell ids for the current coordinates
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
RPC is used to communicate with the Pokémon Go API
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is used to communicate with the Pokémon Go API
func NewSession ¶
func NewSession(provider auth.Provider, location *Location, feed Feed, crypto Crypto, debug bool) *Session
NewSession constructs a Pokémon Go RPC API client
func (*Session) Announce ¶
func (s *Session) Announce(ctx context.Context) (mapObjects *protos.GetMapObjectsResponse, err error)
Announce publishes the player's presence and returns the map environment
func (*Session) Call ¶
func (s *Session) Call(ctx context.Context, requests []*protos.Request) (*protos.ResponseEnvelope, error)
Call queries the Pokémon Go API through RPC protobuf
func (*Session) GetInventory ¶
GetInventory returns the player items
func (*Session) GetPlayerMap ¶
GetPlayerMap returns the surrounding map cells
func (*Session) SetTimeout ¶
SetTimeout sets the client timeout for the RPC API