sms

package
v1.0.155 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 16

Documentation

Index

Constants

View Source
const (
	DefaultRegion          = "cn-north-1"
	ServiceVersion20200101 = "2020-01-01"
	ServiceVersion20210101 = "2021-01-01"
	ServiceVersion20210111 = "2021-01-11"
	ServiceName            = "volcSMS"
)
View Source
const (
	DefaultSendLog = SendLogStatus(0)
	SendNoReceipt  = SendLogStatus(1)
	SendFail       = SendLogStatus(2)
	SendAndReceipt = SendLogStatus(3)
	Verify         = SendLogStatus(4)
	Click          = SendLogStatus(5)
)
View Source
const (
	SourceTypeText     = "text/string"
	SourceTypeImageJPG = "image/jpg"
	SourceTypeImagePNG = "image/png"
	SourceTypeImageGIF = "image/gif"
	SourceTypeVideo    = "video/mp4"
	SourceTypeAudio    = "audio/mp3"
)

Variables

View Source
var (
	ServiceInfo = map[string]*base.ServiceInfo{
		DefaultRegion: {
			Timeout: 5 * time.Second,
			Host:    "sms.volcengineapi.com",
			Scheme:  "https",
			Header: http.Header{
				"Accept": []string{"application/json"},
			},
		},
	}

	ApiInfoList = map[string]*base.ApiInfo{
		"SendSms": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"SendSms"},
				"Version": []string{ServiceVersion20200101},
			},
		},
		"SendBatchSms": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"SendBatchSms"},
				"Version": []string{ServiceVersion20210101},
			},
		},
		"SendSmsVerifyCode": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"SendSmsVerifyCode"},
				"Version": []string{ServiceVersion20200101},
			},
		},
		"CheckSmsVerifyCode": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"CheckSmsVerifyCode"},
				"Version": []string{ServiceVersion20200101},
			},
		},
		"Conversion": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"Conversion"},
				"Version": []string{ServiceVersion20200101},
			},
		},
		"GetSmsTemplateAndOrderList": {
			Method: http.MethodGet,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetSmsTemplateAndOrderList"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"ApplySmsTemplate": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"ApplySmsTemplate"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"DeleteSmsTemplate": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"DeleteSmsTemplate"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"GetSubAccountList": {
			Method: http.MethodGet,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetSubAccountList"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"GetSubAccountDetail": {
			Method: http.MethodGet,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetSubAccountDetail"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"InsertSubAccount": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"InsertSubAccount"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"GetSignatureAndOrderList": {
			Method: http.MethodGet,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetSignatureAndOrderList"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"ApplySmsSignature": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"ApplySmsSignature"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"DeleteSignature": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"DeleteSignature"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"ApplyVmsTemplate": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"ApplyVmsTemplate"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"GetVmsTemplateStatus": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetVmsTemplateStatus"},
				"Version": []string{ServiceVersion20210111},
			},
		},
		"GetSmsSendDetails": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetSmsSendDetails"},
				"Version": []string{ServiceVersion20210111},
			},
		},
	}
)
View Source
var DefaultInstance = NewInstance()

DefaultInstance 默认的实例

Functions

This section is empty.

Types

type ApplySmsSignatureRequest

type ApplySmsSignatureRequest struct {
	SubAccount     string         `json:"subAccount"`
	Content        string         `json:"content"`
	Source         string         `json:"source"`
	Domain         string         `json:"domain"`
	Desc           string         `json:"desc,omitempty"`
	UploadFileList []SignAuthFile `json:"uploadFileList"`
	Purpose        int            `json:"purpose"`
}

type ApplySmsSignatureResponse

type ApplySmsSignatureResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *SmsSignatureInfo
}

type ApplySmsTemplateRequest

type ApplySmsTemplateRequest struct {
	SubAccount     string          `json:"subAccount"`
	Area           Area            `json:"area"`
	ChannelType    SmsChannelType  `json:"channelType"`
	Name           string          `json:"name"`
	Content        string          `json:"content"`
	Desc           string          `json:"desc"`
	ShortUrlConfig *ShortUrlConfig `json:"shortUrlConfig"`
}

type ApplySmsTemplateResponse

type ApplySmsTemplateResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *SmsTemplateInfo
}

