domain

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VillageCoordsStringMaxLength = 1000
)

Variables

View Source
var ErrNothingToUpdate = errors.New("nothing to update")

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Name  string
	Value string
}

type CreateGroupParams

type CreateGroupParams struct {
	// contains filtered or unexported fields
}

func NewCreateGroupParams

func NewCreateGroupParams(
	serverID, versionCode, serverKey, languageTag, channelGains, channelLosses string,
	barbarians, internals bool,
) (CreateGroupParams, error)

func (CreateGroupParams) Barbarians

func (c CreateGroupParams) Barbarians() bool

func (CreateGroupParams) ChannelGains

func (c CreateGroupParams) ChannelGains() string

func (CreateGroupParams) ChannelLosses

func (c CreateGroupParams) ChannelLosses() string

func (CreateGroupParams) Internals

func (c CreateGroupParams) Internals() bool

func (CreateGroupParams) LanguageTag added in v0.4.0

func (c CreateGroupParams) LanguageTag() string

func (CreateGroupParams) ServerID

func (c CreateGroupParams) ServerID() string

func (CreateGroupParams) ServerKey

func (c CreateGroupParams) ServerKey() string

func (CreateGroupParams) VersionCode

func (c CreateGroupParams) VersionCode() string

type Ennoblement

type Ennoblement struct {
	ID        int64
	Village   VillageMeta
	NewOwner  NullPlayerMeta
	CreatedAt time.Time
}

func (Ennoblement) IsBarbarian added in v0.4.1

func (e Ennoblement) IsBarbarian() bool

func (Ennoblement) IsSelfConquer added in v0.4.1

func (e Ennoblement) IsSelfConquer() bool

type EnnoblementNotification

type EnnoblementNotification struct {
	Type        EnnoblementNotificationType
	ServerID    string
	ChannelID   string
	LanguageTag string
	Ennoblement Ennoblement
}

func NewEnnoblementNotifications added in v0.4.1

func NewEnnoblementNotifications(g GroupWithMonitors, ennoblements []Ennoblement) []EnnoblementNotification

type EnnoblementNotificationType

type EnnoblementNotificationType uint8
const (
	EnnoblementNotificationTypeGain EnnoblementNotificationType = iota
	EnnoblementNotificationTypeLoss
)

type GreaterEqualThanError added in v0.4.1

type GreaterEqualThanError struct {
	Field     string
	Threshold int
}

func (GreaterEqualThanError) Error added in v0.4.1

func (e GreaterEqualThanError) Error() string

func (GreaterEqualThanError) Params added in v0.4.1

func (e GreaterEqualThanError) Params() map[string]any

func (GreaterEqualThanError) Slug added in v0.4.1

func (e GreaterEqualThanError) Slug() string

type Group

type Group struct {
	ID            string
	ServerID      string // Discord server ID
	ChannelGains  string
	ChannelLosses string
	Internals     bool   // Show conquers in the same group
	Barbarians    bool   // Show barbarian conquers
	ServerKey     string // TW server key (e.g. en130)
	VersionCode   string
	LanguageTag   string // BCP 47 language tag
	CreatedAt     time.Time
}

type GroupDoesNotExistError

type GroupDoesNotExistError struct {
	ID string
}

func (GroupDoesNotExistError) Error

func (e GroupDoesNotExistError) Error() string

func (GroupDoesNotExistError) Params added in v0.4.0

func (e GroupDoesNotExistError) Params() map[string]any

func (GroupDoesNotExistError) Slug added in v0.4.0

func (e GroupDoesNotExistError) Slug() string

type GroupLimitReachedError

type GroupLimitReachedError struct {
	Current int // current number of groups
	Limit   int // maximum number of groups
}

func (GroupLimitReachedError) Error

func (e GroupLimitReachedError) Error() string

func (GroupLimitReachedError) Params added in v0.4.0

