alidayu

package
v0.0.0-...-396ab03 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SmsResult

func SmsResult(m map[string]interface{}) (bool, error)

SmsResult judges a sms sent ok or not.

Types

type Alidayu

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

Alidayu handles communication with related methods of the Alidayu API.

func New

func New(httpClient *http.Client) *Alidayu

New ...

func (*Alidayu) SendSms

func (a *Alidayu) SendSms(c Config) (map[string]interface{}, error)

SendSms sends a sms.

func (*Alidayu) Sign

func (a *Alidayu) Sign(s interface{}, secret []byte) string

Sign signs an Alidayu request struct.

type Config

type Config struct {
	Method          string `json:"method,omitempty" structs:"method"`
	AppKey          string `json:"app_key,omitempty" structs:"app_key"`
	Timestamp       string `json:"timestamp,omitempty" structs:"timestamp"`
	Format          string `json:"format,omitempty" structs:"format"`
	Version         string `json:"v,omitempty" structs:"v"`
	PartnerID       string `json:"partner_id,omitempty" structs:"partner_id"`
	SignMethod      string `json:"sign_method,omitempty" structs:"sign_method"`
	Sign            string `json:"sign,omitempty" structs:"sign"`
	Extend          string `json:"extend,omitempty" structs:"extend"`
	SmsType         string `json:"sms_type,omitempty" structs:"sms_type"`
	SmsFreeSignName string `json:"sms_free_sign_name,omitempty" structs:"sms_free_sign_name"`
	SmsParam        string `json:"sms_param,omitempty" structs:"sms_param"`
	RecNum          string `json:"rec_num,omitempty" structs:"rec_num"`
	SmsTemplateCode string `json:"sms_template_code,omitempty" structs:"sms_template_code"`
}

Config the alidayu configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default alidayu configuration.

func (Config) Merge

func (c Config) Merge(cfg Config) (config Config)

Merge merges the default with the given config and returns the result.

Jump to

Keyboard shortcuts

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