api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheFirst

func CacheFirst(objCache cache.ObjectCache, retrieveFunc RetrieveFunc) (string, error)

func CheckResult

func CheckResult(result Result, url string, request ...any) error

func Get

func Get[RESULT any](url string, request ...any) (RESULT, error)

func Post

func Post[RESULT any](url string, request ...any) (RESULT, error)

func PostResponse

func PostResponse(url string, request ...any) ([]byte, error)

PostResponse http post and get response

Types

type API

type API interface {
	GetAccessToken() (string, error)
	GetAppId() string
	GetAppSecret() string
}

func New

func New(appId, appSecret string, redisProvider ...types.RedisProvider) API

type AccessTokenResult

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

type Result

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

type RetrieveFunc

type RetrieveFunc func() (string, int, error) // 返回值,过期时间

Directories

Path Synopsis
wx
wx
wx
wx
wx

Jump to

Keyboard shortcuts

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