smitego

package module
v0.0.0-...-9654c6f Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2014 License: MIT Imports: 7 Imported by: 0

README

SmiteGo

Package smitego is an API wrapper for Hirez' Smite game API.

If you want easily consume data from Hirez' Smite API server then smitego is definitely the easiest way to do it.

package main

import (
  "fmt"
  "github.com/kr/pretty"
  "github.com/sergiotapia/smitego"
)

func main() {
  smitego.DevID = "1132"
  smitego.AuthKey = "29FA3BCE7ACF4BDDA7310A352FB855BE"

  smitego.GetSessionID()

  match := smitego.GetMatchDetails("78900556")
  fmt.Printf("%# v", pretty.Formatter(match))
}

Supported API Endpoints

  • API - Connectivity
    • Ping
    • CreateSession
    • TestSession
  • API - Smite Data
    • GetDataUsed
    • GetDemodeDetails
    • GetFriends
    • GetGodRanks
    • GetGods
    • GetGodRecommendedItems
    • GetItems
    • GetMatchDetails
    • GetMatchIdsByQueue - Completed: Look into bug. Response is empty array. Is it on Hirez's side?
    • GetLeagueLeaderBoard - Completed: Look into bug. Response is empty array. Is it on Hirez's side?
    • GetLeagueSeasons - Completed: Look into bug. Response is empty array. Is it on Hirez's side?
    • GetMatchHistory
    • GetPlayer
    • GetQueueStats
    • GetTeamDetails
    • GetTeamMatchHistory
    • GetTeamPlayers
    • GetTopMatches
    • SearchTeams

License

The MIT License (MIT)

Copyright (c) 2014 Sergio Tapia Gutierrez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Overview

Package smitego is an API wrapper for Hirez' Smite game API.

If you want easily consume data from Hirez' Smite API server then smitego is definitely the easiest way to do it.

For a full guide visit http://github.com/sergiotapia/smitego

package main

import (
  "fmt"
  "github.com/kr/pretty"
  "github.com/sergiotapia/smitego"
)

func main() {
  smitego.DevID = "1132"
  smitego.AuthKey = "29FA3BCE7ACF4BDDA7310A352FB855BE"

  smitego.GetSessionID()

  match := smitego.GetMatchDetails("78900556")
  fmt.Printf("%# v", pretty.Formatter(match))
}

Index

Constants

View Source
const (
	Conquest5v5         = "423"
	NoviceQueue         = "424"
	Conquest            = "426"
	Practice            = "427"
	ConquestChallenge   = "429"
	ConquestRanked      = "430"
	Domination          = "433"
	MatchOfTheDay       = "434"
	Arena               = "435"
	ArenaChallenge      = "438"
	DominationChallenge = "439"
	JoustLeague         = "440"
	JoustChallenge      = "441"
	ConquestTeamRanked  = "442"
	Assault             = "445"
	AssaultChallenge    = "446"
	Joust3v3            = "448"
	ConquestLeague      = "451"
	ArenaLeague         = "452"
)

These constants represent the various Queue IDs in the game.

Variables

View Source
var AuthKey = ""

AuthKey is the unique authentication key assigned by HiRez when requestion API access.

View Source
var DevID = ""

DevID is the unique developer id assigned by HiRez when requesting API access.

View Source
var SessionID = ""

SessionID is the current assigned session id given by the Smite API server.

Functions

func GetLeagueLeaderBoard

func GetLeagueLeaderBoard(queue string, tier string, season string) string

GetLeagueLeaderBoard returns a JSON string of players for a given queue on a given tier grade for a given season. Currently this API endpoint is not working well on HiRez's end.

func GetLeagueSeasons

func GetLeagueSeasons(queue string) string

GetLeagueSeasons returns a JSON string of league seasons for a given queue. Currently this API endpoint is not working well on HiRez's end.

func GetMatchIDsByQueue

func GetMatchIDsByQueue(queue string, date string) string

GetMatchIDsByQueue returns a JSON string of match IDs for a given queue on a given date. Currently this API endpoint is not working well on HiRez's end.

func GetQueueStats

func GetQueueStats(playerName string, queueId int) string

TODO: Create struct and find out why Request Error is happening on correct API call.

func GetSessionID

func GetSessionID()

GetSessionID populates the SessionID with a current and valid session id assigned by the Smite API server.

func GetTopRanked

func GetTopRanked(queueId int) string

TO-DO: Service Endpoint not found.

func Ping

func Ping() string

Returns ping information for the Smite API endpoint server.

Types

type Ability

