Package com.stripe.net
Class ApiResource
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- All Implemented Interfaces:
StripeObjectInterface
- Direct Known Subclasses:
Account
,AccountLink
,ApplePayDomain
,ApplicationFee
,Authorization
,Balance
,BalanceTransaction
,BankAccount
,BitcoinReceiver
,Capability
,Card
,Card
,Cardholder
,Charge
,Configuration
,ConnectionToken
,CountrySpec
,Coupon
,CreditNote
,Customer
,CustomerBalanceTransaction
,Dispute
,Dispute
,EarlyFraudWarning
,EphemeralKey
,Event
,ExchangeRate
,FeeRefund
,File
,FileLink
,Invoice
,InvoiceItem
,IssuerFraudRecord
,Location
,LoginLink
,Mandate
,Order
,OrderReturn
,PagingIterator
,PaymentIntent
,PaymentMethod
,Payout
,Person
,Plan
,Price
,Product
,PromotionCode
,Reader
,Recipient
,Refund
,ReportRun
,ReportType
,Review
,ScheduledQueryRun
,Session
,Session
,SetupAttempt
,SetupIntent
,Sku
,Source
,Subscription
,SubscriptionItem
,SubscriptionSchedule
,TaxId
,TaxRate
,ThreeDSecure
,Token
,Topup
,Transaction
,Transfer
,TransferReversal
,UsageRecord
,ValueList
,ValueListItem
,WebhookEndpoint
public abstract class ApiResource extends StripeObject
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ApiResource.RequestMethod
-
Field Summary
Fields Modifier and Type Field Description static java.nio.charset.Charset
CHARSET
static com.google.gson.Gson
GSON
-
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
-
Constructor Summary
Constructors Constructor Description ApiResource()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkNullTypedParams(java.lang.String url, ApiRequestParams params)
Invalidate null typed parameters.protected static java.lang.String
classUrl(java.lang.Class<?> clazz)
protected static java.lang.String
classUrl(java.lang.Class<?> clazz, java.lang.String apiBase)
protected static java.lang.String
instanceUrl(java.lang.Class<?> clazz, java.lang.String id)
protected static java.lang.String
instanceUrl(java.lang.Class<?> clazz, java.lang.String id, java.lang.String apiBase)
static <T extends StripeObjectInterface>
Trequest(ApiResource.RequestMethod method, java.lang.String url, ApiRequestParams params, java.lang.Class<T> clazz, RequestOptions options)
static <T extends StripeObjectInterface>
Trequest(ApiResource.RequestMethod method, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.Class<T> clazz, RequestOptions options)
static <T extends StripeCollectionInterface<?>>
TrequestCollection(java.lang.String url, ApiRequestParams params, java.lang.Class<T> clazz, RequestOptions options)
static <T extends StripeCollectionInterface<?>>
TrequestCollection(java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.Class<T> clazz, RequestOptions options)
Similar to #request, but specific for use with collection types that come from the API (i.e.static <T extends HasId>
ExpandableField<T>setExpandableFieldId(java.lang.String newId, ExpandableField<T> currentObject)
When setting a String ID for an ExpandableField, we need to be careful about keeping the String ID and the expanded object in sync.static void
setStripeResponseGetter(StripeResponseGetter srg)
protected static java.lang.String
singleClassUrl(java.lang.Class<?> clazz)
protected static java.lang.String
singleClassUrl(java.lang.Class<?> clazz, java.lang.String apiBase)
protected static java.lang.String
subresourceUrl(java.lang.Class<?> clazz, java.lang.String id, java.lang.Class<?> subClazz)
static java.lang.String
urlEncode(java.lang.String str)
URL-encodes a string.static java.lang.String
urlEncodeId(java.lang.String id)
URL-encode a string ID in url path formatting.-
Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
-
-
-
Method Detail
-
setStripeResponseGetter
public static void setStripeResponseGetter(StripeResponseGetter srg)
-
singleClassUrl
protected static java.lang.String singleClassUrl(java.lang.Class<?> clazz)
-
singleClassUrl
protected static java.lang.String singleClassUrl(java.lang.Class<?> clazz, java.lang.String apiBase)
-
classUrl
protected static java.lang.String classUrl(java.lang.Class<?> clazz)
-
classUrl
protected static java.lang.String classUrl(java.lang.Class<?> clazz, java.lang.String apiBase)
-
instanceUrl
protected static java.lang.String instanceUrl(java.lang.Class<?> clazz, java.lang.String id) throws InvalidRequestException
- Throws:
InvalidRequestException
-
instanceUrl
protected static java.lang.String instanceUrl(java.lang.Class<?> clazz, java.lang.String id, java.lang.String apiBase) throws InvalidRequestException
- Throws:
InvalidRequestException
-
subresourceUrl
protected static java.lang.String subresourceUrl(java.lang.Class<?> clazz, java.lang.String id, java.lang.Class<?> subClazz) throws InvalidRequestException
- Throws:
InvalidRequestException
-
urlEncode
public static java.lang.String urlEncode(java.lang.String str)
URL-encodes a string.
-
urlEncodeId
public static java.lang.String urlEncodeId(java.lang.String id) throws InvalidRequestException
URL-encode a string ID in url path formatting.- Throws:
InvalidRequestException
-
request
public static <T extends StripeObjectInterface> T request(ApiResource.RequestMethod method, java.lang.String url, ApiRequestParams params, java.lang.Class<T> clazz, RequestOptions options) throws StripeException
- Throws:
StripeException
-
request
public static <T extends StripeObjectInterface> T request(ApiResource.RequestMethod method, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.Class<T> clazz, RequestOptions options) throws StripeException
- Throws:
StripeException
-
requestCollection
public static <T extends StripeCollectionInterface<?>> T requestCollection(java.lang.String url, ApiRequestParams params, java.lang.Class<T> clazz, RequestOptions options) throws StripeException
- Throws:
StripeException
-
requestCollection
public static <T extends StripeCollectionInterface<?>> T requestCollection(java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.Class<T> clazz, RequestOptions options) throws StripeException
Similar to #request, but specific for use with collection types that come from the API (i.e. lists of resources).Collections need a little extra work because we need to plumb request options and params through so that we can iterate to the next page if necessary.
- Throws:
StripeException
-
checkNullTypedParams
public static void checkNullTypedParams(java.lang.String url, ApiRequestParams params)
Invalidate null typed parameters.- Parameters:
url
- request url associated with the given parameters.params
- typed parameters to check for null value.
-
setExpandableFieldId
public static <T extends HasId> ExpandableField<T> setExpandableFieldId(java.lang.String newId, ExpandableField<T> currentObject)
When setting a String ID for an ExpandableField, we need to be careful about keeping the String ID and the expanded object in sync. If they specify a new String ID that is different from the ID within the expanded object, we don't keep the object.
-
-