public class APIContext extends BaseAPIContext
APIContext wraps wire-level parameters for the API call.
AccessToken, which is essentially an OAuth token, is treated as a mandatory
parameter for (PayPal REST APIs). RequestId is generated if not supplied for
marking Idempotency of the API call. OAuth token can be generated using
OAuthTokenCredential. The Application Header property may be used by
clients to access application level headers. The clients are responsible to
cast the Application Header property to appropriate type.| Constructor and Description |
|---|
APIContext()
Default Constructor
|
APIContext(String accessToken)
APIContext, requestId is auto generated, calling setMaskRequestId(true)
will override the requestId getter to return null
|
APIContext(String accessToken,
String requestId)
APIContext
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessToken()
Returns the Access Token
|
Map<String,String> |
getHeadersMap()
Deprecated.
Use getHTTPHeaders() instead
|
String |
getRequestId()
Returns the unique requestId set during creation, if not available and if
maskRequestId is set to false returns a generated one, else returns null.
|
SDKVersion |
getSdkVersion() |
void |
setHeadersMap(Map<String,String> headersMap)
Deprecated.
|
void |
setMaskRequestId(boolean maskRequestId) |
void |
setSdkVersion(SDKVersion sdkVersion) |
getConfigurationMap, getHTTPHeaders, getSOAPHeader, setConfigurationMap, setHTTPHeaders, setSOAPHeaderpublic APIContext()
public APIContext(String accessToken)
accessToken - OAuthToken required for the call. OAuth token used by the REST
API service. The token should be of the form 'Bearer xxxx..'.
See OAuthTokenCredential to generate OAuthTokenpublic APIContext(String accessToken, String requestId)
accessToken - OAuthToken required for the call. OAuth token used by the REST
API service. The token should be of the form 'Bearer xxxx..'.
See OAuthTokenCredential to generate OAuthTokenrequestId - Unique requestId required for the call. Idempotency id,
Calling setMaskRequestId(true) will override the requestId
getter to return null, which can be used by the client (null
check) to forcibly not sent requestId in the API call.public String getAccessToken()
public String getRequestId()
public void setMaskRequestId(boolean maskRequestId)
maskRequestId - the maskRequestId to setpublic SDKVersion getSdkVersion()
public void setSdkVersion(SDKVersion sdkVersion)
sdkVersion - the sdkVersion to setpublic Map<String,String> getHeadersMap()
Copyright © 2016. All Rights Reserved.