jsms

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 自定义配置回调接口服务监听地址,默认为 ":8088"。
	WithCallbackAddr = callback.WithAddr
	// 自定义配置回调接口服务回调路径,默认为 "/callback"。
	WithCallbackPath = callback.WithPath
	// 自定义配置回调接口服务的日志打印器,默认与 JSMS API v1 使用相同的日志打印器。
	WithCallbackLogger = callback.WithLogger
	// 自定义配置回调接口服务的 HTTP Handler,默认为使用 net/http 实现的一个简单的 Handler。
	WithCallbackHTTPHandler = callback.WithHTTPHandler
	// 自定义配置「用户回复消息」SMS_REPLY 回执数据回调处理器。注:你的自定义处理器需要实现 CallbackReplyDataProcessor 接口。
	WithCallbackReplyDataProcessor = callback.WithReplyDataProcessor
	// 自定义配置「短信送达状态」SMS_REPORT 回执数据回调处理器。注:你的自定义处理器需要实现 CallbackReportDataProcessor 接口。
	WithCallbackReportDataProcessor = callback.WithReportDataProcessor
	// 自定义配置「模板审核结果」SMS_TEMPLATE 回执数据回调处理器。注:你的自定义处理器需要实现 CallbackTemplateDataProcessor 接口。
	WithCallbackTemplateDataProcessor = callback.WithTemplateDataProcessor
	// 自定义配置「签名审核结果」SMS_SIGN 回执数据回调处理器。注:你的自定义处理器需要实现 CallbackSignDataProcessor 接口。
	WithCallbackSignDataProcessor = callback.WithSignDataProcessor
)

Functions

This section is empty.

Types

type APIv1

