|
- package apiclient
-
- import (
- "fmt"
- "net/http"
- "strings"
-
- "github.com/AFASystems/presence/internal/pkg/config"
- )
-
- func setHeader(req *http.Request, token string) {
- req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
- }
-
- func getRequest(token, route string, client *http.Client, cfg *config.Config) (*http.Response, error) {
- url := fmt.Sprintf("%s/reslevis/%s", cfg.APIBaseURL, route)
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
-
- setHeader(req, token)
- return client.Do(req)
- }
-
- func convertMac(mac string) string {
- return strings.ToUpper(strings.ReplaceAll(mac, ":", ""))
- }
|