restful

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName = "JSESSOINID"
)

Variables

This section is empty.

Functions

func ParseURI

func ParseURI(url *url.URL, uri string) string

func ParseURL

func ParseURL(s string) (*url.URL, error)

ParseURL is wrapper around url.Parse, where Scheme defaults to "https" and Path defaults to "/"

Types

type Client

type Client struct {
	HttpClient *resty.Client

	Namespace string // ics internal
	Version   string //  ics api version

	Authorization   string
	AccessKeyID     string
	AccessKeySecret string
	CheckParams     string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(u *url.URL, insecure bool) *Client

func (*Client) DeleteTrip

func (c *Client) DeleteTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)

func (*Client) GetAccessKey added in v1.0.5

func (c *Client) GetAccessKey() string

func (*Client) GetToken

func (c *Client) GetToken() string

func (*Client) GetTrip

func (c *Client) GetTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)

func (*Client) PostTrip

func (c *Client) PostTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)

func (*Client) PutTrip

func (c *Client) PutTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)

func (*Client) SetAccessKey added in v1.0.5

func (c *Client) SetAccessKey(keyID string, keySecret string)

func (*Client) SetCheckParams added in v1.0.9

func (c *Client) SetCheckParams(checkParams string)

func (*Client) SetToken

func (c *Client) SetToken(token string)

func (*Client) URL

func (c *Client) URL() *url.URL

type Error

type Error struct {
}

type Response

type Response struct {
	RawResponse *http.Response
	// contains filtered or unexported fields
}

func (*Response) Body

func (r *Response) Body() []byte

func (*Response) IsError

func (r *Response) IsError() bool

IsError method returns true if HTTP status `code >= 400` otherwise false.

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

IsSuccess method returns true if HTTP status `code >= 200 and <= 299` otherwise false.

func (*Response) RawBody

func (r *Response) RawBody() io.ReadCloser

func (*Response) Status

func (r *Response) Status() string

func (*Response) StatusCode

func (r *Response) StatusCode() int

type RestAPITripper

type RestAPITripper interface {
	GetTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)
	PostTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)
	PutTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)
	DeleteTrip(ctx context.Context, api types.ICSApi, req interface{}) (*Response, error)
}

Jump to

Keyboard shortcuts

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