2021-10-17 17:24:36 +02:00
|
|
|
package aiden
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-10-17 17:40:53 +02:00
|
|
|
func ApiCall(uri string) string {
|
2021-10-17 17:33:46 +02:00
|
|
|
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/%s", uri))
|
2021-10-17 17:24:36 +02:00
|
|
|
if err != nil {
|
|
|
|
log.Error(err)
|
|
|
|
return "Something went wrong FeelsBadMan"
|
|
|
|
}
|
|
|
|
|
|
|
|
defer resp.Body.Close()
|
|
|
|
|
|
|
|
body, err := ioutil.ReadAll(resp.Body)
|
|
|
|
if err != nil {
|
|
|
|
log.Error(err)
|
|
|
|
return "Something went wrong FeelsBadMan"
|
|
|
|
}
|
|
|
|
return string(body)
|
|
|
|
}
|