urllink

package
v0.0.0-...-95bb97b Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateReq

type GenerateReq struct {
	AccessToken string `json:"access_token"` // 必选, 小程序 access_token
	MaAppId     string `json:"ma_app_id"`    // 必选, 小程序的 id
	AppName     string `json:"app_name"`     // 必选, 宿主名称,可选 douyin,douyinlite
	Path        string `json:"path"`         // 可选, 通过URL Link进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query。path 为空时会跳转小程序主页。
	Query       string `json:"query"`        // 可选, 通过URL Link进入小程序时的 query(json形式),若无请填{}。最大1024个字符,只支持数字,大小写英文以及部分特殊字符:`{}!#$&'()*+,/:;=?@-._~%“。
	ExpireTime  string `json:"expire_time"`  // 必选, 到期失效的URL Link的失效时间。为 Unix 时间戳,实际失效时间为距离当前时间小时数,向上取整。最长间隔天数为180天。
}

type GenerateResp

type GenerateResp struct {
	ErrNo   int64  `json:"err_no"`
	ErrTips string `json:"err_tips"`
	UrlLink string `json:"url_link"`
}

type QueryInfoInfo

type QueryInfoInfo struct {
	// AppName 宿主名称,douyin,douyinlite
	AppName string `json:"app_name"`
	// MaAppId 小程序ID
	MaAppId string `json:"ma_app_id"`
	// Path 小程序页面路径。
	Path string `json:"path"`
	// Query 小程序页面query。
	Query string `json:"query"`
	// CreateTime 创建时间,为 Unix 时间戳
	CreateTime int `json:"create_time"`
	// ExpireTime 到期失效时间,为 Unix 时间戳
	ExpireTime int `json:"expire_time"`
}

type QueryInfoReq

type QueryInfoReq struct {
	AccessToken string `json:"access_token"` // 必选, 小程序 access_token
	MaAppId     string `json:"ma_app_id"`    // 必选, 小程序的 id
	UrlLink     string `json:"url_link"`     // 必选, 生成的url_link
}

type QueryInfoResp

type QueryInfoResp struct {
	ErrNo       int            `json:"err_no"`
	ErrTips     string         `json:"err_tips"`
	UrlLinkInfo *QueryInfoInfo `json:"url_link_info"`
}

type QueryQuotaReq

type QueryQuotaReq struct {
	AccessToken string `json:"access_token"` // 必选, 小程序 access_token
	MaAppId     string `json:"ma_app_id"`    // 必选, 小程序的 id
}

type QueryQuotaResp

type QueryQuotaResp struct {
	ErrNo        int           `json:"err_no"`
	ErrTips      string        `json:"err_tips"`
	UrlLinkQuota *UrlLinkQuota `json:"url_link_quota"`
}

type SDK

type SDK struct {
	HttpCli   *http.Client
	AppID     string
	IsSandBox bool
}

func (*SDK) Generate

func (sdk *SDK) Generate(ctx context.Context, req *GenerateReq) (*GenerateResp, error)

Generate 该接口用于生成能够直接跳转到端内小程序的 url link。

func (*SDK) QueryInfo

func (sdk *SDK) QueryInfo(ctx context.Context, req *QueryInfoReq) (*QueryInfoResp, error)

QueryInfo 该接口用于查询已经生成的 link 的信息。

func (*SDK) QueryQuota

func (sdk *SDK) QueryQuota(ctx context.Context, req *QueryQuotaReq) (*QueryQuotaResp, error)

QueryQuota 该接口用于查询当前小程序配额。

type UrlLinkQuota

type UrlLinkQuota struct {
	// UrlLinkUsed url_link 已生成次数
	UrlLinkUsed string `json:"app_name"`
	// UrlLinkLimit url_link 生成次数上限
	UrlLinkLimit string `json:"ma_app_id"`
}

Jump to

Keyboard shortcuts

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