hirezapi

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	DeveloperID  string
	AuthKey      string
	BasePath     string
	RespType     string
	SessionID    string
	SessionStamp string
}

APIClient stores data needed to interface with the HiRez API and implements the HiRezAPI interface methods.

func (*APIClient) ChangeBasePath

func (a *APIClient) ChangeBasePath(url string)

ChangeBasePath modifies the base path if you want to query a different platform.

func (*APIClient) ChangeResponseType

func (a *APIClient) ChangeResponseType(respType string)

ChangeResponseType modifies the response type if you want to switch between JSON and XML

func (*APIClient) CreateSession

func (a *APIClient) CreateSession() error

CreateSession is a required step to Authenticate the developerId/signature for further API use.

func (*APIClient) GetBountyItems

func (a *APIClient) GetBountyItems() ([]models.BountyItem, error)

GetBountyItems returns daily Bounty Item history for the past 6 months.

func (*APIClient) GetChampionCards

func (a *APIClient) GetChampionCards(champID, langCode string) ([]models.ChampionCard, error)

GetChampionCards returns all Champion cards.

func (*APIClient) GetChampionLeaderboard

func (a *APIClient) GetChampionLeaderboard(champID string) ([]models.ChampionLeaderboardEntry, error)

GetChampionLeaderboard returns the current season's leaderboard for a champion/queue. [ Only queue 428]

func (*APIClient) GetChampionRanks

func (a *APIClient) GetChampionRanks(player string) ([]models.ChampionRank, error)

GetChampionRanks returns the rank and worshipper values for each Champion a player has played.

func (*APIClient) GetChampionSkins

func (a *APIClient) GetChampionSkins(champID, langCode string) ([]models.ChampionSkin, error)

GetChampionSkins returns a list of skins for a particular champion.

func (*APIClient) GetChampions

func (a *APIClient) GetChampions(langCode string) ([]models.Champion, error)

GetChampions returns all Champions and their various attributes.

func (*APIClient) GetDataUsed

func (a *APIClient) GetDataUsed() ([]models.DataUsed, error)

GetDataUsed returns API Developer daily usage limits and the current status against those limits.

func (*APIClient) GetESportsProLeagueDetails

func (a *APIClient) GetESportsProLeagueDetails() ([]models.ESportsProLeagueDetail, error)

GetESportsProLeagueDetails returns matchup info for each matchup of the current season. match_status = 1 - scheduled, 2 - in progress, 3 - complete

func (*APIClient) GetFriends

func (a *APIClient) GetFriends(player string) ([]models.Friend, error)

GetFriends returns Smite Usernames of each of the player's friends. [PC Only]

func (*APIClient) GetGodAltAbilities added in v0.0.6

func (a *APIClient) GetGodAltAbilities() ([]models.GodAltAbility, error)

func (*APIClient) GetGodLeaderboard

func (a *APIClient) GetGodLeaderboard(godID, queueID string) ([]models.GodLeaderboardEntry, error)

GetGodLeaderboard returns the current season's leaderboard for a god/queue. [SmiteAPI: only queues 440, 450, 451]

func (*APIClient) GetGodRanks

func (a *APIClient) GetGodRanks(player string) ([]models.GodRank, error)

GetGodRanks returns the rank and worshipper values for each God a player has played.

func (*APIClient) GetGodRecommendedItems

func (a *APIClient) GetGodRecommendedItems(godID int64, langCode string) ([]models.GodRecommendedItem, error)

GetGodRecommendedItems returns the recommended items for a particular God.

func (*APIClient) GetGodSkins

func (a *APIClient) GetGodSkins(godID int64, langCode string) ([]models.GodSkin, error)

GetGodSkins returns all available skins for a particular God.

func (*APIClient) GetGods

func (a *APIClient) GetGods(langCode string) ([]models.God, error)

GetGods returns all Gods and their various attributes.

func (*APIClient) GetHiRezServerStatus

func (a *APIClient) GetHiRezServerStatus() ([]models.HiRezServerStatus, error)

GetHiRezServerStatus returns UP/DOWN status for the primary game/platform environments. Data is cached once a minute.

func (*APIClient) GetItems

func (a *APIClient) GetItems(langCode string) ([]models.Item, error)

GetItems returns all items and their various attributes.

func (*APIClient) GetLeagueLeaderboard

func (a *APIClient) GetLeagueLeaderboard(queueID, tier, round string) ([]models.LeagueLeaderboardEntry, error)

GetLeagueLeaderboard returns the top players for a particular league.

func (*APIClient) GetLeagueSeasons

func (a *APIClient) GetLeagueSeasons(queueID string) ([]models.Season, error)

GetLeagueSeasons returns a list of seasons for a match queue.

func (*APIClient) GetMOTD

func (a *APIClient) GetMOTD() ([]models.MOTD, error)