func (e GroupLimitReachedError) Params() map[string]any

func (GroupLimitReachedError) Slug added in v0.4.0

func (e GroupLimitReachedError) Slug() string

type GroupNotFoundError

type GroupNotFoundError struct {
	ID string
}

func (GroupNotFoundError) Error

func (e GroupNotFoundError) Error() string

func (GroupNotFoundError) Params added in v0.4.0

func (e GroupNotFoundError) Params() map[string]any

func (GroupNotFoundError) Slug added in v0.4.0

func (e GroupNotFoundError) Slug() string

type GroupWithMonitors added in v0.4.0

type GroupWithMonitors struct {
	Group

	Monitors []Monitor
}

func (GroupWithMonitors) CanSendEnnoblementNotificationTypeGain added in v0.4.1

func (g GroupWithMonitors) CanSendEnnoblementNotificationTypeGain(e Ennoblement) bool

func (GroupWithMonitors) CanSendEnnoblementNotificationTypeLoss added in v0.4.1

func (g GroupWithMonitors) CanSendEnnoblementNotificationTypeLoss(e Ennoblement) bool

func (GroupWithMonitors) IsGain added in v0.4.1

func (g GroupWithMonitors) IsGain(e Ennoblement) bool

func (GroupWithMonitors) IsInternal added in v0.4.1

func (g GroupWithMonitors) IsInternal(e Ennoblement) bool

func (GroupWithMonitors) IsLoss added in v0.4.1

func (g GroupWithMonitors) IsLoss(e Ennoblement) bool

type GroupWithMonitorsAndTribes added in v0.4.0

type GroupWithMonitorsAndTribes struct {
	Group

	Monitors []MonitorWithTribe
}

type LengthTooShortError added in v0.4.1

type LengthTooShortError struct {
	Field     string
	Threshold int
}

func (LengthTooShortError) Error added in v0.4.1

func (e LengthTooShortError) Error() string

func (LengthTooShortError) Params added in v0.4.1

func (e LengthTooShortError) Params() map[string]any

func (LengthTooShortError) Slug added in v0.4.1

func (e LengthTooShortError) Slug() string

type LessEqualThanError added in v0.4.1

type LessEqualThanError struct {
	Field     string
	Threshold int
}

func (LessEqualThanError) Error added in v0.4.1

func (e LessEqualThanError) Error() string

func (LessEqualThanError) Params added in v0.4.1

func (e LessEqualThanError) Params() map[string]any

func (LessEqualThanError) Slug added in v0.4.1

func (e LessEqualThanError) Slug() string

type ListGroupsParams

type ListGroupsParams struct {
	ServerIDs            []string // DC server IDs
	VersionCode          NullString
	ServerKeys           []string
	EnabledNotifications NullBool // check if ChannelGains != null && ChannelLosses != null
	CreatedAtLTE         time.Time
}

type Monitor

type Monitor struct {
	ID        string
	TribeID   int64
	GroupID   string
	CreatedAt time.Time
}

type MonitorAlreadyExistsError

type MonitorAlreadyExistsError struct {
	TribeID int64
	GroupID string
}

func (MonitorAlreadyExistsError) Error

func (MonitorAlreadyExistsError) Params added in v0.4.0

func (e MonitorAlreadyExistsError) Params() map[string]any

func (MonitorAlreadyExistsError) Slug added in v0.4.0

type MonitorLimitReachedError

type MonitorLimitReachedError struct {
	Current int // current number of groups
	Limit   int // max number of groups
}

func (MonitorLimitReachedError) Error

func (e MonitorLimitReachedError) Error() string

func (MonitorLimitReachedError) Params added in v0.4.0

func (e MonitorLimitReachedError) Params() map[string]any

func (MonitorLimitReachedError) Slug added in v0.4.0

func (MonitorLimitReachedError) UserError

func (e MonitorLimitReachedError) UserError() string

type MonitorNotFoundError

