httpclient

package
v0.1.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGET    = "GET"
	MethodPOST   = "POST"
	MethodPUT    = "PUT"
	MethodPATCH  = "PATCH"
	MethodDELETE = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Do(req Request) (Response, error)
}

func New

func New(baseURL string, apiKey string) Client

type Request

type Request struct {
	BaseURL string
	Method  string
	Path    string
	Body    map[string]interface{}
	Headers map[string]string
}

func (*Request) ToHTTPRequest

func (r *Request) ToHTTPRequest(baseURL string) (*http.Request, error)

type Response

type Response struct {
	StatusCode int          `json:"statusCode"`
	Body       ResponseBody `json:"body"`
}

func (*Response) FromHTTPResponse

func (r *Response) FromHTTPResponse(resp *http.Response) error

func (*Response) MatchBody

func (r *Response) MatchBody(body ResponseBody) bool

type ResponseBody

type ResponseBody = interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