Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(value string) ([]byte, string)
- func Download(uri string, dis io.Writer) (result []byte, err error)
- func Encrypt(value string) string
- func Execute(url string, param Parameter) (json *simplejson.Json, err error)
- func Get(url string, args map[string]string) (result []byte, err error)
- func GetErrorMsg(code int) string
- func NewContext(ctx context.Context, c Clienter) context.Context
- func NewError(buf []byte) error
- func Post(url, contentType string, args map[string]string) (result string, err error)
- func PostJSON(url string, jsonObject interface{}) (result []byte, err error)
- func Upload(uri, filename string, description *VideoDescription, srcFile io.Reader) (result []byte, err error)
- type AccessTokenReply
- type CDATA
- type Client
- type ClientFromRedis
- type ClientFromRedisOption
- type ClientFromRedisOptions
- type Clienter
- type Configer
- type JSONer
- type JsAPITicketReply
- type Parameter
- type VideoDescription
- type XMLer
Constants ¶
View Source
const ( // RedisAccessTokenKey ... RedisAccessTokenKey = "github.com/nilorg/go-wechat/access_token" // RedisJsAPITicketKey ... RedisJsAPITicketKey = "github.com/nilorg/go-wechat/js_api_ticket" )
View Source
const MetadataAccessTokenKey = "wechat-access-token"
MetadataAccessTokenKey Metadata wehcat AccessToken key.
View Source
const MetadataJsAPITicketKey = "wechat-js-api-ticket"
MetadataJsAPITicketKey Metadata wehcat JsAPITicketKey key.
Variables ¶
View Source
var ( // AppID 应用Key AppID = "" // AppSecret 秘密 AppSecret = "" )
View Source
var ( // ErrContextNotFoundClient 上下文不存在客户端错误 ErrContextNotFoundClient = errors.New("上下文中没有获取到微信客户端") )
View Source
var ( // ErrMetadataNotFoundClient 元数据不存在客户端AccessToken错误 ErrMetadataNotFoundClient = errors.New("Metadata不存在客户端AccessToken") )
Functions ¶
func Execute ¶
func Execute(url string, param Parameter) (json *simplejson.Json, err error)
Execute 执行
func NewContext ¶
NewContext 创建微信客户端上下文
Types ¶
type AccessTokenReply ¶
type AccessTokenReply struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` }
AccessTokenReply ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 客户端
func (*Client) GetAccessToken ¶
GetAccessToken 获取 accessToken
func (*Client) GetJsAPITicket ¶
GetJsAPITicket 获取 js api ticket
type ClientFromRedis ¶
type ClientFromRedis struct {
// contains filtered or unexported fields
}
ClientFromRedis Redis客户端
func NewClientFromRedis ¶
func NewClientFromRedis(opts ...ClientFromRedisOption) *ClientFromRedis
NewClientFromRedis 创建客户端
func (*ClientFromRedis) GetAccessToken ¶
func (client *ClientFromRedis) GetAccessToken() string
GetAccessToken 获取AccessToken
func (*ClientFromRedis) GetJsAPITicket ¶
func (client *ClientFromRedis) GetJsAPITicket() string
GetJsAPITicket 获取JsAPITicket
type ClientFromRedisOption ¶
type ClientFromRedisOption func(*ClientFromRedisOptions)
ClientFromRedisOption 为可选参数赋值的函数
func ClientFromRedisOptionAccessTokenKey ¶
func ClientFromRedisOptionAccessTokenKey(accessTokenKey string) ClientFromRedisOption
ClientFromRedisOptionAccessTokenKey ...
func ClientFromRedisOptionJsAPITicketKey ¶
func ClientFromRedisOptionJsAPITicketKey(jsAPITicketKey string) ClientFromRedisOption
ClientFromRedisOptionJsAPITicketKey ...
func ClientFromRedisOptionRedisClient ¶
func ClientFromRedisOptionRedisClient(client *redis.Client) ClientFromRedisOption
ClientFromRedisOptionRedisClient ...
type ClientFromRedisOptions ¶
type ClientFromRedisOptions struct { RedisClient *redis.Client AccessTokenKey string JsAPITicketKey string }
ClientFromRedisOptions 可选参数列表
func NewClientFromRedisOptions ¶
func NewClientFromRedisOptions(opts ...ClientFromRedisOption) ClientFromRedisOptions
NewClientFromRedisOptions 创建可选参数
type JsAPITicketReply ¶
JsAPITicketReply ...
type VideoDescription ¶
type VideoDescription struct { Title string `json:"title"` // 视频素材的标题 Introduction string `json:"introduction"` // 视频素材的描述 }
VideoDescription 视频描述
Source Files ¶
Click to show internal directories.
Click to hide internal directories.