type MonitorNotFoundError struct {
	ID string
}

func (MonitorNotFoundError) Error

func (e MonitorNotFoundError) Error() string

func (MonitorNotFoundError) Params added in v0.4.0

func (e MonitorNotFoundError) Params() map[string]any

func (MonitorNotFoundError) Slug added in v0.4.0

func (e MonitorNotFoundError) Slug() string

func (MonitorNotFoundError) UserError

func (e MonitorNotFoundError) UserError() string

type MonitorWithTribe

type MonitorWithTribe struct {
	Monitor
	Tribe Tribe
}

type NullBool

type NullBool struct {
	Bool  bool
	Valid bool // Valid is true if Bool is not NULL
}

type NullPlayerMeta

type NullPlayerMeta struct {
	Player PlayerMeta
	Valid  bool
}

type NullString

type NullString struct {
	String string
	Valid  bool // Valid is true if String is not NULL
}

type NullTribeMeta

type NullTribeMeta struct {
	Tribe TribeMeta
	Valid bool
}

type PlayerMeta

type PlayerMeta struct {
	ID         int64
	Name       string
	ProfileURL string
	Tribe      NullTribeMeta
}

type RequiredError added in v0.4.0

type RequiredError struct {
	Field string
}

func (RequiredError) Error added in v0.4.0

func (e RequiredError) Error() string

func (RequiredError) Params added in v0.4.0

func (e RequiredError) Params() map[string]any

func (RequiredError) Slug added in v0.4.0

func (e RequiredError) Slug() string

type TWServer added in v0.4.1

type TWServer struct {
	Key  string
	URL  string
	Open bool
}

type TWServerNotFoundError added in v0.4.1

type TWServerNotFoundError struct {
	VersionCode string
	Key         string
}

func (TWServerNotFoundError) Error added in v0.4.1

func (e TWServerNotFoundError) Error() string

func (TWServerNotFoundError) Params added in v0.4.1

func (e TWServerNotFoundError) Params() map[string]any

func (TWServerNotFoundError) Slug added in v0.4.1

func (e TWServerNotFoundError) Slug() string

type TWVersion added in v0.4.1

type TWVersion struct {
	Code     string
	Host     string
	Name     string
	Timezone string
}

type TranslatableError added in v0.4.0

type TranslatableError interface {
	error
	Slug() string
	Params() map[string]any
}

type TranslateVillageCoordsParams added in v0.4.1

type TranslateVillageCoordsParams struct {
	// contains filtered or unexported fields
}

func NewTranslateVillageCoordsParams added in v0.4.1

func NewTranslateVillageCoordsParams(versionCode, serverKey, coordsStr string, perPage int32) (TranslateVillageCoordsParams, error)

func UnmarshalTranslateVillageCoordsParamsFromDatabase added in v0.4.1

func UnmarshalTranslateVillageCoordsParamsFromDatabase(
	versionCode string,
	serverKey string,
	coords []string,
	perPage int32,
	maxPage int32,
	sha256Hash string,
) (TranslateVillageCoordsParams, error)

UnmarshalTranslateVillageCoordsParamsFromDatabase unmarshals TranslateVillageCoordsParams from the database.

It should be used only for unmarshalling from the database! You can't use UnmarshalTranslateVillageCoordsParamsFromDatabase as constructor - It may put domain into the invalid state!

func (TranslateVillageCoordsParams) Coords added in v0.4.1

func (t TranslateVillageCoordsParams) Coords() []string

func (TranslateVillageCoordsParams) IsPageInRange added in v0.4.1

func (t TranslateVillageCoordsParams) IsPageInRange(page int32) error

func (TranslateVillageCoordsParams) MaxPage added in v0.4.1

func (t TranslateVillageCoordsParams) MaxPage() int32

func (TranslateVillageCoordsParams) PerPage added in v0.4.1

func (t TranslateVillageCoordsParams) PerPage() int32

