24 lines
486 B
Go
24 lines
486 B
Go
package http
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
|
|
"git.lorenzzz.dev/lorenzhohermuth/home-assistant/internal/api"
|
|
"git.lorenzzz.dev/lorenzhohermuth/home-assistant/pkg/env"
|
|
)
|
|
|
|
func FireEvent(event string, eventBody string) {
|
|
reader := strings.NewReader(eventBody)
|
|
|
|
apiSpecs := api.GetApiSpecifications()
|
|
url := env.GetUrl() + apiSpecs.FireEvent + event
|
|
|
|
response, err := http.Post(url, apiSpecs.JsonContentType, reader)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(response)
|
|
}
|