2021-10-17 17:24:36 +02:00
|
|
|
package aiden
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-10-17 18:04:06 +02:00
|
|
|
var (
|
|
|
|
basePath = "https://customapi.aidenwallis.co.uk/"
|
|
|
|
)
|
|
|
|
|
2021-10-17 17:47:56 +02:00
|
|
|
func ApiCall(uri string) (string, error) {
|
2021-10-17 18:04:06 +02:00
|
|
|
resp, err := http.Get(fmt.Sprint(basePath + uri))
|
2021-10-17 17:24:36 +02:00
|
|
|
if err != nil {
|
|
|
|
log.Error(err)
|
2021-10-17 17:47:56 +02:00
|
|
|
return "Something went wrong FeelsBadMan", err
|
2021-10-17 17:24:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
defer resp.Body.Close()
|
|
|
|
|
|
|
|
body, err := ioutil.ReadAll(resp.Body)
|
|
|
|
if err != nil {
|
|
|
|
log.Error(err)
|
2021-10-17 17:47:56 +02:00
|
|
|
return "Something went wrong FeelsBadMan", err
|
2021-10-17 17:24:36 +02:00
|
|
|
}
|
2021-10-17 17:47:56 +02:00
|
|
|
return string(body), nil
|
2021-10-17 17:24:36 +02:00
|
|
|
}
|