Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func NewServerError(resp *http.Response, httpError error) error
- type AuthenticationService
- type BasicAuthTransport
- type CatData
- type CatMenu
- type CatMenuData
- type CatMenuParam
- type CatMenuService
- type Client
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetBaseURL() url.URL
- func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
- func (c *Client) NewRawRequest(method, urlStr string, body io.Reader) (*http.Request, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- type EnvGlobal
- type EnvHeader
- type Error
- type Interface
- type InterfaceData
- type InterfaceList
- type InterfaceListData
- type InterfaceListParam
- type InterfaceParam
- type InterfaceService
- type Project
- type ProjectData
- type ProjectEnv
- type ProjectParam
- type ProjectService
- type ReqKVItemDetail
- type ReqKVItemSimple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body. The body can contain JSON (if the error is intended) or xml.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
AuthenticationService .
type BasicAuthTransport ¶
type BasicAuthTransport struct { Username string Password string // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper }
BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.
func (*BasicAuthTransport) Client ¶
func (t *BasicAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication. This is a nice little bit of sugar so we can just get the client instead of creating the client in the calling code. If it's necessary to send more information on client init, the calling code can always skip this and set the transport itself.
type CatMenu ¶
type CatMenu struct { ErrCode int `json:"errcode" structs:"errcode"` ErrMsg string `json:"errmsg" structs:"errmsg"` Data CatMenuData `json:"data" structs:"data"` }
type CatMenuData ¶
type CatMenuData []CatData
type CatMenuParam ¶
type CatMenuService ¶
type CatMenuService struct {
// contains filtered or unexported fields
}
CatMenuService .
type Client ¶
type Client struct { // Services used for talking to different parts of the API. Authentication *AuthenticationService Interface *InterfaceService Project *ProjectService CatMenu *CatMenuService // contains filtered or unexported fields }
A Client manages communication with the API.
func NewClient ¶
NewClient returns a new API client. If a nil httpClient is provided, http.DefaultClient will be used.
func (*Client) Do ¶
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.
func (*Client) GetBaseURL ¶
GetBaseURL will return you the Base URL. This is the same URL as in the NewClient constructor
func (*Client) NewMultiPartRequest ¶
func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (*http.Request, error)
NewMultiPartRequest creates an API request including a multi-part file. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by buf is a multipart form.
func (*Client) NewRawRequest ¶
NewRawRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Allows using an optional native io.Reader for sourcing the request body.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Error ¶
type Error struct { HTTPError error ErrorMessages []string `json:"errorMessages"` Errors map[string]string `json:"errors"` }
Error message
type Interface ¶
type Interface struct { ErrCode int `json:"errcode" structs:"errcode"` ErrMsg string `json:"errmsg" structs:"errmsg"` Data InterfaceData `json:"data" structs:"data"` }
type InterfaceData ¶
type InterfaceData struct {
// contains filtered or unexported fields
}
type InterfaceList ¶
type InterfaceList struct { ErrCode int `json:"errcode" structs:"errcode"` ErrMsg string `json:"errmsg" structs:"errmsg"` Data InterfaceListData `json:"data" structs:"data"` }
type InterfaceListData ¶
type InterfaceListData struct { Count int `json:"count" structs:"count"` Total int `json:"total" structs:"total"` List []InterfaceData `json:"list" structs:"list"` }
type InterfaceListParam ¶
type InterfaceParam ¶
type InterfaceService ¶
type InterfaceService struct {
// contains filtered or unexported fields
}
InterfaceService .
func (*InterfaceService) GetList ¶
func (s *InterfaceService) GetList(opt *InterfaceListParam) (*InterfaceList, *http.Response, error)
type Project ¶
type Project struct { ErrCode int `json:"errcode" structs:"errcode"` ErrMsg string `json:"errmsg" structs:"errmsg"` Data ProjectData `json:"data" structs:"data"` }
type ProjectData ¶
type ProjectData struct { ID int `json:"_id" structs:"_id"` UID int `json:"uid" structs:"uid"` GroupID int `json:"group_id" structs:"group_id"` Name string `json:"name" structs:"name"` Type string `json:"project_type" structs:"project_type"` Role string `json:"role" structs:"role"` Env []ProjectEnv `json:"env" structs:"env"` }
type ProjectEnv ¶
type ProjectParam ¶
type ProjectParam struct {
Token string `url:"token"`
}
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService .
type ReqKVItemDetail ¶
type ReqKVItemDetail struct { ReqKVItemSimple Type string `json:"type" structs:"type"` Required string `json:"required" structs:"required"` }