/poeapi

A Go client for the Path of Exile API

Primary LanguageGoGNU General Public License v3.0GPL-3.0

poeapi

License Badge Build Badge CodeCov Badge GoReportCard Badge GoDoc Badge

A Go client for the Path of Exile API.

Features

  • Supports every endpoint of the Path of Exile API
  • All operations are thread-safe
  • Built-in, tunable rate limiting
  • Built-in, tunable caching for responses
  • No dependencies; 100% standard library code

Usage

clientOpts := poeapi.ClientOptions{
    Host:           "api.pathofexile.com", // The primary API domain.
    NinjaHost:      "poe.ninja",           // Used to get latest stash ID.
    UseSSL:         true,                  // Use HTTPS for requests.
    UseCache:       true,                  // Enable the in-memory cache.
    UseDNSCache:    true,                  // Enable the in-memory DNS resolution cache.
    CacheSize:      200,                   // Number of items to store.
    RateLimit:      4.0,                   // Requests per second.
    StashRateLimit: 1.0,                   // Requests per second for trade API.
    RequestTimeout: 5 * time.Second        // Time to wait before canceling requests.
} // This is equivalent to poeapi.DefaultClientOptions.

client, err := poeapi.NewAPIClient(clientOpts)
if err != nil {
    // Handle error.
}

ladder, err := client.GetLadder(poeapi.GetLadderOptions{
    ID:    "SSF Hardcore",
    Realm: "pc",
    Type:  "league",
})
// Etc.

Interface

These are the methods available on the client's interface:

// Method:                                 Returns:
GetLadder(poeapi.GetLadderOptions)         (poeapi.Ladder, error)
GetLeague(poeapi.GetLeagueOptions)         (poeapi.League, error)
GetLeagueRule(poeapi.GetLeagueRuleOptions) (poeapi.LeagueRule, error)
GetLeagueRules()                           ([]poeapi.LeagueRule, error)
GetLeagues(poeapi.GetLeaguesOptions)       ([]poeapi.League, error)
GetPVPMatches(poeapi.GetPVPMatchesOptions) ([]poeapi.PVPMatch, error)
GetStashes(poeapi.GetStashOptions)         (poeapi.StashResponse, error)
GetLatestStashID()                         (string, error)

See the documentation or examples for more usage information.

Examples

There are several examples in the examples directory.

Contributing

Contributions to the code, examples, or documentation are very welcome.

Found a problem? Have a question? Open an issue

Have a patch or a new feature? Open a pull request