type APIv1 interface {
	// 创建签名
	//  - 功能说明:创建短信签名。
	//  - 调用地址:POST `/v1/sign`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_sign#%E5%88%9B%E5%BB%BA%E7%AD%BE%E5%90%8D-api
	CreateSign(ctx context.Context, param *SignCreateParam) (*SignCreateResult, error)

	// 修改签名
	//  - 功能说明:修改审核不通过的签名,并再次提交审核。
	//  - 调用地址:POST `/v1/sign/{signID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_sign#%E4%BF%AE%E6%94%B9%E7%AD%BE%E5%90%8Dapi
	UpdateSign(ctx context.Context, signID int, param *SignUpdateParam) (*SignUpdateResult, error)

	// 查询签名
	//  - 功能说明:查询短信签名。
	//  - 调用地址:GET `/v1/sign/{signID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_sign#%E6%9F%A5%E8%AF%A2%E7%AD%BE%E5%90%8Dapi
	GetSign(ctx context.Context, signID int) (*SignGetResult, error)

	// 删除签名
	//  - 功能说明:删除短信签名。
	//  - 调用地址:DELETE `/v1/sign/{signID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_sign#%E5%88%A0%E9%99%A4%E7%AD%BE%E5%90%8D-api
	DeleteSign(ctx context.Context, signID int) (*SignDeleteResult, error)

	// 创建模板
	//  - 功能说明:创建短信模板。
	//  - 调用地址:POST `/v1/templates`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_templates#%E5%88%9B%E5%BB%BA%E6%A8%A1%E6%9D%BF-api
	CreateTemplate(ctx context.Context, param *TemplateCreateParam) (*TemplateCreateResult, error)

	// 修改模板
	//  - 功能说明:修改审核不通过的模板,并再次提交审核。
	//  - 调用地址:PUT `/v1/templates/{tempID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_templates#%E4%BF%AE%E6%94%B9%E6%A8%A1%E6%9D%BF-api
	UpdateTemplate(ctx context.Context, tempID int64, param *TemplateUpdateParam) (*TemplateUpdateResult, error)

	// 查询模板
	//  - 功能说明:查询短信模板。
	//  - 调用地址:GET `/v1/templates/{tempID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_templates#%E6%9F%A5%E8%AF%A2%E6%A8%A1%E6%9D%BF-api
	GetTemplate(ctx context.Context, tempID int64) (*TemplateGetResult, error)

	// 删除模板
	//  - 功能说明:删除短信模板。
	//  - 调用地址:DELETE `/v1/templates/{tempID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_templates#%E5%88%A0%E9%99%A4%E6%A8%A1%E6%9D%BF-api
	DeleteTemplate(ctx context.Context, tempID int64) (*TemplateDeleteResult, error)

	// 发送文本验证码短信
	//  - 功能说明:发送文本验证码短信。
	//  - 调用地址:POST `/v1/codes`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms#%E5%8F%91%E9%80%81%E6%96%87%E6%9C%AC%E9%AA%8C%E8%AF%81%E7%A0%81%E7%9F%AD%E4%BF%A1-api
	SendCode(ctx context.Context, param *CodeSendParam) (*CodeSendResult, error)

	// 发送语音验证码短信
	//  - 功能说明:发送语音验证码短信。
	//  - 调用地址:POST `/v1/voice_codes`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms#%E5%8F%91%E9%80%81%E8%AF%AD%E9%9F%B3%E9%AA%8C%E8%AF%81%E7%A0%81%E7%9F%AD%E4%BF%A1-api
	SendVoiceCode(ctx context.Context, param *VoiceCodeSendParam) (*VoiceCodeSendResult, error)

	// 验证码验证
	//  - 功能说明:验证验证码是否有效。
	//  - 调用地址:POST `/v1/codes/{msgID}/valid`,其中 `msgID` 为发送验证码短信时返回的消息 ID,`code` 为用户输入的验证码。
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms#%E9%AA%8C%E8%AF%81%E7%A0%81%E9%AA%8C%E8%AF%81-api
	VerifyCode(ctx context.Context, msgID, code string) (*CodeVerifyResult, error)

	// 发送单条模板短信
	//  - 功能说明:发送单条模板短信。
	//  - 调用地址:POST `/v1/messages`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms#%E5%8F%91%E9%80%81%E5%8D%95%E6%9D%A1%E6%A8%A1%E6%9D%BF%E7%9F%AD%E4%BF%A1-api
	SendMessage(ctx context.Context, param *MessageSendParam) (*MessageSendResult, error)

	// 发送批量模板短信
	//  - 功能说明:发送批量模板短信。
	//  - 调用地址:POST `/v1/messages/batch`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms#%E5%8F%91%E9%80%81%E6%89%B9%E9%87%8F%E6%A8%A1%E6%9D%BF%E7%9F%AD%E4%BF%A1-api
	SendBatchMessage(ctx context.Context, param *BatchMessageSendParam) (*BatchMessageSendResult, error)

	// 单条定时短信提交
	//  - 功能说明:提交单条模板短信定时发送任务。
	//  - 调用地址:POST `/v1/schedule`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E5%8D%95%E6%9D%A1%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E6%8F%90%E4%BA%A4-api
	SendSchedule(ctx context.Context, param *ScheduleSendParam) (*ScheduleSendResult, error)

	// 单条定时短信修改
	//  - 功能说明:修改单条模版短信定时发送任务。
	//  - 调用地址:PUT `/v1/schedule/{scheduleID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E5%8D%95%E6%9D%A1%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E4%BF%AE%E6%94%B9-api
	UpdateSchedule(ctx context.Context, scheduleID string, param *ScheduleUpdateParam) (*ScheduleUpdateResult, error)

	// 定时短信查询
	//  - 功能说明:查询模板短信定时发送任务。
	//  - 调用地址:GET `/v1/schedule/{scheduleID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E6%9F%A5%E8%AF%A2api
	GetSchedule(ctx context.Context, scheduleID string) (*ScheduleGetResult, error)

	// 定时短信删除
	//  - 功能说明:删除模板短信定时发送任务。
	//  - 调用地址:DELETE `/v1/schedule/{scheduleID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E5%88%A0%E9%99%A4-api
	DeleteSchedule(ctx context.Context, scheduleID string) (*ScheduleDeleteResult, error)

	// 批量定时短信提交
	//  - 功能说明:提交批量模板短信定时发送任务。
	//  - 调用地址:POST `/v1/schedule/batch`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E6%89%B9%E9%87%8F%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E6%8F%90%E4%BA%A4-api
	SendBatchSchedule(ctx context.Context, param *BatchScheduleSendParam) (*BatchScheduleSendResult, error)

	// 批量定时短信修改
	//  - 功能说明:修改批量模板短信定时发送任务。
	//  - 调用地址:PUT `/v1/schedule/batch/{scheduleID}`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_schedule#%E6%89%B9%E9%87%8F%E5%AE%9A%E6%97%B6%E7%9F%AD%E4%BF%A1%E4%BF%AE%E6%94%B9-api
	UpdateBatchSchedule(ctx context.Context, scheduleID string, param *BatchScheduleUpdateParam) (*BatchScheduleUpdateResult, error)

	// 账号余量查询 (devKey:devSecret)
	//  - 功能说明:查询账号余量,账号余量指未分配给某个应用,属于账号共享的短信余量。
	//  - 调用地址:GET `/v1/accounts/dev`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_jsms_api_account#%E8%B4%A6%E5%8F%B7%E4%BD%99%E9%87%8F%E6%9F%A5%E8%AF%A2-api
	GetDevBalance(ctx context.Context) (*DevBalanceGetResult, error)

	// 应用余量查询 (appKey:masterSecret)
	//  - 功能说明:查询应用余量,应用余量指分配给某个应用单独使用的短信余量。
	//  - 调用地址:GET `/v1/accounts/app`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_jsms_api_account#%E5%BA%94%E7%94%A8%E4%BD%99%E9%87%8F%E6%9F%A5%E8%AF%A2-api
	GetAppBalance(ctx context.Context) (*AppBalanceGetResult, error)

	// 获取短信发送状态 (SMS_REPORT - 短信送达状态)
	//  - 功能说明:获取 appKey 下短信的发送状态报告;API 调用频率为 5 秒/次,每次调用最多可获取 500 条数据;每条短信发送状态报告数据最多保留七天,即极光收到运营商返回状态报告后的七天。
	//  - 调用地址:GET `/v1/report`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_inquire#%E8%8E%B7%E5%8F%96%E7%9F%AD%E4%BF%A1%E5%8F%91%E9%80%81%E7%8A%B6%E6%80%81
	GetReport(ctx context.Context) (*ReportGetResult, error)

	// 获取上行短信消息 (SMS_REPLY - 用户回复消息)
	//  - 功能说明:获取 appKey 下的上行短信消息;API 调用频率为 5 秒/次,每次调用最多可获取 500 条数据;每条上行短信消息数据最多保留七天,即极光收到运营商返回上行消息后的七天。
	//  - 调用地址:GET `/v1/reply`
	//  - 接口文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms_inquire#%E8%8E%B7%E5%8F%96%E4%B8%8A%E8%A1%8C%E7%9F%AD%E4%BF%A1%E6%B6%88%E6%81%AF
	GetReply(ctx context.Context) (*ReplyGetResult, error)

	// 获取配置好的回调接口服务。
	Callback() (*Callback, error)
}

