package main import ( "encoding/json" "fmt" "net/http" ) func GetKillmail(id int32, 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 GetType(id int32) (EsiType, error) { r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/universe/types/%d/", id)) if err != nil { return EsiType{}, err } decoder := json.NewDecoder(r.Body) var details EsiType if err := decoder.Decode(&details); err != nil { return EsiType{}, err } return details, nil } func GetGroup(id int32) (EsiGroup, error) { r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/universe/groups/%d/", id)) if err != nil { return EsiGroup{}, err } decoder := json.NewDecoder(r.Body) var details EsiGroup if err := decoder.Decode(&details); err != nil { return EsiGroup{}, 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 } func GetConstellation(id int32) (EsiUniverseConstellation, error) { r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/universe/constellations/%d/", id)) if err != nil { return EsiUniverseConstellation{}, err } decoder := json.NewDecoder(r.Body) var details EsiUniverseConstellation if err := decoder.Decode(&details); err != nil { return EsiUniverseConstellation{}, err } return details, nil } func GetRegion(id int32) (EsiUniverseRegion, error) { r, err := http.Get(fmt.Sprintf("https://esi.evetech.net/latest/universe/regions/%d/", id)) if err != nil { return EsiUniverseRegion{}, err } decoder := json.NewDecoder(r.Body) var details EsiUniverseRegion if err := decoder.Decode(&details); err != nil { return EsiUniverseRegion{}, err } return details, nil }