type Ability struct {
	AbilityDescription ItemDescription `json:"itemDescription"`
}

Ability is a struct that represents a God's spell ability information.

type BasicAttack

type BasicAttack struct {
	AttackDescription ItemDescription `json:"itemDescription"`
}

BasicAttack is a struct that represents a God's basic attack information.

type DataUsed

type DataUsed struct {
	ActiveSession      int    `json:"Active_Sessions"`
	ConcurrentSessions int    `json:"Concurrent_Sessions"`
	RequestLimitDaily  int    `json:"Request_Limit_Daily"`
	SessionCap         int    `json:"Session_Cap"`
	SessionTimeLimit   int    `json:"Session_Time_Limit"`
	TotalRequestsToday int    `json:"Total_Requests_Today"`
	TotalSessionsToday int    `json:"Total_Sessions_Today"`
	ReturnMessage      string `json:"ret_msg"`
}

DataUsed is a struct that represents a how many resources you have used so far in the HiRez Smite API server.

func GetDataUsed

func GetDataUsed() DataUsed

GetDataUsed returns a DataUsed instance loaded with API usage information on the HiRez Smite API server.

type Friend

type Friend struct {
	Name          string `json:"name"`
	ReturnMessage string `json:"ret_msg"`
}

Friend is a struct that represents a Smite player's friend.

func GetFriends

func GetFriends(playerName string) []Friend

GetFriends returns a new Friend array instance with a collection of a player's friends.

type God

type God struct {
	Ability1                   string      `json:"Ability1"`
	Ability2                   string      `json:"Ability2"`
	Ability3                   string      `json:"Ability3"`
	Ability4                   string      `json:"Ability4"`
	Ability5                   string      `json:"Ability5"`
	Abilityid1                 int         `json:"AbilityId1"`
	Abilityid2                 int         `json:"AbilityId2"`
	Abilityid3                 int         `json:"AbilityId3"`
	Abilityid4                 int         `json:"AbilityId4"`
	Abilityid5                 int         `json:"AbilityId5"`
	Attackspeed                float32     `json:"AttackSpeed"`
	Attackspeedperlevel        float32     `json:"AttackSpeedPerLevel"`
	Cons                       string      `json:"Cons"`
	Hp5perlevel                float32     `json:"HP5PerLevel"`
	Health                     int         `json:"Health"`
	Healthperfive              int         `json:"HealthPerFive"`
	Healthperlevel             int         `json:"HealthPerLevel"`
	Item1                      string      `json:"Item1"`
	Item2                      string      `json:"Item2"`
	Item3                      string      `json:"Item3"`
	Item4                      string      `json:"Item4"`
	Item5                      string      `json:"Item5"`
	Item6                      string      `json:"Item6"`
	Item7                      string      `json:"Item7"`
	Item8                      string      `json:"Item8"`
	Item9                      string      `json:"Item9"`
	Itemid1                    int         `json:"ItemId1"`
	Itemid2                    int         `json:"ItemId2"`
	Itemid3                    int         `json:"ItemId3"`
	Itemid4                    int         `json:"ItemId4"`
	Itemid5                    int         `json:"ItemId5"`
	Itemid6                    int         `json:"ItemId6"`
	Itemid7                    int         `json:"ItemId7"`
	Itemid8                    int         `json:"ItemId8"`
	Itemid9                    int         `json:"ItemId9"`
	Lore                       string      `json:"Lore"`
	Mp5perlevel                float32     `json:"MP5PerLevel"`
	Magicprotection            int         `json:"MagicProtection"`
	Magicprotectionperlevel    int         `json:"MagicProtectionPerLevel"`
	Mana                       int         `json:"Mana"`
	Manaperfive                float32     `json:"ManaPerFive"`
	Manaperlevel               int         `json:"ManaPerLevel"`
	Name                       string      `json:"Name"`
	Onfreerotation             string      `json:"OnFreeRotation"`
	Pantheon                   string      `json:"Pantheon"`
	Physicalpower              int         `json:"PhysicalPower"`
	Physicalpowerperlevel      int         `json:"PhysicalPowerPerLevel"`
	Physicalprotection         int         `json:"PhysicalProtection"`
	Physicalprotectionperlevel float32     `json:"PhysicalProtectionPerLevel"`
	Pros                       string      `json:"Pros"`
	Roles                      string      `json:"Roles"`
	Speed                      int         `json:"Speed"`
	Title                      string      `json:"Title"`
	Type                       string      `json:"Type"`
	AbilityDescription1        Ability     `json:"abilityDescription1"`
	AbilityDescription2        Ability     `json:"abilityDescription2"`
	AbilityDescription3        Ability     `json:"abilityDescription3"`
	AbilityDescription4        Ability     `json:"abilityDescription4"`
	AbilityDescription5        Ability     `json:"abilityDescription5"`
	BasickAttack               BasicAttack `json:"basicAttack"`
	ReturnMessage              string      `json:"ret_msg"`
	ID                         int         `json:"id"`
}

