Skip to content

Commit 968af1b

Browse files
Monthly SDK Update to Latest API Definition (#23)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 5de2ab3 commit 968af1b

File tree

315 files changed

+18283
-2149
lines changed

Some content is hidden

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

315 files changed

+18283
-2149
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ publishing {
4040
maven(MavenPublication) {
4141
groupId = 'dev.merge'
4242
artifactId = 'merge-java-client'
43-
version = '0.1.6'
43+
version = '0.1.7'
4444
from components.java
4545
}
4646
}

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.6", "X-Fern-Language", "JAVA"));
26+
"X-Fern-SDK-Name", "com.merge.fern:api-sdk", "X-Fern-SDK-Version", "0.1.7", "X-Fern-Language", "JAVA"));
2727
this.headerSuppliers = headerSuppliers;
2828
this.httpClient = httpClient;
2929
;

src/main/java/com/merge/api/resources/accounting/AccountingClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import com.merge.api.core.ClientOptions;
44
import com.merge.api.core.Suppliers;
55
import com.merge.api.resources.accounting.accountdetails.AccountDetailsClient;
6+
import com.merge.api.resources.accounting.accountingperiods.AccountingPeriodsClient;
67
import com.merge.api.resources.accounting.accounts.AccountsClient;
78
import com.merge.api.resources.accounting.accounttoken.AccountTokenClient;
89
import com.merge.api.resources.accounting.addresses.AddressesClient;
910
import com.merge.api.resources.accounting.asyncpassthrough.AsyncPassthroughClient;
1011
import com.merge.api.resources.accounting.attachments.AttachmentsClient;
12+
import com.merge.api.resources.accounting.audittrail.AuditTrailClient;
1113
import com.merge.api.resources.accounting.availableactions.AvailableActionsClient;
1214
import com.merge.api.resources.accounting.balancesheets.BalanceSheetsClient;
1315
import com.merge.api.resources.accounting.cashflowstatements.CashFlowStatementsClient;
@@ -46,6 +48,8 @@ public class AccountingClient {
4648

4749
protected final Supplier<AccountTokenClient> accountTokenClient;
4850

51+
protected final Supplier<AccountingPeriodsClient> accountingPeriodsClient;
52+
4953
protected final Supplier<AccountsClient> accountsClient;
5054

5155
protected final Supplier<AddressesClient> addressesClient;
@@ -54,6 +58,8 @@ public class AccountingClient {
5458

5559
protected final Supplier<AttachmentsClient> attachmentsClient;
5660

61+
protected final Supplier<AuditTrailClient> auditTrailClient;
62+
5763
protected final Supplier<AvailableActionsClient> availableActionsClient;
5864

5965
protected final Supplier<BalanceSheetsClient> balanceSheetsClient;
@@ -116,10 +122,12 @@ public AccountingClient(ClientOptions clientOptions) {
116122
this.clientOptions = clientOptions;
117123
this.accountDetailsClient = Suppliers.memoize(() -> new AccountDetailsClient(clientOptions));
118124
this.accountTokenClient = Suppliers.memoize(() -> new AccountTokenClient(clientOptions));
125+
this.accountingPeriodsClient = Suppliers.memoize(() -> new AccountingPeriodsClient(clientOptions));
119126
this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions));
120127
this.addressesClient = Suppliers.memoize(() -> new AddressesClient(clientOptions));
121128
this.asyncPassthroughClient = Suppliers.memoize(() -> new AsyncPassthroughClient(clientOptions));
122129
this.attachmentsClient = Suppliers.memoize(() -> new AttachmentsClient(clientOptions));
130+
this.auditTrailClient = Suppliers.memoize(() -> new AuditTrailClient(clientOptions));
123131
this.availableActionsClient = Suppliers.memoize(() -> new AvailableActionsClient(clientOptions));
124132
this.balanceSheetsClient = Suppliers.memoize(() -> new BalanceSheetsClient(clientOptions));
125133
this.cashFlowStatementsClient = Suppliers.memoize(() -> new CashFlowStatementsClient(clientOptions));
@@ -159,6 +167,10 @@ public AccountTokenClient accountToken() {
159167
return this.accountTokenClient.get();
160168
}
161169

170+
public AccountingPeriodsClient accountingPeriods() {
171+
return this.accountingPeriodsClient.get();
172+
}
173+
162174
public AccountsClient accounts() {
163175
return this.accountsClient.get();
164176
}
@@ -175,6 +187,10 @@ public AttachmentsClient attachments() {
175187
return this.attachmentsClient.get();
176188
}
177189

190+
public AuditTrailClient auditTrail() {
191+
return this.auditTrailClient.get();
192+
}
193+
178194
public AvailableActionsClient availableActions() {
179195
return this.availableActionsClient.get();
180196
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.merge.api.resources.accounting.accountingperiods;
2+
3+
import com.merge.api.core.ApiError;
4+
import com.merge.api.core.ClientOptions;
5+
import com.merge.api.core.ObjectMappers;
6+
import com.merge.api.core.RequestOptions;
7+
import com.merge.api.resources.accounting.accountingperiods.requests.AccountingPeriodsListRequest;
8+
import com.merge.api.resources.accounting.accountingperiods.requests.AccountingPeriodsRetrieveRequest;
9+
import com.merge.api.resources.accounting.types.AccountingPeriod;
10+
import com.merge.api.resources.accounting.types.PaginatedAccountingPeriodList;
11+
import java.io.IOException;
12+
import okhttp3.Headers;
13+
import okhttp3.HttpUrl;
14+
import okhttp3.Request;
15+
import okhttp3.RequestBody;
16+
import okhttp3.Response;
17+
18+
public class AccountingPeriodsClient {
19+
protected final ClientOptions clientOptions;
20+
21+
public AccountingPeriodsClient(ClientOptions clientOptions) {
22+
this.clientOptions = clientOptions;
23+
}
24+
25+
public PaginatedAccountingPeriodList list(AccountingPeriodsListRequest request) {
26+
return list(request, null);
27+
}
28+
29+
public PaginatedAccountingPeriodList list(AccountingPeriodsListRequest request, RequestOptions requestOptions) {
30+
HttpUrl.Builder _httpUrl = HttpUrl.parse(
31+
this.clientOptions.environment().getUrl())
32+
.newBuilder()
33+
.addPathSegments("api/accounting/v1/accounting-periods");
34+
if (request.getCursor().isPresent()) {
35+
_httpUrl.addQueryParameter("cursor", request.getCursor().get());
36+
}
37+
if (request.getIncludeDeletedData().isPresent()) {
38+
_httpUrl.addQueryParameter(
39+
"include_deleted_data",
40+
request.getIncludeDeletedData().get().toString());
41+
}
42+
if (request.getIncludeRemoteData().isPresent()) {
43+
_httpUrl.addQueryParameter(
44+
"include_remote_data", request.getIncludeRemoteData().get().toString());
45+
}
46+
if (request.getPageSize().isPresent()) {
47+
_httpUrl.addQueryParameter("page_size", request.getPageSize().get().toString());
48+
}
49+
RequestBody _requestBody = null;
50+
Request.Builder _requestBuilder = new Request.Builder()
51+
.url(_httpUrl.build())
52+
.method("GET", _requestBody)
53+
.headers(Headers.of(clientOptions.headers(requestOptions)))
54+
.addHeader("Content-Type", "application/json");
55+
Request _request = _requestBuilder.build();
56+
try {
57+
Response _response = clientOptions.httpClient().newCall(_request).execute();
58+
if (_response.isSuccessful()) {
59+
return ObjectMappers.JSON_MAPPER.readValue(
60+
_response.body().string(), PaginatedAccountingPeriodList.class);
61+
}
62+
throw new ApiError(
63+
_response.code(),
64+
ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class));
65+
} catch (IOException e) {
66+
throw new RuntimeException(e);
67+
}
68+
}
69+
70+
public AccountingPeriod retrieve(String id, AccountingPeriodsRetrieveRequest request) {
71+
return retrieve(id, request, null);
72+
}
73+
74+
public AccountingPeriod retrieve(
75+
String id, AccountingPeriodsRetrieveRequest request, RequestOptions requestOptions) {
76+
HttpUrl.Builder _httpUrl = HttpUrl.parse(
77+
this.clientOptions.environment().getUrl())
78+
.newBuilder()
79+
.addPathSegments("api/accounting/v1/accounting-periods")
80+
.addPathSegment(id);
81+
if (request.getIncludeRemoteData().isPresent()) {
82+
_httpUrl.addQueryParameter(
83+
"include_remote_data", request.getIncludeRemoteData().get().toString());
84+
}
85+
RequestBody _requestBody = null;
86+
Request.Builder _requestBuilder = new Request.Builder()
87+
.url(_httpUrl.build())
88+
.method("GET", _requestBody)
89+
.headers(Headers.of(clientOptions.headers(requestOptions)))
90+
.addHeader("Content-Type", "application/json");
91+
Request _request = _requestBuilder.build();
92+
try {
93+
Response _response = clientOptions.httpClient().newCall(_request).execute();
94+
if (_response.isSuccessful()) {
95+
return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AccountingPeriod.class);
96+
}
97+
throw new ApiError(
98+
_response.code(),
99+
ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class));
100+
} catch (IOException e) {
101+
throw new RuntimeException(e);
102+
}
103+
}
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
package com.merge.api.resources.accounting.accountingperiods.requests;
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.annotation.JsonDeserialize;
9+
import com.merge.api.core.ObjectMappers;
10+
import java.util.Objects;
11+
import java.util.Optional;
12+
13+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
14+
@JsonDeserialize(builder = AccountingPeriodsListRequest.Builder.class)
15+
public final class AccountingPeriodsListRequest {
16+
private final Optional<String> cursor;
17+
18+
private final Optional<Boolean> includeDeletedData;
19+
20+
private final Optional<Boolean> includeRemoteData;
21+
22+
private final Optional<Integer> pageSize;
23+
24+
private AccountingPeriodsListRequest(
25+
Optional<String> cursor,
26+
Optional<Boolean> includeDeletedData,
27+
Optional<Boolean> includeRemoteData,
28+
Optional<Integer> pageSize) {
29+
this.cursor = cursor;
30+
this.includeDeletedData = includeDeletedData;
31+
this.includeRemoteData = includeRemoteData;
32+
this.pageSize = pageSize;
33+
}
34+
35+
/**
36+
* @return The pagination cursor value.
37+
*/
38+
@JsonProperty("cursor")
39+
public Optional<String> getCursor() {
40+
return cursor;
41+
}
42+
43+
/**
44+
* @return Whether to include data that was marked as deleted by third party webhooks.
45+
*/
46+
@JsonProperty("include_deleted_data")
47+
public Optional<Boolean> getIncludeDeletedData() {
48+
return includeDeletedData;
49+
}
50+
51+
/**
52+
* @return Whether to include the original data Merge fetched from the third-party to produce these models.
53+
*/
54+
@JsonProperty("include_remote_data")
55+
public Optional<Boolean> getIncludeRemoteData() {
56+
return includeRemoteData;
57+
}
58+
59+
/**
60+
* @return Number of results to return per page.
61+
*/
62+
@JsonProperty("page_size")
63+
public Optional<Integer> getPageSize() {
64+
return pageSize;
65+
}
66+
67+
@Override
68+
public boolean equals(Object other) {
69+
if (this == other) return true;
70+
return other instanceof AccountingPeriodsListRequest && equalTo((AccountingPeriodsListRequest) other);
71+
}
72+
73+
private boolean equalTo(AccountingPeriodsListRequest other) {
74+
return cursor.equals(other.cursor)
75+
&& includeDeletedData.equals(other.includeDeletedData)
76+
&& includeRemoteData.equals(other.includeRemoteData)
77+
&& pageSize.equals(other.pageSize);
78+
}
79+
80+
@Override
81+
public int hashCode() {
82+
return Objects.hash(this.cursor, this.includeDeletedData, this.includeRemoteData, this.pageSize);
83+
}
84+
85+
@Override
86+
public String toString() {
87+
return ObjectMappers.stringify(this);
88+
}
89+
90+
public static Builder builder() {
91+
return new Builder();
92+
}
93+
94+
@JsonIgnoreProperties(ignoreUnknown = true)
95+
public static final class Builder {
96+
private Optional<String> cursor = Optional.empty();
97+
98+
private Optional<Boolean> includeDeletedData = Optional.empty();
99+
100+
private Optional<Boolean> includeRemoteData = Optional.empty();
101+
102+
private Optional<Integer> pageSize = Optional.empty();
103+
104+
private Builder() {}
105+
106+
public Builder from(AccountingPeriodsListRequest other) {
107+
cursor(other.getCursor());
108+
includeDeletedData(other.getIncludeDeletedData());
109+
includeRemoteData(other.getIncludeRemoteData());
110+
pageSize(other.getPageSize());
111+
return this;
112+
}
113+
114+
@JsonSetter(value = "cursor", nulls = Nulls.SKIP)
115+
public Builder cursor(Optional<String> cursor) {
116+
this.cursor = cursor;
117+
return this;
118+
}
119+
120+
public Builder cursor(String cursor) {
121+
this.cursor = Optional.of(cursor);
122+
return this;
123+
}
124+
125+
@JsonSetter(value = "include_deleted_data", nulls = Nulls.SKIP)
126+
public Builder includeDeletedData(Optional<Boolean> includeDeletedData) {
127+
this.includeDeletedData = includeDeletedData;
128+
return this;
129+
}
130+
131+
public Builder includeDeletedData(Boolean includeDeletedData) {
132+
this.includeDeletedData = Optional.of(includeDeletedData);
133+
return this;
134+
}
135+
136+
@JsonSetter(value = "include_remote_data", nulls = Nulls.SKIP)
137+
public Builder includeRemoteData(Optional<Boolean> includeRemoteData) {
138+
this.includeRemoteData = includeRemoteData;
139+
return this;
140+
}
141+
142+
public Builder includeRemoteData(Boolean includeRemoteData) {
143+
this.includeRemoteData = Optional.of(includeRemoteData);
144+
return this;
145+
}
146+
147+
@JsonSetter(value = "page_size", nulls = Nulls.SKIP)
148+
public Builder pageSize(Optional<Integer> pageSize) {
149+
this.pageSize = pageSize;
150+
return this;
151+
}
152+
153+
public Builder pageSize(Integer pageSize) {
154+
this.pageSize = Optional.of(pageSize);
155+
return this;
156+
}
157+
158+
public AccountingPeriodsListRequest build() {
159+
return new AccountingPeriodsListRequest(cursor, includeDeletedData, includeRemoteData, pageSize);
160+
}
161+
}
162+
}

0 commit comments

Comments
 (0)