Skip to content

Commit b3b06f4

Browse files
committed
client config struct comments added
1 parent fb43927 commit b3b06f4

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

httpclient/client.go

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,49 @@ type Client struct {
3535

3636
// Options/Variables for Client
3737
type ClientConfig struct {
38-
Integration APIIntegration
39-
HideSensitiveData bool `json:"hide_sensitive_data"`
40-
CustomCookies []*http.Cookie
41-
MaxRetryAttempts int `json:"max_retry_attempts"`
42-
MaxConcurrentRequests int `json:"max_concurrent_requests"`
43-
EnableDynamicRateLimiting bool `json:"enable_dynamic_rate_limiting"`
44-
CustomTimeout time.Duration
45-
TokenRefreshBufferPeriod time.Duration
46-
TotalRetryDuration time.Duration
47-
FollowRedirects bool `json:"follow_redirects"`
48-
MaxRedirects int `json:"max_redirects"`
38+
// Interface which implements the APIIntegration patterns. Integration handles all server/endpoint specific configuration, auth and vars.
39+
Integration APIIntegration
40+
41+
// HideSenitiveData controls if sensitive data will be visible in logs. Debug option which should be True in production use.
42+
HideSensitiveData bool `json:"hide_sensitive_data"`
43+
44+
// CustomCookies allows implementation of persistent, session wide cookies.
45+
CustomCookies []*http.Cookie
46+
47+
// MaxRetry Attempts limits the amount of retries the client will perform on requests which are deemd retriable.
48+
MaxRetryAttempts int `json:"max_retry_attempts"`
49+
50+
// MaxConcurrentRequests limits the amount of Semaphore tokens available to the client and therefor limits concurrent requests.
51+
MaxConcurrentRequests int `json:"max_concurrent_requests"`
52+
53+
// EnableDynamicRateLimiting // TODO because I don't know.
54+
EnableDynamicRateLimiting bool `json:"enable_dynamic_rate_limiting"`
55+
56+
// CustomTimeout // TODO also because I don't know.
57+
CustomTimeout time.Duration
58+
59+
// TokenRefreshBufferPeriod is the duration of time before the token expires in which it's deemed
60+
// more sensible to replace the token rather then carry on using it.
61+
TokenRefreshBufferPeriod time.Duration
62+
63+
// TotalRetryDuration // TODO maybe this should be called context?
64+
TotalRetryDuration time.Duration
65+
66+
// FollowRedirects allows the client to follow redirections when they're returned from a request.
67+
FollowRedirects bool `json:"follow_redirects"`
68+
69+
// MaxRedirects is the maximum amount of redirects the client will follow before throwing an error.
70+
MaxRedirects int `json:"max_redirects"`
71+
72+
// EnableConcurrencyManagement when false bypasses any concurrency management to allow for a simpler request flow.
4973
EnableConcurrencyManagement bool `json:"enable_concurrency_management"`
50-
MandatoryRequestDelay time.Duration
51-
RetryEligiableRequests bool `json:"retry_eligiable_requests"`
74+
75+
// MandatoryRequestDelay is a short, usually sub 0.5 second, delay after every request as to not overwhelm an endpoint.
76+
// Can be set to nothing if you want to be lightning fast!
77+
MandatoryRequestDelay time.Duration
78+
79+
// RetryEligiableRequests when false bypasses any retry logic for a simpler request flow.
80+
RetryEligiableRequests bool `json:"retry_eligiable_requests"`
5281
}
5382

5483
// BuildClient creates a new HTTP client with the provided configuration.

0 commit comments

Comments
 (0)