JSMS API v1【极光短信 > REST API】

1.【短信签名 API】

  • 支持创建、修改、查询和删除短信签名。

2.【短信模板 API】

  • 支持创建、修改、查询和删除短信模板。

3.【短信发送 API】

  • 支持发送文本、语音验证码短信;
  • 支持验证验证码;
  • 支持发送单条、批量模板短信。

4.【短信定时发送 API】

  • 支持提交、修改、查询和删除模板短信定时发送任务。

5.【短信余量查询 API】

  • 支持查询开发者账号余量;
  • 支持查询应用余量。

6.【短信回执 API】

  • 支持 “获取短信发送状态” 和 “获取上行短信消息” 接口;
  • 注意:短信发送状态、上行短信消息已提供回调的获取方式(7),若开发者已使用了回调的获取方式,则不支持使用短信回执 API 获取。

7.【回调接口】

  • 支持使用默认或定制回调接口服务,包括 “发送状态回调”、“回复内容回调”、“模板审核回调” 和 “签名审核回调”。

极光文档:https://docs.jiguang.cn/jsms/server/rest_api_jsms

type APIv1Builder

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

用于构建和配置 JSMS API v1 访问客户端的构建器。

func NewAPIv1Builder

func NewAPIv1Builder() *APIv1Builder

func (*APIv1Builder) Build

func (b *APIv1Builder) Build() (APIv1, error)

func (*APIv1Builder) DisableHttpLogging

func (b *APIv1Builder) DisableHttpLogging() *APIv1Builder

【可选】禁用 API 的 HTTP 日志记录,即不记录 API 的 HTTP 请求和响应的日志信息。

func (*APIv1Builder) EnableCallback

func (b *APIv1Builder) EnableCallback(callbackConfigOptions ...CallbackConfigOption) *APIv1Builder

【可选】启用回调接口服务。

func (*APIv1Builder) SetAppKey

func (b *APIv1Builder) SetAppKey(appKey string) *APIv1Builder

