go-mcm/model/player.go

35 lines
755 B
Go

package model
import (
"encoding/json"
"go.etztech.xyz/go-mcm/model/django"
)
type Player struct {
ID int64 `json:"id"`
AuthUserID int64 `json:"auth_user_id"`
UUID string `json:"uuid"`
Username string `json:"username"`
ApplicationID int64 `json:"application_id"`
FirstSeen string `json:"first_seen"`
LastSeen string `json:"last_seen"`
Link string `json:"link"`
}
func (q *Query) Player(builder *django.Builder) ([]*Player, error) {
endpoint := q.endpoint("player", builder.QueryString())
players := make([]*Player, 0)
resp, err := response(endpoint)
if err != nil {
return nil, err
}
err = json.Unmarshal(resp, &players)
if err != nil {
return nil, err
}
return players, nil
}