feat: send events in batches

This commit is contained in:
Oleh Astappiev 2025-03-31 18:41:09 +02:00
parent 07ef234cac
commit c84831d4f4
No known key found for this signature in database
GPG key ID: 37D7AC22589E9632
6 changed files with 101 additions and 43 deletions

View file

@ -2,18 +2,18 @@ package traefik_umami_feeder
import "context"
type Auth struct {
type authRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type AuthResponse struct {
type authResponse struct {
Token string `json:"token"`
}
func getToken(ctx context.Context, umamiHost string, umamiUsername string, umamiPassword string) (string, error) {
var result AuthResponse
err := sendRequestAndParse(ctx, umamiHost+"/api/auth/login", Auth{
var result authResponse
err := sendRequestAndParse(ctx, umamiHost+"/api/auth/login", authRequest{
Username: umamiUsername,
Password: umamiPassword,
}, nil, &result)