summaryrefslogtreecommitdiffhomepage
path: root/esi.go
diff options
context:
space:
mode:
Diffstat (limited to 'esi.go')
-rw-r--r--esi.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/esi.go b/esi.go
new file mode 100644
index 0000000..f50eb4d
--- /dev/null
+++ b/esi.go
@@ -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
+}