api

package
v0.0.0-...-42eebf1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorFromStatus

func GetErrorFromStatus(status int32) error

GetErrorFromStatus will, depending on the status code, give you an error or nil if there is no error

Types

type CellIDs

type CellIDs []uint64

CellIDs is a slice of uint64s

func (CellIDs) Len

func (a CellIDs) Len() int

func (CellIDs) Less

func (a CellIDs) Less(i, j int) bool

func (CellIDs) Swap

func (a CellIDs) Swap(i, j int)

type Feed

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

Feed is an intermediary that holds a buffer of encountered game items and a reporter to notify about them

func NewFeed

func NewFeed(r Reporter) *Feed

NewFeed construct a new Feed

func (*Feed) Push

func (f *Feed) Push(entry interface{})

Push is used to get an entry on to the feed buffer

func (*Feed) Report

func (f *Feed) Report()

Report is a blocking operation that starts retrieving data from the feed buffer

type InvalidSessionError

type InvalidSessionError struct{}

InvalidSessionError happens when the session token has expired or been invalidated

func (*InvalidSessionError) Error

func (e *InvalidSessionError) Error() string

type Location

type Location struct {
	Lon float64
	Lat float64
	Alt float64
}

Location consists of coordinates in longitude, latitude and altitude

func (*Location) DistanceToFort

func (l *Location) DistanceToFort(fort *protos.FortData) float64

DistanceToFort returns distance between the location and a fort using the Haversine formula Reference: https://gist.github.com/cdipaolo/d3f8db3848278b49db68

func (*Location) GetCellIDs

func (l *Location) GetCellIDs() CellIDs

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

func NewRPC

func NewRPC() *RPC

NewRPC constructs a Pokémon Go RPC API client

func (*RPC) Request

func (c *RPC) Request(endpoint string, requestEnvelope *protos.RequestEnvelope) (responseEnvelope *protos.ResponseEnvelope, err error)

Request queries the Pokémon Go API will all pending requests

type Reporter

type Reporter interface {
	WildPokemons([]*protos.WildPokemon)
	Forts([]*protos.FortData)
}

Reporter is a common interface for collecting findings

type RequestError

type RequestError struct{}

RequestError happens when there's an error that is not accounted for

func (*RequestError) Error

func (e *RequestError) Error() string

type RequiresAuthorizationError

type RequiresAuthorizationError struct{}

RequiresAuthorizationError happens when the API wants you to re-authorize the profile

func (*RequiresAuthorizationError) Error

type RequiresRPCEndpointError

type RequiresRPCEndpointError struct{}

RequiresRPCEndpointError happens when an invalid session endpoint has been used

func (*RequiresRPCEndpointError) Error

func (e *RequiresRPCEndpointError) Error() string

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, debug bool) *Session

NewSession constructs a Pokémon Go RPC API client

func (*Session) Announce

func (s *Session) Announce() (mapObjects *protos.GetMapObjectsResponse, err error)

Announce publishes the player's presence and returns the map environment

func (*Session) Call

func (s *Session) Call(requests []*protos.Request) (*protos.ResponseEnvelope, error)

Call queries the Pokémon Go API through RPC protobuf

func (*Session) GetInventory

func (s *Session) GetInventory() (*protos.GetInventoryResponse, error)

GetInventory returns the player items

func (*Session) GetPlayer

func (s *Session) GetPlayer() (*protos.GetPlayerResponse, error)

GetPlayer returns the current player profile

func (*Session) GetPlayerMap

func (s *Session) GetPlayerMap() (*protos.GetMapObjectsResponse, error)

GetPlayerMap returns the surrounding map cells

func (*Session) Init

func (s *Session) Init() error

Init initializes the client by performing full authentication

func (*Session) MoveTo

func (s *Session) MoveTo(location *Location)

MoveTo sets your current location

func (*Session) SetTimeout

func (s *Session) SetTimeout(d time.Duration)

func (*Session) SetTransport

func (s *Session) SetTransport(t http.RoundTripper)

type VoidReporter

type VoidReporter struct{}

VoidReporter sends any reported entries in to the void

func (*VoidReporter) Forts

func (r *VoidReporter) Forts([]*protos.FortData)

Forts accepts wirld forts in to the void

func (*VoidReporter) WildPokemons

func (r *VoidReporter) WildPokemons([]*protos.WildPokemon)

WildPokemons accepts wild pokémons in to the void

Jump to

Keyboard shortcuts

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