GetMOTD returns information about the 20 most recent Match-of-the-Days.

func (*APIClient) GetMatchDetails

func (a *APIClient) GetMatchDetails(matchID string) ([]models.MatchPlayer, error)

GetMatchDetails returns the statistics for a particular completed match.

func (*APIClient) GetMatchDetailsBatch

func (a *APIClient) GetMatchDetailsBatch(matchIDs []string) ([]models.MatchPlayer, error)

GetMatchDetailsBatch returns the statistics for a particular set of completed matches. (limit batch query to 5-10 matchIDs)

func (*APIClient) GetMatchHistory

func (a *APIClient) GetMatchHistory(player string) ([]models.Match, error)

GetMatchHistory returns a list of recent matches and high level match statistics for a particular player

func (*APIClient) GetMatchIDsByQueue

func (a *APIClient) GetMatchIDsByQueue(queueID, date, hour string) ([]models.Match, error)

GetMatchIDsByQueue lists all MatchIDs for a particular match queue. - queueID can be referened by constants defined in this package (eg, hirezapi.ConquestRanked). - date must be formatted/formattable by hirezapi.DateFormat (yyyyMMdd). - hour may be "0" - "23" and optionally may contain a ten minute window separated by a comma (eg, "6,30"). - hour may also be "-1" to fetch the whole day, but may stall/fail due to the amount of data.

func (*APIClient) GetMatchPlayerDetails

func (a *APIClient) GetMatchPlayerDetails(matchID string) ([]models.LiveMatchPlayer, error)

GetMatchPlayerDetails returns player information for a live match.

func (*APIClient) GetOrganizedMatchDetailsBatch

func (a *APIClient) GetOrganizedMatchDetailsBatch(matchIDs []string) ([][]models.MatchPlayer, error)

GetOrganizedMatchDetailsBatch is the same as GetMatchDetailsBatch(), except it groups the players by match. (limit batch query to 5-10 matchIDs)

func (*APIClient) GetPatchInfo

func (a *APIClient) GetPatchInfo() (*models.VersionInfo, error)

GetPatchInfo returns information about the currently deployed patch.

func (*APIClient) GetPlayer

func (a *APIClient) GetPlayer(player string) ([]models.Player, error)

GetPlayer returns league and other high level data for a particular player.

func (*APIClient) GetPlayerAchievements

func (a *APIClient) GetPlayerAchievements(playerID string) (*models.PlayerAchievements, error)

GetPlayerAchievements returns select achievement totals.

func (*APIClient) GetPlayerBatch

func (a *APIClient) GetPlayerBatch(playerIDs []string) ([]models.Player, error)

GetPlayerBatch returns league and other high level data for a particular list of players. [20 max]

func (*APIClient) GetPlayerByPlatform

func (a *APIClient) GetPlayerByPlatform(player, portalID string) ([]models.Player, error)

GetPlayerByPlatform returns league and other high level data for a particular player.

func (*APIClient) GetPlayerIDByName

func (a *APIClient) GetPlayerIDByName(player string) ([]models.PlayerIDInfo, error)

GetPlayerIDByName returns a list of Hi-Rez PlayerID values for the particular player

func (*APIClient) GetPlayerIDByPortalUserID

func (a *APIClient) GetPlayerIDByPortalUserID(portalID, portalUserID string) ([]models.PlayerIDInfo, error)

GetPlayerIDByPortalUserID returns a list of Hi-Rez PlayerID values for portalID/portalUserID combo

func (*APIClient) GetPlayerIDInfoForXBOXAndSwitch

func (a *APIClient) GetPlayerIDInfoForXBOXAndSwitch(player string) ([]models.PlayerIDInfoForXBOXAndSwitch, error)

GetPlayerIDInfoForXBOXAndSwitch returns all PlayerID data associated with the playerName

func (*APIClient) GetPlayerIDsByGamertag

func (a *APIClient) GetPlayerIDsByGamertag(portalID, gamerTag string) ([]models.PlayerIDInfo, error)

GetPlayerIDsByGamertag returns a list of Hi-Rez PlayerID values for a portalID/gamerTag combo

func (*APIClient) GetPlayerLoadouts

func (a *APIClient) GetPlayerLoadouts(player, langCode string) ([]models.PlayerLoadout, error)

GetPlayerLoadouts returns deck loadouts per Champion

func (*APIClient) GetPlayerStatus

func (a *APIClient) GetPlayerStatus(player string) ([]models.PlayerStatus, error)

GetPlayerStatus returns a player status.

func (*APIClient) GetQueueStats

func (a *APIClient) GetQueueStats(player, queueID string) ([]models.PlayerGodQueueStat, error)

GetQueueStats returns match summary stats for a player + queue, grouped by Gods played.

