Documentation
¶
Overview ¶
Package config provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- Variables
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func PrintTicketListingConfig(config TicketListingConfig)
- func PrintTicketListingConfigs(configs []TicketListingConfig)
- func Save(conf Config, filePath string) error
- func Watch(filePath string, callback func(Config) error) error
- type Config
- type Country
- type Event
- type GlobalTicketListingConfig
- type GotifyConfig
- type NotificationConfig
- type NotificationType
- type Notifications
- type NtfyConfig
- type Region
- type Regions
- type TelegramConfig
- type TicketListingConfig
Constants ¶
This section is empty.
Variables ¶
var ( NotificationTypeGotify = notificationTypeBuilder.Add(NotificationType{"gotify"}) NotificationTypeNtfy = notificationTypeBuilder.Add(NotificationType{"ntfy"}) NotificationTypeTelegram = notificationTypeBuilder.Add(NotificationType{"telegram"}) NotificationTypes = notificationTypeBuilder.Enum() )
Defines values for NotificationType.
Functions ¶
func GetSwagger ¶ added in v1.0.0
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func PathToRawSpec ¶ added in v1.0.0
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PrintTicketListingConfig ¶ added in v0.6.0
func PrintTicketListingConfig(config TicketListingConfig)
func PrintTicketListingConfigs ¶ added in v0.6.0
func PrintTicketListingConfigs(configs []TicketListingConfig)
Types ¶
type Config ¶
type Config struct {
// APIKey REQUIRED: See README.md for details on how to obtain
APIKey string `json:"apiKey"`
// Country Country code.
// Currently only GB is supported.
Country Country `json:"country"`
// Notification Notification service configuration
Notification NotificationConfig `json:"notification"`
GlobalTicketConfig GlobalTicketListingConfig `json:"global"`
TicketConfigs []TicketListingConfig `json:"tickets"`
}
Config defines model for Config.
func (Config) CombinedTicketListingConfigs ¶ added in v0.6.0
func (c Config) CombinedTicketListingConfigs() []TicketListingConfig
type GlobalTicketListingConfig ¶ added in v0.6.0
type GlobalTicketListingConfig struct {
// EventSimilarity Event name similarity matching (0.0 - 1.0).
// Default: 0.9 (allows for minor naming differences)
EventSimilarity float64 `json:"eventSimilarity,omitempty"`
// Regions Geographic regions to search for tickets.
// Default: All regions if not specified.
// Full list: https://github.com/ahobsonsayers/twigots/blob/main/location.go#L79-L90
Regions []Region `json:"regions,omitempty"`
// NumTickets Minimum number of tickets required in listing
// Default: Any number of tickets.
NumTickets int `json:"numTickets,omitempty"`
// MinDiscount Minimum discount (including fee) on the original price as a percentage
// Default: Any discount (including no discount).
MinDiscount float64 `json:"discount,omitempty"`
// MaxTicketPriceInclFee Maximum price per ticket (including fee) in pounds (£)
// Default: Any price.
MaxTicketPriceInclFee float64 `json:"maxTicketPrice,omitempty"`
// Notification Notification services to use
// Default: All configured services.
Notification []NotificationType `json:"notification,omitempty"`
}
GlobalTicketListingConfig GlobalTicketListingConfig represents configuration settings that apply to all ticket listings unless explicitly overridden by a specific ticket configuration. Any setting not specified will use the default.
type GotifyConfig ¶ added in v1.0.0
type GotifyConfig struct {
// Url Your Gotify server URL
Url string `json:"url"`
// Token Application token from Gotify
Token string `json:"token"`
}
GotifyConfig defines model for GotifyConfig.
type NotificationConfig ¶
type NotificationConfig struct {
Ntfy *NtfyConfig `json:"ntfy,omitempty"`
Gotify *GotifyConfig `json:"gotify,omitempty"`
Telegram *TelegramConfig `json:"telegram,omitempty"`
}
NotificationConfig Notification service configuration
func (NotificationConfig) Validate ¶ added in v0.6.0
func (c NotificationConfig) Validate() error
type NotificationType ¶
NotificationType defines model for NotificationType.
func (NotificationType) MarshalJSON ¶ added in v1.0.0
func (c NotificationType) MarshalJSON() ([]byte, error)
func (*NotificationType) UnmarshalJSON ¶
func (c *NotificationType) UnmarshalJSON(data []byte) error
func (*NotificationType) UnmarshalText ¶
func (c *NotificationType) UnmarshalText(data []byte) error
type Notifications ¶ added in v1.0.0
type Notifications []NotificationType
Notifications defines model for Notifications.
type NtfyConfig ¶ added in v1.0.0
type NtfyConfig struct {
// Url You can use the public instance at https://ntfy.sh
Url string `json:"url"`
// Topic If using https://ntfy.sh, make sure this is unique to you!
Topic string `json:"topic"`
// Username Optional: for authenticated instances
Username string `json:"username"`
// Password Optional: for authenticated instances
Password string `json:"password"`
}
NtfyConfig defines model for NtfyConfig.
type Region ¶ added in v1.0.0
Region Region code. Possible values are: - GBLO: London - GBSO: South - GBSW: South West - GBSE: South East - GBMI: Midlands - GBEA: East Anglia - GBNO: North - GBNE: North East - GBNW: North West - GBSC: Scotland - GBWA: Wales - GBNI: Northern Ireland
type TelegramConfig ¶ added in v1.0.0
type TelegramConfig struct {
// Token Get from @BotFather on Telegram
Token string `json:"token"`
// ChatId Your chat ID or group chat ID
ChatId int `json:"chatId"`
}
TelegramConfig defines model for TelegramConfig.
type TicketListingConfig ¶ added in v0.6.0
type TicketListingConfig struct {
// Event Event name
Event string `json:"event"`
// EventSimilarity Event name similarity matching (0.0 - 1.0).
// Overrides global setting.
EventSimilarity *float64 `json:"eventSimilarity,omitempty"`
// Regions Geographic regions to search for tickets
// Overrides global setting. To reset to default (all regions), use an empty array [].
Regions Regions `json:"regions,omitzero"`
// NumTickets Number of tickets required in listing
// Overrides global setting. To reset to default (any number), use -1.
NumTickets *int `json:"numTickets,omitempty"`
// MinDiscount Minimum discount on the original price as a percentage
// Overrides global setting. To reset to default (any discount), use -1.
MinDiscount *float64 `json:"discount,omitempty"`
// MaxTicketPriceInclFee Maximum price per ticket (including fee) in pounds (£)
// Overrides global setting. To reset to default (any price), use -1.
MaxTicketPriceInclFee *float64 `json:"maxTicketPrice,omitempty"`
// Notification Notification services to use
// Overrides global setting. To reset to default (all configured services), use an empty array [].
Notification Notifications `json:"notification,omitzero"`
}
TicketListingConfig TicketListingConfig represents configuration for specific ticket listings Configuration overrides global configuration To reset a global configuration to its default, use: - "" (empty string) for string values - [] (empty array) for list values - -1 for numeric values
func CombineGlobalAndTicketListingConfigs ¶ added in v0.6.0
func CombineGlobalAndTicketListingConfigs( globalConfig GlobalTicketListingConfig, configs ...TicketListingConfig, ) []TicketListingConfig
CombineGlobalAndTicketConfigs merges global and specific ticket listing configurations.
It returns a slice of TicketListingConfig where each configuration has global ticket listing configuration merged with specific ticket listing configuration.
If specific ticket listing configuration is provided, it takes precedence over the global configuration.