account

package
v0.0.0-...-527ea11 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

帐号管理接口.

Index

Constants

View Source
const (
	TemporaryQRCodeExpireSecondsLimit = 604800 // 临时二维码 expire_seconds 限制
	PermanentQRCodeSceneIdLimit       = 100000 // 永久二维码 scene_id 限制
)

Variables

This section is empty.

Functions

func QRCodeDownload

func QRCodeDownload(ticket, filepath string, clt *http.Client) (written int64, err error)

通过ticket换取二维码, 写入到 filepath 路径的文件.

如果 clt == nil 则默认用 http.DefaultClient

func QRCodeDownloadToWriter

func QRCodeDownloadToWriter(ticket string, writer io.Writer, clt *http.Client) (written int64, err error)

通过ticket换取二维码, 写入到 writer.

如果 clt == nil 则默认用 http.DefaultClient.

func QRCodePicURL

func QRCodePicURL(ticket string) string

二维码图片的URL, 可以GET此URL下载二维码或者在线显示此二维码.

Types

type Client

type Client mp.Client

func NewClient

func NewClient(srv mp.AccessTokenServer, clt *http.Client) *Client

func (*Client) CreatePermanentQRCode

func (clt *Client) CreatePermanentQRCode(SceneId uint32) (qrcode *PermanentQRCode, err error)

创建永久二维码

SceneId: 场景值ID, 目前参数只支持1--100000

func (*Client) CreatePermanentQRCodeWithSceneString

func (clt *Client) CreatePermanentQRCodeWithSceneString(SceneString string) (qrcode *PermanentQRCode, err error)

创建永久二维码

SceneString: 场景值ID(字符串形式的ID), 字符串类型, 长度限制为1到64

func (*Client) CreateTemporaryQRCode

func (clt *Client) CreateTemporaryQRCode(SceneId uint32, ExpireSeconds int) (qrcode *TemporaryQRCode, err error)

创建临时二维码

SceneId:       场景值ID, 为32位非0整型
ExpireSeconds: 二维码有效时间, 以秒为单位.  最大不超过 604800.

func (*Client) QRCodeDownload

func (clt *Client) QRCodeDownload(ticket, filepath string) (written int64, err error)

通过ticket换取二维码, 写入到 filepath 路径的文件.

func (*Client) QRCodeDownloadToWriter

func (clt *Client) QRCodeDownloadToWriter(ticket string, writer io.Writer) (written int64, err error)

通过ticket换取二维码, 写入到 writer.

func (*Client) ShortURL

func (clt *Client) ShortURL(longURL string) (shortURL string, err error)

将一条长链接转成短链接.

type PermanentQRCode

type PermanentQRCode struct {
	// 下面两个字段同时只有一个有效, 非zero值表示有效.
	SceneId     uint32 `json:"scene_id,omitempty"`  // 场景值ID, 临时二维码时为32位非0整型, 永久二维码时最大值为100000(目前参数只支持1--100000)
	SceneString string `json:"scene_str,omitempty"` // 场景值ID(字符串形式的ID), 字符串类型, 长度限制为1到64, 仅永久二维码支持此字段

	Ticket string `json:"ticket"` // 获取的二维码ticket, 凭借此ticket可以在有效时间内换取二维码.
	URL    string `json:"url"`    // 二维码图片解析后的地址, 开发者可根据该地址自行生成需要的二维码图片
}

永久二维码

type TemporaryQRCode

type TemporaryQRCode struct {
	ExpireSeconds int `json:"expire_seconds,omitempty"` // 二维码的有效时间, 以秒为单位. 最大不超过 604800.
	PermanentQRCode
}

临时二维码

Jump to

Keyboard shortcuts

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