io.polyapi.client.api.VariableChangeEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of library Show documentation
Show all versions of library Show documentation
Java client library for Poly API
The newest version!
package io.polyapi.client.api;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class VariableChangeEvent {
private Type type;
private boolean secret;
private String id;
private T previousValue;
private T currentValue;
private long updateTime;
private String updatedBy;
private List updatedFields;
public enum Type {
UPDATE("update"),
DELETE("delete");
private final String jsonValue;
Type(String jsonValue) {
this.jsonValue = jsonValue;
}
@JsonValue
public String jsonValue() {
return this.jsonValue;
}
@JsonCreator
public static Type fromJsonValue(String jsonValue) {
for (Type type : Type.values()) {
if (type.jsonValue.equalsIgnoreCase(jsonValue)) {
return type;
}
}
throw new IllegalArgumentException("Unexpected value '" + jsonValue + "'");
}
}
public enum UpdatedField {
VALUE("value"),
SECRET("secret");
private final String jsonValue;
UpdatedField(String jsonValue) {
this.jsonValue = jsonValue;
}
@JsonValue
public String jsonValue() {
return this.jsonValue;
}
@JsonCreator
public static UpdatedField fromJsonValue(String jsonValue) {
for (UpdatedField type : UpdatedField.values()) {
if (type.jsonValue.equalsIgnoreCase(jsonValue)) {
return type;
}
}
throw new IllegalArgumentException("Unexpected value '" + jsonValue + "'");
}
}
}