God is a struct that represents a God character in Smite.

func GetGods

func GetGods() []God

GetGods returns a new God array instance with all the God's and their information from Smite.

type GodRank

type GodRank struct {
	Rank          int    `json:"rank"`
	Worshippers   int    `json:"worshippers"`
	God           string `json:"god"`
	ReturnMessage string `json:"ret_msg"`
}

GodRank is a struct that represents a player's god rank for the Gods in Smite.

func GetGodRanks

func GetGodRanks(playerName string) []GodRank

GetGodRanks returns a new GodRank array instance with a collection of a player's god rank for each God in Smite.

type GodRecommendedItem

type GodRecommendedItem struct {
	Category        string `json:"Category"`
	CategoryValueID int    `json:"category_value_id"`
	Name            string `json:"Item"`
	ItemID          int    `json:"item_id"`
	Role            string `json:"Role"`
	RoleValueID     int    `json:"role_value_id"`
	GodID           int    `json:"god_id"`
	GodName         string `json:"god_name"`
	ReturnMessage   string `json:"ret_msg"`
}

GodRecommendedItem is a struct that represents a God's recommended item to purchase.

func GetGodRecommendedItems

func GetGodRecommendedItems(godID string) []GodRecommendedItem

GetGodRecommendedItems returns a new GodRecommendedItem array instance with all the God's recommended items and their information from Smite.

type Item

type Item struct {
	ChilditemID      int             `json:"ChildItemId"`
	DeviceName       string          `json:"DeviceName"`
	IconID           int             `json:"IconId"`
	ItemDescription  ItemDescription `json:"itemDescription"`
	ItemID           int             `json:"ItemId"`
	ItemTier         int             `json:"ItemTier"`
	Price            int             `json:"Price"`
	RootItemID       int             `json:"RootItemId"`
	ShortDescription string          `json:"ShortDesc"`
	StartingItem     bool            `json:"StartingItem"`
	Type             string          `json:"Type"`
	RetMsg           string          `json:"ret_msg"`
}

Item is a struct that represents an Item in Smite.

func GetItems

func GetItems() []Item

GetItems returns a new Item array instance with all the Items and their information from Smite.

type ItemDescription

type ItemDescription struct {
	Cooldown             string     `json:"cooldown"`
	Cost                 string     `json:"cost"`
	Description          string     `json:"description"`
	MenuItems            []MenuItem `json:"menuitems"`
	RankItems            []RankItem `json:"rankitems"`
	SecondaryDescription string     `json:"secondaryDescription"`
}

type LeagueConquest

type LeagueConquest struct {
	Leaves        int    `json:"Leaves"`
	Losses        int    `json:"Losses"`
	Name          string `json:"Name"`
	Points        int    `json:"Points"`
	PreviousRank  int    `json:"PrevRank"`
	Rank          int    `json:"Rank"`
	Season        int    `json:"Season"`
	Tier          int    `json:"Tier"`
	Trend         int    `json:"Trend"`
	VictoryPoints int    `json:"VictoryPoints"`
	Wins          int    `json:"Wins"`
	ReturnMessage string `json:"ret_msg"`
}

LeagueConquest is a struct that represents a player's status within the Conquest league in Smite.

type LeagueJoust

type LeagueJoust struct {
	Leaves        int    `json:"Leaves"`
	Losses        int    `json:"Losses"`
	Name          string `json:"Name"`
	Points        int    `json:"Points"`
	PreviousRank  int    `json:"PrevRank"`
	Rank          int    `json:"Rank"`
	Season        int    `json:"Season"`
	Tier          int    `json:"Tier"`
	Trend         int    `json:"Trend"`
	VictoryPoints int    `json:"VictoryPoints"`
	Wins          int    `json:"Wins"`
	ReturnMessage string `json:"ret_msg"`
}

LeagueJoust is a struct that represents a player's status within the Joust league in Smite.

type MatchHistory

