Skip to content

Commit af856a2

Browse files
authored
Merge pull request #16 from merge-api/fern-bot/08-14-2023-0951PM
🌿 Fern Regeneration -- August 14, 2023
2 parents 6f289b4 + 2929c9c commit af856a2

13 files changed

+715
-51
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ publishing {
3434
maven(MavenPublication) {
3535
groupId = 'dev.merge'
3636
artifactId = 'merge-java-client'
37-
version = '0.1.1'
37+
version = '0.1.2'
3838
from components.java
3939
}
4040
}

src/main/java/com/merge/api/MergeApiClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,34 @@ public class MergeApiClient {
1515

1616
protected final Supplier<AtsClient> atsClient;
1717

18+
protected final Supplier<CrmClient> crmClient;
19+
1820
protected final Supplier<FilestorageClient> filestorageClient;
1921

2022
protected final Supplier<HrisClient> hrisClient;
2123

2224
protected final Supplier<TicketingClient> ticketingClient;
2325

24-
protected final Supplier<CrmClient> crmClient;
25-
2626
protected final Supplier<AccountingClient> accountingClient;
2727

2828
public MergeApiClient(ClientOptions clientOptions) {
2929
this.clientOptions = clientOptions;
3030
this.atsClient = Suppliers.memoize(() -> new AtsClient(clientOptions));
31+
this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions));
3132
this.filestorageClient = Suppliers.memoize(() -> new FilestorageClient(clientOptions));
3233
this.hrisClient = Suppliers.memoize(() -> new HrisClient(clientOptions));
3334
this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
34-
this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions));
3535
this.accountingClient = Suppliers.memoize(() -> new AccountingClient(clientOptions));
3636
}
3737

3838
public AtsClient ats() {
3939
return this.atsClient.get();
4040
}
4141

42+
public CrmClient crm() {
43+
return this.crmClient.get();
44+
}
45+
4246
public FilestorageClient filestorage() {
4347
return this.filestorageClient.get();
4448
}
@@ -51,10 +55,6 @@ public TicketingClient ticketing() {
5155
return this.ticketingClient.get();
5256
}
5357

54-
public CrmClient crm() {
55-
return this.crmClient.get();
56-
}
57-
5858
public AccountingClient accounting() {
5959
return this.accountingClient.get();
6060
}

src/main/java/com/merge/api/core/ClientOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private ClientOptions(
2323
this.headers = new HashMap<>();
2424
this.headers.putAll(headers);
2525
this.headers.putAll(Map.of(
26-
"X-Fern-SDK-Name", "com.merge.fern:api-sdk", "X-Fern-SDK-Version", "0.1.1", "X-Fern-Language", "JAVA"));
26+
"X-Fern-SDK-Name", "com.merge.fern:api-sdk", "X-Fern-SDK-Version", "0.1.2", "X-Fern-Language", "JAVA"));
2727
this.headerSuppliers = headerSuppliers;
2828
this.httpClient = httpClient;
2929
;

