Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ClientOptions ¶
type ClientOptions struct {
Endpoint string
Insecure bool
Username string
Password string
Headers map[string]string
UseCookies bool
Timeout int64
IDAttribute string
CreateMethod string
ReadMethod string
UpdateMethod string
DestroyMethod string
CopyKeys []string
ResponseFilter *ResponseFilter
DriftDetection bool
WriteReturnsObject bool
CreateReturnsObject bool
XSSIPrefix string
RateLimit float64
TestPath string
OAuthClientCredentials *OAuthCredentials
CertString string
KeyString string
CertFile string
KeyFile string
}
type OAuthCredentials ¶
type ResponseFilter ¶
type RestClient ¶
type RestClient struct {
HTTPClient *http.Client
Options *ClientOptions
// contains filtered or unexported fields
}
RestClient is a HTTP client with additional controlling fields.
func New ¶
func New(ctx context.Context, opts *ClientOptions) (*RestClient, error)
New creates a new RestClient instance. It takes a context and ClientOptions, and returns a RestClient instance and error. It initializes the RestClient with the provided options, creating the HTTP client, OAuth client if configured, rate limiter, etc. It returns any errors encountered while initializing the client.
func (*RestClient) SendRequest ¶
func (rc *RestClient) SendRequest(ctx context.Context, method, path, data string) (string, int, error)
SendRequest sends an HTTP request to the configured API endpoint. It handles constructing the request, adding headers and authentication, rate limiting, logging, and error handling.
func (*RestClient) ToString ¶
func (rc *RestClient) ToString() string
ToString returns a string representation of the RestClient options.
Click to show internal directories.
Click to hide internal directories.