【必填】设置 API 的应用标识。

func (*APIv1Builder) SetClient

func (b *APIv1Builder) SetClient(client api.Client) *APIv1Builder

【可选】设置 API 的客户端,用于发送 HTTP 请求,默认为 api.DefaultClient。

func (*APIv1Builder) SetDevKey

func (b *APIv1Builder) SetDevKey(devKey string) *APIv1Builder

【可选】设置 API 的开发者标识。

func (*APIv1Builder) SetDevSecret

func (b *APIv1Builder) SetDevSecret(devSecret string) *APIv1Builder

【可选】设置 API 的开发者密钥。

func (*APIv1Builder) SetHost

func (b *APIv1Builder) SetHost(host string) *APIv1Builder

【可选】设置 API 的 Host 基础 URL,默认为 api.HostJSmsV1。

func (*APIv1Builder) SetHttpLogLevel

func (b *APIv1Builder) SetHttpLogLevel(httpLogLevel api.HttpLogLevel) *APIv1Builder

【可选】设置 API 的 HTTP 日志记录级别,用于指定记录 API 的 HTTP 请求和响应的日志信息的详细程度,默认为 api.HttpLogLevelBasic。

  • 可用的级别:api.HttpLogLevelNone、api.HttpLogLevelBasic、api.HttpLogLevelHeaders、api.HttpLogLevelFull;
  • 若要禁用 HTTP 日志记录,可使用 DisableHttpLogging。

func (*APIv1Builder) SetLogger

func (b *APIv1Builder) SetLogger(logger jiguang.Logger) *APIv1Builder

【可选】设置 API 的日志记录器,默认为 api.DefaultJSMSLogger。

func (*APIv1Builder) SetMasterSecret

func (b *APIv1Builder) SetMasterSecret(masterSecret string) *APIv1Builder

【必填】设置 API 的应用主密钥。

type AppBalanceGetResult

type AppBalanceGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	AppBalance    *uint64        `json:"app_balance,omitempty"`  // 全类型短信余量
	AppVoice      *uint64        `json:"app_voice,omitempty"`    // 语音短信余量
	AppIndustry   *uint64        `json:"app_industry,omitempty"` // 行业短信余量
	AppMarket     *uint64        `json:"app_market,omitempty"`   // 营销短信余量
}

func (*AppBalanceGetResult) IsSuccess

func (rs *AppBalanceGetResult) IsSuccess() bool

type BatchMessageSendParam

type BatchMessageSendParam struct {
	SignID     int                       `json:"sign_id,omitempty"` // 【可选】签名 ID,该字段为空则使用应用默认签名
	TempID     int64                     `json:"temp_id"`           // 【必填】模板 ID
	Tag        string                    `json:"tag,omitempty"`     // 【可选】标签
	Recipients []BatchSendRecipientParam `json:"recipients"`        // 【必填】接收者列表
}

批量模板短信发送参数

type BatchMessageSendResult

type BatchMessageSendResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError             `json:"error,omitempty"`
	SuccessCount  *uint64                    `json:"success_count,omitempty"` // 成功发送的数量
	FailureCount  *uint64                    `json:"failure_count,omitempty"` // 发送失败的数量
	Recipients    []BatchSendRecipientResult `json:"recipients,omitempty"`    // 发送失败接收者结果列表
}

批量模板短信发送结果

func (*BatchMessageSendResult) IsSuccess

func (rs *BatchMessageSendResult) IsSuccess() bool

type BatchScheduleFailureRecipientResult

type BatchScheduleFailureRecipientResult struct {
	ErrorCode    string                 `json:"error_code,omitempty"`    // 错误码
	ErrorMessage string                 `json:"error_message,omitempty"` // 错误信息
	Mobile       string                 `json:"mobile"`                  // 手机号码
	TempParams   map[string]interface{} `json:"temp_para,omitempty"`     // 模板参数,需要替换的参数名和参数值的键值对
}

批量定时短信发送失败接收者结果

func (*BatchScheduleFailureRecipientResult) IsSuccess

func (rs *BatchScheduleFailureRecipientResult) IsSuccess() bool

func (*BatchScheduleFailureRecipientResult) UnmarshalJSON

func (rs *BatchScheduleFailureRecipientResult) UnmarshalJSON(data []byte) error

type BatchScheduleRecipientParam

