client

package
v0.0.0-...-72cdef8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet    = "GET"
	MethodPost   = "POST"
	MethodPut    = "PUT"
	MethodPatch  = "PATCH"
	MethodDelete = "DELETE"
)

Declare constants for service package

Variables

This section is empty.

Functions

func NewRizhiyidHTTPClient

func NewRizhiyidHTTPClient(timeout time.Duration, skipValidateTLS bool) (*http.Client, error)

NewRizhiyidHTTPClient returns a HTTP Client with timeout and tls validation setup

Types

type Client

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

A Client is used to communicate with rizhiyi endpoints

func NewDefaultRizhiyidClient

func NewDefaultRizhiyidClient() (*Client, error)

NewDefaultRizhiyidClient creates a Client with default values

func NewRizhiyidClient

func NewRizhiyidClient(sessionKey string, auth [2]string, host string, httpClient *http.Client) (*Client, error)

NewRizhiyidClient creates a Client with custom values passed in

func NewRizhiyidClientWithAuthToken

func NewRizhiyidClientWithAuthToken(authToken string, auth [2]string, host string, httpClient *http.Client) (*Client, error)

NewRizhiyidClient creates a Client with custom values passed in

func (*Client) BuildRizhiyiURL

func (c *Client) BuildRizhiyiURL(queryValues url.Values, urlPathParts ...string) url.URL

func (*Client) Delete

func (c *Client) Delete(deleteURL url.URL) (*http.Response, error)

Delete implements HTTP DELETE call

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do sends out request and returns HTTP response

func (*Client) DoRequest

func (c *Client) DoRequest(method string, requestURL url.URL, body interface{}) (*http.Response, error)

DoRequest creates and execute a new request

func (*Client) EncodeObject

func (c *Client) EncodeObject(content interface{}) ([]byte, error)

EncodeObject encodes an object into url-encoded string

func (*Client) EncodeRequestBody

func (c *Client) EncodeRequestBody(content interface{}) ([]byte, error)

EncodeRequestBody takes a json string or object and serializes it to be used in request body

func (*Client) Get

func (c *Client) Get(getURL url.URL) (*http.Response, error)

Get implements HTTP Get call

func (*Client) Login

func (c *Client) Login() (e error)

func (*Client) NewRequest

func (c *Client) NewRequest(httpMethod, url string, body io.Reader) (*http.Request, error)

NewRequest creates a new HTTP Request and set proper header

func (*Client) Patch

func (c *Client) Patch(patchURL url.URL, body interface{}) (*http.Response, error)

Patch implements HTTP Patch call

func (*Client) Post

func (c *Client) Post(postURL url.URL, body interface{}) (*http.Response, error)

Post implements HTTP POST call

func (*Client) Put

func (c *Client) Put(putURL url.URL, body interface{}) (*http.Response, error)

Put implements HTTP PUT call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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