Help us shape the future of Go! Take the 2026 Go Developer Survey

yunpian

package module
v0.0.0-...-a889bf2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2015 License: MIT Imports: 4 Imported by: 1

README

yunpian

云片网 GO SDK

##基本概念

创建一个api对象
然后对应的方式调用函数 
api.{resource}{function}
传入参数的结构体为函数名+Info
例:SmsSend(info SMSSendInfo)
返回值error为nil则是执行成功,附带的返回信息在第一个返回值中。

##使用需要import 本代码

import (
	"github.com/shesuyo/yunpian"
)

##创建一个新的云片API

api := NewYunpianAPI("你的apikey")

##发送手机短信验证码

api.SmsSend(SMSSendInfo{Mobile: "13250061802", Text: "【垣创科技】您的验证码是970702"})

##发送语音验证码

api.VoiceSend(VoiceSendInfo{Mobile: "13250061802", Text: "970702"})

##更多函数使用方式请查看测试函数

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FORMAT = "json"
View Source
var HOST = "yunpian.com"
View Source
var PORT = 80
View Source
var SCHEMES = "http://"
View Source
var URL_SMS_GETBLACKWORD = "sms/get_black_word"

3.7 插屏蔽词

View Source
var URL_SMS_GETREPLY = "sms/get_reply"

3.5 推送回复信息 3.6 查回复信息

View Source
var URL_SMS_MULTISEND = "sms/multi_send"

3.9 批量个性化发送

View Source
var URL_SMS_PULLREPLY = "sms/pull_reply"

3.3 推送状态报告 3.4 获取回复信息

View Source
var URL_SMS_PULLSTATUS = "sms/pull_status"

3.2 获取状态报告

View Source
var URL_SMS_SEND = "sms/send"

3.1 智能匹配模板发送

View Source
var URL_SMS_TPLSEND = "sms/tpl_send"

3.8 指定模板发送

View Source
var URL_TPL_ADD = "tpl/add"

2.2 添加模板

View Source
var URL_TPL_DEL = "tpl/del"

2.5 删除模板

View Source
var URL_TPL_GET = "tpl/get"

2.3 取模板

View Source
var URL_TPL_GETDEFAULT = "tpl/get_default"

2.1 取默认模板

View Source
var URL_TPL_UPDATE = "tpl/update"

2.4 修改模板

View Source
var URL_USER_GET = "user/get"

1.1 查看账户信息

View Source
var URL_USER_SET = "user/set"

1.2 修改账户信息

View Source
var URL_VOICE_PULLSTATUS = "voice/pull_status"

4.2 获取状态报告

View Source
var URL_VOICE_SEND = "voice/send"

4.1 发语音验证码

View Source
var VERSION = "v1"

Functions

This section is empty.

Types

type BaseStruct

type BaseStruct struct {
	Code   int
	Msg    string
	Detail string
}

type SMSGetBlackWord

type SMSGetBlackWord struct {
	BaseStruct
	Result SMSGetBlackWordResult
}

type SMSGetBlackWordResult

type SMSGetBlackWordResult struct {
	Black_Word string `json:"black_word"`
}

type SMSGetReply

type SMSGetReply struct {
	BaseStruct
	SMS_Replys []SMSReply `json:"sms_reply"`
}

type SMSGetReplyInfo

type SMSGetReplyInfo struct {
	Start_Time    string
	End_Time      string
	Page_Num      int
	Page_Size     int
	Mobile        string
	Return_fields string
	Sort_Fields   string
}

type SMSPullReply

type SMSPullReply struct {
	BaseStruct
	SMSReplys []SMSReply `json:"sms_reply"`
}

type SMSPullStatus

type SMSPullStatus struct {
	BaseStruct
	SMSStatus []SMSStatu `json:"sms_status"`
}

type SMSReply

type SMSReply struct {
	Mobile      string
	Reply_Time  string `json:"reply_time"`
	Text        string
	Extend      string
	Base_Extend string `json:"base_extend"`
}

type SMSResult

type SMSResult struct {
	Count int
	Fee   int
	Sid   int64
}

type SMSSend

type SMSSend struct {
	BaseStruct
	Result SMSResult
}

type SMSSendInfo

type SMSSendInfo struct {
	Mobile       string
	Text         string
	Extend       string
	Uid          string
	Callback_URL string
}

type SMSStatu

type SMSStatu struct {
	Sid               int64
	Uid               string
	User_Receive_Time string `json:"user_receive_time"`
	Error_Msg         string `json:"error_msg"`
	Mobile            string
	Report_Status     string `json:"report_status"`
}

type SMSTplSendInfo

type SMSTplSendInfo struct {
	BaseStruct
	Mobile    string
	Tpl_ID    int    `json:"tpl_id"`
	Tpl_Value string `json:"tpl_value"`
	Extend    string
	Uid       string
}

type Template