type BatchScheduleRecipientParam struct {
	Mobile     string                 `json:"mobile"`              // 【必填】手机号码。
	TempParams map[string]interface{} `json:"temp_para,omitempty"` // 【可选】模板参数,需要替换的参数名和参数值的键值对。
}

批量定时短信接收者参数

type BatchScheduleSendParam

type BatchScheduleSendParam struct {
	SendTime   jiguang.LocalDateTime         `json:"send_time"`         // 【必填】发送时间。
	SignID     int                           `json:"sign_id,omitempty"` // 【可选】签名 ID,该参数为空则使用应用默认签名;注意:签名审核通过后,可在控制台设为默认签名。
	TempID     int64                         `json:"temp_id"`           // 【必填】模板 ID。
	Tag        string                        `json:"tag,omitempty"`     // 【可选】标签,仅用作标示该短信的别名,不在短信中展示,最多不超过 10 个字。
	Recipients []BatchScheduleRecipientParam `json:"recipients"`        // 【必填】接收者列表,上限 1000 个。
}

type BatchScheduleSendResult

type BatchScheduleSendResult struct {
	*api.Response     `json:"-"`
	Error             *api.CodeError                        `json:"error,omitempty"`
	SuccessCount      *uint64                               `json:"success_count,omitempty"`      // 成功发送的数量
	FailureCount      *uint64                               `json:"failure_count,omitempty"`      // 发送失败的数量
	FailureRecipients []BatchScheduleFailureRecipientResult `json:"failure_recipients,omitempty"` // 发送失败接收者结果列表
}

func (*BatchScheduleSendResult) IsSuccess

func (rs *BatchScheduleSendResult) IsSuccess() bool

type BatchScheduleUpdateParam

type BatchScheduleUpdateParam = BatchScheduleSendParam

type BatchScheduleUpdateResult

type BatchScheduleUpdateResult = BatchScheduleSendResult

type BatchSendRecipientParam

type BatchSendRecipientParam struct {
	Mobile     string                 `json:"mobile"`              // 【必填】手机号码
	TempParams map[string]interface{} `json:"temp_para,omitempty"` // 【可选】模板参数,需要替换的参数名和参数值的键值对
}

批量模板短信接收者参数

type BatchSendRecipientResult

type BatchSendRecipientResult struct {
	ErrorCode    string                 `json:"error_code,omitempty"`    // 错误码
	ErrorMessage string                 `json:"error_message,omitempty"` // 错误信息
	MsgID        string                 `json:"msg_id,omitempty"`        // 消息 ID
	Mobile       string                 `json:"mobile"`                  // 手机号码
	TempParams   map[string]interface{} `json:"temp_para,omitempty"`     // 模板参数,需要替换的参数名和参数值的键值对
}

批量模板短信发送接收者结果

func (*BatchSendRecipientResult) IsSuccess

func (rs *BatchSendRecipientResult) IsSuccess() bool

func (*BatchSendRecipientResult) UnmarshalJSON

func (rs *BatchSendRecipientResult) UnmarshalJSON(data []byte) error

type Callback

type Callback = callback.Server // 回调接口服务核心结构。

type CallbackConfigOption

type CallbackConfigOption = callback.ConfigOption // 回调接口服务配置选项。

type CallbackReplyData

type CallbackReplyData = callback.ReplyData // 「用户回复消息」SMS_REPLY 回执数据。

type CallbackReplyDataProcessor

type CallbackReplyDataProcessor = callback.ReplyDataProcessor // 「用户回复消息」SMS_REPLY 回执数据回调处理器。

type CallbackReportData

type CallbackReportData = callback.ReportData // 「短信送达状态」SMS_REPORT 回执数据。

type CallbackReportDataProcessor

type CallbackReportDataProcessor = callback.ReportDataProcessor // 「短信送达状态」SMS_REPORT 回执数据回调处理器。

type CallbackSignData

type CallbackSignData = callback.SignData // 「签名审核结果」SMS_SIGN 回执数据。

type CallbackSignDataProcessor

type CallbackSignDataProcessor = callback.SignDataProcessor // 「签名审核结果」SMS_SIGN 回执数据回调处理器。

type CallbackTemplateData

type CallbackTemplateData = callback.TemplateData // 「模板审核结果」SMS_TEMPLATE 回执数据。

type CallbackTemplateDataProcessor

type CallbackTemplateDataProcessor = callback.TemplateDataProcessor // 「模板审核结果」SMS_TEMPLATE 回执数据回调处理器。

