Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadCredentials is returned when the login attempt has failed. ErrBadCredentials = errors.New("provided user credentials are invalid") // ErrNoFormBuildID is returned when 'form_build_id' could not be parsed from response body. ErrNoFormBuildID = errors.New("could not parse 'form_build_id' from response body") // ErrNoActivityEndpoint is returned when the activity endpoint could not be parsed from // response body. ErrNoActivityEndpoint = errors.New("could not parse bot activity endpoint from response body") // ErrCookiesRefresh is returned when the attempt to refresh user cookies has failed. ErrCookiesRefresh = errors.New("error refreshing cookies") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // ParseWithDefaults returns a slice of Ros-Bot server updates based on the default parsing // configuration. ParseWithDefaults(ctx context.Context) ([]*ServerUpdate, error) // ParseWithConfig returns a slice of Ros-Bot server updates based on the provided // parsing configuration. ParseWithConfig(ctx context.Context, config *ParserConfig) ([]*ServerUpdate, error) }
type Destination ¶
type Destination string
Destination is where the bot placed the item upon collection of it.
const ( DestinationStashed Destination = "STASHED" DestinationSalvaged Destination = "SALVAGED" DestinationSold Destination = "SOLD" DestinationUnknown Destination = "UNKNOWN" )
type HTTPService ¶
type HTTPService interface { // Authenticate posts the user credentials, and places the resulting cookies in a jar. Authenticate() (HTTPService, error) // GetActivity retrieves the page body of 'user/{user_id}/bot-activity'. GetActivity(searchSegment string) (io.ReadCloser, error) }
HTTPService handles all the requests made to 'https://www.ros-bot.com'.
type LegendaryItem ¶
type LegendaryItem struct { Name string `json:"name"` Quality Quality `json:"type"` Rarity Rarity `json:"rarity"` Destination Destination `json:"destination"` IsIdentified bool `json:"is_identified"` Stats string `json:"stats"` }
LegendaryItem is a Diablo III legendary item.
type Parser ¶
type Parser interface { // Parse parses server updates from the '/bot-activity' page. Parse(ctx context.Context) ([]*ServerUpdate, error) }
type ParserConfig ¶
type ParserConfig struct { Destinations []Destination RarityLevel Rarity Quality Quality Page int8 }
ParserConfig is the parsing configuration
func NewParseConfig ¶
func NewParseConfig() *ParserConfig
NewParseConfig returns a new instance of `rosbotcollector.ParserConfig` with the default values.
type ServerUpdate ¶
type ServerUpdate struct { Items []*LegendaryItem `json:"legendaries"` ServerTimestamp time.Time `json:"server_timestamp"` }
ServerUpdate is a Ros-Bot server update.
Click to show internal directories.
Click to hide internal directories.