-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault_configuration.go
43 lines (38 loc) · 1.38 KB
/
default_configuration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Package advancedbilling
This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
package advancedbilling
import (
"net/http"
)
// DefaultRetryConfiguration returns the default RetryConfiguration for HTTP requests.
// It also configures various retry options.
func DefaultRetryConfiguration() RetryConfiguration {
return NewRetryConfiguration(
WithMaxRetryAttempts(0),
WithRetryOnTimeout(true),
WithRetryInterval(1),
WithMaximumRetryWaitTime(0),
WithBackoffFactor(2),
WithHttpStatusCodesToRetry([]int64{408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524}),
WithHttpMethodsToRetry([]string{"GET", "PUT", "GET", "PUT"}),
)
}
// DefaultHttpConfiguration returns the default HttpConfiguration for HTTP requests.
// It also configures various HttpConfiguration options.
func DefaultHttpConfiguration() HttpConfiguration {
return NewHttpConfiguration(
WithTimeout(120),
WithTransport(http.DefaultTransport),
WithRetryConfiguration(DefaultRetryConfiguration()),
)
}
// DefaultConfiguration returns the default Configuration.
func DefaultConfiguration() Configuration {
return newConfiguration(
WithEnvironment(US),
WithSite("subdomain"),
WithHttpConfiguration(DefaultHttpConfiguration()),
)
}