type CodeSendParam

type CodeSendParam struct {
	Mobile string `json:"mobile"`            // 【必填】手机号码
	SignID int    `json:"sign_id,omitempty"` // 【可选】签名 ID,该字段为空则使用应用默认签名
	TempID int64  `json:"temp_id"`           // 【必填】模板 ID
}

文本验证码短信发送参数

type CodeSendResult

type CodeSendResult = sendResult

文本验证码短信发送结果

type CodeVerifyResult

type CodeVerifyResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	IsValid       bool           `json:"is_valid"` // 验证码是否有效
}

验证码验证结果

func (*CodeVerifyResult) IsSuccess

func (rs *CodeVerifyResult) IsSuccess() bool

type DevBalanceGetResult

type DevBalanceGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	DevBalance    *uint64        `json:"dev_balance,omitempty"`  // 全类型短信余量
	DevVoice      *uint64        `json:"dev_voice,omitempty"`    // 语音短信余量
	DevIndustry   *uint64        `json:"dev_industry,omitempty"` // 行业短信余量
	DevMarket     *uint64        `json:"dev_market,omitempty"`   // 营销短信余量
}

func (*DevBalanceGetResult) IsSuccess

func (rs *DevBalanceGetResult) IsSuccess() bool

type MessageSendParam

type MessageSendParam struct {
	Mobile     string                 `json:"mobile"`              // 【必填】手机号码
	SignID     int                    `json:"sign_id,omitempty"`   // 【可选】签名 ID,该字段为空则使用应用默认签名
	TempID     int64                  `json:"temp_id"`             // 【必填】模板 ID
	TempParams map[string]interface{} `json:"temp_para,omitempty"` // 【可选】模板参数,需要替换的参数名和参数值的键值对
}

单条模板短信发送参数

type MessageSendResult

type MessageSendResult = sendResult

单条模板短信发送结果

type ReplyGetResult

type ReplyGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError      `json:"error,omitempty"`
	Data          []inquire.ReplyData `json:"-"` // 用户回复消息数据
}

func (*ReplyGetResult) IsSuccess

func (rs *ReplyGetResult) IsSuccess() bool

func (ReplyGetResult) MarshalJSON

func (rs ReplyGetResult) MarshalJSON() ([]byte, error)

func (*ReplyGetResult) UnmarshalJSON

func (rs *ReplyGetResult) UnmarshalJSON(data []byte) error

type ReportGetResult

type ReportGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError       `json:"error,omitempty"`
	Data          []inquire.ReportData `json:"-"` // 短信送达状态报告数据
}

func (*ReportGetResult) IsSuccess

func (rs *ReportGetResult) IsSuccess() bool

func (ReportGetResult) MarshalJSON

func (rs ReportGetResult) MarshalJSON() ([]byte, error)

func (*ReportGetResult) UnmarshalJSON

func (rs *ReportGetResult) UnmarshalJSON(data []byte) error

type ScheduleDeleteResult

type ScheduleDeleteResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
}

func (*ScheduleDeleteResult) IsSuccess

func (rs *ScheduleDeleteResult) IsSuccess() bool

type ScheduleGetResult

type ScheduleGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError            `json:"error,omitempty"`
	ScheduleID    string                    `json:"schedule_id,omitempty"` // 任务 ID
	SendTime      *jiguang.LocalDateTime    `json:"send_time,omitempty"`   // 发送时间
	TempID        int64                     `json:"temp_id,omitempty"`     // 模板 ID
	Recipients    []ScheduleRecipientResult `json:"recipients,omitempty"`  // 接收者列表
}

func (*ScheduleGetResult) IsSuccess

func (rs *ScheduleGetResult) IsSuccess() bool

type ScheduleRecipientResult

type ScheduleRecipientResult struct {
	MsgID      string                 `json:"msg_id,omitempty"`    // 消息 ID
	Mobile     string                 `json:"mobile"`              // 手机号码
	TempParams map[string]interface{} `json:"temp_para,omitempty"` // 模板参数,需要替换的参数名和参数值的键值对
}

定时短信查询接收者结果

type ScheduleSendParam

