Skip to content

Commit 5497f46

Browse files
Upgrade generator version - fix for null error messages (#42)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 8862fa7 commit 5497f46

File tree

198 files changed

+1980
-960
lines changed

Some content is hidden

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

198 files changed

+1980
-960
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ jobs:
5858
env:
5959
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
6060
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
61-
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"
61+
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"

build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ publishing {
4646
maven(MavenPublication) {
4747
groupId = 'dev.merge'
4848
artifactId = 'merge-java-client'
49-
version = '1.0.8'
49+
version = '1.0.9'
5050
from components.java
51+
pom {
52+
scm {
53+
connection = 'scm:git:git://github.com/merge-api/merge-java-client.git'
54+
developerConnection = 'scm:git:git://github.com/merge-api/merge-java-client.git'
55+
url = 'https://github.com/merge-api/merge-java-client'
56+
}
57+
}
5158
}
5259
}
5360
repositories {

gradle/wrapper/gradle-wrapper.jar

-9 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,48 @@
1616
public class MergeApiClient {
1717
protected final ClientOptions clientOptions;
1818

19+
protected final Supplier<FilestorageClient> filestorageClient;
20+
1921
protected final Supplier<AtsClient> atsClient;
2022

21-
protected final Supplier<CrmClient> crmClient;
23+
protected final Supplier<TicketingClient> ticketingClient;
2224

23-
protected final Supplier<FilestorageClient> filestorageClient;
25+
protected final Supplier<CrmClient> crmClient;
2426

2527
protected final Supplier<HrisClient> hrisClient;
2628

27-
protected final Supplier<TicketingClient> ticketingClient;
28-
2929
protected final Supplier<AccountingClient> accountingClient;
3030

3131
public MergeApiClient(ClientOptions clientOptions) {
3232
this.clientOptions = clientOptions;
33+
this.filestorageClient = Suppliers.memoize(() -> new FilestorageClient(clientOptions));
3334
this.atsClient = Suppliers.memoize(() -> new AtsClient(clientOptions));
35+
this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
3436
this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions));
35-
this.filestorageClient = Suppliers.memoize(() -> new FilestorageClient(clientOptions));
3637
this.hrisClient = Suppliers.memoize(() -> new HrisClient(clientOptions));
37-
this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
3838
this.accountingClient = Suppliers.memoize(() -> new AccountingClient(clientOptions));
3939
}
4040

41+
public FilestorageClient filestorage() {
42+
return this.filestorageClient.get();
43+
}
44+
4145
public AtsClient ats() {
4246
return this.atsClient.get();
4347
}
4448

45-
public CrmClient crm() {
46-
return this.crmClient.get();
49+
public TicketingClient ticketing() {
50+
return this.ticketingClient.get();
4751
}
4852

49-
public FilestorageClient filestorage() {
50-
return this.filestorageClient.get();
53+
public CrmClient crm() {
54+
return this.crmClient.get();
5155
}
5256

5357
public HrisClient hris() {
5458
return this.hrisClient.get();
5559
}
5660

57-
public TicketingClient ticketing() {
58-
return this.ticketingClient.get();
59-
}
60-
6161
public AccountingClient accounting() {
6262
return this.accountingClient.get();
6363
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ public MergeApiClient build() {
4646
throw new RuntimeException("Please provide apiKey");
4747
}
4848
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.apiKey);
49-
if (accountToken == null) {
50-
throw new RuntimeException("Please provide accountToken");
49+
if (accountToken != null) {
50+
this.clientOptionsBuilder.addHeader("X-Account-Token", this.accountToken);
5151
}
52-
this.clientOptionsBuilder.addHeader("X-Account-Token", this.accountToken);
5352
clientOptionsBuilder.environment(this.environment);
5453
return new MergeApiClient(clientOptionsBuilder.build());
5554
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private ClientOptions(
2727
this.headers = new HashMap<>();
2828
this.headers.putAll(headers);
2929
this.headers.putAll(Map.of(
30-
"X-Fern-SDK-Name", "com.merge.fern:api-sdk", "X-Fern-SDK-Version", "1.0.8", "X-Fern-Language", "JAVA"));
30+
"X-Fern-SDK-Name", "com.merge.fern:api-sdk", "X-Fern-SDK-Version", "1.0.9", "X-Fern-Language", "JAVA"));
3131
this.headerSuppliers = headerSuppliers;
3232
this.httpClient = httpClient;
3333
;

src/main/java/com/merge/api/resources/accounting/accountdetails/AccountDetailsClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import okhttp3.OkHttpClient;
1515
import okhttp3.Request;
1616
import okhttp3.Response;
17+
import okhttp3.ResponseBody;
1718

1819
public class AccountDetailsClient {
1920
protected final ClientOptions clientOptions;
@@ -49,12 +50,14 @@ public AccountDetails retrieve(RequestOptions requestOptions) {
4950
client = clientOptions.httpClientWithTimeout(requestOptions);
5051
}
5152
Response response = client.newCall(okhttpRequest).execute();
53+
ResponseBody responseBody = response.body();
5254
if (response.isSuccessful()) {
53-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AccountDetails.class);
55+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AccountDetails.class);
5456
}
5557
throw new ApiError(
5658
response.code(),
57-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
59+
ObjectMappers.JSON_MAPPER.readValue(
60+
responseBody != null ? responseBody.string() : "{}", Object.class));
5861
} catch (IOException e) {
5962
throw new RuntimeException(e);
6063
}

src/main/java/com/merge/api/resources/accounting/accountingperiods/AccountingPeriodsClient.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import okhttp3.OkHttpClient;
1818
import okhttp3.Request;
1919
import okhttp3.Response;
20+
import okhttp3.ResponseBody;
2021

2122
public class AccountingPeriodsClient {
2223
protected final ClientOptions clientOptions;
@@ -73,13 +74,14 @@ public PaginatedAccountingPeriodList list(AccountingPeriodsListRequest request,
7374
client = clientOptions.httpClientWithTimeout(requestOptions);
7475
}
7576
Response response = client.newCall(okhttpRequest).execute();
77+
ResponseBody responseBody = response.body();
7678
if (response.isSuccessful()) {
77-
return ObjectMappers.JSON_MAPPER.readValue(
78-
response.body().string(), PaginatedAccountingPeriodList.class);
79+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PaginatedAccountingPeriodList.class);
7980
}
8081
throw new ApiError(
8182
response.code(),
82-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
83+
ObjectMappers.JSON_MAPPER.readValue(
84+
responseBody != null ? responseBody.string() : "{}", Object.class));
8385
} catch (IOException e) {
8486
throw new RuntimeException(e);
8587
}
@@ -124,12 +126,14 @@ public AccountingPeriod retrieve(
124126
client = clientOptions.httpClientWithTimeout(requestOptions);
125127
}
126128
Response response = client.newCall(okhttpRequest).execute();
129+
ResponseBody responseBody = response.body();
127130
if (response.isSuccessful()) {
128-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AccountingPeriod.class);
131+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AccountingPeriod.class);
129132
}
130133
throw new ApiError(
131134
response.code(),
132-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
135+
ObjectMappers.JSON_MAPPER.readValue(
136+
responseBody != null ? responseBody.string() : "{}", Object.class));
133137
} catch (IOException e) {
134138
throw new RuntimeException(e);
135139
}

