Skip to content

Commit 71d3e21

Browse files
Automatically update Java SDK
1 parent d64d16b commit 71d3e21

35 files changed

+4974
-48
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- General project information -->
99
<groupId>so.trophy</groupId>
1010
<artifactId>trophy-java</artifactId>
11-
<version>1.5.0</version>
11+
<version>1.6.0</version>
1212
<packaging>jar</packaging>
1313
<name>Trophy</name>
1414
<description>Java client library for the Trophy API</description>

src/main/java/so/trophy/core/ClientOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private ClientOptions(Environment environment, Map<String, String> headers,
3030
this.environment = environment;
3131
this.headers = new HashMap<>();
3232
this.headers.putAll(headers);
33-
this.headers.putAll(new HashMap<String,String>() {{put("X-Fern-Language", "JAVA");put("X-Fern-SDK-Name", "com.trophy.fern:api-sdk");put("X-Fern-SDK-Version", "0.0.1909");}});
33+
this.headers.putAll(new HashMap<String,String>() {{put("X-Fern-Language", "JAVA");put("X-Fern-SDK-Name", "com.trophy.fern:api-sdk");put("X-Fern-SDK-Version", "0.0.2040");}});
3434
this.headerSuppliers = headerSuppliers;
3535
this.httpClient = httpClient;
3636
this.timeout = timeout;

src/main/java/so/trophy/resources/admin/AdminClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import so.trophy.core.ClientOptions;
99
import so.trophy.core.Suppliers;
1010
import java.util.function.Supplier;
11+
import so.trophy.resources.admin.attributes.AttributesClient;
12+
import so.trophy.resources.admin.metrics.MetricsClient;
1113
import so.trophy.resources.admin.points.PointsClient;
1214
import so.trophy.resources.admin.streaks.StreaksClient;
1315

@@ -16,18 +18,32 @@ public class AdminClient {
1618

1719
protected final Supplier<StreaksClient> streaksClient;
1820

21+
protected final Supplier<AttributesClient> attributesClient;
22+
23+
protected final Supplier<MetricsClient> metricsClient;
24+
1925
protected final Supplier<PointsClient> pointsClient;
2026

2127
public AdminClient(ClientOptions clientOptions) {
2228
this.clientOptions = clientOptions;
2329
this.streaksClient = Suppliers.memoize(() -> new StreaksClient(clientOptions));
30+
this.attributesClient = Suppliers.memoize(() -> new AttributesClient(clientOptions));
31+
this.metricsClient = Suppliers.memoize(() -> new MetricsClient(clientOptions));
2432
this.pointsClient = Suppliers.memoize(() -> new PointsClient(clientOptions));
2533
}
2634

2735
public StreaksClient streaks() {
2836
return this.streaksClient.get();
2937
}
3038

39+
public AttributesClient attributes() {
40+
return this.attributesClient.get();
41+
}
42+
43+
public MetricsClient metrics() {
44+
return this.metricsClient.get();
45+
}
46+
3147
public PointsClient points() {
3248
return this.pointsClient.get();
3349
}

src/main/java/so/trophy/resources/admin/AsyncAdminClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import so.trophy.core.ClientOptions;
99
import so.trophy.core.Suppliers;
1010
import java.util.function.Supplier;
11+
import so.trophy.resources.admin.attributes.AsyncAttributesClient;
12+
import so.trophy.resources.admin.metrics.AsyncMetricsClient;
1113
import so.trophy.resources.admin.points.AsyncPointsClient;
1214
import so.trophy.resources.admin.streaks.AsyncStreaksClient;
1315

@@ -16,18 +18,32 @@ public class AsyncAdminClient {
1618

1719
protected final Supplier<AsyncStreaksClient> streaksClient;
1820

21+
protected final Supplier<AsyncAttributesClient> attributesClient;
22+
23+
protected final Supplier<AsyncMetricsClient> metricsClient;
24+
1925
protected final Supplier<AsyncPointsClient> pointsClient;
2026

2127
public AsyncAdminClient(ClientOptions clientOptions) {
2228
this.clientOptions = clientOptions;
2329
this.streaksClient = Suppliers.memoize(() -> new AsyncStreaksClient(clientOptions));
30+
this.attributesClient = Suppliers.memoize(() -> new AsyncAttributesClient(clientOptions));
31+
this.metricsClient = Suppliers.memoize(() -> new AsyncMetricsClient(clientOptions));
2432
this.pointsClient = Suppliers.memoize(() -> new AsyncPointsClient(clientOptions));
2533
}
2634

2735
public AsyncStreaksClient streaks() {
2836
return this.streaksClient.get();
2937
}
3038

39+
public AsyncAttributesClient attributes() {
40+
return this.attributesClient.get();
41+
}
42+
43+
public AsyncMetricsClient metrics() {
44+
return this.metricsClient.get();
45+
}
46+
3147
public AsyncPointsClient points() {
3248
return this.pointsClient.get();
3349
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
package so.trophy.resources.admin.attributes;
2+
3+
/**
4+
* This file was auto-generated by Fern from our API Definition.
5+
*/
6+
7+
8+
import so.trophy.core.ClientOptions;
9+
import so.trophy.core.RequestOptions;
10+
import java.lang.String;
11+
import java.util.List;
12+
import java.util.concurrent.CompletableFuture;
13+
import so.trophy.resources.admin.attributes.requests.AttributesDeleteRequest;
14+
import so.trophy.resources.admin.attributes.requests.AttributesListRequest;
15+
import so.trophy.types.AdminAttribute;
16+
import so.trophy.types.CreateAttributeRequestItem;
17+
import so.trophy.types.CreateAttributesResponse;
18+
import so.trophy.types.DeleteAttributesResponse;
19+
import so.trophy.types.UpdateAttributeRequestItem;
20+
import so.trophy.types.UpdateAttributesResponse;
21+
22+
public class AsyncAttributesClient {
23+
protected final ClientOptions clientOptions;
24+
25+
private final AsyncRawAttributesClient rawClient;
26+
27+
public AsyncAttributesClient(ClientOptions clientOptions) {
28+
this.clientOptions = clientOptions;
29+
this.rawClient = new AsyncRawAttributesClient(clientOptions);
30+
}
31+
32+
/**
33+
* Get responses with HTTP metadata like headers
34+
*/
35+
public AsyncRawAttributesClient withRawResponse() {
36+
return this.rawClient;
37+
}
38+
39+
/**
40+
* List attributes.
41+
*/
42+
public CompletableFuture<List<AdminAttribute>> list() {
43+
return this.rawClient.list().thenApply(response -> response.body());
44+
}
45+
46+
/**
47+
* List attributes.
48+
*/
49+
public CompletableFuture<List<AdminAttribute>> list(AttributesListRequest request) {
50+
return this.rawClient.list(request).thenApply(response -> response.body());
51+
}
52+
53+
/**
54+
* List attributes.
55+
*/
56+
public CompletableFuture<List<AdminAttribute>> list(AttributesListRequest request,
57+
RequestOptions requestOptions) {
58+
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
59+
}
60+
61+
/**
62+
* Create attributes in bulk.
63+
*/
64+
public CompletableFuture<CreateAttributesResponse> create(
65+
List<CreateAttributeRequestItem> request) {
66+
return this.rawClient.create(request).thenApply(response -> response.body());
67+
}
68+
69+
/**
70+
* Create attributes in bulk.
71+
*/
72+
public CompletableFuture<CreateAttributesResponse> create(
73+
List<CreateAttributeRequestItem> request, RequestOptions requestOptions) {
74+
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
75+
}
76+
77+
/**
78+
* Delete attributes in bulk by ID.
79+
*/
80+
public CompletableFuture<DeleteAttributesResponse> delete() {
81+
return this.rawClient.delete().thenApply(response -> response.body());
82+
}
83+
84+
/**
85+
* Delete attributes in bulk by ID.
86+
*/
87+
public CompletableFuture<DeleteAttributesResponse> delete(AttributesDeleteRequest request) {
88+
return this.rawClient.delete(request).thenApply(response -> response.body());
89+
}
90+
91+
/**
92+
* Delete attributes in bulk by ID.
93+
*/
94+
public CompletableFuture<DeleteAttributesResponse> delete(AttributesDeleteRequest request,
95+
RequestOptions requestOptions) {
96+
return this.rawClient.delete(request, requestOptions).thenApply(response -> response.body());
97+
}
98+
99+
/**
100+
* Update attributes in bulk by ID.
101+
*/
102+
public CompletableFuture<UpdateAttributesResponse> update(
103+
List<UpdateAttributeRequestItem> request) {
104+
return this.rawClient.update(request).thenApply(response -> response.body());
105+
}
106+
107+
/**
108+
* Update attributes in bulk by ID.
109+
*/
110+
public CompletableFuture<UpdateAttributesResponse> update(
111+
List<UpdateAttributeRequestItem> request, RequestOptions requestOptions) {
112+
return this.rawClient.update(request, requestOptions).thenApply(response -> response.body());
113+
}
114+
115+
/**
116+
* Get an attribute by ID.
117+
*/
118+
public CompletableFuture<AdminAttribute> get(String id) {
119+
return this.rawClient.get(id).thenApply(response -> response.body());
120+
}
121+
122+
/**
123+
* Get an attribute by ID.
124+
*/
125+
public CompletableFuture<AdminAttribute> get(String id, RequestOptions requestOptions) {
126+
return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
127+
}
128+
}

0 commit comments

Comments
 (0)