Documentation
¶
Index ¶
- type JSONAPIClient
- func (c *JSONAPIClient) Delete(endpoint string) error
- func (c *JSONAPIClient) Get(endpoint string, result interface{}) error
- func (c *JSONAPIClient) Head(endpoint string) error
- func (c *JSONAPIClient) Options(endpoint string) error
- func (c *JSONAPIClient) Patch(endpoint string, requestData, result interface{}) error
- func (c *JSONAPIClient) Post(endpoint string, requestData, result interface{}) error
- func (c *JSONAPIClient) Put(endpoint string, requestData, result interface{}) error
- type JSONAPIError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONAPIClient ¶
JSONAPIClient defines the basic structure for a JSON API client.
func NewJSONAPIClient ¶
func NewJSONAPIClient(baseURL string, timeout time.Duration) *JSONAPIClient
NewJSONAPIClient creates a new JSON API client.
func (*JSONAPIClient) Delete ¶
func (c *JSONAPIClient) Delete(endpoint string) error
Delete performs an API request using the DELETE HTTP method.
func (*JSONAPIClient) Get ¶
func (c *JSONAPIClient) Get(endpoint string, result interface{}) error
Get performs an API request using the GET HTTP method.
func (*JSONAPIClient) Head ¶
func (c *JSONAPIClient) Head(endpoint string) error
Head performs an API request using the HEAD HTTP method.
func (*JSONAPIClient) Options ¶
func (c *JSONAPIClient) Options(endpoint string) error
Options performs an API request using the OPTIONS HTTP method.
func (*JSONAPIClient) Patch ¶
func (c *JSONAPIClient) Patch(endpoint string, requestData, result interface{}) error
Patch performs an API request using the PATCH HTTP method.
func (*JSONAPIClient) Post ¶
func (c *JSONAPIClient) Post(endpoint string, requestData, result interface{}) error
Post performs an API request using the POST HTTP method.
func (*JSONAPIClient) Put ¶
func (c *JSONAPIClient) Put(endpoint string, requestData, result interface{}) error
Put performs an API request using the PUT HTTP method.
type JSONAPIError ¶
JSONAPIError is a custom error struct for JSON API errors.
func NewJSONAPIError ¶
func NewJSONAPIError(code int, message string) *JSONAPIError
NewJSONAPIError creates a new JSONAPIError instance.
func (*JSONAPIError) Error ¶
func (e *JSONAPIError) Error() string
Error returns the error message for the JSONAPIError.