You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jolheiser 3a2804df4c
Change module
9 months ago
internal Add functions for model POST API (#4) 3 years ago
model Change module 9 months ago
web Change module 9 months ago
.gitignore Initial Release (#1) 3 years ago
README.md Update module 1 year ago
go.mod Change module 9 months ago
mcm.go Change module 9 months ago

README.md

go-mcm

Go library for MCM

Model Example

package main

import (
	"fmt"
	"git.canopymc.net/Etzelia/go-mcm"
	"git.canopymc.net/Etzelia/go-mcm/model"
	"git.canopymc.net/Etzelia/go-mcm/model/django"
)

func main() {
	client := mcm.NewMCM("<token>", "https://24carrotcraft.com/whitelist/api")
	model := client.NewModel()
	builder := model.NewDjangoBuilder().Contains(django.PlayerUsername, "Etzelia")

	players, err := model.Player(builder)
	if err != nil {
		fmt.Println(err)
	}

	for _, player := range players {
		fmt.Printf("%#v\n", player)
	}
}

Response (formatted)

&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",
}