type MatchHistory struct {
	Activeid1       int    `json:"ActiveId1"`
	Activeid2       int    `json:"ActiveId2"`
	Active1         string `json:"Active_1"`
	Active2         string `json:"Active_2"`
	Active3         string `json:"Active_3"`
	Assists         int    `json:"Assists"`
	Ban1            int    `json:"Ban1"`
	Ban1ID          int    `json:"Ban1Id"`
	Ban2            int    `json:"Ban2"`
	Ban2ID          int    `json:"Ban2Id"`
	Ban3            int    `json:"Ban3"`
	Ban3ID          int    `json:"Ban3Id"`
	Ban4            int    `json:"Ban4"`
	Ban4ID          int    `json:"Ban4Id"`
	Ban5            int    `json:"Ban5"`
	Ban5ID          int    `json:"Ban5Id"`
	Ban6            int    `json:"Ban6"`
	Ban6ID          int    `json:"Ban6Id"`
	Creeps          int    `json:"Creeps"`
	Damage          int    `json:"Damage"`
	DamageBot       int    `json:"Damage_Bot"`
	DamageMitigated int    `json:"Datamage_Mitigated"`
	DamageStructure int    `json:"Damage_Structure"`
	DamageTaken     int    `json:"Damage_Taken"`
	Deaths          int    `json:"Deaths"`
	God             string `json:"God"`
	GodID           int    `json:"GodId"`
	Gold            int    `json:"Gold"`
	Healing         int    `json:"Healing"`
	Itemid1         int    `json:"Itemid1"`
	Itemid2         int    `json:"Itemid2"`
	Itemid3         int    `json:"Itemid3"`
	Itemid4         int    `json:"Itemid4"`
	Itemid5         int    `json:"Itemid5"`
	Itemid6         int    `json:"Itemid6"`
	KillingSpree    int    `json:"Killing_Spree"`
	Kills           int    `json:"Kills"`
	Level           int    `json:"Level"`
	Match           int    `json:"Match"`
	MatchTime       string `json:"Match_Time"`
	Minutes         int    `json:"Minutes"`
	MultiKillMax    int    `json:"Multi_kill_max"`
	Queue           string `json:"Queue"`
	Skin            string `json:"Skin"`
	Skinid          int    `json:"SkinId"`
	Surrendered     string `json:"Surrendered"`
	Team1score      int    `json:"Team1Score"`
	Team2score      int    `json:"Team2Score"`
	WinStatus       string `json:"Win_Status"`
	Playername      string `json:"playerName"`
	ReturnMessage   string `json:"ret_msg"`
}

MatchHistory is a struct that represents a player's match history information.

func GetMatchHistory

func GetMatchHistory(playerName string) []MatchHistory

GetMatchHistory returns a MatchHistory array instance loaded with each match information for a player.

type MatchPlayer

type MatchPlayer struct {
	AccountLevel       int    `json:"Account_Level"`
	Activeid1          int    `json:"ActiveId1"`
	Activeid2          int    `json:"ActiveId2"`
	Assists            int    `json:"Assists"`
	Ban1               string `json:"Ban1"`
	Ban1id             int    `json:"Ban1Id"`
	Ban2               string `json:"Ban2"`
	Ban2id             int    `json:"Ban2Id"`
	Ban3               string `json:"Ban3"`
	Ban3id             int    `json:"Ban3Id"`
	Ban4               string `json:"Ban4"`
	Ban4id             int    `json:"Ban4Id"`
	DamageBot          int    `json:"Damage_Bot"`
	DamageDoneMagical  int    `json:"Damage_Done_Magical"`
	DamageDonePhysical int    `json:"Damage_Done_Physical"`
	DamagePlayer       int    `json:"Damage_Player"`
	DamageTaken        int    `json:"Damage_Taken"`
	Deaths             int    `json:"Deaths"`
	EntryDatetime      string `json:"Entry_Datetime"`
	FinalMatchLevel    int    `json:"Final_Match_Level"`
	Godid              int    `json:"GodId"`
	GoldEarned         int    `json:"Gold_Earned"`
	GoldPerMinute      int    `json:"Gold_Per_Minute"`
	Healing            int    `json:"Healing"`
	Itemid1            int    `json:"ItemId1"`
	Itemid2            int    `json:"ItemId2"`
	Itemid3            int    `json:"ItemId3"`
	Itemid4            int    `json:"ItemId4"`
	Itemid5            int    `json:"ItemId5"`
	Itemid6            int    `json:"ItemId6"`
	ItemActive1        string `json:"Item_Active_1"`
	ItemActive2        string `json:"Item_Active_2"`
	ItemActive3        string `json:"Item_Active_3"`
	ItemPurch1         string `json:"Item_Purch_1"`
	ItemPurch2         string `json:"Item_Purch_2"`
	ItemPurch3         string `json:"Item_Purch_3"`
	ItemPurch4         string `json:"Item_Purch_4"`
	ItemPurch5         string `json:"Item_Purch_5"`
	ItemPurch6         string `json:"Item_Purch_6"`
	KillingSpree       int    `json:"Killing_Spree"`
	KillsBot           int    `json:"Kills_Bot"`
	KillsPlayer        int    `json:"Kills_Player"`
	MasteryLevel       int    `json:"Mastery_Level"`
	Match              int    `json:"Match"`
	Minutes            int    `json:"Minutes"`
	MultiKillMax       int    `json:"Multi_kill_Max"`
	Partyid            int    `json:"PartyId"`
	ReferenceName      string `json:"Reference_Name"`
	Skin               string `json:"Skin"`
	Skinid             int    `json:"SkinId"`
	StructureDamage    int    `json:"Structure_Damage"`
	Surrendered        string `json:"Surrendered"`
	Team1score         int    `json:"Team1Score"`
	Team2score         int    `json:"Team2Score"`
	Teamid             int    `json:"TeamId"`
	TeamName           string `json:"Team_Name"`
	WinStatus          string `json:"Win_Status"`
	Name               string `json:"name"`
	Playername         string `json:"playerName"`
	RetMsg             string `json:"ret_msg"`
}