func (*APIClient) GetTeamDetails

func (a *APIClient) GetTeamDetails(clanID string) ([]models.TeamDetail, error)

GetTeamDetails returns the number of players and other high level details for a particular Clan.

func (*APIClient) GetTeamPlayers

func (a *APIClient) GetTeamPlayers(clanID string) ([]models.TeamPlayer, error)

GetTeamPlayers returns a list of players for a particular Clan.

func (*APIClient) GetTopMatches

func (a *APIClient) GetTopMatches() ([]models.TopMatch, error)

GetTopMatches returns the 50 most watched / recorded matches.

func (*APIClient) Ping

func (a *APIClient) Ping() error

Ping is a quick way of validating access to the Hi-Rez API.

func (*APIClient) SearchPlayers

func (a *APIClient) SearchPlayers(searchPlayer string) ([]models.PlayerIDInfo, error)

SearchPlayers returns playerID values for all names and/or gamerTags containing searchPlayer

func (*APIClient) SearchTeams

func (a *APIClient) SearchTeams(searchTeam string) ([]models.TeamDetail, error)

SearchTeams returns high level info for Clan names containing search term.

func (*APIClient) TestSession

func (a *APIClient) TestSession() (string, error)

TestSession is a means of validating that a session is established.

type HiRezAPI

