Documentation
¶
Overview ¶
Package client is a generic REST client for BasicAuth / JWT services.
Index ¶
- type Client
- func (c *Client) Delete(ctx context.Context, url string, resp interface{}) error
- func (c *Client) Get(ctx context.Context, url string, resp interface{}) error
- func (c *Client) Login(ctx context.Context) error
- func (c *Client) Patch(ctx context.Context, url string, body, resp interface{}) error
- func (c *Client) Post(ctx context.Context, url string, body, resp interface{}) error
- func (c *Client) Put(ctx context.Context, url string, body, resp interface{}) error
- func (c *Client) Request(ctx context.Context, method, path string, in, out interface{}) error
- func (c *Client) URL(path string) string
- type Error
- type LoginResponse
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL string Password string Username string Logger logger Debug bool Token string http.Client }
Client is a connection to a REST service.
func (*Client) Login ¶
Login logs into the service. It is optional to call this method as any Request will automatically call Login if the Client is missing its Token. Call this when you want feedback right away on the acceptance of the Username/Password credentials.
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
}
LoginResponse is the response payload for /login.
Click to show internal directories.
Click to hide internal directories.