douyin

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResp added in v1.8.0

type AccessTokenResp struct {
	Data struct {
		AccessToken      string `json:"access_token"`
		Description      string `json:"description"`
		ErrorCode        int    `json:"error_code"`
		ExpiresIn        string `json:"expires_in"`
		OpenId           string `json:"open_id"`
		RefreshExpiresIn string `json:"refresh_expires_in"`
		RefreshToken     string `json:"refresh_token"`
		Scope            string `json:"scope"`
	} `json:"data"`
	Message string `json:"message"`
	Extra   struct {
		Logid string `json:"logid"`
		Now   int64  `json:"now"`
	} `json:"extra"`
}

AccessTokenResp is the response of access token.

type Douyin

type Douyin struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Douyin

func (*Douyin) DecryptUserPhone added in v1.8.3

func (douyin *Douyin) DecryptUserPhone(encryptedPhone string) (string, error)

DecryptUserPhone 解密用户手机号 文档 https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-management/phone-number-decode-demo

func (*Douyin) GetAssessToken added in v1.8.0

func (douyin *Douyin) GetAssessToken(code string) (*AccessTokenResp, error)

GetAssessToken 获取授权码 文档 https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/get-access-token

func (*Douyin) GetUserinfo added in v1.8.2

func (douyin *Douyin) GetUserinfo(accessToken, openid string) (*UserinfoResp, error)

GetUserinfo 获取用户信息 文档 https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-management/get-account-open-info

func (*Douyin) Provide

func (douyin *Douyin) Provide(ctx context.Context) interface{}

type Option

type Option func(*Options)

func WithClientKey added in v1.8.0

func WithClientKey(clientKey string) Option

func WithClientSecret added in v1.8.0

func WithClientSecret(clientSecret string) Option

type Options

type Options struct {
	ClientKey    string
	ClientSecret string
}

type UserinfoResp added in v1.8.2

type UserinfoResp struct {
	Data struct {
		Avatar        string `json:"avatar"`
		AvatarLarger  string `json:"avatar_larger"`
		ClientKey     string `json:"client_key"`
		EAccountRole  string `json:"e_account_role"`
		ErrorCode     int    `json:"error_code"`
		LogId         string `json:"log_id"`
		Nickname      string `json:"nickname"`
		OpenId        string `json:"open_id"`
		UnionId       string `json:"union_id"`
		EncryptMobile string `json:"encrypt_mobile"`
		Description   string `json:"description"`
	} `json:"data"`
	Extra struct {
		Logid string `json:"logid"`
		Now   int64  `json:"now"`
	} `json:"extra"`
	Message string `json:"message"`
}

UserinfoResp is the response of user info.

Jump to

Keyboard shortcuts

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