Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ client.ats().activities().create(
);
```

## Staged Builders
The generated builders all follow the staged builder pattern. Read more [here](https://immutables.github.io/immutable.html#staged-builder).

Staged builders only allow you to build the object once all required properties have been specified. For example, to build an `ApplicationEndpointRequest` the Merge SDK will require that you specify the `model` and `remoteUserId` properties.

## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.
Expand All @@ -219,4 +214,8 @@ otherwise they would be overwritten upon the next generated release. Feel free t
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!
On the other hand, contributions to the README are always very welcome!
## Staged Builders
The generated builders all follow the staged builder pattern. Read more [here](https://immutables.github.io/immutable.html#staged-builder).

Staged builders only allow you to build the object once all required properties have been specified. For example, to build an `ApplicationEndpointRequest` the Merge SDK will require that you specify the `model` and `remoteUserId` properties.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ java {

group = 'dev.merge'

version = '2.0.0'
version = '2.0.1'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand All @@ -71,7 +71,7 @@ publishing {
maven(MavenPublication) {
groupId = 'dev.merge'
artifactId = 'merge-java-client'
version = '2.0.0'
version = '2.0.1'
from components.java
pom {
licenses {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/merge/api/accounting/AccountingClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class AccountingClient {

protected final Supplier<PhoneNumbersClient> phoneNumbersClient;

protected final Supplier<ProjectsClient> projectsClient;

protected final Supplier<PurchaseOrdersClient> purchaseOrdersClient;

protected final Supplier<RegenerateKeyClient> regenerateKeyClient;
Expand Down Expand Up @@ -139,6 +141,7 @@ public AccountingClient(ClientOptions clientOptions) {
this.paymentTermsClient = Suppliers.memoize(() -> new PaymentTermsClient(clientOptions));
this.paymentsClient = Suppliers.memoize(() -> new PaymentsClient(clientOptions));
this.phoneNumbersClient = Suppliers.memoize(() -> new PhoneNumbersClient(clientOptions));
this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions));
this.purchaseOrdersClient = Suppliers.memoize(() -> new PurchaseOrdersClient(clientOptions));
this.regenerateKeyClient = Suppliers.memoize(() -> new RegenerateKeyClient(clientOptions));
this.syncStatusClient = Suppliers.memoize(() -> new SyncStatusClient(clientOptions));
Expand Down Expand Up @@ -294,6 +297,10 @@ public PhoneNumbersClient phoneNumbers() {
return this.phoneNumbersClient.get();
}

public ProjectsClient projects() {
return this.projectsClient.get();
}

public PurchaseOrdersClient purchaseOrders() {
return this.purchaseOrdersClient.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class AsyncAccountingClient {

protected final Supplier<AsyncPhoneNumbersClient> phoneNumbersClient;

protected final Supplier<AsyncProjectsClient> projectsClient;

protected final Supplier<AsyncPurchaseOrdersClient> purchaseOrdersClient;

protected final Supplier<AsyncRegenerateKeyClient> regenerateKeyClient;
Expand Down Expand Up @@ -139,6 +141,7 @@ public AsyncAccountingClient(ClientOptions clientOptions) {
this.paymentTermsClient = Suppliers.memoize(() -> new AsyncPaymentTermsClient(clientOptions));
this.paymentsClient = Suppliers.memoize(() -> new AsyncPaymentsClient(clientOptions));
this.phoneNumbersClient = Suppliers.memoize(() -> new AsyncPhoneNumbersClient(clientOptions));
this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions));
this.purchaseOrdersClient = Suppliers.memoize(() -> new AsyncPurchaseOrdersClient(clientOptions));
this.regenerateKeyClient = Suppliers.memoize(() -> new AsyncRegenerateKeyClient(clientOptions));
this.syncStatusClient = Suppliers.memoize(() -> new AsyncSyncStatusClient(clientOptions));
Expand Down Expand Up @@ -294,6 +297,10 @@ public AsyncPhoneNumbersClient phoneNumbers() {
return this.phoneNumbersClient.get();
}

public AsyncProjectsClient projects() {
return this.projectsClient.get();
}

public AsyncPurchaseOrdersClient purchaseOrders() {
return this.purchaseOrdersClient.get();
}
Expand Down
61 changes: 61 additions & 0 deletions src/main/java/com/merge/api/accounting/AsyncItemsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
package com.merge.api.accounting;

import com.merge.api.accounting.types.Item;
import com.merge.api.accounting.types.ItemEndpointRequest;
import com.merge.api.accounting.types.ItemResponse;
import com.merge.api.accounting.types.ItemsListRequest;
import com.merge.api.accounting.types.ItemsRetrieveRequest;
import com.merge.api.accounting.types.MetaResponse;
import com.merge.api.accounting.types.PatchedItemEndpointRequest;
import com.merge.api.core.ClientOptions;
import com.merge.api.core.RequestOptions;
import com.merge.api.core.SyncPagingIterable;
Expand Down Expand Up @@ -49,6 +53,20 @@ public CompletableFuture<SyncPagingIterable<Item>> list(ItemsListRequest request
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}

/**
* Creates an <code>Item</code> object with the given values.
*/
public CompletableFuture<ItemResponse> create(ItemEndpointRequest request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}

/**
* Creates an <code>Item</code> object with the given values.
*/
public CompletableFuture<ItemResponse> create(ItemEndpointRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}

/**
* Returns an <code>Item</code> object with the given <code>id</code>.
*/
Expand All @@ -69,4 +87,47 @@ public CompletableFuture<Item> retrieve(String id, ItemsRetrieveRequest request)
public CompletableFuture<Item> retrieve(String id, ItemsRetrieveRequest request, RequestOptions requestOptions) {
return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body());
}

/**
* Updates an <code>Item</code> object with the given <code>id</code>.
*/
public CompletableFuture<ItemResponse> partialUpdate(String id, PatchedItemEndpointRequest request) {
return this.rawClient.partialUpdate(id, request).thenApply(response -> response.body());
}

/**
* Updates an <code>Item</code> object with the given <code>id</code>.
*/
public CompletableFuture<ItemResponse> partialUpdate(
String id, PatchedItemEndpointRequest request, RequestOptions requestOptions) {
return this.rawClient.partialUpdate(id, request, requestOptions).thenApply(response -> response.body());
}

/**
* Returns metadata for <code>Item</code> PATCHs.
*/
public CompletableFuture<MetaResponse> metaPatchRetrieve(String id) {
return this.rawClient.metaPatchRetrieve(id).thenApply(response -> response.body());
}

/**
* Returns metadata for <code>Item</code> PATCHs.
*/
public CompletableFuture<MetaResponse> metaPatchRetrieve(String id, RequestOptions requestOptions) {
return this.rawClient.metaPatchRetrieve(id, requestOptions).thenApply(response -> response.body());
}

/**
* Returns metadata for <code>Item</code> POSTs.
*/
public CompletableFuture<MetaResponse> metaPostRetrieve() {
return this.rawClient.metaPostRetrieve().thenApply(response -> response.body());
}

/**
* Returns metadata for <code>Item</code> POSTs.
*/
public CompletableFuture<MetaResponse> metaPostRetrieve(RequestOptions requestOptions) {
return this.rawClient.metaPostRetrieve(requestOptions).thenApply(response -> response.body());
}
}
73 changes: 73 additions & 0 deletions src/main/java/com/merge/api/accounting/AsyncProjectsClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.merge.api.accounting;

import com.merge.api.accounting.types.PaginatedProjectList;
import com.merge.api.accounting.types.Project;
import com.merge.api.accounting.types.ProjectsListRequest;
import com.merge.api.accounting.types.ProjectsRetrieveRequest;
import com.merge.api.core.ClientOptions;
import com.merge.api.core.RequestOptions;
import java.util.concurrent.CompletableFuture;

public class AsyncProjectsClient {
protected final ClientOptions clientOptions;

private final AsyncRawProjectsClient rawClient;

public AsyncProjectsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawProjectsClient(clientOptions);
}

/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawProjectsClient withRawResponse() {
return this.rawClient;
}

/**
* Returns a list of <code>Project</code> objects.
*/
public CompletableFuture<PaginatedProjectList> list() {
return this.rawClient.list().thenApply(response -> response.body());
}

/**
* Returns a list of <code>Project</code> objects.
*/
public CompletableFuture<PaginatedProjectList> list(ProjectsListRequest request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}

/**
* Returns a list of <code>Project</code> objects.
*/
public CompletableFuture<PaginatedProjectList> list(ProjectsListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}

/**
* Returns a <code>Project</code> object with the given <code>id</code>.
*/
public CompletableFuture<Project> retrieve(String id) {
return this.rawClient.retrieve(id).thenApply(response -> response.body());
}

/**
* Returns a <code>Project</code> object with the given <code>id</code>.
*/
public CompletableFuture<Project> retrieve(String id, ProjectsRetrieveRequest request) {
return this.rawClient.retrieve(id, request).thenApply(response -> response.body());
}

/**
* Returns a <code>Project</code> object with the given <code>id</code>.
*/
public CompletableFuture<Project> retrieve(
String id, ProjectsRetrieveRequest request, RequestOptions requestOptions) {
return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public CompletableFuture<MergeApiHttpResponse<SyncPagingIterable<Account>>> list
QueryStringMapper.addQueryParameter(
httpUrl, "account_type", request.getAccountType().get(), false);
}
if (request.getClassification().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "classification", request.getClassification().get(), false);
}
if (request.getCompanyId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "company_id", request.getCompanyId().get(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ public CompletableFuture<MergeApiHttpResponse<SyncPagingIterable<RemoteFieldClas
request.getIsCommonModelField().get().toString(),
false);
}
if (request.getIsCustom().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "is_custom", request.getIsCustom().get().toString(), false);
}
if (request.getPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "page_size", request.getPageSize().get().toString(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ public CompletableFuture<MergeApiHttpResponse<SyncPagingIterable<RemoteFieldClas
request.getIsCommonModelField().get().toString(),
false);
}
if (request.getIsCustom().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "is_custom", request.getIsCustom().get().toString(), false);
}
if (request.getPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "page_size", request.getPageSize().get().toString(), false);
Expand Down Expand Up @@ -607,6 +611,10 @@ public CompletableFuture<MergeApiHttpResponse<SyncPagingIterable<RemoteFieldClas
request.getIsCommonModelField().get().toString(),
false);
}
if (request.getIsCustom().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "is_custom", request.getIsCustom().get().toString(), false);
}
if (request.getPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "page_size", request.getPageSize().get().toString(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
request.getIsCommonModelField().get().toString(),
false);
}
if (request.getIsCustom().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "is_custom", request.getIsCustom().get().toString(), false);
}
if (request.getPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "page_size", request.getPageSize().get().toString(), false);
Expand Down Expand Up @@ -779,6 +783,10 @@ public CompletableFuture<MergeApiHttpResponse<SyncPagingIterable<RemoteFieldClas
request.getIsCommonModelField().get().toString(),
false);
}
if (request.getIsCustom().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "is_custom", request.getIsCustom().get().toString(), false);
}
if (request.getPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "page_size", request.getPageSize().get().toString(), false);
Expand Down
Loading