quanmsms

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 10 Imported by: 1

README

适用于Golang的SDK

API版本:v1

SDK版本:Beta 1.0.0

更新时间:2022-12-19

安装

go get -u gitee.com/chengdu-quanming-network/quanmsms-go

使用流程

  1. 实例化sdk类并传入接口配置。之后就可在需要的位置调用
import (
	"gitee.com/chengdu-quanming-network/quanmsms-go"
)

// 快捷单例测试
func main() {
	var sms *SmsSDK = NewSmsSDK("2", "906c97620d8601eda4bf18c04d837a9c", "")
	sms.Send("13799287679", 0, map[string]interface{}{"code": 2682})
}

单例测试

为了便于查看测试信息,单例测试程序默认使用Error输出信息,不一定代表测试未通过

go test -timeout 30s -run ^TestQuanmsms$ quanmsms

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SmsSDK

type SmsSDK struct {
	OpenID     string // You OpenId
	ApiKey     string // You Apikey
	ApiHttp    string `default:"http"`            // Can set https or http
	ApiHost    string `default:"dev.quanmwl.com"` // Do not edit
	ApiGateway string // Api Gateway,Do not edit
}

func NewSmsSDK

func NewSmsSDK(OpenID, ApiKey string, ApiHttp string) *SmsSDK

NewSmsSDK creates and initializes a new SmsSDK instance

The function returns a pointer to the newly created SmsSDK instance, ready for use

func (*SmsSDK) Init

func (s *SmsSDK) Init()

func (*SmsSDK) Send

func (s *SmsSDK) Send(tel string, template_id int8, template_args map[string]interface{}) (*smsRespbody, error)

Send Mess(base from template) to tel,return repsonse struct and error info(default nil)

func (*SmsSDK) Sign

func (s *SmsSDK) Sign(tel string, template_id int8, template_args map[string]interface{}) *[]byte

Jump to

Keyboard shortcuts

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