src/main/java/com/merge/api/resources/crm/types/RemoteFieldClass.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public final class RemoteFieldClass {
2525

2626
private final Optional<Boolean> isRequired;
2727

28-
private final Optional<FieldTypeEnum> fieldType;
28+
private final Optional<RemoteFieldClassFieldType> fieldType;
2929

30-
private final Optional<FieldFormatEnum> fieldFormat;
30+
private final Optional<RemoteFieldClassFieldFormat> fieldFormat;
3131

32-
private final Optional<List<String>> fieldChoices;
32+
private final Optional<List<RemoteFieldClassFieldChoicesItem>> fieldChoices;
3333

3434
private final Optional<ItemSchema> itemSchema;
3535

@@ -40,9 +40,9 @@ private RemoteFieldClass(
4040
Optional<String> description,
4141
Optional<Boolean> isCustom,
4242
Optional<Boolean> isRequired,
43-
Optional<FieldTypeEnum> fieldType,
44-
Optional<FieldFormatEnum> fieldFormat,
45-
Optional<List<String>> fieldChoices,
43+
Optional<RemoteFieldClassFieldType> fieldType,
44+
Optional<RemoteFieldClassFieldFormat> fieldFormat,
45+
Optional<List<RemoteFieldClassFieldChoicesItem>> fieldChoices,
4646
Optional<ItemSchema> itemSchema) {
4747
this.id = id;
4848
this.displayName = displayName;
@@ -87,17 +87,17 @@ public Optional<Boolean> getIsRequired() {
8787
}
8888

8989
@JsonProperty("field_type")
90-
public Optional<FieldTypeEnum> getFieldType() {
90+
public Optional<RemoteFieldClassFieldType> getFieldType() {
9191
return fieldType;
9292
}
9393

9494
@JsonProperty("field_format")
95-
public Optional<FieldFormatEnum> getFieldFormat() {
95+
public Optional<RemoteFieldClassFieldFormat> getFieldFormat() {
9696
return fieldFormat;
9797
}
9898

9999
@JsonProperty("field_choices")
100-
public Optional<List<String>> getFieldChoices() {
100+
public Optional<List<RemoteFieldClassFieldChoicesItem>> getFieldChoices() {
101101
return fieldChoices;
102102
}
103103

@@ -166,11 +166,11 @@ public static final class Builder {
166166

167167
private Optional<Boolean> isRequired = Optional.empty();
168168

169-
private Optional<FieldTypeEnum> fieldType = Optional.empty();
169+
private Optional<RemoteFieldClassFieldType> fieldType = Optional.empty();
170170

171-
private Optional<FieldFormatEnum> fieldFormat = Optional.empty();
171+
private Optional<RemoteFieldClassFieldFormat> fieldFormat = Optional.empty();
172172

173-
private Optional<List<String>> fieldChoices = Optional.empty();
173+
private Optional<List<RemoteFieldClassFieldChoicesItem>> fieldChoices = Optional.empty();
174174

175175
private Optional<ItemSchema> itemSchema = Optional.empty();
176176

@@ -257,34 +257,34 @@ public Builder isRequired(Boolean isRequired) {
257257
}
258258

259259
@JsonSetter(value = "field_type", nulls = Nulls.SKIP)
260-
public Builder fieldType(Optional<FieldTypeEnum> fieldType) {
260+
public Builder fieldType(Optional<RemoteFieldClassFieldType> fieldType) {
261261
this.fieldType = fieldType;
262262
return this;
263263
}
264264

265-
public Builder fieldType(FieldTypeEnum fieldType) {
265+
public Builder fieldType(RemoteFieldClassFieldType fieldType) {
266266
this.fieldType = Optional.of(fieldType);
267267
return this;
268268
}
269269

270270
@JsonSetter(value = "field_format", nulls = Nulls.SKIP)
271-
public Builder fieldFormat(Optional<FieldFormatEnum> fieldFormat) {
271+
public Builder fieldFormat(Optional<RemoteFieldClassFieldFormat> fieldFormat) {
272272
this.fieldFormat = fieldFormat;
273273
return this;
274274
}
275275

276-
public Builder fieldFormat(FieldFormatEnum fieldFormat) {
276+
public Builder fieldFormat(RemoteFieldClassFieldFormat fieldFormat) {
277277
this.fieldFormat = Optional.of(fieldFormat);
278278
return this;
279279
}
280280

281281
@JsonSetter(value = "field_choices", nulls = Nulls.SKIP)
282-
public Builder fieldChoices(Optional<List<String>> fieldChoices) {
282+
public Builder fieldChoices(Optional<List<RemoteFieldClassFieldChoicesItem>> fieldChoices) {
283283
this.fieldChoices = fieldChoices;
284284
return this;
285285
}
286286

287-
public Builder fieldChoices(List<String> fieldChoices) {
287+
public Builder fieldChoices(List<RemoteFieldClassFieldChoicesItem> fieldChoices) {
288288
this.fieldChoices = Optional.of(fieldChoices);
289289
return this;
290290
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package com.merge.api.resources.crm.types;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import com.fasterxml.jackson.annotation.JsonSetter;
7+
import com.fasterxml.jackson.annotation.Nulls;
8+
import com.fasterxml.jackson.databind.JsonNode;
9+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
10+
import java.util.Objects;
11+
import java.util.Optional;
12+
13+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
14+
@JsonDeserialize(builder = RemoteFieldClassFieldChoicesItem.Builder.class)
15+
public final class RemoteFieldClassFieldChoicesItem {
16+
private final Optional<JsonNode> value;
17+
18+
private final Optional<String> displayName;
19+
20+
private RemoteFieldClassFieldChoicesItem(Optional<JsonNode> value, Optional<String> displayName) {
21+
this.value = value;
22+
this.displayName = displayName;
23+
}
24+
25+
@JsonProperty("value")
26+
public Optional<JsonNode> getValue() {
27+
return value;
28+
}
29+
30+
@JsonProperty("display_name")
31+
public Optional<String> getDisplayName() {
32+
return displayName;
33+
}
34+
35+
@Override
36+
public boolean equals(Object other) {
37+
if (this == other) return true;
38+
return other instanceof RemoteFieldClassFieldChoicesItem && equalTo((RemoteFieldClassFieldChoicesItem) other);
39+
}
40+
41+
private boolean equalTo(RemoteFieldClassFieldChoicesItem other) {
42+
return value.equals(other.value) && displayName.equals(other.displayName);
43+
}
44+
45+
@Override
46+
public int hashCode() {
47+
return Objects.hash(this.value, this.displayName);
48+
}
49+
50+
@Override
51+
public String toString() {
52+
return "RemoteFieldClassFieldChoicesItem{" + "value: " + value + ", displayName: " + displayName + "}";
53+
}
54+
55+
public static Builder builder() {
56+
return new Builder();
57+
}
58+
59+
@JsonIgnoreProperties(ignoreUnknown = true)
60+
public static final class Builder {
61+
private Optional<JsonNode> value = Optional.empty();
62+
63+
private Optional<String> displayName = Optional.empty();
64+
65+
private Builder() {}
66+
67+
public Builder from(RemoteFieldClassFieldChoicesItem other) {
68+
value(other.getValue());
69+
displayName(other.getDisplayName());
70+
return this;
71+
}
72+
73+
@JsonSetter(value = "value", nulls = Nulls.SKIP)
74+
public Builder value(Optional<JsonNode> value) {
75+
this.value = value;
76+
return this;
77+
}
78+
79+
public Builder value(JsonNode value) {
80+
this.value = Optional.of(value);
81+
return this;
82+
}
83+
84+
@JsonSetter(value = "display_name", nulls = Nulls.SKIP)
85+
public Builder displayName(Optional<String> displayName) {
86+
this.displayName = displayName;
87+
return this;
88+
}
89+
90+
public Builder displayName(String displayName) {
91+
this.displayName = Optional.of(displayName);
92+
return this;
93+
}
94+
95+
public RemoteFieldClassFieldChoicesItem build() {
96+
return new RemoteFieldClassFieldChoicesItem(value, displayName);
97+
}
98+
}
99+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package com.merge.api.resources.crm.types;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
import com.fasterxml.jackson.core.JsonParseException;
5+
import com.fasterxml.jackson.core.JsonParser;
6+
import com.fasterxml.jackson.databind.DeserializationContext;
7+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
8+
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
9+
import com.merge.api.core.ObjectMappers;
10+
import java.io.IOException;
11+
import java.util.Objects;
12+
13+
@JsonDeserialize(using = RemoteFieldClassFieldFormat.Deserializer.class)
14+
public final class RemoteFieldClassFieldFormat {
15+
private final Object value;
16+
17+
private final int type;
18+
19+
private RemoteFieldClassFieldFormat(Object value, int type) {
20+
this.value = value;
21+
this.type = type;
22+
}
23+
24+
@JsonValue
25+
public Object get() {
26+
return this.value;
27+
}
28+
29+
public <T> T visit(Visitor<T> visitor) {
30+
if (this.type == 0) {
31+
return visitor.visit((FieldFormatEnum) this.value);
32+
} else if (this.type == 1) {
33+
return visitor.visit((String) this.value);
34+
}
35+
throw new IllegalStateException("Failed to visit value. This should never happen.");
36+
}
37+
38+
@Override
39+
public boolean equals(Object other) {
40+
if (this == other) return true;
41+
return other instanceof RemoteFieldClassFieldFormat && equalTo((RemoteFieldClassFieldFormat) other);
42+
}
43+
44+
private boolean equalTo(RemoteFieldClassFieldFormat other) {
45+
return value.equals(other.value);
46+
}
47+
48+
@Override
49+
public int hashCode() {
50+
return Objects.hash(this.value);
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return this.value.toString();
56+
}
57+
58+
public static RemoteFieldClassFieldFormat of(FieldFormatEnum value) {
59+
return new RemoteFieldClassFieldFormat(value, 0);
60+
}
61+
62+
public static RemoteFieldClassFieldFormat of(String value) {
63+
return new RemoteFieldClassFieldFormat(value, 1);
64+
}
65+
66+
public interface Visitor<T> {
67+
T visit(FieldFormatEnum value);
68+
69+
T visit(String value);
70+
}
71+
72+
static final class Deserializer extends StdDeserializer<RemoteFieldClassFieldFormat> {
73+
Deserializer() {
74+
super(RemoteFieldClassFieldFormat.class);
75+
}
76+
77+
@Override
78+
public RemoteFieldClassFieldFormat deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
79+
Object value = p.readValueAs(Object.class);
80+
try {
81+
return of(ObjectMappers.JSON_MAPPER.convertValue(value, FieldFormatEnum.class));
82+
} catch (IllegalArgumentException e) {
83+
}
84+
try {
85+
return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class));
86+
} catch (IllegalArgumentException e) {
87+
}
88+
throw new JsonParseException(p, "Failed to deserialize");
89+
}
90+
}
91+
}

0 commit comments

Comments
 (0)