conf

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package conf is the configuration package for SMS notification

Index

Constants

This section is empty.

Variables

View Source
var ProviderMap = map[ProviderType]string{
	Yunpian: "yunpian",
	Twilio:  "twilio",
	Nexmo:   "nexmo",
	Unknown: "unknown",
}

ProviderMap is the map of [provider, name]

View Source
var ProviderTypeMap = global.ReverseMap(ProviderMap)

ProviderTypeMap is the map of provider [name, provider]

Functions

This section is empty.

Types

type Options

type Options struct {
	base.DefaultNotify `yaml:",inline"`

	ProviderType ProviderType `` /* 173-byte string literal not displayed */
	Mobile       string       `` /* 150-byte string literal not displayed */
	From         string       `yaml:"from,omitempty" json:"from,omitempty" jsonschema:"title=From,description=The sender of the notification message"`
	Key          string       `yaml:"key" json:"key" jsonschema:"title=Key,description=The key of the SMS provider"`
	Secret       string       `yaml:"secret,omitempty" json:"secret,omitempty" jsonschema:"title=Secret,description=The secret of the SMS provider"`
	URL          string       `yaml:"url,omitempty" json:"url,omitempty" jsonschema:"format=uri,title=URL,description=The URL of the SMS provider"`
	Sign         string       `yaml:"sign,omitempty" json:"sign,omitempty" jsonschema:"title=Sign,description=The sign of the SMS provider"`
}

Options implements the configuration for native client

type Provider

type Provider interface {
	Notify(string, string) error
}

Provider Interface

type ProviderType

type ProviderType int

ProviderType is the sms provider

const (
	Unknown ProviderType = iota
	Yunpian
	Twilio
	Nexmo
)

The Provider Type of different sms provider

func (ProviderType) MarshalJSON

func (d ProviderType) MarshalJSON() (b []byte, err error)

MarshalJSON is marshal the provider

func (ProviderType) MarshalYAML

func (d ProviderType) MarshalYAML() (interface{}, error)

MarshalYAML is marshal the provider type

func (ProviderType) ProviderType

func (d ProviderType) ProviderType(name string) ProviderType

ProviderType convert the string to ProviderType

func (ProviderType) String

func (d ProviderType) String() string

String convert the DriverType to string

func (*ProviderType) UnmarshalJSON

func (d *ProviderType) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON is Unmarshal the provider type

func (*ProviderType) UnmarshalYAML

func (d *ProviderType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is unmarshal the provider type

Jump to

Keyboard shortcuts

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