noitificationapidelivery

package
v0.0.0-...-c7c8722 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeliveryType = "noitificationapi"
View Source
var Factory = func(loader func(interface{}) error) (notificationdelivery.DeliveryDriver, error) {
	c := &Config{}
	err := loader(c)
	if err != nil {
		return nil, err
	}
	p, err := c.Server.CreatePreset()
	if err != nil {
		return nil, err
	}
	d := &Delivery{
		Preset:          p.With(fetcher.Method("POST")),
		RequiredContent: c.RequiredContent,
		Type:            c.DeliveryType,
		Fields:          c.Fields,
	}
	if d.Type == "" {
		d.Type = DeliveryType
	}
	return d, nil
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Server          fetcher.Server
	RequiredContent []string
	Fields          []*notificationdelivery.Field
	DeliveryType    string
}

type Delivery

type Delivery struct {
	Preset          *fetcher.Preset
	Type            string
	Fields          []*notificationdelivery.Field
	RequiredContent []string
}

func (*Delivery) CheckInvalidContent

func (d *Delivery) CheckInvalidContent(c notification.Content) ([]string, error)

CheckInvalidContent check if given content invalid Return invalid fields and any error raised

func (*Delivery) ContentFields

func (d *Delivery) ContentFields() []*notificationdelivery.Field

ContentFields return content fields Return invalid fields and any error raised

func (*Delivery) Deliver

func (d *Delivery) Deliver(c notification.Content) (status notificationdelivery.DeliveryStatus, receipt string, err error)

Deliver send give content. Return delivery status and any receipt if returned,and any error if raised.

func (*Delivery) DeliveryType

func (d *Delivery) DeliveryType() string

DeliveryType Delivery type

func (*Delivery) MustEscape

func (d *Delivery) MustEscape(u string) string

MustEscape delivery escape helper

Jump to

Keyboard shortcuts

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