tripwire/types.go

150 lines
3.6 KiB
Go

package main
import "time"
type YggError struct {
Code int `json:"-"`
Error string `json:"error"`
ErrorMessage string `json:"errorMessage"`
// Cause string `json:"cause"`
}
type MCProfile struct {
Name string `json:"name"`
Id string `json:"id"`
}
type MCAgent struct {
Name string `json:"name"`
Version int `json:"version"`
}
type AuthPayload struct {
Agent MCAgent `json:"agent"`
Username string `json:"username"`
Password string `json:"password"`
ClientToken string `json:"clientToken"`
RequestUser bool `json:"requestUser"`
}
type AuthResponse struct {
ClientToken string `json:"clientToken"`
AccessToken string `json:"accessToken"`
AvailableProfiles []MCProfile `json:"availableProfiles"`
SelectedProfile MCProfile `json:"selectedProfile"`
}
type WebLogInResponse struct {
Token string `json:"token"`
UUID string `json:"uuid"`
Username string `json:"username"`
}
type JoinPayload struct {
AccessToken string `json:"accessToken"`
SelectedProfile string `json:"selectedProfile"`
ServerId string `json:"serverId"`
}
type RefreshPayload struct {
AccessToken string `json:"accessToken"`
ClientToken string `json:"clientToken"`
}
type UserCredentials struct {
Username string `json:"username"`
Password string `json:"password"`
}
type PlayerData struct {
Id int `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
UUID string `json:"uuid"`
ClientToken string `json:"clientToken"`
AuthToken string `json:"authToken"`
WebToken string `json:"webToken"`
CreatedAt time.Time `json:"createdAt"`
}
type YggdrasilInfo struct {
Status string `json:"Status"`
RuntimeMode string `json:"Runtime-Mode"`
AppAuthor string `json:"Application-Author"`
AppDescription string `json:"Application-Description"`
SpecVersion string `json:"Specification-Version"`
AppName string `json:"Application-Name"`
ImplVersion string `json:"Implementation-Version"`
AppOwner string `json:"Application-Owner"`
SkinDomains []string `json:"skinDomains"`
PublicKey *string `json:"signaturePublickey,omitempty"`
}
type Property struct {
Name string `json:"name"`
Value string `json:"value"`
Signature *string `json:"signature,omitempty"`
}
type ProfileResponse struct {
Id string `json:"id"`
Name string `json:"name"`
Properties []Property `json:"properties"`
}
type ProfileTextureMetadata struct {
Timestamp int `json:"timestamp"`
Id string `json:"profileId"`
Name string `json:"profileName"`
Textures ProfileTextures `json:"textures"`
}
type SkinTexture struct {
Url string `json:"url"`
Metadata SkinMetadata `json:"metadata"`
}
type Texture struct {
Url string `json:"url"`
}
type SkinMetadata struct {
Model string `json:"model"`
}
type ProfileTextures struct {
Skin SkinTexture `json:"SKIN"`
Cape *Texture `json:"CAPE,omitempty"`
}
type Empty struct{}
type NotFoundError struct{}
func (m *NotFoundError) Error() string {
return "Not found"
}
type InvalidCredentialsError struct{}
func (m *InvalidCredentialsError) Error() string {
return "Invalid credentials"
}
type AlreadyExistsError struct{}
func (m *AlreadyExistsError) Error() string {
return "The specified item already exists"
}
type TooLargeError struct{}
func (m *TooLargeError) Error() string {
return "The sent payload is too large."
}
type InvalidDataError struct{}
func (m *InvalidDataError) Error() string {
return "The request data is malformed."
}