2019-10-01 22:03:36 +00:00
|
|
|
# go-mcm
|
|
|
|
|
2019-10-02 19:03:23 +00:00
|
|
|
Go library for MCM
|
|
|
|
|
|
|
|
## Model Example
|
|
|
|
```go
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-10-03 20:22:22 +00:00
|
|
|
"go.etztech.xyz/go-mcm"
|
2019-10-02 19:03:23 +00:00
|
|
|
"go.etztech.xyz/go-mcm/model"
|
|
|
|
"go.etztech.xyz/go-mcm/model/django"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-10-03 20:22:22 +00:00
|
|
|
client := mcm.NewMCM("<token>", "https://24carrotcraft.com/whitelist/api")
|
|
|
|
model := client.NewModel()
|
|
|
|
builder := model.NewDjangoBuilder().Contains(django.PlayerUsername, "Etzelia")
|
2019-10-02 19:03:23 +00:00
|
|
|
|
2019-10-03 20:22:22 +00:00
|
|
|
players, err := model.Player(builder)
|
2019-10-02 19:03:23 +00:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
|
2019-10-02 20:02:55 +00:00
|
|
|
for _, player := range players {
|
2019-10-02 20:03:44 +00:00
|
|
|
fmt.Printf("%#v\n", player)
|
|
|
|
}
|
2019-10-02 19:03:23 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Response (formatted)
|
|
|
|
```go
|
|
|
|
&model.Player{
|
|
|
|
ID: 663,
|
|
|
|
AuthUserID: 0,
|
|
|
|
UUID: "de10775b-fcb1-4665-bce4-5924b2e30188",
|
|
|
|
Username: "MrsEtzelia",
|
|
|
|
ApplicationID: 1,
|
|
|
|
FirstSeen: "2016-12-18",
|
|
|
|
LastSeen: "2017-11-23",
|
|
|
|
Link: "https://www.24carrotcraft.com/whitelist/dashboard/player/663",
|
|
|
|
}
|
|
|
|
|
|
|
|
&model.Player{
|
|
|
|
ID: 724,
|
|
|
|
AuthUserID: 1,
|
|
|
|
UUID: "bf0446a8-9695-4c41-aa4c-7ff45bfd1171",
|
|
|
|
Username: "Etzelia",
|
|
|
|
ApplicationID: 838,
|
|
|
|
FirstSeen: "2016-12-02",
|
|
|
|
LastSeen: "2019-10-02",
|
|
|
|
Link: "https://www.24carrotcraft.com/whitelist/dashboard/player/724",
|
|
|
|
}
|
|
|
|
```
|