com.files.models.Style 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 Style {
private HashMap options;
private ObjectMapper objectMapper = JsonMapper
.builder()
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
.build();
public Style() {
this(null, null);
}
public Style(HashMap parameters) {
this(parameters, null);
}
public Style(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
}
}
/**
* Style ID
*/
@Getter
@Setter
@JsonProperty("id")
public Long id;
/**
* Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
*/
@Getter
@Setter
@JsonProperty("path")
public String path;
/**
* Logo
*/
@Getter
@Setter
@JsonProperty("logo")
public Image logo;
/**
* Logo thumbnail
*/
@Getter
@Setter
@JsonProperty("thumbnail")
public Image thumbnail;
/**
* Logo for custom branding.
*/
@Getter
@Setter
@JsonProperty("file")
public byte[] file;
/**
* Parameters:
* file (required) - file - Logo for custom branding.
*/
public Style update(HashMap parameters) {
return update(parameters);
}
/**
*/
public Style delete(HashMap parameters) {
return delete(parameters);
}
public void destroy(HashMap parameters) {
delete(parameters);
}
public void save() throws IOException {
update();
}
/**
* Parameters:
* path (required) - string - Style path.
*/
public static List