client

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

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

func NewRequest

func NewRequest(config *client.Config, json foundation.Json) *Request

func (*Request) Accept

func (r *Request) Accept(contentType string) client.Request

func (*Request) AcceptJSON

func (r *Request) AcceptJSON() client.Request

func (*Request) AsForm

func (r *Request) AsForm() client.Request

func (*Request) Bind

func (r *Request) Bind(value any) client.Request

func (*Request) Clone

func (r *Request) Clone() client.Request

func (*Request) Delete

func (r *Request) Delete(uri string, body io.Reader) (client.Response, error)

func (*Request) FlushHeaders

func (r *Request) FlushHeaders() client.Request

func (*Request) Get

func (r *Request) Get(uri string) (client.Response, error)

func (*Request) Head

func (r *Request) Head(uri string) (client.Response, error)

func (*Request) Options

func (r *Request) Options(uri string) (client.Response, error)

func (*Request) Patch

func (r *Request) Patch(uri string, body io.Reader) (client.Response, error)

func (*Request) Post

func (r *Request) Post(uri string, body io.Reader) (client.Response, error)

func (*Request) Put

func (r *Request) Put(uri string, body io.Reader) (client.Response, error)

func (*Request) ReplaceHeaders

func (r *Request) ReplaceHeaders(headers map[string]string) client.Request

func (*Request) WithBasicAuth

func (r *Request) WithBasicAuth(username, password string) client.Request

func (*Request) WithContext

func (r *Request) WithContext(ctx context.Context) client.Request

func (*Request) WithCookie

func (r *Request) WithCookie(cookie *http.Cookie) client.Request

func (*Request) WithCookies

func (r *Request) WithCookies(cookies []*http.Cookie) client.Request

func (*Request) WithHeader

func (r *Request) WithHeader(key, value string) client.Request

func (*Request) WithHeaders

func (r *Request) WithHeaders(headers map[string]string) client.Request

func (*Request) WithQueryParameter

func (r *Request) WithQueryParameter(key, value string) client.Request

func (*Request) WithQueryParameters

func (r *Request) WithQueryParameters(params map[string]string) client.Request

func (*Request) WithQueryString

func (r *Request) WithQueryString(query string) client.Request

func (*Request) WithToken

func (r *Request) WithToken(token string, ttype ...string) client.Request

func (*Request) WithUrlParameter

func (r *Request) WithUrlParameter(key, value string) client.Request

func (*Request) WithUrlParameters

func (r *Request) WithUrlParameters(params map[string]string) client.Request

func (*Request) WithoutHeader

func (r *Request) WithoutHeader(key string) client.Request

func (*Request) WithoutToken

func (r *Request) WithoutToken() client.Request

type Response

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

func NewResponse

func NewResponse(response *http.Response, json foundation.Json) *Response

func (*Response) Accepted

func (r *Response) Accepted() bool

Accepted checks if the status code is 202.

func (*Response) BadRequest

func (r *Response) BadRequest() bool

BadRequest checks if the status code is 400.

func (*Response) Body

func (r *Response) Body() (string, error)

func (*Response) ClientError

func (r *Response) ClientError() bool

func (*Response) Conflict

func (r *Response) Conflict() bool

Conflict checks if the status code is 409.

func (*Response) Cookie

func (r *Response) Cookie(name string) *http.Cookie

func (*Response) Cookies

func (r *Response) Cookies() []*http.Cookie

func (*Response) Created

func (r *Response) Created() bool

Created checks if the status code is 201.

func (*Response) Failed

func (r *Response) Failed() bool

func (*Response) Forbidden

func (r *Response) Forbidden() bool

Forbidden checks if the status code is 403.

func (*Response) Found

func (r *Response) Found() bool

Found checks if the status code is 302.

func (*Response) Header

func (r *Response) Header(name string) string

func (*Response) Headers

func (r *Response) Headers() http.Header

func (*Response) Json

func (r *Response) Json() (map[string]any, error)

func (*Response) MovedPermanently

func (r *Response) MovedPermanently() bool

MovedPermanently checks if the status code is 301.

func (*Response) NoContent

func (r *Response) NoContent() bool

NoContent checks if the status code is 204.

func (*Response) NotFound

func (r *Response) NotFound() bool

NotFound checks if the status code is 404.

func (*Response) OK

func (r *Response) OK() bool

OK checks if the status code is 200.

func (*Response) PaymentRequired

func (r *Response) PaymentRequired() bool

PaymentRequired checks if the status code is 402.

func (*Response) Redirect

func (r *Response) Redirect() bool

func (*Response) RequestTimeout

func (r *Response) RequestTimeout() bool

RequestTimeout checks if the status code is 408.

func (*Response) ServerError

func (r *Response) ServerError() bool

func (*Response) Status

func (r *Response) Status() int

func (*Response) Successful

func (r *Response) Successful() bool

func (*Response) TooManyRequests

func (r *Response) TooManyRequests() bool

TooManyRequests checks if the status code is 429.

func (*Response) Unauthorized

func (r *Response) Unauthorized() bool

Unauthorized checks if the status code is 401.

func (*Response) UnprocessableEntity

func (r *Response) UnprocessableEntity() bool

UnprocessableEntity checks if the status code is 422.

Jump to

Keyboard shortcuts

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