api

package
v0.0.0-...-2cfbff6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(filepath string, url string) (bytes int64, err error)

Types

type Api

type Api struct {
	BridgeUrl      string
	BridgeLocalUrl string
	UjmUrl         string
	Apikey         string
	Client         http.Client
	ServerUrl      string
}

func (*Api) GetLatestMaps

func (api *Api) GetLatestMaps() ([]LatestMapElement, error)

func (*Api) GetLatestRuns

func (api *Api) GetLatestRuns() ([]LatestRunElement, error)

func (*Api) GetMapInformation

func (api *Api) GetMapInformation(mapname string) (MapInfos, error)

func (*Api) GetMapsWithPattern

func (api *Api) GetMapsWithPattern(criteria string) []string

func (*Api) GetPersonalBestInformation

func (api *Api) GetPersonalBestInformation(mapname string, guid string) (PersonalBestInfos, error)

func (*Api) GetServerStatus

func (api *Api) GetServerStatus() (ServersListStatus, error)

func (*Api) GetToprunsInformation

func (api *Api) GetToprunsInformation(mapname string) (ToprunsInfos, error)

func (*Api) MapSync

func (api *Api) MapSync() error

func (*Api) PostRunDemo

func (api *Api) PostRunDemo(p models.PlayerRunInfo, demoDirectory string) (SendDemoResponse, error)

func (*Api) PostRunWithoutDemo

func (api *Api) PostRunWithoutDemo(demoBody *DemoBody) (SendDemoResponse, error)

func (*Api) UjmGetWithBody

func (api *Api) UjmGetWithBody(url string, body io.Reader) (resp *http.Response, err error)

UjmGetWithBody Sending a body inside a get request is a bad practice, we should change that on ujm side.

type DemoBody

type DemoBody struct {
	Playerguid  string `json:"playerguid"`
	Playername  string `json:"playername"`
	Serverip    string `json:"serverip"`
	Servername  string `json:"servername"`
	Serverfps   string `json:"serverfps"`
	Runtime     string `json:"runtime"`
	Mapfilename string `json:"mapfilename"`
	Waynumber   string `json:"waynumber"`
	Apikey      string `json:"apikey"`
	PlayerIp    string `json:"playerip"`
}

type LatestMapElement

type LatestMapElement struct {
	Date     string   `json:"dateadded"`
	Filename string   `json:"filename"`
	Mapname  string   `json:"mapname"`
	Mappers  []string `json:"mapper"`
	Types    []string `json:"types"`
}

type LatestRunElement

type LatestRunElement struct {
	Mapname    string `json:"mapname"`
	PlayerName string `json:"playername"`
	Rank       string `json:"rank"`
	RunDate    string `json:"rundate"`
	RunTime    string `json:"runtime"`
	Way        int    `json:"waynumber"`
}

type MapInfos

type MapInfos struct {
	Id       int      `json:"id"`
	Filename string   `json:"filename"`
	Mapname  string   `json:"mapname"`
	Jumps    string   `json:"jnumber"`
	Level    int      `json:"level"`
	Release  string   `json:"releasedate"`
	Mappers  []string `json:"mappers"`
	Notes    []string `json:"notes"`
	Types    []string `json:"types"`
}

type MapSearchResult

type MapSearchResult struct {
	Matching []string `json:"matching"`
}

type PersonalBestElement

type PersonalBestElement struct {
	Run     RunPlayerInfos `json:"run"`
	Rank    string         `json:"rank"`
	Wayname string         `json:"wayname"`
}

type PersonalBestInfos

type PersonalBestInfos struct {
	Id        int                   `json:"mapid"`
	Filename  string                `json:"mapfilename"`
	Mapname   string                `json:"mapname"`
	RunsInfos []PersonalBestElement `json:"runs"`
}

type RunPlayerInfos

type RunPlayerInfos struct {
	PlayerName string `json:"playername"`
	RunDate    string `json:"rundate"`
	RunTime    string `json:"time"`
}

type SendDemoResponse

type SendDemoResponse struct {
	Added        int     `json:"added"`
	Improvement  string  `json:"improvement"`
	Wrdifference string  `json:"wrdifference"`
	Rank         *string `json:"rank"`
	Process      bool
}

type ServerStatus

type ServerStatus struct {
	Mapname   string   `json:"mapname"`
	NbPlayers int      `json:"nbPlayers"`
	Ingame    []string `json:"ingame"`
	Spec      []string `json:"spec"`
}

type ServersListStatus

type ServersListStatus []map[string]ServerStatus

type ToprunsInfos

type ToprunsInfos struct {
	Id        int                         `json:"mapid"`
	Filename  string                      `json:"mapfilename"`
	Mapname   string                      `json:"mapname"`
	RunsInfos map[string][]RunPlayerInfos `json:"runs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL