httpapi

package
v0.0.0-...-288620e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WithJWT = F.Flow2(
		S.Format[string]("JWT %s"),
		B.WithAuthorization,
	)
	WithToken = F.Flow2(
		S.Format[string]("Token %s"),
		B.WithAuthorization,
	)
	MakeHTTPRequest = F.Bind13of3(H.MakeRequest)
)

Functions

func CommonHeader

func CommonHeader(lreq *http.Request, token, format string)

func ReqToResponse

func ReqToResponse(creq *http.Request) (*http.Response, error)

func SetHeaderWith

func SetHeaderWith(req *http.Request) *http.Request

func SetHeaderWithJWT

func SetHeaderWithJWT(jwt string) func(*http.Request) *http.Request

func SetHeaderWithToken

func SetHeaderWithToken(token string) func(*http.Request) *http.Request

Types

type JSONPayload

type JSONPayload struct {
	Error   error
	Payload []byte
}

func OnJSONPayloadError

func OnJSONPayloadError(err error) JSONPayload

func OnJSONPayloadSuccess

func OnJSONPayloadSuccess(resp []byte) JSONPayload

type ResponseFeedback

type ResponseFeedback struct {
	Err error
	Msg string
}

type TokenManager

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

func NewTokenManager

func NewTokenManager(
	host, tokenFile string,
) (*TokenManager, error)

func (*TokenManager) FreshToken

func (tkm *TokenManager) FreshToken() (string, error)

func (*TokenManager) RefreshTokenURL

func (tkm *TokenManager) RefreshTokenURL() string

Jump to

Keyboard shortcuts

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