type ScheduleSendParam struct {
	SendTime   jiguang.LocalDateTime  `json:"send_time"`           // 【必填】发送时间。
	Mobile     string                 `json:"mobile"`              // 【必填】手机号码。
	SignID     int                    `json:"sign_id,omitempty"`   // 【可选】签名 ID,该参数为空则使用应用默认签名;注意:签名审核通过后,可在控制台设为默认签名。
	TempID     int64                  `json:"temp_id"`             // 【必填】模板 ID。
	TempParams map[string]interface{} `json:"temp_para,omitempty"` // 【可选】模板参数,需要替换的参数名和参数值的键值对。
}

type ScheduleSendResult

type ScheduleSendResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	ScheduleID    string         `json:"schedule_id,omitempty"` // 任务 ID。
}

func (*ScheduleSendResult) IsSuccess

func (rs *ScheduleSendResult) IsSuccess() bool

type ScheduleUpdateParam

type ScheduleUpdateParam = ScheduleSendParam

type ScheduleUpdateResult

type ScheduleUpdateResult = ScheduleSendResult

type SignCreateParam

type SignCreateParam struct {
	// 【必填】签名内容。
	//  - 仅支持中英文、数字组成,长度为 2~8 个字;
	//  - 无须添加【】、[]、()等符号;
	//  - 范例:极光推送
	Sign string `json:"sign"`
	// 【可选】签名类型,填写数字代号即可。
	//  - 1、公司名称全称或简称:需提供签名所属主体的营业执照复印件图片及对应法人代表的身份证正反面复印件图片,均需加盖公章;
	//  - 2、工信部备案的网站全称或简称:需提供签名所属的已备案的 ICP 备案截图复印件图片、主办单位的营业执照复印件图片及对应法人代表的身份证正反面复印件图片,均需加盖公章;
	//  - 3、APP 应用名称或简称:需提供签名所属的任意应用商店的下载链接、APP 软著证明复印件图片及开发者的营业执照复印件图片、对应法人代表的身份证正反面复印件图片,均需加盖公章;
	//  - 4、公众号小程序全称或简称:需提供签名所属的公众号小程序含主体的页面截图、开发者主体营业执照复印件图片、对应法人代表的身份证正反面复印件图片,均需加盖公章;
	//  - 5、商标名称全称或简称:需提供签名所属商标注册证书复印件图片及商标主体营业执照复印件图片、对应法人代表身份证正反面复印件图片,均需加盖公章;
	//  - 6、其他:申请的签名与所属主体不一致或涉及第三方权益时,需提供第三方授权委托书、第三方签名相关资质(详见类型 1-5),【授权委托书格式参考文档】:https://shimo.im/docs/vqqd6wgwhXCtHjC3
	// 注意:
	//  - 如果用户 A 创建自用签名,签名归属主体属于 A,则不涉及第三方权益;
	//  - 如果用户 A 替公司 B 创建签名,签名归属主体属于公司 B,则涉及第三方权益,需要公司 B 给予 A 授权委托书。公司 B 为授权方,A 为被授权方,并需要加盖公司 B 的公章。
	Type int `json:"type,omitempty"`
	// 【可选】上传签名相关的资质证件图片(文件支持 PNG、JPG、JPEG 格式,且每个大小不超过 2M)。
	Images interface{} `json:"images,omitempty"`
	// 【可选】简略描述您的业务使用场景,不超过 100 个字。
	Remark string `json:"remark,omitempty"`
}

type SignCreateResult

type SignCreateResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	SignID        int            `json:"sign_id,omitempty"` // 签名 ID
}

func (*SignCreateResult) IsSuccess

func (rs *SignCreateResult) IsSuccess() bool

type SignDeleteResult

type SignDeleteResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
}

func (*SignDeleteResult) IsSuccess

func (rs *SignDeleteResult) IsSuccess() bool

type SignGetResult

type SignGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	SignID        int            `json:"sign_id,omitempty"`    // 签名 ID
	Sign          string         `json:"sign,omitempty"`       // 签名内容
	Status        int            `json:"status,omitempty"`     // 签名审核状态:1 - 审核通过;2 - 审核不通过
	IsDefault     bool           `json:"is_default,omitempty"` // 签名使用状态:是否使用默认签名
	UseStatus     bool           `json:"use_status,omitempty"` // 签名使用状态:使用中/未使用
}

func (*SignGetResult) IsSuccess

func (rs *SignGetResult) IsSuccess() bool

func (*SignGetResult) MarshalJSON

func (rs *SignGetResult) MarshalJSON() ([]byte, error)

func (*SignGetResult) UnmarshalJSON

func (rs *SignGetResult) UnmarshalJSON(data []byte) error