type HiRezAPI interface {

	// Ping is a quick way of validating access to the Hi-Rez API.
	Ping() error
	// CreateSession is a required step to Authenticate the developerId/signature for further API use.
	CreateSession() error
	// TestSession is a means of validating that a session is established.
	TestSession() (string, error)
	// GetHirezServerStatus returns UP/DOWN status for the primary game/platform environments. Data is cached once a minute.
	GetHiRezServerStatus() ([]models.HiRezServerStatus, error)
	// GetDataUsed returns API Developer daily usage limits and the current status against those limits.
	GetDataUsed() ([]models.DataUsed, error)
	// ChangeBasePath modifies the base path if you want to query a different platform
	ChangeBasePath(url string)
	// ChangeResponseType modifies the response type if you want to switch between JSON and XML
	ChangeResponseType(respType string)

	// GetPlayer returns league and other high level data for a particular player.
	GetPlayer(player string) ([]models.Player, error)
	// GetPlayer returns league and other high level data for a particular player.
	GetPlayerByPlatform(player, portalID string) ([]models.Player, error)
	// GetPlayerIDByName
	GetPlayerIDByName(player string) ([]models.PlayerIDInfo, error)
	// GetPlayerIDByPortalUserID
	GetPlayerIDByPortalUserID(portalID, portalUserID string) ([]models.PlayerIDInfo, error)
	// GetPlayerIDsByGamertag
	GetPlayerIDsByGamertag(portalID, gamerTag string) ([]models.PlayerIDInfo, error)
	// GetFriends returns Smite Usernames of each of the player's friends. [PC Only]
	GetFriends(player string) ([]models.Friend, error)
	// GetGodRanks returns the rank and worshipper values for each God a player has played.
	GetGodRanks(player string) ([]models.GodRank, error)
	// GetMatchHistory returns a list of recent matches and high level match statistics for a particular player
	GetMatchHistory(player string) ([]models.Match, error)
	// GetPlayerStatus returns a player status. 0 - offline, 1 - lobby, 2 - god select, 3 - in game, 4 - online, 5 - unknown
	GetPlayerStatus(player string) ([]models.PlayerStatus, error)
	// GetPlayerAchievements returns select achievement totals.
	GetPlayerAchievements(playerID string) (*models.PlayerAchievements, error)
	// GetTeamDetails returns the number of players and other high level details for a particular Clan.
	GetTeamDetails(clanID string) ([]models.TeamDetail, error)
	// GetTeamPlayers returns a list of players for a particular Clan.
	GetTeamPlayers(clanID string) ([]models.TeamPlayer, error)
	// SearchTeams returns high level info for Clan names containing search term.
	SearchTeams(searchTeam string) ([]models.TeamDetail, error)
	// SearchPlayers returns playerID values for all names and/or gamerTags containing searchPlayer
	SearchPlayers(searchPlayer string) ([]models.PlayerIDInfo, error)

	// GetGods returns all Gods and their various attributes.
	GetGods(langCode string) ([]models.God, error)
	// GetGodAltAbilities returns alt abilities for all Gods.
	GetGodAltAbilities() ([]models.GodAltAbility, error)
	// GetGodSkins returns all available skins for a particular God.
	GetGodSkins(godID int64, langCode string) ([]models.GodSkin, error)
	// GetGodRecommendedItems returns the recommended items for a particular God.
	GetGodRecommendedItems(godID int64, langCode string) ([]models.GodRecommendedItem, error)
	// GetItems returns all items and their various attributes.
	GetItems(langCode string) ([]models.Item, error)

	// GetMatchDetails returns the statistics for a particular completed match.
	GetMatchDetails(matchID string) ([]models.MatchPlayer, error)
	/*GetMatchDetailsBatch returns the statistics for a particular set of completed matches. (limit batch query to 5-10 matchIDs)

		- The actual Hi-Rez API does not automatically group the response by matchID.
	  - If you want the results to be grouped by matchID, use GetOrganizedMatchDetailsBatch() instead.
	*/
	GetMatchDetailsBatch(matchIDs []string) ([]models.MatchPlayer, error)
	// GetOrganizedMatchDetailsBatch is the same as GetMatchDetailsBatch(), except it groups the players by match.
	GetOrganizedMatchDetailsBatch(matchIDs []string) ([][]models.MatchPlayer, error)
	// GetMatchPlayerDetails returns player information for a live match.
	GetMatchPlayerDetails(matchID string) ([]models.LiveMatchPlayer, error)
	/*GetMatchIDsByQueue lists all MatchIDs for a particular match queue.
	- queueID can be referened by constants defined in this package (eg, hirezapi.ConquestRanked).
	- date must be formatted/formattable by hirezapi.DateFormat (yyyyMMdd).
	- hour may be "0" - "23" and optionally may contain a ten minute window separated by a comma (eg, "6,30").
	- hour may also be "-1" to fetch the whole day, but may stall/fail due to the amount of data.
	*/
	GetMatchIDsByQueue(queueID, date, hour string) ([]models.Match, error)
	// GetQueueStats returns match summary stats for a player + queue, grouped by Gods played.
	GetQueueStats(player, queueID string) ([]models.PlayerGodQueueStat, error)

	// GetESportsProLeagueDetails returns matchup info for each matchup of the current season. match_status = 1 - scheduled, 2 - in progress, 3 - complete
	GetESportsProLeagueDetails() ([]models.ESportsProLeagueDetail, error)
	// GetGodLeaderboard returns the current season's leaderboard for a god/queue. [SmiteAPI: only queues 440, 450, 451 apply]
	GetGodLeaderboard(godID, queueID string) ([]models.GodLeaderboardEntry, error)
	// GetLeagueLeaderboard returns the top players for a particular league.
	GetLeagueLeaderboard(queueID, tier, round string) ([]models.LeagueLeaderboardEntry, error)
	// GetLeagueSeasons returns a list of seasons for a match queue.
	GetLeagueSeasons(queueID string) ([]models.Season, error)
	// GetMOTD returns information about the 20 most recent Match-of-the-Days.
	GetMOTD() ([]models.MOTD, error)
	// GetTopMatches returns the 50 most watched / recorded matches.
	GetTopMatches() ([]models.TopMatch, error)
	// GetPatchInfo returns information about the currently deployed patch.
	GetPatchInfo() (*models.VersionInfo, error)

	// GetPlayerBatch returns league and other high level data for a particular list of players. [20 max]
	GetPlayerBatch(playerIDs []string) ([]models.Player, error)
	// GetChampionRanks returns the rank and worshipper values for each Champion a player has played.
	GetChampionRanks(player string) ([]models.ChampionRank, error)
	// GetChampions returns all Champions and their various attributes.
	GetChampions(langCode string) ([]models.Champion, error)
	// GetChampionLeaderboard returns the current season's leaderboard for a champion/queue. [ Only queue 428]
	GetChampionLeaderboard(champID string) ([]models.ChampionLeaderboardEntry, error)
	// GetChampionSkins
	GetChampionSkins(champID, langCode string) ([]models.ChampionSkin, error)
	// GetPlayerIDInfoForXBOXAndSwitch returns all PlayerID data associated with the playerName
	GetPlayerIDInfoForXBOXAndSwitch(player string) ([]models.PlayerIDInfoForXBOXAndSwitch, error)
	// GetPlayerLoadouts returns deck loadouts per Champion
	GetPlayerLoadouts(player, langCode string) ([]models.PlayerLoadout, error)
	// GetChampionCards returns all Champion cards
	GetChampionCards(champID, langCode string) ([]models.ChampionCard, error)
	// GetBountyItems returns daily Bounty Item history for the past 6 months.
	GetBountyItems() ([]models.BountyItem, error)
}

HiRezAPI is a collection of endpoint methods for interacting with the Hi-Rez API Definitions here are taken from the publicly available "Smite API Developer Guide" PDF

func New

func New(devID, key, url, respType string) (HiRezAPI, error)

New initializes a HiRezAPI instance with devID, auth key, url, and response type.

func NewWithSession

func NewWithSession(devID, key, url, respType string) (HiRezAPI, error)

NewWithSession is like New() but it also tests connectivity with Ping and initializes a session for you.

Jump to

Keyboard shortcuts

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