response

package
v0.0.0-...-6374ba2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Get information on the web api supported on this instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func Do

func Do(c *http.Client, req *http.Request, v interface{}) error

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func NewRequest

func NewRequest(method, path string, baseURL *url.URL, username, password string, opt interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL path can be provided in urlStr, in which case it is resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func SetBaseURLUtil

func SetBaseURLUtil(urlStr string) (*url.URL, error)

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

Types

type Client

type Client struct {
	Webservices *WebservicesService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint, username, password string) (*Client, error)

func (*Client) BaseURL

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

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL path can be provided in urlStr, in which case it is resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr string) error

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

type ErrorResponse

type ErrorResponse struct {
	Body     []byte
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type ExampleFetcher

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

func NewExampleFetcher

func NewExampleFetcher(endpoint, username, password string) *ExampleFetcher

func (*ExampleFetcher) GetResponseExample

func (e *ExampleFetcher) GetResponseExample(service *api.WebService) (examples []*WebservicesResponseExampleResp, err error)

type WebservicesListOption

type WebservicesListOption struct {
	IncludeInternals string `url:"include_internals,omitempty"` // Description:"Include web services that are implemented for internal use only. Their forward-compatibility is not assured",ExampleValue:""
}

type WebservicesListResp

type WebservicesListResp struct{}

[TODO] you should call the <List> func manually and complete the fields of this struct

type WebservicesResponseExampleOption

type WebservicesResponseExampleOption struct {
	Action     string `url:"action,omitempty"`     // Description:"Action of the web service",ExampleValue:"search"
	Controller string `url:"controller,omitempty"` // Description:"Controller of the web service",ExampleValue:"api/issues"
}

type WebservicesResponseExampleResp

type WebservicesResponseExampleResp struct {
	Format  string `json:"format,omitempty"`
	Example string `json:"example,omitempty"`
	Name    string `json:"name,omitempty"`
}

[TODO] you should call the <ResponseExample> func manually and complete the fields of this struct

type WebservicesService

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

func (*WebservicesService) List

List List web services

func (*WebservicesService) ResponseExample

Response_example Display web service response example

Jump to

Keyboard shortcuts

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