generic

package
Version: v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Scheme is the identifying part of this service's configuration URL
	Scheme = "generic"
	// DefaultWebhookScheme is the scheme used for webhook URLs unless overridden
	DefaultWebhookScheme = "https"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	standard.EnumlessConfig

	ContentType string `key:"contenttype" default:"application/json" desc:"The value of the Content-Type header"`
	DisableTLS  bool   `key:"disabletls" default:"No"`
	Template    string `key:"template" optional:""`
	Title       string `key:"title" default:""`
	// contains filtered or unexported fields
}

Config for use within the generic service

func ConfigFromWebhookURL

func ConfigFromWebhookURL(webhookURL url.URL) (*Config, format.PropKeyResolver, error)

ConfigFromWebhookURL creates a new Config from a parsed Webhook URL

func DefaultConfig

func DefaultConfig() (*Config, format.PropKeyResolver)

DefaultConfig creates a PropKeyResolver and uses it to populate the default values of a new Config, returning both

func (*Config) GetURL

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL

func (config *Config) SetURL(serviceURL *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

func (*Config) WebhookURL

func (config *Config) WebhookURL() *url.URL

WebhookURL returns a url.URL that is synchronized with the config props

type Service

type Service struct {
	standard.Standard
	// contains filtered or unexported fields
}

Service providing a generic notification service

func (*Service) GetConfigURLFromCustom

func (*Service) GetConfigURLFromCustom(customURL *url.URL) (serviceURL *url.URL, err error)

GetConfigURLFromCustom creates a regular service URL from one with a custom host

func (*Service) Initialize

func (service *Service) Initialize(configURL *url.URL, logger types.StdLogger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to a generic webhook endpoint

Jump to

Keyboard shortcuts

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