Go-based wrapper for Call of Duty Tracker's API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
client.go

README.md

Call of Duty Tracker API (Go)

Wrapper for Call of Duty Tracker's API, written in Go.

Installation

go get github.com/mtslzr/cod-api/go

Usage

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.

Endpoints

Validate User

data, err := client.ValidateUser()

User Stats

data, err := client.GetUserStats("MATCHTYPE")

MATCHTYPE can be "mp" or "blackout" for specific match data. Or pass "" for default (mp).

Recent Matches

data, err := client.GetRecentMatches(NUMMATCHES)

NUMMATCHES is a number of matches between 1 and 100.

Specific Match

data, err := client.GetSpecificMatch(MATCHID)

MATCHID is a specific Match ID to search.

Users

data, err := client.GetUserNames("USERID1", "USERID2", "USERID3")

USERID can be one (more more) User IDs to search; results will show user for each ID.

Leaderboard

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.

To Do

  • 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.

Credits

Based heavily on code from pubg-go and converted for this API.