api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResult

type AccessTokenResult struct {
	ApiResult
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type Api

type Api struct {
	Kind      ApiKind
	AppId     string
	AppSecret string
	Cache     Cache
}

func New

func New(kind ApiKind, appId, appSecret string, providers ...intf.Provider) (*Api, error)

func (*Api) GetAccessToken

func (a *Api) GetAccessToken() (string, error)

func (*Api) ParseApiResult

func (a *Api) ParseApiResult(data []byte, result any) error

type ApiCommon

type ApiCommon interface {
	GetAccessToken() (string, error)
}

type ApiKind

type ApiKind int // 微信业务类型
const (
	ApiKindUnknown ApiKind = iota
	ApiKindWxmp            // 微信小程序
	ApiKindWxoa            // 微信公众号
	ApiKindWxopen          // 微信开放平台
)

type ApiResult

type ApiResult struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

ApiResult 微信的API结果

type Cache

type Cache interface {
	Get(key string) (string, error)
	Set(key, value string, expires ...int) error
}

Jump to

Keyboard shortcuts

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