type ApplyVmsTemplateRequest

type ApplyVmsTemplateRequest struct {
	SubAccount  string         `json:"subAccount"`
	ChannelType SmsChannelType `json:"channelType"`
	Name        string         `json:"name"`
	Theme       string         `json:"theme"`
	Signature   string         `json:"signature"`
	Contents    []VmsElement   `json:"contents"`
}

type ApplyVmsTemplateResponse

type ApplyVmsTemplateResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *VmsTemplateInfo
}

type Area

type Area string
const (
	AreaCN       Area = "cn"
	AreaOverseas Area = "overseas"
	AreaAll      Area = "all"
)

type CarrierReviewInfo

type CarrierReviewInfo struct {
	Carrier string         `json:"carrier"`
	Status  SmsOrderStatus `json:"status"`
	Reason  string         `json:"reason"`
}

type CheckSmsVerifyCodeRequest

type CheckSmsVerifyCodeRequest struct {
	SmsAccount  string
	PhoneNumber string
	Scene       string
	Code        string
}

type CheckSmsVerifyCodeResponse

type CheckSmsVerifyCodeResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           string
}

type ConversionRequest

type ConversionRequest struct {
	MessageIDs []string
	Type       int
}

type ConversionResponse

type ConversionResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           string
}

type DeleteSignatureRequest

type DeleteSignatureRequest struct {
	SubAccount string `json:"subAccount"`
	Id         string `json:"id"`
	IsOrder    bool   `json:"isOrder"`
}

type DeleteSignatureResponse

type DeleteSignatureResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           string
}

type DeleteSmsTemplateRequest

type DeleteSmsTemplateRequest struct {
	SubAccount string `json:"subAccount"`
	Id         string `json:"id"`
	IsOrder    bool   `json:"isOrder"`
}

type DeleteSmsTemplateResponse

type DeleteSmsTemplateResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           string
}

type DocType added in v1.0.100

type DocType = int
const (
	DocTypeThreeInOne                  DocType = 0 // 三证合一
	DocTypeBusinessLicense             DocType = 1 // 企业营业执照
	DocTypeOrganizationCodeCertificate DocType = 2 // 组织机构代码证
	DocTypeTaxRegistrationCertificate  DocType = 3 // 税务登记证
	DocTypeSocialCreditCodeCertificate DocType = 4 // 社会信用代码证书
	DocTypePowerOfAttorney             DocType = 5 // 授权委托书
	DocTypeOthers                      DocType = 6 // 其他/更多

)

type GetSignatureAndOrderListRequest

type GetSignatureAndOrderListRequest struct {
	SubAccount string `url:"subAccount"`
	Signature  string `url:"signature,omitempty"`
	PageIndex  int    `url:"pageIndex"`
	PageSize   int    `url:"pageSize"`
}

type GetSignatureAndOrderListResponse

type GetSignatureAndOrderListResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *struct {
		List  []*SmsSignatureInfo `json:"list"`
		Total int                 `json:"total"`
	}
}

type GetSmsSendDetailsRequest added in v1.0.152

type GetSmsSendDetailsRequest struct {
	SmsAccount  string `json:"subAccount"`
	PhoneNumber string `json:"phoneNumber"`
	MessageId   string `json:"messageId"`
	SendDate    string `json:"sendDate"`
	PageSize    int64  `json:"pageSize"`
	PageIndex   int64  `json:"pageIndex"`
}

type GetSmsSendDetailsResponse added in v1.0.152

type GetSmsSendDetailsResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *struct {
		List       []*SendDetailsResult `json:"sendDetailsResults"`
		Total      int                  `json:"total"`
		Account    string               `json:"account"`
		SubAccount string               `json:"subAccount"`
	}
}

type GetSmsTemplateAndOrderListRequest

type GetSmsTemplateAndOrderListRequest struct {
	SubAccount  string `url:"subAccount,omitempty"`
	TemplateId  string `url:"templateId"`
	Name        string `url:"name"`
	Area        Area   `url:"area"`
	ChannelType string `url:"channelType"`
	Content     string `url:"content"`
	PageIndex   int    `url:"pageIndex"`
	PageSize    int    `url:"pageSize"`
}

type GetSmsTemplateAndOrderListResponse

type GetSmsTemplateAndOrderListResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *struct {
		List  []*SmsTemplateInfo `json:"list"`
		Total int                `json:"total"`
	}
}

type GetSubAccountDetailRequest

type GetSubAccountDetailRequest struct {
	SubAccount string `url:"subAccount"`
}

type GetSubAccountDetailResponse

type GetSubAccountDetailResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *SmsSubAccountDetail
}

type GetSubAccountListRequest

type GetSubAccountListRequest struct {
	SubAccount     string `url:"subAccount"`
	SubAccountName string `url:"subAccountName"`
	PageIndex      int    `url:"pageIndex"`
	PageSize       int    `url:"pageSize"`
}

type GetSubAccountListResponse

type GetSubAccountListResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *struct {
		List  []*SmsSubAccountInfo `json:"list"`
		Total int                  `json:"total"`
	}
}

type GetVmsTemplateStatusRequest

type GetVmsTemplateStatusRequest struct {
	SubAccount string `json:"SubAccount"`
	TemplateId string `json:"TemplateId"`
}

type GetVmsTemplateStatusResponse

type GetVmsTemplateStatusResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           struct {
		ApplyResult   []CarrierReviewInfo `json:"ApplyResult"`
		ApproveTime   int64               `json:"approveTime"`   // 视频模版;模版通过的第一个运营商审批时间
		ExpireTime    int64               `json:"expireTime"`    // 视频模版;模版的到期时间
		RestValidDays int64               `json:"restValidDays"` // 视频模版;模版剩余有效天数
	}
}

type InsertSmsSubAccountReq

type InsertSmsSubAccountReq struct {
	SubAccountName string `json:"subAccountName"`
	Desc           string `json:"desc"`
}

type InsertSmsSubAccountResponse

type InsertSmsSubAccountResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           string
}

type SMS

type SMS struct {
	Client *base.Client
}

IAM .

func NewInstance

func NewInstance() *SMS

NewInstance 创建一个实例

func (*SMS) ApplySmsSignature

func (p *SMS) ApplySmsSignature(req *ApplySmsSignatureRequest) (*ApplySmsSignatureResponse, int, error)

func (*SMS) ApplySmsTemplate

func (p *SMS) ApplySmsTemplate(req *ApplySmsTemplateRequest) (*ApplySmsTemplateResponse, int, error)

func (*SMS) ApplyVmsTemplate

func (p *SMS) ApplyVmsTemplate(req *ApplyVmsTemplateRequest) (*ApplyVmsTemplateResponse, int, error)

func (*SMS) BatchSend

func (p *SMS) BatchSend(req *SmsBatchRequest) (*SmsResponse, int, error)

func (*SMS) CheckVerifyCode

func (p *SMS) CheckVerifyCode(req *CheckSmsVerifyCodeRequest) (*CheckSmsVerifyCodeResponse, int, error)

func (*SMS) Conversion

func (p *SMS) Conversion(req *ConversionRequest) (*ConversionResponse, int, error)

func (*SMS) DeleteSignature

func (p *SMS) DeleteSignature(req *DeleteSignatureRequest) (*DeleteSignatureResponse, int, error)

func (*SMS) DeleteSmsTemplate

func (p *SMS) DeleteSmsTemplate(req *DeleteSmsTemplateRequest) (*DeleteSmsTemplateResponse, int, error)

func (*SMS) GetAPIInfo

func (p *SMS) GetAPIInfo(api string) *base.ApiInfo

GetAPIInfo interface

func (*SMS) GetServiceInfo

func (p *SMS) GetServiceInfo(region string) *base.ServiceInfo

GetServiceInfo interface

func (*SMS) GetSmsSendDetails added in v1.0.152

func (p *SMS) GetSmsSendDetails(req *GetSmsSendDetailsRequest) (*GetSmsSendDetailsResponse, int, error)

func (*SMS) GetSubAccountDetail

func (p *SMS) GetSubAccountDetail(req *GetSubAccountDetailRequest) (*GetSubAccountDetailResponse, int, error)

func (*SMS) GetSubAccountList

func (p *SMS) GetSubAccountList(req *GetSubAccountListRequest) (*GetSubAccountListResponse, int, error)

func (*SMS) GetVmsTemplateStatus

