bottin/client.go

27 lines
448 B
Go
Raw Normal View History

package main
import (
"fmt"
"codeberg.org/vlbeaudoin/voki/v3"
)
type APIClient struct {
Voki *voki.Voki
}
func (c APIClient) GetHealth() (health string, err error) {
var request HealthGETRequest
response, err := request.Request(c.Voki)
if err != nil {
return "", err
}
if code, message := response.StatusCode(), response.Message; code >= 400 {
err = fmt.Errorf("%d: %s", code, message)
return
}
return response.Message, nil
}