com.citrix.sharefile.api.entities.SFWebhookSubscriptionsEntity Maven / Gradle / Ivy
// ------------------------------------------------------------------------------
//
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// Copyright (c) 2017 Citrix ShareFile. All rights reserved.
//
// ------------------------------------------------------------------------------
package com.citrix.sharefile.api.entities;
import com.citrix.sharefile.api.*;
import com.citrix.sharefile.api.entities.*;
import com.citrix.sharefile.api.models.*;
import com.citrix.sharefile.api.SFApiQuery;
import com.citrix.sharefile.api.interfaces.ISFQuery;
import java.io.InputStream;
import java.util.ArrayList;
import java.net.URI;
import java.util.Date;
import com.google.gson.annotations.SerializedName;
import com.citrix.sharefile.api.enumerations.SFSafeEnum;
import com.citrix.sharefile.api.enumerations.SFSafeEnumFlags;
import com.citrix.sharefile.api.interfaces.ISFApiClient;
import com.citrix.sharefile.api.exceptions.InvalidOrMissingParameterException;
public class SFWebhookSubscriptionsEntity extends SFEntitiesBase
{
public SFWebhookSubscriptionsEntity(ISFApiClient client) {
super(client);
}
/**
* Gets a WebhookSubscription based on id
* @param url
* @return WebhookSubscription
*/
public ISFQuery get(URI url) throws InvalidOrMissingParameterException {
if (url == null) {
throw new InvalidOrMissingParameterException("url");
}
SFApiQuery sfApiQuery = new SFApiQuery(this.client);
sfApiQuery.setFrom("WebhookSubscriptions");
sfApiQuery.addIds(url);
sfApiQuery.setHttpMethod("GET");
return sfApiQuery;
}
/**
* Gets all webhook subscriptions for the current user
* @return List of WebhookSubscription
*/
public ISFQuery> get() {
SFApiQuery> sfApiQuery = new SFApiQuery>(this.client);
sfApiQuery.setFrom("WebhookSubscriptions");
sfApiQuery.setHttpMethod("GET");
return sfApiQuery;
}
/**
* Deletes a WebhookSubscription based on id
* @param url
*/
public ISFQuery delete(URI url) throws InvalidOrMissingParameterException {
if (url == null) {
throw new InvalidOrMissingParameterException("url");
}
SFApiQuery sfApiQuery = new SFApiQuery(this.client);
sfApiQuery.setFrom("WebhookSubscriptions");
sfApiQuery.addIds(url);
sfApiQuery.setHttpMethod("DELETE");
return sfApiQuery;
}
/**
* Creates a WebhookSubscription
* {
* "SubscriptionContext": {
* "ResourceType": "Folder",
* "ResourceId": "fo123"
* },
* "WebhookUrl": "https://webhook.com",
* "Events":
* [
* { "ResourceType":"File", "OperationName":"Upload" },
* { "ResourceType":"File", "OperationName":"Update" },
* { "ResourceType":"File", "OperationName":"Download" },
* { "ResourceType":"File", "OperationName":"Delete" },
* ]
* }
* The above example subscribes `https://webhook.com` endpoint to be called when a File Upload, Update, Download or Delete
* event happened for folder `fo123`.
* Note: Context Resource Id is required for all but the account context.
* The MasterAdmin role is required to create account context subscriptions.
* @return WebhookSubscription
*/
public ISFQuery create(SFWebhookSubscription subscription) throws InvalidOrMissingParameterException {
if (subscription == null) {
throw new InvalidOrMissingParameterException("subscription");
}
SFApiQuery sfApiQuery = new SFApiQuery(this.client);
sfApiQuery.setFrom("WebhookSubscriptions");
sfApiQuery.setBody(subscription);
sfApiQuery.setHttpMethod("POST");
return sfApiQuery;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy