base

package
v0.0.0-...-15a7b9f Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Cache *gcache.Cache
	// Appid       string
	// Secret      string
	TokenKey        string //请求结果中
	RequestTokenKey string //请求时的 获取token key 与请求时不一致时设置,例如第三方平台带小程序公众号请求

	CacheKey          string
	Credentials       TokenCredentail
	EndPoint          string
	RequestPostMethod bool
	Client            *Client
	// contains filtered or unexported fields
}

AccessToken

func (*AccessToken) GetRequestTokenKey

func (at *AccessToken) GetRequestTokenKey() string

GetRequestTokenKey

func (*AccessToken) GetToken

func (at *AccessToken) GetToken(refresh ...bool) string

GetToken

func (*AccessToken) GetTokenKey

func (at *AccessToken) GetTokenKey() string

GetTokenKey

func (*AccessToken) Refresh

func (at *AccessToken) Refresh() *AccessToken

Refresh

func (*AccessToken) SetToken

func (at *AccessToken) SetToken(token string, lifetime time.Duration) *AccessToken

SetToken

type Client

type Client struct {
	Client    *ghttp.Client
	BaseUri   string
	UrlValues url.Values
	Logger    *log.Logger
	Token     auth.AccessToken
}

func (*Client) GetJson

func (c *Client) GetJson(endpoint string, data ...interface{}) *gjson.Json

//GetJson request by get method and return gjson.Json ***Deprecated use RequestJson instead

func (*Client) PostJson

func (c *Client) PostJson(endpoint string, data ...interface{}) *gjson.Json

PostJson request by post method and return gjson.Json **** Deprecated use RequestJson instead

func (*Client) RequestJson

func (c *Client) RequestJson(method string, endpoint string, data ...interface{}) *gjson.Json

request return json

func (*Client) RequestPost

func (c *Client) RequestPost(endpoint string, data ...interface{}) *gjson.Json

request Post retrun Json !!!上传文件图片 内容安全等接口用 配合 @file:

func (*Client) RequestRaw

func (c *Client) RequestRaw(method string, endpoint string, data ...interface{}) []byte

Request return Raw

type Response

type Response struct {
	Status     string
	StatusCode int
	Header     http.Header
	Body       []byte
}

func (*Response) ReadAll

func (r *Response) ReadAll() []byte

ReadAll

func (*Response) ReadAllString

func (r *Response) ReadAllString() string

ReadAllString

type Token

type Token struct {
}

type TokenCredentail

type TokenCredentail interface {
	Get() map[string]string
}

Jump to

Keyboard shortcuts

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