com.files.models.ActionNotificationExportResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of files-sdk Show documentation
Show all versions of files-sdk Show documentation
The Files.com Java client library provides convenient access to the Files.com API from JVM based applications.
package com.files.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.files.FilesClient;
import com.files.FilesConfig;
import com.files.net.HttpMethods.RequestMethods;
import com.files.util.FilesInputStream;
import com.files.util.ModelUtils;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionNotificationExportResult {
private HashMap options;
private ObjectMapper objectMapper = JsonMapper
.builder()
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
.build();
public ActionNotificationExportResult() {
this(null, null);
}
public ActionNotificationExportResult(HashMap parameters) {
this(parameters, null);
}
public ActionNotificationExportResult(HashMap parameters, HashMap options) {
this.options = options;
try {
ObjectReader objectReader = objectMapper.readerForUpdating(this);
objectReader.readValue(objectMapper.writeValueAsString(parameters));
} catch (JsonProcessingException e) {
// TODO: error generation on constructor
}
}
/**
* Notification ID
*/
@Getter
@JsonProperty("id")
public Long id;
/**
* When the notification was sent.
*/
@Getter
@JsonProperty("created_at")
public Long createdAt;
/**
* HTTP status code returned in the webhook response.
*/
@Getter
@JsonProperty("status")
public Long status;
/**
* A message indicating the overall status of the webhook notification.
*/
@Getter
@JsonProperty("message")
public String message;
/**
* `true` if the webhook succeeded by receiving a 200 or 204 response.
*/
@Getter
@JsonProperty("success")
public Boolean success;
/**
* A JSON-encoded string with headers that were sent with the webhook.
*/
@Getter
@JsonProperty("request_headers")
public String requestHeaders;
/**
* The HTTP verb used to perform the webhook.
*/
@Getter
@JsonProperty("request_method")
public String requestMethod;
/**
* The webhook request URL.
*/
@Getter
@JsonProperty("request_url")
public String requestUrl;
/**
* The path to the actual file that triggered this notification. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
*/
@Getter
@JsonProperty("path")
public String path;
/**
* The folder associated with the triggering action for this notification.
*/
@Getter
@JsonProperty("folder")
public String folder;
/**
* Parameters:
* user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
* cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
* per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
* action_notification_export_id (required) - int64 - ID of the associated action notification export.
*/
public static List list() throws IOException {
return list(null, null);
}
public static List list(HashMap parameters) throws IOException {
return list(parameters, null);
}
public static List list(HashMap parameters, HashMap options) throws IOException {
parameters = parameters != null ? parameters : new HashMap();
options = options != null ? options : new HashMap();
if (parameters.containsKey("user_id") && !(parameters.get("user_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: user_id must be of type Long parameters[\"user_id\"]");
}
if (parameters.containsKey("cursor") && !(parameters.get("cursor") instanceof String)) {
throw new IllegalArgumentException("Bad parameter: cursor must be of type String parameters[\"cursor\"]");
}
if (parameters.containsKey("per_page") && !(parameters.get("per_page") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: per_page must be of type Long parameters[\"per_page\"]");
}
if (parameters.containsKey("action_notification_export_id") && !(parameters.get("action_notification_export_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: action_notification_export_id must be of type Long parameters[\"action_notification_export_id\"]");
}
if (!parameters.containsKey("action_notification_export_id") || parameters.get("action_notification_export_id") == null) {
throw new NullPointerException("Parameter missing: action_notification_export_id parameters[\"action_notification_export_id\"]");
}
String url = String.format("%s%s/action_notification_export_results", FilesConfig.getInstance().getApiRoot(), FilesConfig.getInstance().getApiBase());
TypeReference> typeReference = new TypeReference>() {};
return FilesClient.requestList(url, RequestMethods.GET, typeReference, parameters, options);
}
public static List all() throws IOException {
return all(null, null);
}
public static List all(HashMap parameters, HashMap options) throws IOException {
return list(parameters, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy