httpx

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken      string `json:"access_token"`
	RefreshToken     string `json:"refresh_token"`
	ExpiresIn        int    `json:"expires_in"`
	TokenType        string `json:"token_type"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig) (c *Client, err error)

func (*Client) Close added in v0.5.1

func (h *Client) Close()

func (*Client) Do

func (h *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) GetEndpoint

func (h *Client) GetEndpoint() constants.Endpoint

type ClientConfig

type ClientConfig struct {
	HTTPClient         HTTPRequester
	TokenUpdaterConfig TokenUpdaterConfig
	Endpoint           constants.Endpoint
}

type HTTPRequester added in v0.6.4

type HTTPRequester interface {
	Do(req *http.Request) (*http.Response, error)
	Post(url string, bodyType string, body io.Reader) (*http.Response, error)
}

type PeriodicTokenUpdater added in v0.6.4

type PeriodicTokenUpdater struct {
	// contains filtered or unexported fields
}

func (*PeriodicTokenUpdater) GetAccessToken added in v0.6.4

func (t *PeriodicTokenUpdater) GetAccessToken() string

GetAccessToken returns the current access-token

func (*PeriodicTokenUpdater) RunInBackground added in v0.6.4

func (t *PeriodicTokenUpdater) RunInBackground() (cancel func(), err error)

RunInBackground starts a goroutine that fetches a new access token periodically and stores it in the client. The goroutine is stopped when the returned cancel function is called.

type TokenUpdaterConfig

type TokenUpdaterConfig struct {
	RefreshToken string
	ClientID     string
	ClientSecret string
	HTTPClient   HTTPRequester
	Logger       logger.Logger
}

Jump to

Keyboard shortcuts

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