package model import ( "encoding/json" "go.etztech.xyz/go-mcm/internal" "go.etztech.xyz/go-mcm/model/django" ) type Priority string const ( PriorityLow Priority = "L" PriorityMedium Priority = "M" PriorityHigh Priority = "H" ) type World string const ( WorldOverworld World = "O" WorldNether World = "N" WorldTheEnd World = "E" ) type Ticket struct { ID int64 `json:"id"` PlayerID int64 `json:"player_id"` Message string `json:"message"` Priority Priority `json:"priority"` StaffID int64 `json:"staff_id"` Resolved bool `json:"resolved"` World World `json:"world"` X string `json:"x"` Y string `json:"Y"` Z string `json:"Z"` Date string `json:"date"` Link string `json:"link"` } func (q *Model) Ticket(builder *django.Builder) ([]*Ticket, error) { endpoint := q.endpoint("ticket", builder.QueryString()) tickets := make([]*Ticket, 0) resp, err := internal.ResponseGet(endpoint) if err != nil { return nil, err } err = json.Unmarshal(resp, &tickets) if err != nil { return nil, err } return tickets, nil }