notification

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NtfyViewAction

func NtfyViewAction(label string, link *string, params ...map[string]string) string

NtfyViewAction creates a ntfy actions string for a single view actions See https://docs.ntfy.sh/publish/#using-a-json-array

func RenderMessage

func RenderMessage(ticket twigots.TicketListing, options ...RenderMessageOption) (string, error)

Types

type Client

type Client interface {
	SendTicketNotification(twigots.TicketListing) error
}

type GotifyClient

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

func NewGotifyClient

func NewGotifyClient(config GotifyConfig) (GotifyClient, error)

func (GotifyClient) SendTicketNotification

func (g GotifyClient) SendTicketNotification(ticket twigots.TicketListing) error

type GotifyConfig

type GotifyConfig struct {
	Url   string `json:"url"`
	Token string `json:"token"`
}

type MessageTemplateData

type MessageTemplateData struct {
	// Header
	Event string

	// Body
	Date                string
	Time                string
	Venue               string
	Location            string
	TicketType          string // Standing, Stalls etc.
	NumTickets          int
	TotalTicketPrice    string
	TotalPrice          string
	OriginalTicketPrice string
	OriginalTotalPrice  string
	Discount            string

	// Footer
	Link string
}

type NtfyClient

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

func NewNtfyClient

func NewNtfyClient(config NtfyConfig) (NtfyClient, error)

func (NtfyClient) SendTicketNotification

func (c NtfyClient) SendTicketNotification(ticket twigots.TicketListing) error

type NtfyConfig

type NtfyConfig struct {
	Url      string `json:"url"`
	Topic    string `json:"topic"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type RenderMessageOption

type RenderMessageOption func(*renderMessageConfig)

func WithFooter

func WithFooter() RenderMessageOption

Whether to include buy link footer in message

func WithHeader

func WithHeader() RenderMessageOption

Whether to include event name header in message

type TelegramClient

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

func NewTelegramClient

func NewTelegramClient(config TelegramConfig) (TelegramClient, error)

func (TelegramClient) SendTicketNotification

func (c TelegramClient) SendTicketNotification(ticket twigots.TicketListing) error

type TelegramConfig

type TelegramConfig struct {
	Token  string `json:"token"`
	ChatId int    `json:"chatId"`
}

Jump to

Keyboard shortcuts

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