Scrapes Ros-Bot's user activity page, and returns the parsed server updates.
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)
}
rbc, err := rosbotcollector.NewClient("your-username", "password")
if err != nil {
...
}
type ParserConfig struct {
Destinations []Destination
RarityLevel Rarity
Quality Quality
Page int8
}
c := rosbotcollector.NewParseConfig()
OR
c := rosbotcollector.ParseConfig{
...
}
Uses the de-facto configuration.
ParserConfig{
Destinations: []Destination{},
RarityLevel: RarityNonAncient,
Quality: QualityAll,
Page: 1,
}
u, err := rbc.ParseWithDefaults(ctx)
if err != nil {
...
}
Uses a custom configuration object.
c := rosbotcollector.NewParseConfig()
OR
c := rosbotcollector.ParseConfig{...}
u, err := rbc.ParseWithConfig(ctx, &c)
if err != nil {
...
}
ErrBadCredentials
is returned when the login attempt has failed.
ErrNoFormBuildID
is returned when form_build_id
could not be parsed from response body.
ErrNoActivityEndpoint
is returned when the activity endpoint could not be parsed from response body.
ErrCookiesRefresh
is returned when the attempt to refresh user cookies has failed.
Corresponds to a Ros-Bot server update.
type ServerUpdate struct {
Items []*LegendaryItem `json:"legendaries"`
ServerTimestamp time.Time `json:"server_timestamp"`
}
Corresponds to an in-game item of "legendary" quality.
type LegendaryItem struct {
Name string
IsIdentified bool
Quality Quality
Rarity Rarity
Destination Destination
Stats string
}
QualityAll Quality = "*"
QualityNormal Quality = "NORMAL"
QualitySet Quality = "SET"
RarityPrimal Rarity = "PRIMAL"
RarityAncient Rarity = "ANCIENT"
RarityNonAncient Rarity = "NON-ANCIENT"
DestinationStashed Destination = "STASHED"
DestinationSalvaged Destination = "SALVAGED"
DestinationSold Destination = "SOLD"
-
Improve item property parsing (=? weapon, armour, ring, etc).
-
Improve item stat. parsing (base, primary, secondary, power, sockets)
-
Expand parsing to include items of all qualities.
Maximilien Zaleski © 2019