public abstract class HttpClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.time.Duration |
maxNetworkRetriesDelay
Maximum sleep time between tries to send HTTP requests after network failure.
|
static java.time.Duration |
minNetworkRetriesDelay
Minimum sleep time between tries to send HTTP requests after network failure.
|
Constructor and Description |
---|
HttpClient()
Initializes a new instance of the
HttpClient class. |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
buildUserAgentString()
Builds the value of the
User-Agent header. |
protected static java.lang.String |
buildXStripeClientUserAgentString()
Builds the value of the
X-Stripe-Client-User-Agent header. |
abstract StripeResponse |
request(StripeRequest request)
Sends the given request to Stripe's API.
|
StripeResponse |
requestWithRetries(StripeRequest request)
Sends the given request to Stripe's API, retrying the request in cases of intermittent
problems.
|
StripeResponse |
requestWithTelemetry(StripeRequest request)
Sends the given request to Stripe's API, handling telemetry if not disabled.
|
public static final java.time.Duration maxNetworkRetriesDelay
public static final java.time.Duration minNetworkRetriesDelay
public HttpClient()
HttpClient
class.public abstract StripeResponse request(StripeRequest request) throws StripeException
request
- the requestStripeException
- If the request fails for any reasonpublic StripeResponse requestWithTelemetry(StripeRequest request) throws StripeException
request
- the requestStripeException
- If the request fails for any reasonpublic StripeResponse requestWithRetries(StripeRequest request) throws StripeException
request
- the requestStripeException
- If the request fails for any reasonprotected static java.lang.String buildUserAgentString()
User-Agent
header.User-Agent
headerprotected static java.lang.String buildXStripeClientUserAgentString()
X-Stripe-Client-User-Agent
header.X-Stripe-Client-User-Agent
header