Documentation ¶
Index ¶
- type ApiClient
- func (client *ApiClient) GenerateToken() (string, error)
- func (client *ApiClient) Get(path string, params *url.Values) (*http.Response, error)
- func (client *ApiClient) IterGet(path string, params *url.Values) iter.Seq2[*IterResult, error]
- func (client *ApiClient) IterPostJson(path string, params *url.Values, body map[string]interface{}) iter.Seq2[*IterResult, error]
- func (client *ApiClient) Post(path string, params *url.Values, contentType string, body io.Reader) (*http.Response, error)
- type ApiClientOption
- type IterResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func NewApiClient ¶
func NewApiClient( apiKey string, optionFns ...ApiClientOption, ) *ApiClient
NewApiClient can be used to create a new ApiClient instance.
func (*ApiClient) GenerateToken ¶
GenerateToken creates a Flare API token using the API Client's API key.
func (*ApiClient) Get ¶
Get peforms an authenticated GET request at the given path. Includes params in the query string.
func (*ApiClient) IterGet ¶ added in v0.2.0
IterGet allows to iterate over responses for an API endpoint that supports the Flare standard paging pattern.
func (*ApiClient) IterPostJson ¶ added in v0.4.0
func (client *ApiClient) IterPostJson( path string, params *url.Values, body map[string]interface{}, ) iter.Seq2[*IterResult, error]
IterPostJson allows to iterate over responses for an API endpoint that supports the Flare standard paging pattern.
func (*ApiClient) Post ¶
func (client *ApiClient) Post( path string, params *url.Values, contentType string, body io.Reader, ) (*http.Response, error)
Post performs an authenticated POST request at the given path. Includes params in the query string. The provided ContentType should describe the content of the body.
type ApiClientOption ¶
type ApiClientOption func(*ApiClient)
func WithTenantId ¶
func WithTenantId(tenantId int) ApiClientOption
WithTenantId allows configuring the tenant id.
type IterResult ¶ added in v0.2.0
type IterResult struct { // Response associated with the fetched page. // // The response's body must be closed. Response *http.Response // Next is the token to be used to fetch the next page. Next string }
IterResult contains results for a given page.