apis

package
v0.0.0-...-041cb62 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppNameToutiao     = "toutiao"
	AppNameToutiaoLite = "toutiao_lite"
	AppNameDouyin      = "douyin"
	AppNameDouyinLite  = "douyin_lite"
	AppNamePipixia     = "pipixia"
	AppNameHuoshan     = "huoshan"
	AppNameXigua       = "xigua"
)

Variables

This section is empty.

Functions

func CreateQRCode

func CreateQRCode(accessToken, appname, path string) []byte

CreateQRCode 获取 AccessToken 获取小程序/小游戏的二维码。该二维码可通过任意 app 扫码打开,能跳转到开发者指定的对应字节系 app 内拉起小程序/小游戏, 并传入开发者指定的参数。通过该接口生成的二维码,永久有效,暂无数量限制。 see https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/qr-code/create-qr-code

Types

type Code2SessionResp

type Code2SessionResp struct {
	ErrNo   int    `json:"err_no"`
	ErrTips string `json:"err_tips"`
	Data    struct {
		SessionKey      string `json:"session_key"`
		Openid          string `json:"openid"`
		AnonymousOpenid string `json:"anonymous_openid"`
		Unionid         string `json:"unionid"`
	} `json:"data"`
}

func Code2Session

func Code2Session(appid, secret string, code, anonymousCode string) Code2SessionResp

Code2Session 获取 AccessToken 通过login接口获取到登录凭证后,开发者可以通过服务器发送请求的方式获取 session_key 和 openId。 登录凭证 code,anonymous_code 只能使用一次,非匿名需要 code,非匿名下的 anonymous_code 用于数据同步,匿名需要 anonymous_code。 see https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/log-in/code-2-session

type DecryptUserInfoResp

type DecryptUserInfoResp struct {
	NickName  string `json:"nickName"`
	AvatarUrl string `json:"avatarUrl"`
	Gender    int    `json:"gender"`   // 用户性别,0: 未知;1:男性;2:女性
	City      string `json:"city"`     // 用户所在城市
	Province  string `json:"province"` // 用户所在省份
	Country   string `json:"country"`  //	用户所在国家
	OpenId    string `json:"openId"`   //	用户 openId
	Watermark struct {
		Appid     string `json:"appid"`
		Timestamp int    `json:"timestamp"`
	} //敏感数据水印
}

func DecryptUserInfo

func DecryptUserInfo(encryptedData, sessionKey, iv string) DecryptUserInfoResp

type GetAccessTokenResp

type GetAccessTokenResp struct {
	ErrNo   int    `json:"err_no"`
	ErrTips string `json:"err_tips"`
	Data    struct {
		AccessToken string `json:"access_token"`
		ExpiresIn   int    `json:"expires_in"`
	} `json:"data"`
}

func GetAccessToken

func GetAccessToken(appid, secret string) GetAccessTokenResp

GetAccessToken 获取 AccessToken access_token 是小程序的全局唯一调用凭据,开发者调用小程序支付时需要使用 access_token。 access_token 的有效期为 2 个小时,需要定时刷新 access_token,重复获取会导致之前一次获取的 access_token 的有效期缩短为 5 分钟。 see https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/interface-request-credential/get-access-token

Jump to

Keyboard shortcuts

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