oauth

package
v0.0.0-...-905ac7b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetTokenRequest

type GetTokenRequest struct {
	BusinessId int    //api对应的业务id,请参考API文档的说明赋值
	Code       string //OAuth授权码,通过授权回调链接从美团获取
}

func NewGetTokenRequest

func NewGetTokenRequest(businessId int, code string) GetTokenRequest

创建一个新的GetTokenRequest

func (GetTokenRequest) GetToken

func (req GetTokenRequest) GetToken(client mtclient.MeituanClient) (*TokenResponse, error)

GetToken 此方法用于通过授权码获取token

type RefreshTokenRequest

type RefreshTokenRequest struct {
	BusinessId   int    //api对应的业务id,请参考API文档的说明赋值
	RefreshToken string //获取token时同时获得的refreshToken
}

func NewRefreshTokenRequest

func NewRefreshTokenRequest(businessId int, refreshToken string) RefreshTokenRequest

创建一个新的RefreshTokenRequest

func (RefreshTokenRequest) TokenRefresh

func (req RefreshTokenRequest) TokenRefresh(client mtclient.MeituanClient) (*TokenResponse, error)

TokenRefresh 此方法用于用于刷新token

type TokenData

type TokenData struct {
	AccessToken  string
	ExpireIn     int
	RefreshToken string
	Scope        string
	OpBizCode    string
}

type TokenResponse

type TokenResponse struct {
	Code    int
	Msg     string
	Data    TokenData
	TraceId string
}

func (*TokenResponse) IsSuccess

func (response *TokenResponse) IsSuccess() bool

Jump to

Keyboard shortcuts

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