Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCertPool ¶
func WithSecureTLS ¶
Types ¶
type Client ¶
type Client interface { Name() string GetClient() *http.Client RootEndpoint(endpoint string) string // functions needed to make request Add(data HTTPBody, headers HTTPHeader) error Update(data HTTPBody, headers HTTPHeader) error }
The 'Client' struct is a wrapper around the default http.Client that provides an extended API to work with functional options. It also provides functions that work with `collect` data.
type HTTPBody ¶
type HTTPBody []byte
func MakeRequest ¶
func MakeRequest(client *http.Client, url string, httpMethod string, body HTTPBody, header HTTPHeader) (*http.Response, HTTPBody, error)
MakeRequest() is a wrapper function that condenses simple HTTP requests done to a single call. It expects an optional HTTP client, URL, HTTP method, request body, and request headers. This function is useful when making many requests where only these few arguments are changing.
Returns a HTTP response object, response body as byte array, and any error that may have occurred with making the request.
type HTTPHeader ¶
HTTP aliases for readibility
func (HTTPHeader) Authorization ¶
func (h HTTPHeader) Authorization(accessToken string) HTTPHeader
func (HTTPHeader) ContentType ¶
func (h HTTPHeader) ContentType(contentType string) HTTPHeader
type MagellanClient ¶
func (*MagellanClient) Add ¶
func (c *MagellanClient) Add(data HTTPBody, headers HTTPHeader) error
Add() is the default function that is called with a client with no implementation. This function will simply make a HTTP request including all the data passed as the first argument with no data processing or manipulation. The function sends the data to a set callback URL (which may be changed to use a configurable value instead).
func (*MagellanClient) Name ¶
func (c *MagellanClient) Name() string
func (*MagellanClient) Post ¶
func (c *MagellanClient) Post(url string, data map[string]any, header HTTPHeader) (*http.Response, HTTPBody, error)
Post() is a simplified wrapper function that packages all of the that marshals a mapper into a JSON-formatted byte array, and then performs a request to the specified URL.
func (*MagellanClient) Update ¶
func (c *MagellanClient) Update(data HTTPBody, headers HTTPHeader) error
type SmdClient ¶
func (SmdClient) Add ¶
func (c SmdClient) Add(data HTTPBody, headers HTTPHeader) error
Add() has a similar function definition to that of the default implementation, but also allows further customization and data/header manipulation that would be specific and/or unique to SMD's API.