type Template struct {
	Tpl_id       int    `json:"tpl_id"`
	Tpl_Content  string `json:"tpl_content"`
	Check_Status string `json:"check_status"`
	Reason       string `json:"reason"`
}

type Tpl

type Tpl struct {
	BaseStruct
	Template Template `json:"template"`
}

type Tpls

type Tpls struct {
	BaseStruct
	Templates []Template `json:"template"`
}

type User

type User struct {
	BaseStruct
	UserDetail UserDetail `json:"user"`
}

type UserDetail

type UserDetail struct {
	Nick             string
	GMT_Creted       string `json:"gmt_created"`
	Mobile           string
	Email            string
	IP_WhiteList     string `json:"ip_whitelist"`
	API_VERSION      string `json:"api_version"`
	Balance          int
	AlarmBalance     int    `json:"alarm_balance"`
	EmergencyContact string `json:"emergency_contact"`
	EmergencyMobile  string `json:"emergency_mobile"`
}

type UserSetInfo

type UserSetInfo struct {
	AlarmBalance     int
	EmergencyContact string
	EmergencyMobile  string
}

type VoicePullStatus

type VoicePullStatus struct {
	BaseStruct
	Voice_Status []VoiceStatu `json:"voice_status"`
}

type VoiceSend

type VoiceSend struct {
	BaseStruct
	Result VoiceSendResult
}

type VoiceSendInfo

type VoiceSendInfo struct {
	Mobile       string
	Code         string
	Callback_URL string
	Display_Num  string
}

type VoiceSendResult

type VoiceSendResult struct {
	Count int
	Fee   int
	Sid   string
}

type VoiceStatu

type VoiceStatu struct {
	Sid               string
	Uid               string
	User_Receive_Time string `json:"user_receive_time"`
	Duration          int
	Error_Msg         string `json:"error_msg"`
	Mobile            string
	Report_Status     string `json:"report_status"`
}

type YunpianAPI

type YunpianAPI struct {
	APIKey string
}

func NewYunpianAPI

func NewYunpianAPI(apikey string) *YunpianAPI

创建新的云片API

func (*YunpianAPI) SmsGetBlackWord

func (this *YunpianAPI) SmsGetBlackWord(text string) (string, error)

3.7 查看屏蔽词

func (*YunpianAPI) SmsGetReply

func (this *YunpianAPI) SmsGetReply(info SMSGetReplyInfo) ([]SMSReply, error)

3.6 查看回复信息

func (*YunpianAPI) SmsMultiSend

func (this *YunpianAPI) SmsMultiSend(info SMSSendInfo) ([]SMSSend, error)

3.9 批量个性化发送

func (*YunpianAPI) SmsPullReply

func (this *YunpianAPI) SmsPullReply(page_size ...int) ([]SMSReply, error)

3.4 获取回复短信

func (*YunpianAPI) SmsPullStatus

func (this *YunpianAPI) SmsPullStatus(page_size ...int) ([]SMSStatu, error)

3.2 获取状态报告

func (*YunpianAPI) SmsSend

func (this *YunpianAPI) SmsSend(info SMSSendInfo) (SMSResult, error)

3.1 智能匹配模板发送

func (*YunpianAPI) SmsTplSend

func (this *YunpianAPI) SmsTplSend(info SMSTplSendInfo) (SMSResult, error)

3.8 指定模板发送

func (*YunpianAPI) TplAdd

func (this *YunpianAPI) TplAdd(tpl_content string, notify_type int) (Template, error)

2.2 添加模板

func (*YunpianAPI) TplDel

func (this *YunpianAPI) TplDel(tpl_id int) error

2.5 删除模板

func (*YunpianAPI) TplGet

func (this *YunpianAPI) TplGet(tpl_id int) (Template, error)

2.3 取模板

func (*YunpianAPI) TplGetALL

func (this *YunpianAPI) TplGetALL() ([]Template, error)

func (*YunpianAPI) TplGetDefault

func (this *YunpianAPI) TplGetDefault(id int) (Template, error)

2.1 取默认模板

func (*YunpianAPI) TplGetDefaultAll

func (this *YunpianAPI) TplGetDefaultAll() ([]Template, error)

func (*YunpianAPI) TplUpdate

func (this *YunpianAPI) TplUpdate(tpl_id int, tpl_content string) (Template, error)

2.4 修改模板

func (*YunpianAPI) UserGet

func (this *YunpianAPI) UserGet() (User, error)

1.1 查账户信息

func (*YunpianAPI) UserSet

func (this *YunpianAPI) UserSet(user UserSetInfo) error

1.2 修改账户信息

func (*YunpianAPI) VoicePullStatus

func (this *YunpianAPI) VoicePullStatus(page_size ...int) ([]VoiceStatu, error)

获取状态报告

func (*YunpianAPI) VoiceSend

func (this *YunpianAPI) VoiceSend(info VoiceSendInfo) (VoiceSendResult, error)

4.1 发送语音验证码

Jump to

Keyboard shortcuts

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