Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import java.util.HashMap;
  import java.util.List;
  
 
 public class Webhook  extends PayPalResource {

Identifier of the webhook resource.
 
 	private String id;

Webhook notification endpoint url.
 
 	private String url;

List of Webhooks event-types.
 
 	private List<EventTypeeventTypes;

Hateoas Links.
 
 	private List<Linkslinks;

Default Constructor
 
 	public Webhook() {
 	}

Parameterized Constructor
 
 	public Webhook(String urlList<EventTypeeventTypes) {
 		this. = url;
 		this. = eventTypes;
 	}


Setter for id
 
 	public Webhook setId(String id) {
 		this. = id;
 		return this;
 	}

Getter for id
 
 	public String getId() {
 		return this.;
 	}


Setter for url
 
 	public Webhook setUrl(String url) {
 		this. = url;
 		return this;
 	}

Getter for url
 
 	public String getUrl() {
 		return this.;
 	}


Setter for eventTypes
 
 	public Webhook setEventTypes(List<EventTypeeventTypes) {
 		this. = eventTypes;
 		return this;
 	}

Getter for eventTypes
 
 	public List<EventTypegetEventTypes() {
 		return this.;
 	}


Setter for links
	public Webhook setLinks(List<Linkslinks) {
		this. = links;
		return this;
	}

Getter for links
	public List<LinksgetLinks() {
		return this.;
	}

Creates the Webhook for the application associated with the access token.

Parameters:
accessToken Access Token used for the API call.
webhook Webhook Request
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook create(String accessTokenWebhook webhookthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return create(apiContextwebhook);
	}

Creates the Webhook for the application associated with the access token.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
webhook Webhook Request
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook create(APIContext apiContextWebhook webhookthrows 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>());
		}
		if (webhook == null) {
			throw new IllegalArgumentException("webhook cannot be null");
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		Object[] parameters = new Object[] {};
		String pattern = "v1/notifications/webhooks";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = webhook.toJSON();
		return configureAndExecute(apiContext.resourcePathpayLoadWebhook.class);
	}

Retrieves the Webhook identified by webhook_id for the application associated with access token.

Parameters:
accessToken Access Token used for the API call.
webhookId Identifier of the webhook
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook get(String accessTokenString webhookIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextwebhookId);
	}

Retrieves the Webhook identified by webhook_id for the application associated with access token.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
webhookId Identifier of the webhook
patchRequest patchRequest
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook get(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>());
		}
		if (webhookId == null) {
			throw new IllegalArgumentException("webhookId cannot be null");
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		Object[] parameters = new Object[] {webhookId};
		String pattern = "v1/notifications/webhooks/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return configureAndExecute(apiContext.resourcePathpayLoadWebhook.class);
	}

Updates the Webhook identified by webhook_id for the application associated with access token.

Parameters:
accessToken Access Token used for the API call.
webhookId Identifier of the webhook
patchRequest patchRequest
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook update(String accessTokenString webhookIdString patchRequestthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return update(apiContextwebhookIdpatchRequest);
	}

Updates the Webhook identified by webhook_id for the application associated with access token.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
webhookId Identifier of the webhook
Returns:
Webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public Webhook update(APIContext apiContextString webhookIdString patchRequestthrows 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>());
		}
		if (webhookId == null) {
			throw new IllegalArgumentException("webhookId cannot be null");
		}
		if (patchRequest == null) {
			throw new IllegalArgumentException("patchRequest cannot be null");
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		Object[] parameters = new Object[] {webhookId};
		String pattern = "v1/notifications/webhooks/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = patchRequest;
		return configureAndExecute(apiContext.resourcePathpayLoadWebhook.class);
	}

Deletes the Webhook identified by webhook_id for the application associated with access token.

Parameters:
accessToken Access Token used for the API call.
webhookId Identifier of the webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public void delete(String accessTokenString webhookIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		delete(apiContextwebhookId);
	}

Deletes the Webhook identified by webhook_id for the application associated with access token.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
webhookId Identifier of the webhook
Throws:
com.paypal.base.rest.PayPalRESTException
	public void delete(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>());
		}
		if (webhookId == null) {
			throw new IllegalArgumentException("webhookId cannot be null");
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		Object[] parameters = new Object[] {webhookId};
		String pattern = "v1/notifications/webhooks/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		configureAndExecute(apiContext.resourcePathpayLoadnull);
	}
New to GrepCode? Check out our FAQ X