func (TranslateVillageCoordsParams) SHA256 added in v0.4.1

func (TranslateVillageCoordsParams) ServerKey added in v0.4.1

func (t TranslateVillageCoordsParams) ServerKey() string

func (TranslateVillageCoordsParams) VersionCode added in v0.4.1

func (t TranslateVillageCoordsParams) VersionCode() string

type TranslateVillageCoordsParamsNotFoundError added in v0.4.1

type TranslateVillageCoordsParamsNotFoundError struct {
	SHA256 string
}

func (TranslateVillageCoordsParamsNotFoundError) Error added in v0.4.1

func (TranslateVillageCoordsParamsNotFoundError) Params added in v0.4.1

func (TranslateVillageCoordsParamsNotFoundError) Slug added in v0.4.1

type TranslateVillageCoordsResult added in v0.4.1

type TranslateVillageCoordsResult struct {
	Villages     []Village
	NotFound     []string
	HasNext      bool
	HasPrev      bool
	Page         int32
	MaxPage      int32
	ParamsSHA256 string
}

type Tribe added in v0.4.1

type Tribe struct {
	ID         int64
	Tag        string
	Name       string
	ProfileURL string
	DeletedAt  time.Time
}

type TribeIDNotFoundError added in v0.4.1

type TribeIDNotFoundError struct {
	VersionCode string
	ServerKey   string
	ID          int64
}

func (TribeIDNotFoundError) Error added in v0.4.1

func (e TribeIDNotFoundError) Error() string

func (TribeIDNotFoundError) Params added in v0.4.1

func (e TribeIDNotFoundError) Params() map[string]any

func (TribeIDNotFoundError) Slug added in v0.4.1

func (e TribeIDNotFoundError) Slug() string

type TribeMeta

type TribeMeta struct {
	ID         int64
	Name       string
	Tag        string
	ProfileURL string
}

type TribeTagNotFoundError added in v0.4.1

type TribeTagNotFoundError struct {
	VersionCode string
	ServerKey   string
	Tag         string
}

func (TribeTagNotFoundError) Error added in v0.4.1

func (e TribeTagNotFoundError) Error() string

func (TribeTagNotFoundError) Params added in v0.4.1

func (e TribeTagNotFoundError) Params() map[string]any

func (TribeTagNotFoundError) Slug added in v0.4.1

func (e TribeTagNotFoundError) Slug() string

type UpdateGroupParams

type UpdateGroupParams struct {
	ChannelGains  NullString
	ChannelLosses NullString
	LanguageTag   NullString
	Internals     NullBool
	Barbarians    NullBool
}

func (UpdateGroupParams) IsZero

func (u UpdateGroupParams) IsZero() bool

type Village added in v0.4.1

type Village struct {
	ID         int64
	FullName   string
	ProfileURL string
	Points     int64
	X          int64
	Y          int64
	Player     NullPlayerMeta
}

func (Village) Coords added in v0.4.1

func (v Village) Coords() string

type VillageCoordsNotFoundInStringError added in v0.4.1

type VillageCoordsNotFoundInStringError struct {
	Str string
}

func (VillageCoordsNotFoundInStringError) Error added in v0.4.1

func (VillageCoordsNotFoundInStringError) Params added in v0.4.1

func (VillageCoordsNotFoundInStringError) Slug added in v0.4.1

type VillageCoordsStringTooLongError added in v0.4.1

type VillageCoordsStringTooLongError struct {
	Str string
	Max int
}

func (VillageCoordsStringTooLongError) Error added in v0.4.1

func (VillageCoordsStringTooLongError) Params added in v0.4.1

func (VillageCoordsStringTooLongError) Slug added in v0.4.1

type VillageMeta

type VillageMeta struct {
	ID         int64
	FullName   string
	ProfileURL string
	Player     NullPlayerMeta
}

Jump to

Keyboard shortcuts

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