Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import  com.paypal.core.rest.JSONFormatter;
  import  com.paypal.core.rest.PayPalRESTException;
  import  com.paypal.core.rest.PayPalResource;
  import  com.paypal.core.rest.HttpMethod;
  import  com.paypal.core.rest.RESTUtil;
  import  com.paypal.core.rest.APIContext;
  import  com.paypal.core.Constants;
 import java.io.File;
 
 public class EventType  {

Unique event-type name.
 
 	private String name;

Human readable description of the event-type
 
 	private String description;

Returns the last request sent to the Service

Returns:
Last request sent to the server
 
 	public static String getLastRequest() {
 		return PayPalResource.getLastRequest();
 	}

Returns the last response returned by the Service

Returns:
Last response got from the Service
 
 	public static String getLastResponse() {
 		return PayPalResource.getLastResponse();
 	}

Initialize using InputStream(of a Properties file)

Parameters:
is InputStream
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
PayPalRESTException
 
 	public static void initConfig(InputStream isthrows PayPalRESTException {
 		PayPalResource.initConfig(is);
 	}

Initialize using a File(Properties file)

Parameters:
file File object of a properties entity
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
PayPalRESTException
 
 	public static void initConfig(File filethrows PayPalRESTException {
 		PayPalResource.initConfig(file);
 	}

Initialize using Properties

Parameters:
properties Properties object
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
 
 	public static void initConfig(Properties properties) {
 		PayPalResource.initConfig(properties);
 	}
Default Constructor
 
 	public EventType() {
 	}

Parameterized Constructor
 
 	public EventType(String name) {
 		this. = name;
 	}


Setter for name
 
 	public EventType setName(String name) {
 		this. = name;
 		return this;
	}

Getter for name
	public String getName() {
		return this.;
	}


Setter for description
	public EventType setDescription(String description) {
		this. = description;
		return this;
	}

Getter for description
	public String getDescription() {
		return this.;
	}


Retrieves the list of events-types subscribed by the given Webhook.

Parameters:
accessToken Access Token used for the API call.
webhookId String
Returns:
EventTypeList
Throws:
PayPalRESTException
	public static EventTypeList subscribedEventTypes(String accessTokenString webhookIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return subscribedEventTypes(apiContextwebhookId);
	}

Retrieves the list of events-types subscribed by the given Webhook.

Parameters:
apiContext APIContext used for the API call.
webhookId String
Returns:
EventTypeList
Throws:
PayPalRESTException
	public static EventTypeList subscribedEventTypes(APIContext apiContextString webhookIdthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.getHTTPHeaders().put(Constants.HTTP_CONTENT_TYPE_HEADER, Constants.HTTP_CONTENT_TYPE_JSON);
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (webhookId == null) {
			throw new IllegalArgumentException("webhookId cannot be null");
		}
		Object[] parameters = new Object[] {webhookId};
		String pattern = "v1/notifications/webhooks/{0}/event-types";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.GET, resourcePathpayLoadEventTypeList.class);
	}


Retrieves the master list of available Webhooks events-types resources for any webhook to subscribe to.

Parameters:
accessToken Access Token used for the API call.
Returns:
EventTypeList
Throws:
PayPalRESTException
	public static EventTypeList availableEventTypes(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return availableEventTypes(apiContext);
	}

Retrieves the master list of available Webhooks events-types resources for any webhook to subscribe to.

Parameters:
apiContext APIContext used for the API call.
Returns:
EventTypeList
Throws:
PayPalRESTException
	public static EventTypeList availableEventTypes(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.getHTTPHeaders().put(Constants.HTTP_CONTENT_TYPE_HEADER, Constants.HTTP_CONTENT_TYPE_JSON);
		apiContext.setSdkVersion(new SDKVersionImpl());
		String resourcePath = "v1/notifications/webhooks-event-types";
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.GET, resourcePathpayLoadEventTypeList.class);
	}

Returns a JSON string corresponding to object state

Returns:
JSON representation
	public String toJSON() {
		return JSONFormatter.toJSON(this);
	}
	public String toString() {
		return toJSON();
	}
New to GrepCode? Check out our FAQ X