Documentation ¶
Index ¶
- type AccountInfo
- type Client
- func (c Client) GetAccountInfo(ctx context.Context) (*AccountInfo, error)
- func (c Client) GetAuthURL(redirect string, getUserInfo bool) string
- func (c Client) SendRedPocket(ctx context.Context, redPocket RedPocket) error
- func (c Client) VerifyURL(url string) (openId string, userInfo UserInfo, ok bool)
- type Error
- type RedPocket
- type RedPocketType
- type Time
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) GetAccountInfo ¶
func (c Client) GetAccountInfo(ctx context.Context) (*AccountInfo, error)
GetAccountInfo gets balance and expiration date of current account.
func (Client) GetAuthURL ¶
GetAuthURL generates authorization URL. Visit this URL in Wechat to get user's Open ID. To get user's name and image, set getUserInfo to true. Open ID and user info will be added as query string to the redirect URL provided. The URL can be verified by VerifyURL().
func (Client) SendRedPocket ¶
SendRedPocket sends a Wechat red pocket.
type RedPocket ¶
type RedPocket struct { // Defaults to RedPocketTypePersonal, set to // RedPocketTypeEnterprise to send red pocket over 200 yuan Type RedPocketType // Money in cents of a red pocket, must not be less than 30 Cents int // Once SendRedPocket() succeeds, you'll receive a new // Wechat message like this: // 你参与{Title},成功获得{SenderName}赠送的红包, // 点击消息打开,一起抢红包、拼手气吧! // 点击消息拆开红包即可获得现金 // And on the details page, you'll see: // {SenderName}的红包 // {Description} Title string Description string SenderName string // Open ID of the user who receives a red pocket, can be // obtained by the redirection URL from GetAuthURL ReceiverOpenId string // If Order ID is empty, random string will be used OrderId string }
type RedPocketType ¶
type RedPocketType int
const ( RedPocketTypePersonal RedPocketType = iota RedPocketTypeEnterprise )
type Time ¶
func (*Time) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.