31 lines
536 B
Go
31 lines
536 B
Go
|
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
|
||
|
}
|