wechat

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AppID is ClientID is the application's ID.
	// ClientID string
	AppID string

	// ClientSecret is the application's secret.
	Secret string

	// Endpoint contains the resource server's token endpoint
	// URLs. These are constants specific to each server and are
	// often available via site-specific packages, such as
	// google.Endpoint or github.Endpoint.
	Endpoint Endpoint

	// RedirectURL is the URL to redirect users going through
	// the OAuth flow, after the resource owner's URLs.
	// RedirectURL string
	RedirectUri string

	// Scope specifies optional requested permissions.
	Scopes []string

	// State
	State string

	// Lang
	Lang string
}

func (*Config) GetAuthUrl

func (c *Config) GetAuthUrl() string

func (*Config) GetTokenFromCode

func (c *Config) GetTokenFromCode(ctx context.Context, code string) (token *gjson.Json)

GetTokenFromCode

func (*Config) GetUserByToken

func (c *Config) GetUserByToken(ctx context.Context, token string) (user *core.User, err error)

GetUserFromToken

func (*Config) SetScopes

func (c *Config) SetScopes(scopes []string)

func (*Config) SetState

func (c *Config) SetState(state ...string)

func (*Config) UserFromCode

func (c *Config) UserFromCode(ctx context.Context, code string) (user *core.User, err error)

type Endpoint

type Endpoint struct {
	AuthURL  string
	TokenURL string
}

type OpenplatformConfig

type OpenplatformConfig struct{}

type User

type User struct {
	Raw      *gjson.Json
	ID       string
	Name     string
	NickName string
	Avatar   string
	Email    string
	Error    error
}

User

func (*User) ContainsError

func (u *User) ContainsError() bool

是否包含错误信息

func (*User) GetAccessToken

func (u *User) GetAccessToken() string

GetAccessToken

func (*User) GetAvatar

func (u *User) GetAvatar() string

GetAvatar

func (*User) GetEmail

func (u *User) GetEmail() string

GetEmail

func (*User) GetErrorCode

func (u *User) GetErrorCode() gcode.Code

func (*User) GetExpiresIn

func (u *User) GetExpiresIn() int

GetExpiresIn

func (*User) GetID

func (u *User) GetID() string

GetID

func (*User) GetName

func (u *User) GetName() string

GetName

func (*User) GetNickName

func (u *User) GetNickName() string

GetNickName

func (*User) GetRaw

func (u *User) GetRaw() *gjson.Json

GetRaw return *gjson.Json 具体用法查看 github.com/gogf/gf/encoding/gjson

func (*User) GetRefreshToken

func (u *User) GetRefreshToken() string

GetRefreshToken

func (*User) SetAccessToken

func (u *User) SetAccessToken(token string) error

SetAccessToken

func (*User) SetExpiresIn

func (u *User) SetExpiresIn(expiresIn int) error

SetExpiresIn

func (*User) SetRefreshToken

func (u *User) SetRefreshToken(token string) error

SetRefreshTokne

type WechatError

type WechatError struct {
	ErrCode int
	ErrMsg  string
}

func (*WechatError) Contains

func (e *WechatError) Contains() bool

Contains err

Jump to

Keyboard shortcuts

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