diff options
Diffstat (limited to 'esi.go')
-rw-r--r-- | esi.go | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +package main + +import ( + "encoding/json" + "fmt" + "net/http" +) + +func GetKillmail(id uint64, hash string) (EsiKillmail, error) { + r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/killmails/%d/%s/", id, hash)) + if err != nil { + return EsiKillmail{}, err + } + decoder := json.NewDecoder(r.Body) + var details EsiKillmail + if err := decoder.Decode(&details); err != nil { + return EsiKillmail{}, err + } + + return details, nil +} + +func GetSolarSystem(id int32) (EsiUniverseSystem, error) { + r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/universe/systems/%d/", id)) + if err != nil { + return EsiUniverseSystem{}, err + } + decoder := json.NewDecoder(r.Body) + var details EsiUniverseSystem + if err := decoder.Decode(&details); err != nil { + return EsiUniverseSystem{}, err + } + + return details, nil +} |