stash

package
v0.0.0-...-89d8475 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const StashAPIBase string = "http://www.pathofexile.com/api/public-stash-tabs"

StashAPIBase is the URL the stash api is located at

View Source
const TestResponseLoc string = "StashResponse.json"

TestResponseLoc is where testing data is kept

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CleanResponse

func CleanResponse(response *Response) error

CleanResponse adds on Type data as well as ensures the response will satisfy our expectations, as wildly unreasonable as they can be

func FetchAndSetStore

func FetchAndSetStore() error

FetchAndSetStore grabs the latest stash tab api update and stores it in TestResponseLoc

func MatchTypeline

func MatchTypeline(typeline string) (flavor, root string, ok bool)

MatchTypeline returns a flavor and root for a discovered base or ok is false.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type ChangeSet

type ChangeSet struct {
	// Changes mapping from ID to position in Changes
	ChangeIDToIndex map[string]int
	// Changes as individually compressed
	Changes []CompressedResponse
	// Size as stored
	Size int
}

ChangeSet represents the number

func NewChangeSet

func NewChangeSet() ChangeSet

NewChangeSet returns an empty, initialized ChangeSet

func OpenChangeSet

func OpenChangeSet(path string) (*ChangeSet, error)

OpenChangeSet attempts to open a ChangeSet at the provided path

func (*ChangeSet) AddResponse

func (changes *ChangeSet) AddResponse(changeID string,
	comp CompressedResponse)

AddResponse includes another CompressedResponse inside the Changes

func (*ChangeSet) DecodeMsg

func (z *ChangeSet) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ChangeSet) EncodeMsg

func (z *ChangeSet) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ChangeSet) GetCompByChangeID

func (changes *ChangeSet) GetCompByChangeID(changeID string) (*CompressedResponse,
	bool)

GetCompByChangeID returns the CompressedResponse associated with a given changeID. Follows the _, ok pattern ala maps if not found

func (*ChangeSet) GetFirstChange

func (changes *ChangeSet) GetFirstChange() (*CompressedResponse, error)

GetFirstChange returns the first Change in the set.

func (*ChangeSet) MarshalMsg

func (z *ChangeSet) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChangeSet) Msgsize

func (z *ChangeSet) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChangeSet) Save

func (changes *ChangeSet) Save(path string) error

Save stores the marshalled ChangeSet's at the provided location

func (*ChangeSet) UnmarshalMsg

func (z *ChangeSet) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CompressedResponse

type CompressedResponse struct {
	Content []byte
	Size    int
}

CompressedResponse represents a Response compressed using this package

func NewCompressedResponse

func NewCompressedResponse(resp *Response) (*CompressedResponse, error)

NewCompressedResponse compresses a Response into compact form and returns the result

func (*CompressedResponse) DecodeMsg

func (z *CompressedResponse) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (CompressedResponse) Decompress

func (comp CompressedResponse) Decompress() (*Response, error)

Decompress decompresses the CompressedResponse.

func (*CompressedResponse) EncodeMsg

func (z *CompressedResponse) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*CompressedResponse) MarshalMsg

func (z *CompressedResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*CompressedResponse) Msgsize

func (z *CompressedResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CompressedResponse) UnmarshalMsg

func (z *CompressedResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Item

type Item struct {
	Verified     bool      `json:"verified"`
	League       string    `json:"league"`
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	TypeLine     string    `json:"typeLine"`
	Identified   bool      `json:"identified"`
	Corrupted    bool      `json:"corrupted"`
	ImplicitMods []ItemMod `json:"implicitMods,omitempty"`
	ExplicitMods []ItemMod `json:"explicitMods,omitempty"`
	Note         string    `json:"note,omitempty"`
	UtilityMods  []string  `json:"utilityMods,omitempty"`
	DescrText    string    `json:"descrText,omitempty"`
	// Additional data not present in response
	StashID    string `json:"-"`
	RootType   string `json:"-"`
	RootFlavor string `json:"-"`
}

Item represents a single item found from the stash api

func (*Item) DecodeMsg

func (z *Item) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Item) EncodeMsg