src/main/java/com/merge/api/resources/accounting/accounts/AccountsClient.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import okhttp3.Request;
2525
import okhttp3.RequestBody;
2626
import okhttp3.Response;
27+
import okhttp3.ResponseBody;
2728

2829
public class AccountsClient {
2930
protected final ClientOptions clientOptions;
@@ -113,12 +114,14 @@ public PaginatedAccountList list(AccountsListRequest request, RequestOptions req
113114
client = clientOptions.httpClientWithTimeout(requestOptions);
114115
}
115116
Response response = client.newCall(okhttpRequest).execute();
117+
ResponseBody responseBody = response.body();
116118
if (response.isSuccessful()) {
117-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), PaginatedAccountList.class);
119+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PaginatedAccountList.class);
118120
}
119121
throw new ApiError(
120122
response.code(),
121-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
123+
ObjectMappers.JSON_MAPPER.readValue(
124+
responseBody != null ? responseBody.string() : "{}", Object.class));
122125
} catch (IOException e) {
123126
throw new RuntimeException(e);
124127
}
@@ -166,12 +169,14 @@ public AccountResponse create(AccountEndpointRequest request, RequestOptions req
166169
client = clientOptions.httpClientWithTimeout(requestOptions);
167170
}
168171
Response response = client.newCall(okhttpRequest).execute();
172+
ResponseBody responseBody = response.body();
169173
if (response.isSuccessful()) {
170-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AccountResponse.class);
174+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AccountResponse.class);
171175
}
172176
throw new ApiError(
173177
response.code(),
174-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
178+
ObjectMappers.JSON_MAPPER.readValue(
179+
responseBody != null ? responseBody.string() : "{}", Object.class));
175180
} catch (IOException e) {
176181
throw new RuntimeException(e);
177182
}
@@ -226,12 +231,14 @@ public Account retrieve(String id, AccountsRetrieveRequest request, RequestOptio
226231
client = clientOptions.httpClientWithTimeout(requestOptions);
227232
}
228233
Response response = client.newCall(okhttpRequest).execute();
234+
ResponseBody responseBody = response.body();
229235
if (response.isSuccessful()) {
230-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Account.class);
236+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class);
231237
}
232238
throw new ApiError(
233239
response.code(),
234-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
240+
ObjectMappers.JSON_MAPPER.readValue(
241+
responseBody != null ? responseBody.string() : "{}", Object.class));
235242
} catch (IOException e) {
236243
throw new RuntimeException(e);
237244
}
@@ -264,12 +271,14 @@ public MetaResponse metaPostRetrieve(RequestOptions requestOptions) {
264271
client = clientOptions.httpClientWithTimeout(requestOptions);
265272
}
266273
Response response = client.newCall(okhttpRequest).execute();
274+
ResponseBody responseBody = response.body();
267275
if (response.isSuccessful()) {
268-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), MetaResponse.class);
276+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), MetaResponse.class);
269277
}
270278
throw new ApiError(
271279
response.code(),
272-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
280+
ObjectMappers.JSON_MAPPER.readValue(
281+
responseBody != null ? responseBody.string() : "{}", Object.class));
273282
} catch (IOException e) {
274283
throw new RuntimeException(e);
275284
}

0 commit comments

Comments
 (0)