func (p *SMS) GetVmsTemplateStatus(req *GetVmsTemplateStatusRequest) (*GetVmsTemplateStatusResponse, int, error)

func (*SMS) InsertSmsSubAccount

func (p *SMS) InsertSmsSubAccount(req *InsertSmsSubAccountReq) (*InsertSmsSubAccountResponse, int, error)

func (*SMS) Send

func (p *SMS) Send(req *SmsRequest) (*SmsResponse, int, error)

func (*SMS) SendVerifyCode

func (p *SMS) SendVerifyCode(req *SmsVerifyCodeRequest) (*SmsResponse, int, error)

func (*SMS) SendVms

func (p *SMS) SendVms(req *SendVmsRequest) (*SendVmsResponse, int, error)

func (*SMS) SetHost

func (s *SMS) SetHost(host string)

SetHost .

func (*SMS) SetRegion

func (s *SMS) SetRegion(region string)

SetHost .

func (*SMS) SetSchema

func (s *SMS) SetSchema(schema string)

SetSchema .

type SendDetailsResult added in v1.0.152

type SendDetailsResult struct {
	Status       SendLogStatus `json:"status"`
	ErrorCode    string        `json:"errorCode"`
	ErrorMessage string        `json:"errorMessage"`
	PhoneNumber  string        `json:"phoneNumber"`
	Signature    string        `json:"signature"`
	TemplateId   string        `json:"templateID"`
	Content      string        `json:"content"`
	ChannelType  string        `json:"channelType"`
	MessageId    string        `json:"messageId"`
	MsgCount     int32         `json:"msgCount"`
	SendTime     int64         `json:"sendTime"`
	ReceiptTime  int64         `json:"receiptTime"`
}

type SendLogStatus added in v1.0.152

type SendLogStatus int32

type SendVmsRequest

type SendVmsRequest struct {
	SmsAccount    string
	TemplateID    string
	TemplateParam string
	PhoneNumbers  string
	Tag           string
}

type SendVmsResponse

type SendVmsResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *VmsResult `json:"Result,omitempty"`
}

type ShortUrlConfig

type ShortUrlConfig struct {
	IsEnabled          ShortUrlEnableStatus `json:"isEnabled"`
	IsNeedClickDetails ShortUrlEnableStatus `json:"isNeedClickDetails"`
	RawUrl             string               `json:"rawUrl"`
}

type ShortUrlEnableStatus

type ShortUrlEnableStatus string
const (
	EnableStatusNotEnabled ShortUrlEnableStatus = "0"
	EnableStatusEnabled    ShortUrlEnableStatus = "1"
)

type SignAuthFile added in v1.0.100

type SignAuthFile struct {
	FileType    DocType `json:"fileType"`
	FileContent string  `json:"fileContent"`
	FileSuffix  string  `json:"fileSuffix"`
}

type SignPurpose added in v1.0.100

type SignPurpose = int
const (
	SignPurposeForOwn   SignPurpose = 1
	SignPurposeForOther SignPurpose = 2
)

type SignSourceType added in v1.0.100

type SignSourceType = string
const (
	SignSourceTypeCompany          SignSourceType = "公司全称/简称"
	SignSourceTypeSite             SignSourceType = "工信部备案网站全称/简称"
	SignSourceTypeApp              SignSourceType = "APP全称/简称"
	SignSourceTypeOfficialAccounts SignSourceType = "公众号、小程序全称/简称"
	SignSourceTypeBrand            SignSourceType = "商标全称/简称"
	SignSourceTypeStore            SignSourceType = "电商平台店铺名的全称/简称"
)

type SmsBatchMessages

type SmsBatchMessages struct {
	TemplateParam string
	PhoneNumber   string
}

type SmsBatchRequest

type SmsBatchRequest struct {
	SmsAccount string
	Sign       string
	TemplateID string

	Tag      string
	From     string
	Messages []*SmsBatchMessages
}

type SmsChannelType

type SmsChannelType string
const (
	SmsChannelTypeCnOTP   SmsChannelType = "CN_OTP"
	SmsChannelTypeCnNTC   SmsChannelType = "CN_NTC"
	SmsChannelTypeCnMKT   SmsChannelType = "CN_MKT"
	SmsChannelTypeCnVms   SmsChannelType = "CN_VMS"
	SmsChannelTypeI18nOTP SmsChannelType = "I18N_OTP"
	SmsChannelTypeI18nMKT SmsChannelType = "I18N_MKT"
)

