entity

package
v0.0.0-...-785f0e5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCResponse

type GRPCResponse struct {
	Response
}

type HTTPMethod

type HTTPMethod string
const (
	GET    HTTPMethod = "GET"
	POST   HTTPMethod = "POST"
	PUT    HTTPMethod = "PUT"
	DELETE HTTPMethod = "DELETE"
)

type HTTPRequest

type HTTPRequest struct {
	Url     string            `json:"url"`
	Headers map[string]string `json:"headers"`
	// allow redirect to another url
	AllowRedirect bool `json:"allowRedirect"`
	// request body
	Body    any        `json:"body"`
	Method  HTTPMethod `json:"method"`
	Timeout int        `json:"timeout"`
}

type HTTPResponse

type HTTPResponse struct {
	*Response
	Error      error
	StatusCode int `json:"statusCode"`
	//ResponseHeaders map[string]string `json:"responseHeaders"`
	Headers map[string]string `json:"headers"`
	Elapsed int64             `json:"elapsed"`
	Request *HTTPRequest      `json:"request"`
}

type RequestOption

type RequestOption func(h *HTTPRequest)

func WithBody

func WithBody(data any) RequestOption

func WithHeader

func WithHeader(key, value string) RequestOption

func WithHeaderString

func WithHeaderString(data string) RequestOption

func WithHeaders

func WithHeaders(kv map[string]string) RequestOption

func WithQuery

func WithQuery(query map[string]string) RequestOption

func WithRedirect

func WithRedirect(redirect bool) RequestOption

func WithTimeout

func WithTimeout(timeout int) RequestOption

type Response

type Response struct {
	Data string `json:"data"`
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(success bool, raw []byte) *Response

func (*Response) JSON

func (r *Response) JSON(out interface{}) error

func (*Response) Text

func (r *Response) Text() string

Jump to

Keyboard shortcuts

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