Documentation ¶
Index ¶
- Variables
- func AcceptAndContentTypeHeader(accept string, contentType string) map[string][]string
- func AcceptHeader(accept string) map[string][]string
- func ContentTypeHeader(contentType string) map[string][]string
- func ContentTypeHeaderAndContentLength(contentType string, contentLength int) map[string][]string
- func EmptyHeader() map[string][]string
- func JsonFromObject(o interface{}) ([]byte, error)
- func ObjectFromJson(j []byte, targetStruct interface{}) error
- func PageSizeParameter(pageSize int, params *url.Values) error
- type Client
- func (client *Client) Delete(path string, header map[string][]string) ([]byte, int, error)
- func (client *Client) Get(path string, header map[string][]string) ([]byte, int, error)
- func (client *Client) Post(path string, body []byte, header map[string][]string) ([]byte, int, error)
- func (client *Client) Put(path string, body []byte, header map[string][]string) ([]byte, int, error)
- type Error
- type PagingStatistics
- type Tag
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessDeniedErr = errors.New("access denied")
View Source
var BadCredentialsErr = errors.New("bad credentials")
View Source
var ErrorContentType = "application/vnd.com.nsn.cumulocity.error+json"
Functions ¶
func AcceptHeader ¶
Returns a pre filled header map with an "Accept" header.
func ContentTypeHeader ¶
func JsonFromObject ¶
func ObjectFromJson ¶
Takes a json as []byte and a pointer of the target struct Returns an error, otherwise fills the `targetStruct` reference with values.
Types ¶
type Error ¶
type Error struct { ErrorType string `json:"error"` Message string `json:"message"` Info string `json:"info"` }
Error represent cumulocity's 'application/vnd.com.nsn.cumulocity.error+json' without 'Error details'. See: https://cumulocity.com/guides/reference/rest-implementation/#error-application-vnd-com-nsn-cumulocity-error-json
func ClientError ¶
func CreateErrorFromResponse ¶
type PagingStatistics ¶
type PagingStatistics struct { TotalRecords int `json:"totalRecords,omitempty"` TotalPages int `json:"totalPages,omitempty"` PageSize int `json:"pageSize"` CurrentPage int `json:"currentPage"` }
PagingStatistics represent cumulocity's 'application/vnd.com.nsn.cumulocity.pagingStatistics+json'. See: https://cumulocity.com/guides/reference/rest-implementation/#pagingstatistics-application-vnd-com-nsn-cumulocity-pagingstatistics-json
Click to show internal directories.
Click to hide internal directories.