type SmsOrderStatus

type SmsOrderStatus int64
const (
	SmsOrder_REVIEWING SmsOrderStatus = 1
	SmsOrder_REJECTED  SmsOrderStatus = 2
	SmsOrder_PASSED    SmsOrderStatus = 3
	SmsOrder_CLOSE     SmsOrderStatus = 4
	SmsOrder_EXEMPTED  SmsOrderStatus = 5

	VmsOrder_VENDOR_REVIEWING SmsOrderStatus = 6 // 视频短信供应商审核中
	VmsOrder_VENDOR_REJECTED  SmsOrderStatus = 7 // 视频短信供应商审核失败
	VmsOrder_VENDOR_PASSED    SmsOrderStatus = 8 // 视频短信供应商审核通过
	VmsOrder_VENDOR_EXPIRED   SmsOrderStatus = 9 // 视频短信模版过期
)

type SmsRequest

type SmsRequest struct {
	SmsAccount    string
	Sign          string
	TemplateID    string
	TemplateParam string
	PhoneNumbers  string
	Tag           string
	UserExtCode   string
}

type SmsResponse

type SmsResponse struct {
	ResponseMetadata base.ResponseMetadata
	Result           *SmsResult `json:"Result,omitempty"`
}

AssumeRole

type SmsResult

type SmsResult struct {
	MessageID []string `json:"MessageID"`
}

type SmsSignatureInfo

type SmsSignatureInfo struct {
	Id          string         `json:"id"`
	ApplyId     string         `json:"applyId"`
	Content     string         `json:"content"`
	Source      string         `json:"source"`
	Application string         `json:"application"`
	CreatedTime int64          `json:"createdTime"`
	IsOrder     bool           `json:"isOrder"`
	Status      SmsOrderStatus `json:"status"`
	Reason      string         `json:"reason"`
}

type SmsSubAccountDetail

type SmsSubAccountDetail struct {
	SubAccountId       string `json:"subAccountId"`
	SubAccountName     string `json:"subAccountName"`
	EnabledChannelType []*struct {
		Name  string         `json:"name"`
		Value SmsChannelType `json:"value"`
		Area  Area
	} `json:"enabledChannelType"`
	Status      int    `json:"status"`
	Desc        string `json:"desc"`
	CreatedTime int64  `json:"createdTime"`
}

type SmsSubAccountInfo

type SmsSubAccountInfo struct {
	SubAccountId   string `json:"subAccountId"`
	SubAccountName string `json:"subAccountName"`
	CreatedTime    int64  `json:"createdTime"`
	Status         int    `json:"status"`
	Desc           string `json:"desc"`
}

type SmsTemplateInfo

type SmsTemplateInfo struct {
	Id              string          `json:"id"`
	ApplyId         string          `json:"applyId,omitempty"`
	TemplateId      string          `json:"templateId"`
	ChannelType     SmsChannelType  `json:"channelType"`
	ChannelTypeName string          `json:"channelTypeName"`
	Name            string          `json:"name"`
	Content         string          `json:"content"`
	Status          SmsOrderStatus  `json:"status"`
	IsOrder         bool            `json:"isOrder"`
	Reason          string          `json:"reason"`
	CreatedTime     int64           `json:"createdTime"`
	ShortUrlConfig  *ShortUrlConfig `json:"shortUrlConfig"`
}

type SmsVerifyCodeRequest

type SmsVerifyCodeRequest struct {
	SmsAccount  string
	Sign        string
	TemplateID  string
	PhoneNumber string
	Tag         string
	UserExtCode string
	Scene       string
	CodeType    int32
	ExpireTime  int32
	TryCount    int32
}

type VmsElement

type VmsElement struct {
	SourceType string `json:"sourceType"`
	Content    string `json:"content"`
}

type VmsResult

type VmsResult struct {
	MessageID []string `json:"MessageID"`
}

type VmsTemplateInfo

type VmsTemplateInfo struct {
	TemplateId string `json:"templateId"`
}

Jump to

Keyboard shortcuts

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