Skip to content

Commit 25d8c8b

Browse files
feat(specs): add analytics v3 pattern endpoints (generated)
algolia/api-clients-automation#6795 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: My Lan Aragon <mylan.aragon@algolia.com>
1 parent a2d3d50 commit 25d8c8b

21 files changed

Lines changed: 3559 additions & 0 deletions

algoliasearch/src/main/java/com/algolia/api/AnalyticsClient.java

Lines changed: 1306 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.analytics;
5+
6+
import com.algolia.exceptions.AlgoliaRuntimeException;
7+
import com.fasterxml.jackson.annotation.*;
8+
import com.fasterxml.jackson.core.*;
9+
import com.fasterxml.jackson.databind.*;
10+
import com.fasterxml.jackson.databind.annotation.*;
11+
import java.io.IOException;
12+
import java.util.logging.Logger;
13+
14+
/**
15+
* A histogram bin edge. Use integers for discrete distributions and floating-point values for
16+
* continuous ones.
17+
*/
18+
@JsonDeserialize(using = BinEdge.Deserializer.class)
19+
public interface BinEdge {
20+
// BinEdge as Integer wrapper.
21+
static BinEdge of(Integer value) {
22+
return new IntegerWrapper(value);
23+
}
24+
25+
// BinEdge as Double wrapper.
26+
static BinEdge of(Double value) {
27+
return new DoubleWrapper(value);
28+
}
29+
30+
// BinEdge as Integer wrapper.
31+
@JsonSerialize(using = IntegerWrapper.Serializer.class)
32+
class IntegerWrapper implements BinEdge {
33+
34+
private final Integer value;
35+
36+
IntegerWrapper(Integer value) {
37+
this.value = value;
38+
}
39+
40+
public Integer getValue() {
41+
return value;
42+
}
43+
44+
static class Serializer extends JsonSerializer<IntegerWrapper> {
45+
46+
@Override
47+
public void serialize(IntegerWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
48+
gen.writeObject(value.getValue());
49+
}
50+
}
51+
}
52+
53+
// BinEdge as Double wrapper.
54+
@JsonSerialize(using = DoubleWrapper.Serializer.class)
55+
class DoubleWrapper implements BinEdge {
56+
57+
private final Double value;
58+
59+
DoubleWrapper(Double value) {
60+
this.value = value;
61+
}
62+
63+
public Double getValue() {
64+
return value;
65+
}
66+
67+
static class Serializer extends JsonSerializer<DoubleWrapper> {
68+
69+
@Override
70+
public void serialize(DoubleWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
71+
gen.writeObject(value.getValue());
72+
}
73+
}
74+
}
75+
76+
class Deserializer extends JsonDeserializer<BinEdge> {
77+
78+
private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());
79+
80+
@Override
81+
public BinEdge deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
82+
JsonNode tree = jp.readValueAsTree();
83+
// deserialize Integer
84+
if (tree.isInt()) {
85+
try (JsonParser parser = tree.traverse(jp.getCodec())) {
86+
Integer value = parser.readValueAs(Integer.class);
87+
return new BinEdge.IntegerWrapper(value);
88+
} catch (Exception e) {
89+
// deserialization failed, continue
90+
LOGGER.finest("Failed to deserialize oneOf Integer (error: " + e.getMessage() + ") (type: Integer)");
91+
}
92+
}
93+
// deserialize Double
94+
if (tree.isDouble()) {
95+
try (JsonParser parser = tree.traverse(jp.getCodec())) {
96+
Double value = parser.readValueAs(Double.class);
97+
return new BinEdge.DoubleWrapper(value);
98+
} catch (Exception e) {
99+
// deserialization failed, continue
100+
LOGGER.finest("Failed to deserialize oneOf Double (error: " + e.getMessage() + ") (type: Double)");
101+
}
102+
}
103+
throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
104+
}
105+
106+
/** Handle deserialization of the 'null' value. */
107+
@Override
108+
public BinEdge getNullValue(DeserializationContext ctxt) throws JsonMappingException {
109+
throw new JsonMappingException(ctxt.getParser(), "BinEdge cannot be null");
110+
}
111+
}
112+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.analytics;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
import java.util.Objects;
11+
12+
/** Catalog */
13+
public class Catalog {
14+
15+
@JsonProperty("domains")
16+
private Map<String, DomainCatalog> domains = new HashMap<>();
17+
18+
public Catalog setDomains(Map<String, DomainCatalog> domains) {
19+
this.domains = domains;
20+
return this;
21+
}
22+
23+
public Catalog putDomains(String key, DomainCatalog domainsItem) {
24+
this.domains.put(key, domainsItem);
25+
return this;
26+
}
27+
28+
/** Catalog entries grouped by domain. */
29+
@javax.annotation.Nonnull
30+
public Map<String, DomainCatalog> getDomains() {
31+
return domains;
32+
}
33+
34+
@Override
35+
public boolean equals(Object o) {
36+
if (this == o) {
37+
return true;
38+
}
39+
if (o == null || getClass() != o.getClass()) {
40+
return false;
41+
}
42+
Catalog catalog = (Catalog) o;
43+
return Objects.equals(this.domains, catalog.domains);
44+
}
45+
46+
@Override
47+
public int hashCode() {
48+
return Objects.hash(domains);
49+
}
50+
51+
@Override
52+
public String toString() {
53+
StringBuilder sb = new StringBuilder();
54+
sb.append("class Catalog {\n");
55+
sb.append(" domains: ").append(toIndentedString(domains)).append("\n");
56+
sb.append("}");
57+
return sb.toString();
58+
}
59+
60+
/**
61+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
62+
*/
63+
private String toIndentedString(Object o) {
64+
if (o == null) {
65+
return "null";
66+
}
67+
return o.toString().replace("\n", "\n ");
68+
}
69+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.analytics;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Objects;
11+
12+
/** CatalogEntry */
13+
public class CatalogEntry {
14+
15+
@JsonProperty("kind")
16+
private String kind;
17+
18+
@JsonProperty("description")
19+
private String description;
20+
21+
@JsonProperty("roots")
22+
private List<String> roots = new ArrayList<>();
23+
24+
@JsonProperty("requires")
25+
private List<String> requires = new ArrayList<>();
26+
27+
public CatalogEntry setKind(String kind) {
28+
this.kind = kind;
29+
return this;
30+
}
31+
32+
/** Field identifier. */
33+
@javax.annotation.Nonnull
34+
public String getKind() {
35+
return kind;
36+
}
37+
38+
public CatalogEntry setDescription(String description) {
39+
this.description = description;
40+
return this;
41+
}
42+
43+
/** Human-readable description of the field. */
44+
@javax.annotation.Nonnull
45+
public String getDescription() {
46+
return description;
47+
}
48+
49+
public CatalogEntry setRoots(List<String> roots) {
50+
this.roots = roots;
51+
return this;
52+
}
53+
54+
public CatalogEntry addRoots(String rootsItem) {
55+
this.roots.add(rootsItem);
56+
return this;
57+
}
58+
59+
/**
60+
* Root stages the field depends on. Two fields are combinable in one query only when their roots
61+
* intersect.
62+
*/
63+
@javax.annotation.Nonnull
64+
public List<String> getRoots() {
65+
return roots;
66+
}
67+
68+
public CatalogEntry setRequires(List<String> requires) {
69+
this.requires = requires;
70+
return this;
71+
}
72+
73+
public CatalogEntry addRequires(String requiresItem) {
74+
this.requires.add(requiresItem);
75+
return this;
76+
}
77+
78+
/** Public ACL identifiers required to read the field, for example `clickAnalyticsEnabled`. */
79+
@javax.annotation.Nonnull
80+
public List<String> getRequires() {
81+
return requires;
82+
}
83+
84+
@Override
85+
public boolean equals(Object o) {
86+
if (this == o) {
87+
return true;
88+
}
89+
if (o == null || getClass() != o.getClass()) {
90+
return false;
91+
}
92+
CatalogEntry catalogEntry = (CatalogEntry) o;
93+
return (
94+
Objects.equals(this.kind, catalogEntry.kind) &&
95+
Objects.equals(this.description, catalogEntry.description) &&
96+
Objects.equals(this.roots, catalogEntry.roots) &&
97+
Objects.equals(this.requires, catalogEntry.requires)
98+
);
99+
}
100+
101+
@Override
102+
public int hashCode() {
103+
return Objects.hash(kind, description, roots, requires);
104+
}
105+
106+
@Override
107+
public String toString() {
108+
StringBuilder sb = new StringBuilder();
109+
sb.append("class CatalogEntry {\n");
110+
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
111+
sb.append(" description: ").append(toIndentedString(description)).append("\n");
112+
sb.append(" roots: ").append(toIndentedString(roots)).append("\n");
113+
sb.append(" requires: ").append(toIndentedString(requires)).append("\n");
114+
sb.append("}");
115+
return sb.toString();
116+
}
117+
118+
/**
119+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
120+
*/
121+
private String toIndentedString(Object o) {
122+
if (o == null) {
123+
return "null";
124+
}
125+
return o.toString().replace("\n", "\n ");
126+
}
127+
}

0 commit comments

Comments
 (0)