26 lines
791 B
Go
26 lines
791 B
Go
// Package apiclient provides the API client used by the web app
|
|
package apiclient
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"codeberg.org/vlbeaudoin/voki"
|
|
"git.agecem.com/agecem/bottin-ag/apiresponse"
|
|
)
|
|
|
|
type APIClient struct {
|
|
Voki *voki.Voki
|
|
}
|
|
|
|
func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) {
|
|
return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, true, &response)
|
|
}
|
|
|
|
func (a *APIClient) GetDecompte() (response apiresponse.DecompteGET, err error) {
|
|
return response, a.Voki.Unmarshal(http.MethodGet, "/v0/decompte", nil, true, &response)
|
|
}
|
|
|
|
func (a *APIClient) GetPresences() (response apiresponse.PresencesGET, err error) {
|
|
return response, a.Voki.Unmarshal(http.MethodGet, "/v0/presences", nil, true, &response)
|
|
}
|