Skip to content

chore: Generated code for commit 34ad2c1f37aa31258bf9ca11f95a7415b9148166. #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.internal.Primitives;
import com.google.gson.internal.bind.MapTypeAdapterFactory;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
Expand All @@ -28,11 +27,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Collections;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Hashtable;
Expand All @@ -47,14 +42,12 @@
public class JSON {

private static Gson gson;
private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
private static RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory();
private static final ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
private static final RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory();

static {
gson =
createGson()
.registerTypeAdapter(Date.class, dateTypeAdapter)
.registerTypeAdapter(byte[].class, byteArrayAdapter)
.registerTypeAdapterFactory(mapAdapter)
.create();
Expand All @@ -65,6 +58,11 @@ public static GsonBuilder createGson() {
return fireBuilder.createGsonBuilder();
}

// Suppress default constructor for noninstantiability
private JSON() {
throw new AssertionError();
}

/**
* Get Gson.
*
Expand Down Expand Up @@ -115,10 +113,6 @@ public static <T> T deserialize(String body, Type returnType) {
}
}
}

public static void setDateFormat(DateFormat dateFormat) {
dateTypeAdapter.setFormat(dateFormat);
}
}

/** Gson TypeAdapter for Byte Array type */
Expand All @@ -135,71 +129,13 @@ public void write(JsonWriter out, byte[] value) throws IOException {

@Override
public byte[] read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String bytesAsBase64 = in.nextString();
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
return byteString.toByteArray();
}
}
}

/**
* Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be used.
*/
class DateTypeAdapter extends TypeAdapter<Date> {

private DateFormat dateFormat;

public DateTypeAdapter() {}

public DateTypeAdapter(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}

public void setFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}

@Override
public void write(JsonWriter out, Date date) throws IOException {
if (date == null) {
out.nullValue();
} else {
String value;
if (dateFormat != null) {
value = dateFormat.format(date);
} else {
value = ISO8601Utils.format(date, true);
}
out.value(value);
}
}

