go-mcm/model/application.go

38 lines
1009 B
Go
Raw Normal View History

2019-10-02 19:03:23 +00:00
package model
import (
"encoding/json"
"go.etztech.xyz/go-mcm/model/django"
)
type Application struct {
ID int64 `json:"id"`
Username string `json:"username"`
Age int64 `json:"age"`
PlayerType string `json:"player_type"`
EverBanned bool `json:"ever_banned"`
EverBannedExplanation string `json:"ever_banned_explanation"`
Reference string `json:"reference"`
ReadRules string `json:"read_rules"`
Accepted bool `json:"accepted"`
Date string `json:"date"`
Link string `json:"link"`
}
func (q *Query) Application(builder *django.Builder) ([]*Application, error) {
endpoint := q.endpoint("application", builder.QueryString())
applications := make([]*Application, 0)
resp, err := response(endpoint)
if err != nil {
return nil, err
}
err = json.Unmarshal(resp, &applications)
if err != nil {
return nil, err
}
return applications, nil
}