Skip to content

Commit 0b80f6d

Browse files
Automatically update Java SDK
1 parent f4ec75c commit 0b80f6d

20 files changed

Lines changed: 561 additions & 294 deletions

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.3.4</version>
11+
<version>1.4.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.1794");}});
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.1879");}});
3434
this.headerSuppliers = headerSuppliers;
3535
this.httpClient = httpClient;
3636
this.timeout = timeout;

src/main/java/so/trophy/resources/admin/points/boosts/AsyncBoostsClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
import so.trophy.core.ClientOptions;
99
import so.trophy.core.RequestOptions;
1010
import java.lang.String;
11-
import java.lang.Void;
1211
import java.util.concurrent.CompletableFuture;
1312
import so.trophy.resources.admin.points.boosts.requests.BoostsBatchArchiveRequest;
1413
import so.trophy.resources.admin.points.boosts.requests.CreatePointsBoostsRequest;
15-
import so.trophy.types.ArchivePointsBoostsResponse;
1614
import so.trophy.types.CreatePointsBoostsResponse;
15+
import so.trophy.types.DeletePointsBoostsResponse;
1716

1817
public class AsyncBoostsClient {
1918
protected final ClientOptions clientOptions;
@@ -50,37 +49,38 @@ public CompletableFuture<CreatePointsBoostsResponse> create(CreatePointsBoostsRe
5049
/**
5150
* Archive multiple points boosts by ID.
5251
*/
53-
public CompletableFuture<ArchivePointsBoostsResponse> batchArchive() {
52+
public CompletableFuture<DeletePointsBoostsResponse> batchArchive() {
5453
return this.rawClient.batchArchive().thenApply(response -> response.body());
5554
}
5655

5756
/**
5857
* Archive multiple points boosts by ID.
5958
*/
60-
public CompletableFuture<ArchivePointsBoostsResponse> batchArchive(
59+
public CompletableFuture<DeletePointsBoostsResponse> batchArchive(
6160
BoostsBatchArchiveRequest request) {
6261
return this.rawClient.batchArchive(request).thenApply(response -> response.body());
6362
}
6463

6564
/**
6665
* Archive multiple points boosts by ID.
6766
*/
68-
public CompletableFuture<ArchivePointsBoostsResponse> batchArchive(
67+
public CompletableFuture<DeletePointsBoostsResponse> batchArchive(
6968
BoostsBatchArchiveRequest request, RequestOptions requestOptions) {
7069
return this.rawClient.batchArchive(request, requestOptions).thenApply(response -> response.body());
7170
}
7271

7372
/**
7473
* Archive a points boost by ID.
7574
*/
76-
public CompletableFuture<Void> archive(String id) {
75+
public CompletableFuture<DeletePointsBoostsResponse> archive(String id) {
7776
return this.rawClient.archive(id).thenApply(response -> response.body());
7877
}
7978

8079
/**
8180
* Archive a points boost by ID.
8281
*/
83-
public CompletableFuture<Void> archive(String id, RequestOptions requestOptions) {
82+
public CompletableFuture<DeletePointsBoostsResponse> archive(String id,
83+
RequestOptions requestOptions) {
8484
return this.rawClient.archive(id, requestOptions).thenApply(response -> response.body());
8585
}
8686
}

src/main/java/so/trophy/resources/admin/points/boosts/AsyncRawBoostsClient.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.lang.Object;
2323
import java.lang.Override;
2424
import java.lang.String;
25-
import java.lang.Void;
2625
import java.util.concurrent.CompletableFuture;
2726
import okhttp3.Call;
2827
import okhttp3.Callback;
@@ -36,8 +35,8 @@
3635
import org.jetbrains.annotations.NotNull;
3736
import so.trophy.resources.admin.points.boosts.requests.BoostsBatchArchiveRequest;
3837
import so.trophy.resources.admin.points.boosts.requests.CreatePointsBoostsRequest;
39-
import so.trophy.types.ArchivePointsBoostsResponse;
4038
import so.trophy.types.CreatePointsBoostsResponse;
39+
import so.trophy.types.DeletePointsBoostsResponse;
4140
import so.trophy.types.ErrorBody;
4241

4342
public class AsyncRawBoostsClient {
@@ -126,22 +125,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
126125
/**
127126
* Archive multiple points boosts by ID.
128127
*/
129-
public CompletableFuture<TrophyApiHttpResponse<ArchivePointsBoostsResponse>> batchArchive() {
128+
public CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> batchArchive() {
130129
return batchArchive(BoostsBatchArchiveRequest.builder().build());
131130
}
132131

133132
/**
134133
* Archive multiple points boosts by ID.
135134
*/
136-
public CompletableFuture<TrophyApiHttpResponse<ArchivePointsBoostsResponse>> batchArchive(
135+
public CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> batchArchive(
137136
BoostsBatchArchiveRequest request) {
138137
return batchArchive(request,null);
139138
}
140139

141140
/**
142141
* Archive multiple points boosts by ID.
143142
*/
144-
public CompletableFuture<TrophyApiHttpResponse<ArchivePointsBoostsResponse>> batchArchive(
143+
public CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> batchArchive(
145144
BoostsBatchArchiveRequest request, RequestOptions requestOptions) {
146145
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getAdminURL()).newBuilder()
147146

@@ -158,13 +157,13 @@ public CompletableFuture<TrophyApiHttpResponse<ArchivePointsBoostsResponse>> bat
158157
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
159158
client = clientOptions.httpClientWithTimeout(requestOptions);
160159
}
161-
CompletableFuture<TrophyApiHttpResponse<ArchivePointsBoostsResponse>> future = new CompletableFuture<>();
160+
CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> future = new CompletableFuture<>();
162161
client.newCall(okhttpRequest).enqueue(new Callback() {
163162
@Override
164163
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
165164
try (ResponseBody responseBody = response.body()) {
166165
if (response.isSuccessful()) {
167-
future.complete(new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ArchivePointsBoostsResponse.class), response));
166+
future.complete(new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePointsBoostsResponse.class), response));
168167
return;
169168
}
170169
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
@@ -198,14 +197,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
198197
/**
199198
* Archive a points boost by ID.
200199
*/
201-
public CompletableFuture<TrophyApiHttpResponse<Void>> archive(String id) {
200+
public CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> archive(String id) {
202201
return archive(id,null);
203202
}
204203

205204
/**
206205
* Archive a points boost by ID.
207206
*/
208-
public CompletableFuture<TrophyApiHttpResponse<Void>> archive(String id,
207+
public CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> archive(String id,
209208
RequestOptions requestOptions) {
210209
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getAdminURL()).newBuilder()
211210

@@ -222,18 +221,20 @@ public CompletableFuture<TrophyApiHttpResponse<Void>> archive(String id,
222221
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
223222
client = clientOptions.httpClientWithTimeout(requestOptions);
224223
}
225-
CompletableFuture<TrophyApiHttpResponse<Void>> future = new CompletableFuture<>();
224+
CompletableFuture<TrophyApiHttpResponse<DeletePointsBoostsResponse>> future = new CompletableFuture<>();
226225
client.newCall(okhttpRequest).enqueue(new Callback() {
227226
@Override
228227
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
229228
try (ResponseBody responseBody = response.body()) {
230229
if (response.isSuccessful()) {
231-
future.complete(new TrophyApiHttpResponse<>(null, response));
230+
future.complete(new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePointsBoostsResponse.class), response));
232231
return;
233232
}
234233
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
235234
try {
236235
switch (response.code()) {
236+
case 400:future.completeExceptionally(new BadRequestError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response));
237+
return;
237238
case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response));
238239
return;
239240
case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response));

src/main/java/so/trophy/resources/admin/points/boosts/BoostsClient.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import java.lang.String;
1111
import so.trophy.resources.admin.points.boosts.requests.BoostsBatchArchiveRequest;
1212
import so.trophy.resources.admin.points.boosts.requests.CreatePointsBoostsRequest;
13-
import so.trophy.types.ArchivePointsBoostsResponse;
1413
import so.trophy.types.CreatePointsBoostsResponse;
14+
import so.trophy.types.DeletePointsBoostsResponse;
1515

1616
public class BoostsClient {
1717
protected final ClientOptions clientOptions;
@@ -48,36 +48,36 @@ public CreatePointsBoostsResponse create(CreatePointsBoostsRequest request,
4848
/**
4949
* Archive multiple points boosts by ID.
5050
*/
51-
public ArchivePointsBoostsResponse batchArchive() {
51+
public DeletePointsBoostsResponse batchArchive() {
5252
return this.rawClient.batchArchive().body();
5353
}
5454

5555
/**
5656
* Archive multiple points boosts by ID.
5757
*/
58-
public ArchivePointsBoostsResponse batchArchive(BoostsBatchArchiveRequest request) {
58+
public DeletePointsBoostsResponse batchArchive(BoostsBatchArchiveRequest request) {
5959
return this.rawClient.batchArchive(request).body();
6060
}
6161

6262
/**
6363
* Archive multiple points boosts by ID.
6464
*/
65-
public ArchivePointsBoostsResponse batchArchive(BoostsBatchArchiveRequest request,
65+
public DeletePointsBoostsResponse batchArchive(BoostsBatchArchiveRequest request,
6666
RequestOptions requestOptions) {
6767
return this.rawClient.batchArchive(request, requestOptions).body();
6868
}
6969

7070
/**
7171
* Archive a points boost by ID.
7272
*/
73-
public void archive(String id) {
74-
this.rawClient.archive(id).body();
73+
public DeletePointsBoostsResponse archive(String id) {
74+
return this.rawClient.archive(id).body();
7575
}
7676

7777
/**
7878
* Archive a points boost by ID.
7979
*/
80-
public void archive(String id, RequestOptions requestOptions) {
81-
this.rawClient.archive(id, requestOptions).body();
80+
public DeletePointsBoostsResponse archive(String id, RequestOptions requestOptions) {
81+
return this.rawClient.archive(id, requestOptions).body();
8282
}
8383
}

src/main/java/so/trophy/resources/admin/points/boosts/RawBoostsClient.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.io.IOException;
2222
import java.lang.Object;
2323
import java.lang.String;
24-
import java.lang.Void;
2524
import okhttp3.Headers;
2625
import okhttp3.HttpUrl;
2726
import okhttp3.OkHttpClient;
@@ -31,8 +30,8 @@
3130
import okhttp3.ResponseBody;
3231
import so.trophy.resources.admin.points.boosts.requests.BoostsBatchArchiveRequest;
3332
import so.trophy.resources.admin.points.boosts.requests.CreatePointsBoostsRequest;
34-
import so.trophy.types.ArchivePointsBoostsResponse;
3533
import so.trophy.types.CreatePointsBoostsResponse;
34+
import so.trophy.types.DeletePointsBoostsResponse;
3635
import so.trophy.types.ErrorBody;
3736

3837
public class RawBoostsClient {
@@ -104,22 +103,22 @@ public TrophyApiHttpResponse<CreatePointsBoostsResponse> create(CreatePointsBoos
104103
/**
105104
* Archive multiple points boosts by ID.
106105
*/
107-
public TrophyApiHttpResponse<ArchivePointsBoostsResponse> batchArchive() {
106+
public TrophyApiHttpResponse<DeletePointsBoostsResponse> batchArchive() {
108107
return batchArchive(BoostsBatchArchiveRequest.builder().build());
109108
}
110109

111110
/**
112111
* Archive multiple points boosts by ID.
113112
*/
114-
public TrophyApiHttpResponse<ArchivePointsBoostsResponse> batchArchive(
113+
public TrophyApiHttpResponse<DeletePointsBoostsResponse> batchArchive(
115114
BoostsBatchArchiveRequest request) {
116115
return batchArchive(request,null);
117116
}
118117

119118
/**
120119
* Archive multiple points boosts by ID.
121120
*/
122-
public TrophyApiHttpResponse<ArchivePointsBoostsResponse> batchArchive(
121+
public TrophyApiHttpResponse<DeletePointsBoostsResponse> batchArchive(
123122
BoostsBatchArchiveRequest request, RequestOptions requestOptions) {
124123
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getAdminURL()).newBuilder()
125124

@@ -139,7 +138,7 @@ public TrophyApiHttpResponse<ArchivePointsBoostsResponse> batchArchive(
139138
try (Response response = client.newCall(okhttpRequest).execute()) {
140139
ResponseBody responseBody = response.body();
141140
if (response.isSuccessful()) {
142-
return new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ArchivePointsBoostsResponse.class), response);
141+
return new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePointsBoostsResponse.class), response);
143142
}
144143
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
145144
try {
@@ -161,14 +160,15 @@ public TrophyApiHttpResponse<ArchivePointsBoostsResponse> batchArchive(
161160
/**
162161
* Archive a points boost by ID.
163162
*/
164-
public TrophyApiHttpResponse<Void> archive(String id) {
163+
public TrophyApiHttpResponse<DeletePointsBoostsResponse> archive(String id) {
165164
return archive(id,null);
166165
}
167166

168167
/**
169168
* Archive a points boost by ID.
170169
*/
171-
public TrophyApiHttpResponse<Void> archive(String id, RequestOptions requestOptions) {
170+
public TrophyApiHttpResponse<DeletePointsBoostsResponse> archive(String id,
171+
RequestOptions requestOptions) {
172172
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getAdminURL()).newBuilder()
173173

174174
.addPathSegments("points/boosts")
@@ -187,11 +187,12 @@ public TrophyApiHttpResponse<Void> archive(String id, RequestOptions requestOpti
187187
try (Response response = client.newCall(okhttpRequest).execute()) {
188188
ResponseBody responseBody = response.body();
189189
if (response.isSuccessful()) {
190-
return new TrophyApiHttpResponse<>(null, response);
190+
return new TrophyApiHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePointsBoostsResponse.class), response);
191191
}
192192
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
193193
try {
194194
switch (response.code()) {
195+
case 400:throw new BadRequestError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response);
195196
case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response);
196197
case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorBody.class), response);
197198
}

src/main/java/so/trophy/resources/admin/points/boosts/requests/CreatePointsBoostsRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public String getSystemKey() {
5151
}
5252

5353
/**
54-
* @return Array of boosts to create. Maximum 1,000 boosts per request.
54+
* @return Array of boosts to create. Maximum 100 boosts per request.
5555
*/
5656
@JsonProperty("boosts")
5757
public List<CreatePointsBoostsRequestBoostsItem> getBoosts() {
@@ -100,7 +100,7 @@ public interface _FinalStage {
100100
CreatePointsBoostsRequest build();
101101

102102
/**
103-
* <p>Array of boosts to create. Maximum 1,000 boosts per request.</p>
103+
* <p>Array of boosts to create. Maximum 100 boosts per request.</p>
104104
*/
105105
_FinalStage boosts(List<CreatePointsBoostsRequestBoostsItem> boosts);
106106

@@ -143,7 +143,7 @@ public _FinalStage systemKey(@NotNull String systemKey) {
143143
}
144144

145145
/**
146-
* <p>Array of boosts to create. Maximum 1,000 boosts per request.</p>
146+
* <p>Array of boosts to create. Maximum 100 boosts per request.</p>
147147
* @return Reference to {@code this} so that method calls can be chained together.
148148
*/
149149
@java.lang.Override
@@ -155,7 +155,7 @@ public _FinalStage addAllBoosts(List<CreatePointsBoostsRequestBoostsItem> boosts
155155
}
156156

157157
/**
158-
* <p>Array of boosts to create. Maximum 1,000 boosts per request.</p>
158+
* <p>Array of boosts to create. Maximum 100 boosts per request.</p>
159159
* @return Reference to {@code this} so that method calls can be chained together.
160160
*/
161161
@java.lang.Override
@@ -165,7 +165,7 @@ public _FinalStage addBoosts(CreatePointsBoostsRequestBoostsItem boosts) {
165165
}
166166

167167
/**
168-
* <p>Array of boosts to create. Maximum 1,000 boosts per request.</p>
168+
* <p>Array of boosts to create. Maximum 100 boosts per request.</p>
169169
*/
170170
@java.lang.Override
171171
@JsonSetter(

src/main/java/so/trophy/resources/admin/streaks/AsyncRawStreaksClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public AsyncRawStreaksClient(ClientOptions clientOptions) {
4343
}
4444

4545
/**
46-
* Restore streaks for multiple users to the maximum length in the last 90 days (in the case of daily streaks), one year (in the case of weekly streaks), or two years (in the case of monthly streaks).
46+
* Restore streaks for multiple users to the maximum previously achieved streak length found within the current restore window: the last 90 days for daily streaks, weekly periods starting with the week containing the start of the current calendar year for weekly streaks, and monthly periods starting at the beginning of the previous calendar year for monthly streaks.
4747
*/
4848
public CompletableFuture<TrophyApiHttpResponse<RestoreStreaksResponse>> restore(
4949
RestoreStreaksRequest request) {
5050
return restore(request,null);
5151
}
5252

5353
/**
54-
* Restore streaks for multiple users to the maximum length in the last 90 days (in the case of daily streaks), one year (in the case of weekly streaks), or two years (in the case of monthly streaks).
54+
* Restore streaks for multiple users to the maximum previously achieved streak length found within the current restore window: the last 90 days for daily streaks, weekly periods starting with the week containing the start of the current calendar year for weekly streaks, and monthly periods starting at the beginning of the previous calendar year for monthly streaks.
5555
*/
5656
public CompletableFuture<TrophyApiHttpResponse<RestoreStreaksResponse>> restore(
5757
RestoreStreaksRequest request, RequestOptions requestOptions) {

src/main/java/so/trophy/resources/admin/streaks/AsyncStreaksClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public AsyncRawStreaksClient withRawResponse() {
3535
}
3636

3737
/**
38-
* Restore streaks for multiple users to the maximum length in the last 90 days (in the case of daily streaks), one year (in the case of weekly streaks), or two years (in the case of monthly streaks).
38+
* Restore streaks for multiple users to the maximum previously achieved streak length found within the current restore window: the last 90 days for daily streaks, weekly periods starting with the week containing the start of the current calendar year for weekly streaks, and monthly periods starting at the beginning of the previous calendar year for monthly streaks.
3939
*/
4040
public CompletableFuture<RestoreStreaksResponse> restore(RestoreStreaksRequest request) {
4141
return this.rawClient.restore(request).thenApply(response -> response.body());
4242
}
4343

4444
/**
45-
* Restore streaks for multiple users to the maximum length in the last 90 days (in the case of daily streaks), one year (in the case of weekly streaks), or two years (in the case of monthly streaks).
45+
* Restore streaks for multiple users to the maximum previously achieved streak length found within the current restore window: the last 90 days for daily streaks, weekly periods starting with the week containing the start of the current calendar year for weekly streaks, and monthly periods starting at the beginning of the previous calendar year for monthly streaks.
4646
*/
4747
public CompletableFuture<RestoreStreaksResponse> restore(RestoreStreaksRequest request,
4848
RequestOptions requestOptions) {

0 commit comments

Comments
 (0)