client

package
v1.1.1-0...-115938a Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(baseURL string) (c *Client)

func (*Client) Execute

func (c *Client) Execute(method, url string, prepareRequestFunc PrepareRequestFunc) (resp *resty.Response, err error)

Executes a request, automatically resolving timed out API token problems and retrying.

func (*Client) Login

func (c *Client) Login(loginParams LoginParams) (token string, err error)

type LoginParams

type LoginParams struct {
	Username string
	Password string
	Lifetime int
}

type PrepareRequestFunc

type PrepareRequestFunc func(request *resty.Request) *resty.Request

type Response

type Response struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Response is the default json return of the cmdb upon any request success or error

type ResponseError

type ResponseError struct {
	Response
}

ResponseError is used for the resty SetError Function as a reference to capture the error message on failure

func (ResponseError) Error

func (res ResponseError) Error() string

Jump to

Keyboard shortcuts

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