go-mcm/model/ip.go

31 lines
536 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 IP struct {
ID int64 `json:"id"`
PlayerID int64 `json:"player_id"`
LastUsed string `json:"last_used"`
Link string `json:"link"`
}
func (q *Query) IP(builder *django.Builder) ([]*IP, error) {
endpoint := q.endpoint("ip", builder.QueryString())
ips := make([]*IP, 0)
resp, err := response(endpoint)
if err != nil {
return nil, err
}
err = json.Unmarshal(resp, &ips)
if err != nil {
return nil, err
}
return ips, nil
}