Skip to content

Commit acd56c0

Browse files
millotpalgolia-bot
andauthored
Generated code for commit 34ad2c1. (#345)
Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: algolia-bot <[email protected]>
1 parent af34375 commit acd56c0

File tree

114 files changed

+1328
-3998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1328
-3998
lines changed

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java

Lines changed: 13 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.google.gson.internal.ObjectConstructor;
1818
import com.google.gson.internal.Primitives;
1919
import com.google.gson.internal.bind.MapTypeAdapterFactory;
20-
import com.google.gson.internal.bind.util.ISO8601Utils;
2120
import com.google.gson.reflect.TypeToken;
2221
import com.google.gson.stream.JsonReader;
2322
import com.google.gson.stream.JsonToken;
@@ -28,11 +27,7 @@
2827
import java.lang.reflect.Field;
2928
import java.lang.reflect.Type;
3029
import java.lang.reflect.TypeVariable;
31-
import java.text.DateFormat;
32-
import java.text.ParseException;
33-
import java.text.ParsePosition;
3430
import java.util.Collections;
35-
import java.util.Date;
3631
import java.util.EnumMap;
3732
import java.util.HashMap;
3833
import java.util.Hashtable;
@@ -47,14 +42,12 @@
4742
public class JSON {
4843

4944
private static Gson gson;
50-
private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
51-
private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
52-
private static RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory();
45+
private static final ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
46+
private static final RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory();
5347

5448
static {
5549
gson =
5650
createGson()
57-
.registerTypeAdapter(Date.class, dateTypeAdapter)
5851
.registerTypeAdapter(byte[].class, byteArrayAdapter)
5952
.registerTypeAdapterFactory(mapAdapter)
6053
.create();
@@ -65,6 +58,11 @@ public static GsonBuilder createGson() {
6558
return fireBuilder.createGsonBuilder();
6659
}
6760

61+
// Suppress default constructor for noninstantiability
62+
private JSON() {
63+
throw new AssertionError();
64+
}
65+
6866
/**
6967
* Get Gson.
7068
*
@@ -115,10 +113,6 @@ public static <T> T deserialize(String body, Type returnType) {
115113
}
116114
}
117115
}
118-
119-
public static void setDateFormat(DateFormat dateFormat) {
120-
dateTypeAdapter.setFormat(dateFormat);
121-
}
122116
}
123117

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

136130
@Override
137131
public byte[] read(JsonReader in) throws IOException {
138-
switch (in.peek()) {
139-
case NULL:
140-
in.nextNull();
141-
return null;
142-
default:
143-
String bytesAsBase64 = in.nextString();
144-
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
145-
return byteString.toByteArray();
146-
}
147-
}
148-
}
149-
150-
/**
151-
* Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be used.
152-
*/
153-
class DateTypeAdapter extends TypeAdapter<Date> {
154-
155-
private DateFormat dateFormat;
156-
157-
public DateTypeAdapter() {}
158-
159-
public DateTypeAdapter(DateFormat dateFormat) {
160-
this.dateFormat = dateFormat;
161-
}
162-
163-
public void setFormat(DateFormat dateFormat) {
164-
this.dateFormat = dateFormat;
165-
}
166-
167-
@Override
168-
public void write(JsonWriter out, Date date) throws IOException {
169-
if (date == null) {
170-
out.nullValue();
171-
} else {
172-
String value;
173-
if (dateFormat != null) {
174-
value = dateFormat.format(date);
175-
} else {
176-
value = ISO8601Utils.format(date, true);
177-
}
178-
out.value(value);
179-
}
180-
}
181-
182-
@Override
183-
public Date read(JsonReader in) throws IOException {
184-
try {
185-
switch (in.peek()) {
186-
case NULL:
187-
in.nextNull();
188-
return null;
189-
default:
190-
String date = in.nextString();
191-
try {
192-
if (dateFormat != null) {
193-
return dateFormat.parse(date);
194-
}
195-
return ISO8601Utils.parse(date, new ParsePosition(0));
196-
} catch (ParseException e) {
197-
throw new JsonParseException(e);
198-
}
199-
}
200-
} catch (IllegalArgumentException e) {
201-
throw new JsonParseException(e);
132+
if (in.peek() == JsonToken.NULL) {
133+
in.nextNull();
134+
return null;
202135
}
136+
String bytesAsBase64 = in.nextString();
137+
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
138+
return byteString != null ? byteString.toByteArray() : new byte[0];
203139
}
204140
}
205141

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/Acl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
/** Gets or Sets acl */
1010
@JsonAdapter(Acl.Adapter.class)
1111
public enum Acl {
12-
ADDOBJECT("addObject"),
12+
ADD_OBJECT("addObject"),
1313

1414
ANALYTICS("analytics"),
1515

1616
BROWSE("browse"),
1717

18-
DELETEOBJECT("deleteObject"),
18+
DELETE_OBJECT("deleteObject"),
1919

20-
DELETEINDEX("deleteIndex"),
20+
DELETE_INDEX("deleteIndex"),
2121

22-
EDITSETTINGS("editSettings"),
22+
EDIT_SETTINGS("editSettings"),
2323

24-
LISTINDEXES("listIndexes"),
24+
LIST_INDEXES("listIndexes"),
2525

2626
LOGS("logs"),
2727

@@ -31,13 +31,13 @@ public enum Acl {
3131

3232
SEARCH("search"),
3333

34-
SEEUNRETRIEVABLEATTRIBUTES("seeUnretrievableAttributes"),
34+
SEE_UNRETRIEVABLE_ATTRIBUTES("seeUnretrievableAttributes"),
3535

3636
SETTINGS("settings"),
3737

3838
USAGE("usage");
3939

40-
private String value;
40+
private final String value;
4141

4242
Acl(String value) {
4343
this.value = value;

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/Action.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
/** type of operation. */
1010
@JsonAdapter(Action.Adapter.class)
1111
public enum Action {
12-
ADDOBJECT("addObject"),
12+
ADD_OBJECT("addObject"),
1313

14-
UPDATEOBJECT("updateObject"),
14+
UPDATE_OBJECT("updateObject"),
1515

16-
PARTIALUPDATEOBJECT("partialUpdateObject"),
16+
PARTIAL_UPDATE_OBJECT("partialUpdateObject"),
1717

18-
PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"),
18+
PARTIAL_UPDATE_OBJECT_NO_CREATE("partialUpdateObjectNoCreate"),
1919

20-
DELETEOBJECT("deleteObject"),
20+
DELETE_OBJECT("deleteObject"),
2121

2222
DELETE("delete"),
2323

2424
CLEAR("clear");
2525

26-
private String value;
26+
private final String value;
2727

2828
Action(String value) {
2929
this.value = value;

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/AddApiKeyResponse.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AddApiKeyResponse {
1212
@SerializedName("createdAt")
1313
private String createdAt;
1414

15-
public AddApiKeyResponse key(String key) {
15+
public AddApiKeyResponse setKey(String key) {
1616
this.key = key;
1717
return this;
1818
}
@@ -27,11 +27,7 @@ public String getKey() {
2727
return key;
2828
}
2929

30-
public void setKey(String key) {
31-
this.key = key;
32-
}
33-
34-
public AddApiKeyResponse createdAt(String createdAt) {
30+
public AddApiKeyResponse setCreatedAt(String createdAt) {
3531
this.createdAt = createdAt;
3632
return this;
3733
}
@@ -46,10 +42,6 @@ public String getCreatedAt() {
4642
return createdAt;
4743
}
4844

49-
public void setCreatedAt(String createdAt) {
50-
this.createdAt = createdAt;
51-
}
52-
5345
@Override
5446
public boolean equals(Object o) {
5547
if (this == o) {

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/Anchoring.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
public enum Anchoring {
1515
IS("is"),
1616

17-
STARTSWITH("startsWith"),
17+
STARTS_WITH("startsWith"),
1818

19-
ENDSWITH("endsWith"),
19+
ENDS_WITH("endsWith"),
2020

2121
CONTAINS("contains");
2222

23-
private String value;
23+
private final String value;
2424

2525
Anchoring(String value) {
2626
this.value = value;

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/ApiKey.java

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ApiKey {
3232
@SerializedName("validity")
3333
private Integer validity = 0;
3434

35-
public ApiKey acl(List<Acl> acl) {
35+
public ApiKey setAcl(List<Acl> acl) {
3636
this.acl = acl;
3737
return this;
3838
}
@@ -52,11 +52,7 @@ public List<Acl> getAcl() {
5252
return acl;
5353
}
5454

55-
public void setAcl(List<Acl> acl) {
56-
this.acl = acl;
57-
}
58-
59-
public ApiKey description(String description) {
55+
public ApiKey setDescription(String description) {
6056
this.description = description;
6157
return this;
6258
}
@@ -72,11 +68,7 @@ public String getDescription() {
7268
return description;
7369
}
7470

75-
public void setDescription(String description) {
76-
this.description = description;
77-
}
78-
79-
public ApiKey indexes(List<String> indexes) {
71+
public ApiKey setIndexes(List<String> indexes) {
8072
this.indexes = indexes;
8173
return this;
8274
}
@@ -100,11 +92,7 @@ public List<String> getIndexes() {
10092
return indexes;
10193
}
10294

103-
public void setIndexes(List<String> indexes) {
104-
this.indexes = indexes;
105-
}
106-
107-
public ApiKey maxHitsPerQuery(Integer maxHitsPerQuery) {
95+
public ApiKey setMaxHitsPerQuery(Integer maxHitsPerQuery) {
10896
this.maxHitsPerQuery = maxHitsPerQuery;
10997
return this;
11098
}
@@ -119,11 +107,7 @@ public Integer getMaxHitsPerQuery() {
119107
return maxHitsPerQuery;
120108
}
121109

122-
public void setMaxHitsPerQuery(Integer maxHitsPerQuery) {
123-
this.maxHitsPerQuery = maxHitsPerQuery;
124-
}
125-
126-
public ApiKey maxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
110+
public ApiKey setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
127111
this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour;
128112
return this;
129113
}
@@ -138,11 +122,7 @@ public Integer getMaxQueriesPerIPPerHour() {
138122
return maxQueriesPerIPPerHour;
139123
}
140124

141-
public void setMaxQueriesPerIPPerHour(Integer maxQueriesPerIPPerHour) {
142-
this.maxQueriesPerIPPerHour = maxQueriesPerIPPerHour;
143-
}
144-
145-
public ApiKey queryParameters(String queryParameters) {
125+
public ApiKey setQueryParameters(String queryParameters) {
146126
this.queryParameters = queryParameters;
147127
return this;
148128
}
@@ -158,11 +138,7 @@ public String getQueryParameters() {
158138
return queryParameters;
159139
}
160140

161-
public void setQueryParameters(String queryParameters) {
162-
this.queryParameters = queryParameters;
163-
}
164-
165-
public ApiKey referers(List<String> referers) {
141+
public ApiKey setReferers(List<String> referers) {
166142
this.referers = referers;
167143
return this;
168144
}
@@ -185,11 +161,7 @@ public List<String> getReferers() {
185161
return referers;
186162
}
187163

188-
public void setReferers(List<String> referers) {
189-
this.referers = referers;
190-
}
191-
192-
public ApiKey validity(Integer validity) {
164+
public ApiKey setValidity(Integer validity) {
193165
this.validity = validity;
194166
return this;
195167
}
@@ -205,10 +177,6 @@ public Integer getValidity() {
205177
return validity;
206178
}
207179

208-
public void setValidity(Integer validity) {
209-
this.validity = validity;
210-
}
211-
212180
@Override
213181
public boolean equals(Object o) {
214182
if (this == o) {

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/AroundRadius.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ public static AroundRadius ofInteger(Integer inside) {
2020
return new AroundRadiusInteger(inside);
2121
}
2222

23-
public abstract Object getInsideValue();
24-
2523
public static class Adapter extends TypeAdapter<AroundRadius> {
2624

2725
@Override

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/search/AroundRadiusOneOf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
public enum AroundRadiusOneOf {
1212
ALL("all");
1313

14-
private String value;
14+
private final String value;
1515

1616
AroundRadiusOneOf(String value) {
1717
this.value = value;

0 commit comments

Comments
 (0)