@Override
public Date read(JsonReader in) throws IOException {
try {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
try {
if (dateFormat != null) {
return dateFormat.parse(date);
}
return ISO8601Utils.parse(date, new ParsePosition(0));
} catch (ParseException e) {
throw new JsonParseException(e);
}
}
} catch (IllegalArgumentException e) {
throw new JsonParseException(e);
if (in.peek() == JsonToken.NULL) {
in.nextNull();
return null;
}
String bytesAsBase64 = in.nextString();
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
return byteString != null ? byteString.toByteArray() : new byte[0];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
/** Gets or Sets acl */
@JsonAdapter(Acl.Adapter.class)
public enum Acl {
ADDOBJECT("addObject"),
ADD_OBJECT("addObject"),

ANALYTICS("analytics"),

BROWSE("browse"),

DELETEOBJECT("deleteObject"),
DELETE_OBJECT("deleteObject"),

DELETEINDEX("deleteIndex"),
DELETE_INDEX("deleteIndex"),

EDITSETTINGS("editSettings"),
EDIT_SETTINGS("editSettings"),

LISTINDEXES("listIndexes"),
LIST_INDEXES("listIndexes"),

LOGS("logs"),

Expand All @@ -31,13 +31,13 @@ public enum Acl {

SEARCH("search"),

SEEUNRETRIEVABLEATTRIBUTES("seeUnretrievableAttributes"),
SEE_UNRETRIEVABLE_ATTRIBUTES("seeUnretrievableAttributes"),

SETTINGS("settings"),

USAGE("usage");

private String value;
private final String value;

Acl(String value) {
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
/** type of operation. */
@JsonAdapter(Action.Adapter.class)
public enum Action {
ADDOBJECT("addObject"),
ADD_OBJECT("addObject"),

UPDATEOBJECT("updateObject"),
UPDATE_OBJECT("updateObject"),

PARTIALUPDATEOBJECT("partialUpdateObject"),
PARTIAL_UPDATE_OBJECT("partialUpdateObject"),

PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"),
PARTIAL_UPDATE_OBJECT_NO_CREATE("partialUpdateObjectNoCreate"),

DELETEOBJECT("deleteObject"),
DELETE_OBJECT("deleteObject"),

DELETE("delete"),

CLEAR("clear");

private String value;
private final String value;

Action(String value) {
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AddApiKeyResponse {
@SerializedName("createdAt")
private String createdAt;

public AddApiKeyResponse key(String key) {
public AddApiKeyResponse setKey(String key) {
this.key = key;
return this;
}
Expand All @@ -27,11 +27,7 @@ public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public AddApiKeyResponse createdAt(String createdAt) {
public AddApiKeyResponse setCreatedAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
Expand All @@ -46,10 +42,6 @@ public String getCreatedAt() {
return createdAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
public enum Anchoring {
IS("is"),

STARTSWITH("startsWith"),
STARTS_WITH("startsWith"),

ENDSWITH("endsWith"),
ENDS_WITH("endsWith"),

CONTAINS("contains");

private String value;
private final String value;

Anchoring(String value) {
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ApiKey {
@SerializedName("validity")
private Integer validity = 0;

public ApiKey acl(List<Acl> acl) {
public ApiKey setAcl(List<Acl> acl) {
this.acl = acl;
return this;
}
Expand All @@ -52,11 +52,7 @@ public List<Acl> getAcl() {
return acl;
}

public void setAcl(List<Acl> acl) {
this.acl = acl;
}

public ApiKey description(String description) {
public ApiKey setDescription(String description) {
this.description = description;
return this;
}
Expand All @@ -72,11 +68,7 @@ public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public ApiKey indexes(List<String> indexes) {
public ApiKey setIndexes(List<String> indexes) {
this.indexes = indexes;
return this;
}
Expand All @@ -100,11 +92,7 @@ public List<String> getIndexes() {
return indexes;
}

public void setIndexes(List<String> indexes) {
this.indexes = indexes;
}

public ApiKey maxHitsPerQuery(Integer maxHitsPerQuery) {
public ApiKey setMaxHitsPerQuery(Integer maxHitsPerQuery) {
this.maxHitsPerQuery = maxHitsPerQuery;
return this;
}
Expand All @@ -119,11 +107,7 @@ public Integer getMaxHitsPerQuery() {
return maxHitsPerQuery;
}

public void setMaxHitsPerQuery(Integer maxHitsPerQuery) {
this.maxHitsPerQuery = maxHitsPerQuery;
}

public ApiKey maxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
public ApiKey setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour;
return this;
}
Expand All @@ -138,11 +122,7 @@ public Integer getMaxQueriesPerIPPerHour() {
return maxQueriesPerIPPerHour;
}

public void setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour;
}

public ApiKey queryParameters(String queryParameters) {
public ApiKey setQueryParameters(String queryParameters) {
this.queryParameters = queryParameters;
return this;
}
Expand All @@ -158,11 +138,7 @@ public String getQueryParameters() {
return queryParameters;
}

public void setQueryParameters(String queryParameters) {
this.queryParameters = queryParameters;
}

public ApiKey referers(List<String> referers) {
public ApiKey setReferers(List<String> referers) {
this.referers = referers;
return this;
}
Expand All @@ -185,11 +161,7 @@ public List<String> getReferers() {
return referers;
}

public void setReferers(List<String> referers) {
this.referers = referers;
}

public ApiKey validity(Integer validity) {
public ApiKey setValidity(Integer validity) {
this.validity = validity;
return this;
}
Expand All @@ -205,10 +177,6 @@ public Integer getValidity() {
return validity;
}

public void setValidity(Integer validity) {
this.validity = validity;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public static AroundRadius ofInteger(Integer inside) {
return new AroundRadiusInteger(inside);
}

public abstract Object getInsideValue();

public static class Adapter extends TypeAdapter<AroundRadius> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public enum AroundRadiusOneOf {
ALL("all");

private String value;
private final String value;

AroundRadiusOneOf(String value) {
this.value = value;
Expand Down
Loading