com.paypal.base.rest
Class APIContext

java.lang.Object
  extended by com.paypal.base.BaseAPIContext
      extended by com.paypal.base.rest.APIContext

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.

Author:
kjayakumar

Constructor Summary
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
 
Method Summary
 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)
           
 
Methods inherited from class com.paypal.base.BaseAPIContext
getConfigurationMap, getHTTPHeaders, getSOAPHeader, setConfigurationMap, setHTTPHeaders, setSOAPHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

APIContext

public APIContext()
Default Constructor


APIContext

public APIContext(String accessToken)
APIContext, requestId is auto generated, calling setMaskRequestId(true) will override the requestId getter to return null

Parameters:
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 OAuthToken

APIContext

public APIContext(String accessToken,
                  String requestId)
APIContext

Parameters:
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 OAuthToken
requestId - 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.
Method Detail

getAccessToken

public String getAccessToken()
Returns the Access Token

Returns:
Access Token

getRequestId

public 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.

Returns:
requestId

setMaskRequestId

public void setMaskRequestId(boolean maskRequestId)
Parameters:
maskRequestId - the maskRequestId to set

getSdkVersion

public SDKVersion getSdkVersion()
Returns:
the sdkVersion

setSdkVersion

public void setSdkVersion(SDKVersion sdkVersion)
Parameters:
sdkVersion - the sdkVersion to set

getHeadersMap

public Map<String,String> getHeadersMap()
Deprecated. Use getHTTPHeaders() instead

Returns:
the headersMap

setHeadersMap

public void setHeadersMap(Map<String,String> headersMap)
Deprecated. 

Parameters:
headersMap - the headersMap to set


Copyright © 2015. All Rights Reserved.