Documentation ¶
Index ¶
- type DefaultLogger
- type JsCode2SessionData
- type JsCode2SessionReq
- type JsCode2SessionResp
- type Logger
- type NotifyReq
- type NotifyResp
- type SDK
- func (sdk *SDK) CallToken(ctx context.Context) (*TokenResp, error)
- func (sdk *SDK) DecodeTokenResp(result map[string]string) *TokenResp
- func (sdk *SDK) JsCode2Session(ctx context.Context, code string, anonymousCode string) (*JsCode2SessionResp, error)
- func (sdk *SDK) Notify(ctx context.Context, req *NotifyReq) (*NotifyResp, error)
- func (sdk *SDK) SaveTokenRespToRedis(ctx context.Context, tokenResp *TokenResp) error
- func (sdk *SDK) Token(ctx context.Context) (*TokenResp, error)
- type TokenData
- type TokenReq
- type TokenResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLogger ¶
type DefaultLogger struct{}
func (DefaultLogger) Error ¶
func (l DefaultLogger) Error(args ...any)
func (DefaultLogger) Errorf ¶
func (l DefaultLogger) Errorf(template string, args ...any)
type JsCode2SessionData ¶
type JsCode2SessionReq ¶
type JsCode2SessionReq struct { AppID string `json:"appid"` Secret string `json:"secret"` Code string `json:"code"` AnonymousCode string `json:"anonymous_code"` }
JsCode2SessionReq 登录凭证校验请求参数
type JsCode2SessionResp ¶
type JsCode2SessionResp struct { ErrNo int `json:"err_no"` ErrTips string `json:"err_tips"` Data *JsCode2SessionData `json:"data"` AppID string }
JsCode2SessionResp 登录凭证校验的返回结果
type NotifyReq ¶
type NotifyReq struct { AccessToken string `json:"access_token"` // 必选, 小程序 access_token AppID string `json:"app_id"` // 必选, 小程序的 id TplID string `json:"tpl_id"` // 必选, 模板的 id OpenID string `json:"open_id"` // 必选, 接收消息目标用户的 open_id Data map[string]string `json:"data"` // 必选, 模板内容,格式形如 { "key1": "value1", "key2": "value2" },具体使用方式参考下文请求示例 Page string `json:"page"` // 可选, 跳转的页面 }
NotifyReq 订阅消息请求参数
type NotifyResp ¶
type SDK ¶
type SDK struct { HttpCli *http.Client AppID string Secret string RedisCli redis.UniversalClient RedisSync *redsync.Redsync TokenKey string TokenLockerKey string IsSandBox bool Logger Logger }
func (*SDK) JsCode2Session ¶
func (*SDK) SaveTokenRespToRedis ¶
Click to show internal directories.
Click to hide internal directories.