cod

package module
v0.0.0-...-33cc50d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 10 Imported by: 0

README

COD-GO

LIBRARY NO LONGER MAINTAINED

This library was built to support Warzone. Feel free to do a PR!

Installation

go get -u github.com/Fyb3roptik/cod-go

Examples

Creating A Session
session := cod.Login("someuser@domain.com", "password")
Logged In User Identities
identites := session.GetIdentites("mw")
Get Player Recent Matches
stats := session.GetPlayerStats("uno", "SomeUser#12345678")
stats := session.GetPlayerStats("battle", "SomeUser#1234")
stats := session.GetPlayerStats("xbl", "SomeGamertag")
stats := session.GetPlayerStats("psn", "PsnOnlineId")

Documentation

Index

Constants

View Source
const (
	CSRF_URL  = "https://profile.callofduty.com/cod/login"
	LOGIN_URL = "https://profile.callofduty.com/do_login?new_SiteId=cod"
	USER_URL  = "https://profile.callofduty.com/cod/userInfo"
	STATS_URL = "https://my.callofduty.com/api/papi-client/crm/cod/v2/title/mw/platform"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Identity

type Identity struct {
	Identities []*UserData `json:"identities"`
}

type Match

type Match struct {
	UtcStartSeconds int          `json:"utcStartSeconds"`
	UtcEndSeconds   int          `json:"utcEndSeconds"`
	Map             string       `json:"map"`
	Mode            string       `json:"mode"`
	MatchID         string       `json:"matchID"`
	Duration        int64        `json:"duration"`
	GameType        string       `json:"gameType"`
	PlayerCount     int          `json:"playerCount"`
	PlayerStats     *PlayerStats `json:"playerStats"`
	Player          *Player      `json:"player"`
	TeamCount       int          `json:"teamCount"`
	Draw            bool         `json:"draw"`
	PrivateMatch    bool         `json:"privateMatch"`
}

type MatchData

type MatchData struct {
	Matches []Match `json:"matches"`
	Message string  `json:"message"`
}

type Player

type Player struct {
	Team     string  `json:"team"`
	Rank     float64 `json:"rank"`
	Username string  `json:"username"`
}

type PlayerStats

type PlayerStats struct {
	Kills            float64 `json:"kills"`
	MedalXp          float64 `json:"medalXp"`
	MatchXp          float64 `json:"matchXp"`
	ScoreXp          float64 `json:"scoreXp"`
	Score            float64 `json:"score"`
	TotalXp          float64 `json:"totalXp"`
	Heashots         float64 `json:"headshots"`
	Assists          float64 `json:"assists"`
	ChallengeXp      float64 `json:"challengeXp"`
	Rank             float64 `json:"rank"`
	ScorePerMinute   float64 `json:"scorePerMinute"`
	DistanceTraveled float64 `json:"distanceTraveled"`
	TeamSurvivalTime float64 `json:"teamSurvivalTime"`
	Deaths           float64 `json:"deaths"`
	KdRatio          float64 `json:"kdRatio"`
	BonusXp          float64 `json:"bonusXp"`
	GulagDeaths      float64 `json:"gulagDeaths"`
	TimePlayed       float64 `json:"timePlayed"`
	Executions       float64 `json:"executions"`
	GulagKills       float64 `json:"gulagKills"`
	MiscXp           float64 `json:"miscXp"`
	LongestStreak    float64 `json:"longestStreak"`
	TeamPlacement    float64 `json:"teamPlacement"`
	DamageDone       float64 `json:"damageDone"`
	DamageTaken      float64 `json:"damageTaken"`
}

type RawRecentMatchesResponse

type RawRecentMatchesResponse struct {
	Status string     `json:"status"`
	Data   *MatchData `json:"data"`
}

Player Data Structs

type Session

type Session struct {
	Xsrf         string
	Atkn         string
	Rtkn         string
	ActSsoCookie string
	Cookies      []*http.Cookie
}

AUTHENTICATION Structs

func Login

func Login(username string, password string) (*Session, error)

func (Session) GetIdentities

func (c Session) GetIdentities() (*Identity, error)

Title options: mw, bo4, wwii

func (Session) GetPlayerStats

func (c Session) GetPlayerStats(platform string, username string) ([]Match, error)

Platform options: uno(Activision), xbl(Xbox), psn(Playstation), battle(PC)

type UserData

type UserData struct {
	Username string `json:"username"`
	Provider string `json:"provider"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL