diff --git a/main.go b/main.go index c9a64af..4b90580 100644 --- a/main.go +++ b/main.go @@ -115,6 +115,20 @@ func LoadMatrixData() (string, int, int) { return url, width, height } +func SendRequest(client *resty.Client, url string, ins []interface{}) { + resp, err := client.R(). + SetHeader("Content-Type", "application/json"). + SetBody(ins). + Post(fmt.Sprintf("%s/instructions", url)) + + if err != nil { + log.Fatal(err) + return + } + + log.Printf("Response Status: %s\n", resp.Status()) +} + func main() { // Load .env file if it exists err := godotenv.Load(".env") @@ -132,4 +146,7 @@ func main() { col := Color{R: 255, G: 0, B: 255, endpoint: COLOR} rct := Rectangle{X: 0, Y: 0, W: 10, H: 10, endpoint: RECTANGLE} upd := Update{endpoint: UPDATE} + + // Send request to remote server + SendRequest(client, url, []interface{}{col, rct, upd}) }