MatchPlayer is a struct that represents a player that participated in a Smite match.

func GetMatchDetails

func GetMatchDetails(matchID string) []MatchPlayer

GetMatchDetails returns a MatchPlayer array instance loaded with each player's information for the match.

type MenuItem struct {
	Description string `json:"description"`
	Value       string `json:"value"`
}

type ModeDetail

type ModeDetail struct {
	Ban1               string `json:"Ban1"`
	Ban2               string `json:"Ban2"`
	EntryDatetime      string `json:"Entry_Datetime"`
	Match              int    `json:"Match"`
	MatchTime          int    `json:"Match_Time"`
	OfflineSpectators  int    `json:"Offline_Spectators"`
	RealtimeSpectators int    `json:"Realtime_Spectators"`
	RecordingEnded     string `json:"Recording_Ended"`
	RecordingStarted   string `json:"Recording_Started"`
	Team1Avglevel      int    `json:"Team1_AvgLevel"`
	Team1Gold          int    `json:"Team1_Gold"`
	Team1Kills         int    `json:"Team1_Kills"`
	Team1Score         int    `json:"Team1_Score"`
	Team2Avglevel      int    `json:"Team2_AvgLevel"`
	Team2Gold          int    `json:"Team2_Gold"`
	Team2Kills         int    `json:"Team2_Kills"`
	Team2Score         int    `json:"Team2_Score"`
	WinningTeam        int    `json:"Winning_Team"`
	ReturnMessage      string `json:"ret_msg"`
}

ModeDetail is a struct that represents the mode information of a given match.

func GetModeDetails

func GetModeDetails(matchID string) ModeDetail

GetModeDetails returns a ModeDetail instance loaded with mode information for a specific match ID.

type Player

type Player struct {
	ID                int            `json:"Id"`
	CreatedDateTime   string         `json:"Created_Datetime"`
	LastLoginDateTime string         `json:"Last_Login_Datetime"`
	Leaves            int            `json:"Leaves"`
	Level             int            `json:"Level"`
	LeagueConquest    LeagueConquest `json:"LeagueConquest"`
	LeagueJoust       LeagueJoust    `json:"LeagueJoust"`
	Losses            int            `json:"Losses"`
	MasteryLevel      int            `json:"MasteryLevel"`
	Name              string         `json:"Name"`
	RankStat          float32        `json:"Rank_Stat"`
	RankStatJoust     float32        `json:"Rank_Stat_Joust"`
	TeamID            int            `json:"TeamId"`
	TeamName          string         `json:"Team_Name"`
	TierConquest      int            `json:"Tier_Conquest"`
	TierJoust         int            `json:"Tier_Joust"`
	Wins              int            `json:"Wins"`
	ReturnMessage     string         `json:"ret_msg"`
}

Player is a struct that represents a Smite game player.

func GetPlayer

func GetPlayer(playerName string) Player

GetPlayer returns a new Player instance with the fields filled with data from the json response.

type RankItem

type RankItem struct {
	Description string `json:"description"`
	Value       string `json:"value"`
}

Jump to

Keyboard shortcuts

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