Documentation ¶
Index ¶
- func DoGetBytes(c Client, baseURL, path string, queryParams ...string) ([]byte, error)
- func DoGetUnmarshal(resultPtr interface{}, c Client, baseURL, path string, queryParams ...string) error
- func DoPostBytes(c Client, baseURL, path string, bodyPtr interface{}, queryParams ...string) ([]byte, error)
- func DoPostUnmarshal(resultPtr interface{}, c Client, baseURL, path string, bodyPtr interface{}, ...) error
- func DoRespAsBytes(c Client, req *http.Request, bodyPtr interface{}, queryParams ...string) ([]byte, error)
- func DoRespAsUnmarshalled(c Client, resultPtr interface{}, req *http.Request, bodyPtr interface{}, ...) error
- func NewGet(c Client, baseURL, path string, queryParams ...string) (*http.Request, error)
- func NewPost(c Client, baseURL, path string, bodyPtr interface{}, queryParams ...string) (*http.Request, error)
- type BaseClient
- type Client
- type WharfBranch
- type WharfProject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoGetBytes ¶
DoGetBytes is a convenience function that is equivalent to calling NewGet, executing the resulting request using http.DefaultClient.Do, checking the status code and then reading the response body, returning the resulting byte slice.
func DoGetUnmarshal ¶
func DoGetUnmarshal(resultPtr interface{}, c Client, baseURL, path string, queryParams ...string) error
DoGetUnmarshal is a convenience function that is equivalent to calling DoGetBytes and then unmarshalling the resulting byte array into the passed pointer.
func DoPostBytes ¶
func DoPostUnmarshal ¶
func DoRespAsBytes ¶
func DoRespAsUnmarshalled ¶
func NewGet ¶
NewGet creates a new HTTP GET request to the set provider URL's endpoint, specified with path, using Basic Auth.
Query parameters are interleaved like ( "name_1", "value_1", "name_2", "value_2" ).
func NewPost ¶
func NewPost(c Client, baseURL, path string, bodyPtr interface{}, queryParams ...string) (*http.Request, error)
NewPost creates a new HTTP POST request to the set provider URL's endpoint, specified with path, using Basic Auth.
Query parameters are interleaved like ( "name_1", "value_1", "name_2", "value_2" ).
Types ¶
type BaseClient ¶
func (*BaseClient) GetContext ¶
func (c *BaseClient) GetContext() context.Context
func (*BaseClient) GetToken ¶
func (c *BaseClient) GetToken() string
func (*BaseClient) SetContext ¶
func (c *BaseClient) SetContext(ctx context.Context)
func (*BaseClient) SetToken ¶
func (c *BaseClient) SetToken(token string)
type Client ¶
type Client interface { // GetContext gets the context for the client. // // This method is implemented by the BaseClient type for convenience. GetContext() context.Context // GetToken gets the token that is used when sending requests to the API. // // This method is implemented by the BaseClient type for convenience. GetToken() string // SetContext sets the context to use for the connection. // // This method is implemented by the BaseClient type for convenience. SetContext(ctx context.Context) // SetToken sets the token that is used when sending requests to the remote provider. // // This method is implemented by the BaseClient type for convenience. SetToken(token string) }
type WharfBranch ¶
WharfBranch is an alias for wharf-api's database.Branch.
type WharfProject ¶
WharfProject is an alias for wharf-api's database.Project. Currently using a hack to pretend that the RemoteProjectID addition has been merged.
func RequireProject ¶
func RequireProject(c *gin.Context) (WharfProject, bool)