api

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 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 added in v0.2.0

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

func CheckResult added in v0.2.0

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

func Get added in v0.2.0

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

func Post added in v0.2.0

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

func PostResponse added in v0.2.0

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

PostResponse http post and get response

Types

type API added in v0.2.0

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 added in v0.0.4

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

type RetrieveFunc added in v0.2.0

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