2023-09-15 17:10:57 -04:00
|
|
|
// Package apiclient provides the API client used by the web app
|
|
|
|
package apiclient
|
2023-09-16 23:21:46 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
2023-09-18 18:34:53 -04:00
|
|
|
"codeberg.org/vlbeaudoin/voki"
|
2023-09-16 23:21:46 -04:00
|
|
|
"git.agecem.com/agecem/bottin-ag/apiresponse"
|
|
|
|
)
|
|
|
|
|
|
|
|
type APIClient struct {
|
2023-09-18 18:34:53 -04:00
|
|
|
Voki *voki.Voki
|
2023-09-16 23:21:46 -04:00
|
|
|
}
|
2023-09-17 16:32:40 -04:00
|
|
|
|
|
|
|
func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) {
|
2023-09-19 16:57:39 -04:00
|
|
|
return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, true, &response)
|
2023-09-17 16:32:40 -04:00
|
|
|
}
|
2023-09-19 18:25:12 -04:00
|
|
|
|
|
|
|
func (a *APIClient) GetDecompte() (response apiresponse.DecompteGET, err error) {
|
|
|
|
return response, a.Voki.Unmarshal(http.MethodGet, "/v0/decompte", nil, true, &response)
|
|
|
|
}
|
2023-10-02 14:08:03 -04:00
|
|
|
|
|
|
|
func (a *APIClient) GetPresences() (response apiresponse.PresencesGET, err error) {
|
|
|
|
return response, a.Voki.Unmarshal(http.MethodGet, "/v0/presences", nil, true, &response)
|
|
|
|
}
|