api

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AuthorizationHeaderName   = "Authorization"
	BearerAuthorizationPrefix = "Bearer "
)

Variables

View Source
var (
	Routes = endpoints{
		// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type CertificateVerifyMode added in v1.6.0

type CertificateVerifyMode int
const (
	// Default: Always verify server certificate, unless the BaseURL is overridden to a value
	// that uses an ip address, localhost, or a custom port
	CertificateVerifyAutomatic CertificateVerifyMode = iota

	// Secure: Always verify server certificate, this is only needed if you override
	// the default BaseURL and the automatic behavior isn't suitable
	CertificateVerifyAlways

	// Insecure: Never verify server certificate
	CertificateVerifyNever
)

func (CertificateVerifyMode) SkipVerifyValue added in v1.6.0

func (mode CertificateVerifyMode) SkipVerifyValue(baseURL string) bool

type Client

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

func NewClient

func NewClient(conf ClientParams) *Client

func (*Client) DoDeleteRequest added in v1.1.0

func (c *Client) DoDeleteRequest(ctx context.Context, uri string, options *HTTPRequest, pswd string) (*HTTPResponse, error)

func (*Client) DoGetRequest

func (c *Client) DoGetRequest(ctx context.Context, uri string, options *HTTPRequest, pswd string) (*HTTPResponse, error)

func (*Client) DoPostRequest

func (c *Client) DoPostRequest(ctx context.Context, uri string, body interface{}, options *HTTPRequest, pswd string) (*HTTPResponse, error)

func (*Client) DoRequest

func (c *Client) DoRequest(ctx context.Context, method, uriPath string, body io.Reader, options *HTTPRequest, pswd string) (*HTTPResponse, error)

type ClientParams

type ClientParams struct {
	ProjectID            string
	BaseURL              string
	DefaultClient        IHttpClient
	CustomDefaultHeaders map[string]string
	CertificateVerify    CertificateVerifyMode
	RequestTimeout       time.Duration
}

type HTTPRequest

type HTTPRequest struct {
	Headers     map[string]string
	QueryParams map[string]string
	BaseURL     string
	ResBodyObj  interface{}
	Request     *http.Request
	Cookies     []*http.Cookie
}

type HTTPResponse

type HTTPResponse struct {
	Req     *http.Request
	Res     *http.Response
	BodyStr string
}

type IHttpClient

type IHttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

Jump to

Keyboard shortcuts

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