func (z *Item) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Item) GetMods

func (item *Item) GetMods() []ItemMod

GetMods concats both ExplicitMods and ImplicitMods, returning the result

func (Item) MarshalEasyJSON

func (v Item) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Item) MarshalJSON

func (v Item) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Item) MarshalMsg

func (z *Item) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Item) Msgsize

func (z *Item) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Item) UnmarshalEasyJSON

func (v *Item) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Item) UnmarshalJSON

func (v *Item) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Item) UnmarshalMsg

func (z *Item) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ItemMod

type ItemMod struct {
	Template []byte
	Values   []uint16
}

ItemMod is a modifier an item can have

func (*ItemMod) DecodeMsg

func (z *ItemMod) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ItemMod) EncodeMsg

func (z *ItemMod) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ItemMod) MarshalJSON

func (m *ItemMod) MarshalJSON() ([]byte, error)

MarshalJSON implements custom serialization for this type

func (*ItemMod) MarshalMsg

func (z *ItemMod) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ItemMod) Msgsize

func (z *ItemMod) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ItemMod) UnmarshalJSON

func (m *ItemMod) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom deserialization for this type

Typically, the GGG api will return string which we run through regexp for ease

func (*ItemMod) UnmarshalMsg

func (z *ItemMod) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PropertyValue

type PropertyValue struct {
	Value    string
	PrintKey int
}

PropertyValue holds a string value alongside an associated PrintKey

func (*PropertyValue) DecodeMsg

func (z *PropertyValue) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PropertyValue) EncodeMsg

func (z PropertyValue) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PropertyValue) MarshalJSON

func (v *PropertyValue) MarshalJSON() ([]byte, error)

MarshalJSON implements custom serialization for this type

func (PropertyValue) MarshalMsg

func (z PropertyValue) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PropertyValue) Msgsize

func (z PropertyValue) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PropertyValue) UnmarshalJSON

func (v *PropertyValue) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom deserialization for this type

Typically, the GGG api will return [string, int] which is very unhelpful, so we take care of that right here

func (*PropertyValue) UnmarshalMsg

func (z *PropertyValue) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Response

type Response struct {
	NextChangeID string  `json:"next_change_id"`
	Stashes      []Stash `json:"stashes"`
}

Response represents expected structure of a stash api call

func FetchUpdate

func FetchUpdate(changeID string) (*Response, error)

FetchUpdate grabs the update indicated by the changeID.

If empty changeID is provided, it grabs the default update.

func GetStored

func GetStored() (*Response, error)

GetStored gets the stored testing data and returns it

func RespFromJSON

func RespFromJSON(r io.Reader) (*Response, error)

RespFromJSON attempts to deserialize the provided data and return it as a StashResponse

func (*Response) DecodeMsg

func (z *Response) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Response) EncodeMsg

func (z *Response) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Response) MarshalEasyJSON

func (v Response) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Response) MarshalJSON

func (v Response) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Response) MarshalMsg

func (z *Response) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Response) Msgsize

func (z *Response) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Response) UnmarshalEasyJSON

func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Response) UnmarshalJSON

func (v *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Response) UnmarshalMsg

func (z *Response) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Stash

type Stash struct {
	AccountName       string `json:"accountName"`
	LastCharacterName string `json:"lastCharacterName"`
	ID                string `json:"id"`
	Stash             string `json:"stash"`
	StashType         string `json:"stashType"`
	Items             []Item `json:"items"`
	Public            bool   `json:"public"`
}

Stash represents a stash tab with items and associated metadata

func (*Stash) DecodeMsg

func (z *Stash) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Stash) EncodeMsg

func (z *Stash) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Stash) MarshalEasyJSON

func (v Stash) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Stash) MarshalJSON

func (v Stash) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Stash) MarshalMsg

func (z *Stash) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Stash) Msgsize

func (z *Stash) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Stash) UnmarshalEasyJSON

func (v *Stash) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Stash) UnmarshalJSON

func (v *Stash) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Stash) UnmarshalMsg

func (z *Stash) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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