Call of Duty Tracker API (Go)
Wrapper for Call of Duty Tracker's API, written in Go.
go get github.com/mtslzr/cod-api/go
import cod "cod-api-go" client, err := cod.New("GAME", "PLATFORM", "USERNAME")
Replace the following placeholders:
- GAME: bo3, bo4, wwii, iw
- PLATFORM: bnet, psn, steam, xbl
- USERNAME: Platform-specific username (include #1111 tag for Battle.net)
See API Documentation for more information on variables.
data, err := client.ValidateUser()
data, err := client.GetUserStats("MATCHTYPE")
MATCHTYPE can be "mp" or "blackout" for specific match data. Or pass "" for default (mp).
data, err := client.GetRecentMatches(NUMMATCHES)
NUMMATCHES is a number of matches between 1 and 100.
data, err := client.GetSpecificMatch(MATCHID)
MATCHID is a specific Match ID to search.
data, err := client.GetUserNames("USERID1", "USERID2", "USERID3")
USERID can be one (more more) User IDs to search; results will show user for each ID.
data, err := client.GetLeaderboard("SCOPE", NUMPLAYERS)
SCOPE is which leaderboard you'd like to return (kills, deaths, ekia, wins, losses, gamesplayed, timeplayed). NUMPLAYERS is the number of players between 1 and 100.
- Add Unit Tests for each endpoint.
- Add validation for variables being passed to API struct and each endpoint.
- Either adjust API variables or allow game/platform/username to be passed in other calls.
Based heavily on code from pubg-go and converted for this API.