type SignUpdateParam

type SignUpdateParam = SignCreateParam

type SignUpdateResult

type SignUpdateResult = SignCreateResult

type TemplateCreateParam

type TemplateCreateParam struct {
	// 【必填】模板内容。
	//  - 1. 短信内容不超过 500 个字,短信内容包括:签名、正文、退订方式(仅营销短信),创建模版时请预留签名等文字的字数;
	//  短信计费规则:70 字按 1 条短信计费,超过 70 字,按 67 字 / 条逐条计费。单个汉字、标点、英文都算一个字、回车记两个字。
	//  若短信中包含变量,计费条数以实际发送的字数为准;
	//  - 2. 验证码模版仅支持设置一个变量,且变量名必须为 code;
	//  - 3. 通知、营销短信中,变量名仅支持英文及数字,若含有链接变量,变量名必须为 url ,为避免短信发送时因进入人工审核而导致发送延迟,
	//  请在 Remark 参数中填写链接以报备,支持不设置参数。
	Template string `json:"template"`
	// 【必填】模板类型,1 为验证码类,2 为通知类,3 为营销类。
	Type int `json:"type,omitempty"`
	// 【可选】验证码有效期,必须大于 0 且不超过 86400 ,单位为秒(当模板类型为 1 时必传)。
	TTL int `json:"ttl,omitempty"`
	// 【可选】简略描述正文模版的发送场景及发送对象,不超过 100 字(包含链接的情况下需要将链接地址放置在最前面,请求才会成功)。
	Remark string `json:"remark,omitempty"`
}

type TemplateCreateResult

type TemplateCreateResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	TempID        int64          `json:"temp_id,omitempty"` // 模板 ID
}

func (*TemplateCreateResult) IsSuccess

func (rs *TemplateCreateResult) IsSuccess() bool

type TemplateDeleteResult

type TemplateDeleteResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
}

func (*TemplateDeleteResult) IsSuccess

func (rs *TemplateDeleteResult) IsSuccess() bool

type TemplateGetResult

type TemplateGetResult struct {
	*api.Response `json:"-"`
	Error         *api.CodeError `json:"error,omitempty"`
	TempID        int64          `json:"temp_id,omitempty"`  // 模板 ID
	Template      string         `json:"template,omitempty"` // 模板内容
	Type          int            `json:"type,omitempty"`     // 模板类型,1 为验证码类,2 为通知类,3 为营销类。
	TTL           int            `json:"ttl,omitempty"`      // 验证码有效期,单位为秒。
	Remark        string         `json:"remark,omitempty"`   // 正文模版的发送场景及发送对象的简略描述。
	Status        int            `json:"status,omitempty"`   // 模板审核状态:0 - 审核中;1 - 审核通过;2 - 审核不通过
}

func (*TemplateGetResult) IsSuccess

func (rs *TemplateGetResult) IsSuccess() bool

type TemplateUpdateParam

type TemplateUpdateParam = TemplateCreateParam

type TemplateUpdateResult

type TemplateUpdateResult = TemplateCreateResult

type VoiceCodeSendParam

type VoiceCodeSendParam struct {
	Mobile    string    `json:"mobile"`               // 【必填】手机号码
	Code      string    `json:"code,omitempty"`       // 【可选】语音验证码的值,验证码仅支持 4-8 个数字
	VoiceLang VoiceLang `json:"voice_lang,omitempty"` // 【可选】语音验证码播报语言选择,0:中文播报,1:英文播报,2:中英混合播报
	TTL       int       `json:"ttl,omitempty"`        // 【可选】验证码有效期,默认为 60 秒
}

语音验证码发送参数

func (VoiceCodeSendParam) MarshalJSON

func (p VoiceCodeSendParam) MarshalJSON() ([]byte, error)

func (*VoiceCodeSendParam) UnmarshalJSON

func (p *VoiceCodeSendParam) UnmarshalJSON(data []byte) error

type VoiceCodeSendResult

type VoiceCodeSendResult = sendResult

语音验证码发送结果

type VoiceLang

type VoiceLang string

语音验证码播报语言

const (
	VoiceLangChinese        VoiceLang = "0" // 中文播报
	VoiceLangEnglish        VoiceLang = "1" // 英文播报
	VoiceLangChineseEnglish VoiceLang = "2" // 中英混合播报
)

func (VoiceLang) String

func (vl VoiceLang) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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