Documentation ¶
Overview ¶
Package web provides functions for interacting with a REST API. It was designed to work with GIN Gogs (https://github.com/G-Node/gogs), a fork of the Gogs git service (https://github.com/gogits/gogs), and therefore only implements requests and assumes responses for working with that particular API. Beyond that, the implementation is relatively general and service agnostic.
Index ¶
- func CloseRes(b io.ReadCloser)
- func DeleteToken(srvalias string) error
- type Client
- func (cl *Client) Delete(address string) (*http.Response, error)
- func (cl *Client) Get(address string) (*http.Response, error)
- func (cl *Client) GetBasicAuth(address, username, password string) (*http.Response, error)
- func (cl *Client) Post(address string, data interface{}) (*http.Response, error)
- func (cl *Client) PostBasicAuth(address, username, password string, data interface{}) (*http.Response, error)
- type UserToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseRes ¶
func CloseRes(b io.ReadCloser)
CloseRes closes a given result buffer (for use with defer).
func DeleteToken ¶
DeleteToken deletes the token file if it exists (for finalising a logout).
Types ¶
type Client ¶
Client struct for making requests
func (*Client) Get ¶
Get sends a GET request to address. The address is appended to the client host, so it should be specified without a host prefix.
func (*Client) GetBasicAuth ¶
GetBasicAuth sends a GET request to address. The username and password are used to perform Basic authentication.