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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 6 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ LICENSE.md
# Patch

src/main/java/com/merge/api/core/MergeApiApiError.java
src/main/java/com/merge/legacy
src/main/java/com/merge/legacy

# Fern is working on a fix to our code, which will automatically handle the logic we
# added to QueryStringMapper.java. Once that is fixed, we can remove this file from
# .fernignore.
src/main/java/com/merge/api/core/QueryStringMapper.java
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Java
id: setup-jre
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Java
id: setup-jre
Expand All @@ -43,7 +43,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Java
id: setup-jre
Expand Down
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 = '1.1.1'
version = '2.0.0'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand All @@ -71,7 +71,7 @@ publishing {
maven(MavenPublication) {
groupId = 'dev.merge'
artifactId = 'merge-java-client'
version = '1.1.1'
version = '2.0.0'
from components.java
pom {
licenses {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 3 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -205,15 +205,15 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
4 changes: 2 additions & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
2 changes: 1 addition & 1 deletion sample-app/src/main/java/sample/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

public final class App {
public static void main(String[] args) {
// import com.merge.api.MergeApiClient
// import com.merge.api.AsyncMergeApiClient
}
}
68 changes: 68 additions & 0 deletions src/main/java/com/merge/api/AsyncMergeApiClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.merge.api;

import com.merge.api.accounting.AsyncAccountingClient;
import com.merge.api.ats.AsyncAtsClient;
import com.merge.api.core.ClientOptions;
import com.merge.api.core.Suppliers;
import com.merge.api.crm.AsyncCrmClient;
import com.merge.api.filestorage.AsyncFileStorageClient;
import com.merge.api.hris.AsyncHrisClient;
import com.merge.api.ticketing.AsyncTicketingClient;
import java.util.function.Supplier;

public class AsyncMergeApiClient {
protected final ClientOptions clientOptions;

protected final Supplier<AsyncAtsClient> atsClient;

protected final Supplier<AsyncAccountingClient> accountingClient;

protected final Supplier<AsyncCrmClient> crmClient;

protected final Supplier<AsyncFileStorageClient> fileStorageClient;

protected final Supplier<AsyncHrisClient> hrisClient;

protected final Supplier<AsyncTicketingClient> ticketingClient;

public AsyncMergeApiClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.atsClient = Suppliers.memoize(() -> new AsyncAtsClient(clientOptions));
this.accountingClient = Suppliers.memoize(() -> new AsyncAccountingClient(clientOptions));
this.crmClient = Suppliers.memoize(() -> new AsyncCrmClient(clientOptions));
this.fileStorageClient = Suppliers.memoize(() -> new AsyncFileStorageClient(clientOptions));
this.hrisClient = Suppliers.memoize(() -> new AsyncHrisClient(clientOptions));
this.ticketingClient = Suppliers.memoize(() -> new AsyncTicketingClient(clientOptions));
}

public AsyncAtsClient ats() {
return this.atsClient.get();
}

public AsyncAccountingClient accounting() {
return this.accountingClient.get();
}

public AsyncCrmClient crm() {
return this.crmClient.get();
}

public AsyncFileStorageClient fileStorage() {
return this.fileStorageClient.get();
}

public AsyncHrisClient hris() {
return this.hrisClient.get();
}

public AsyncTicketingClient ticketing() {
return this.ticketingClient.get();
}

public static AsyncMergeApiClientBuilder builder() {
return new AsyncMergeApiClientBuilder();
}
}
75 changes: 75 additions & 0 deletions src/main/java/com/merge/api/AsyncMergeApiClientBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.merge.api;

import com.merge.api.core.ClientOptions;
import com.merge.api.core.Environment;
import okhttp3.OkHttpClient;

public final class AsyncMergeApiClientBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();

private String apiKey = null;

private String accountToken = null;

private Environment environment = Environment.PRODUCTION;

/**
* Sets apiKey
*/
public AsyncMergeApiClientBuilder apiKey(String apiKey) {
this.apiKey = apiKey;
return this;
}

/**
* Sets accountToken
*/
public AsyncMergeApiClientBuilder accountToken(String accountToken) {
this.accountToken = accountToken;
return this;
}

public AsyncMergeApiClientBuilder environment(Environment environment) {
this.environment = environment;
return this;
}

/**
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
*/
public AsyncMergeApiClientBuilder timeout(int timeout) {
this.clientOptionsBuilder.timeout(timeout);
return this;
}

/**
* Sets the maximum number of retries for the client. Defaults to 2 retries.
*/
public AsyncMergeApiClientBuilder maxRetries(int maxRetries) {
this.clientOptionsBuilder.maxRetries(maxRetries);
return this;
}

/**
* Sets the underlying OkHttp client
*/
public AsyncMergeApiClientBuilder httpClient(OkHttpClient httpClient) {
this.clientOptionsBuilder.httpClient(httpClient);
return this;
}

public AsyncMergeApiClient build() {
if (apiKey == null) {
throw new RuntimeException("Please provide apiKey");
}
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.apiKey);
if (accountToken != null) {
this.clientOptionsBuilder.addHeader("X-Account-Token", this.accountToken);
}
clientOptionsBuilder.environment(this.environment);
return new AsyncMergeApiClient(clientOptionsBuilder.build());
}
}
42 changes: 21 additions & 21 deletions src/main/java/com/merge/api/MergeApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@
*/
package com.merge.api;

import com.merge.api.accounting.AccountingClient;
import com.merge.api.ats.AtsClient;
import com.merge.api.core.ClientOptions;
import com.merge.api.core.Suppliers;
import com.merge.api.resources.accounting.AccountingClient;
import com.merge.api.resources.ats.AtsClient;
import com.merge.api.resources.crm.CrmClient;
import com.merge.api.resources.filestorage.FilestorageClient;
import com.merge.api.resources.hris.HrisClient;
import com.merge.api.resources.ticketing.TicketingClient;
import com.merge.api.crm.CrmClient;
import com.merge.api.filestorage.FileStorageClient;
import com.merge.api.hris.HrisClient;
import com.merge.api.ticketing.TicketingClient;
import java.util.function.Supplier;

public class MergeApiClient {
protected final ClientOptions clientOptions;

protected final Supplier<AtsClient> atsClient;

protected final Supplier<CrmClient> crmClient;
protected final Supplier<AccountingClient> accountingClient;

protected final Supplier<FilestorageClient> filestorageClient;
protected final Supplier<CrmClient> crmClient;

protected final Supplier<TicketingClient> ticketingClient;
protected final Supplier<FileStorageClient> fileStorageClient;

protected final Supplier<HrisClient> hrisClient;

protected final Supplier<AccountingClient> accountingClient;
protected final Supplier<TicketingClient> ticketingClient;

public MergeApiClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.atsClient = Suppliers.memoize(() -> new AtsClient(clientOptions));
this.accountingClient = Suppliers.memoize(() -> new AccountingClient(clientOptions));
this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions));
this.filestorageClient = Suppliers.memoize(() -> new FilestorageClient(clientOptions));
this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
this.fileStorageClient = Suppliers.memoize(() -> new FileStorageClient(clientOptions));
this.hrisClient = Suppliers.memoize(() -> new HrisClient(clientOptions));
this.accountingClient = Suppliers.memoize(() -> new AccountingClient(clientOptions));
this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
}

public AtsClient ats() {
return this.atsClient.get();
}

public CrmClient crm() {
return this.crmClient.get();
public AccountingClient accounting() {
return this.accountingClient.get();
}

public FilestorageClient filestorage() {
return this.filestorageClient.get();
public CrmClient crm() {
return this.crmClient.get();
}

public TicketingClient ticketing() {
return this.ticketingClient.get();
public FileStorageClient fileStorage() {
return this.fileStorageClient.get();
}

public HrisClient hris() {
return this.hrisClient.get();
}

public AccountingClient accounting() {
return this.accountingClient.get();
public TicketingClient ticketing() {
return this.ticketingClient.get();
}

public static MergeApiClientBuilder builder() {
Expand Down
22 changes: 17 additions & 5 deletions src/main/java/com/merge/api/MergeApiClientBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.merge.api.core.ClientOptions;
import com.merge.api.core.Environment;
import okhttp3.OkHttpClient;

public final class MergeApiClientBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
Expand Down Expand Up @@ -36,16 +37,27 @@ public MergeApiClientBuilder environment(Environment environment) {
return this;
}

public MergeApiClientBuilder url(String url) {
this.environment = Environment.custom(url);
/**
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
*/
public MergeApiClientBuilder timeout(int timeout) {
this.clientOptionsBuilder.timeout(timeout);
return this;
}

/**
* Sets the timeout (in seconds) for the client
* Sets the maximum number of retries for the client. Defaults to 2 retries.
*/
public MergeApiClientBuilder timeout(int timeout) {
this.clientOptionsBuilder.timeout(timeout);
public MergeApiClientBuilder maxRetries(int maxRetries) {
this.clientOptionsBuilder.maxRetries(maxRetries);
return this;
}

/**
* Sets the underlying OkHttp client
*/
public MergeApiClientBuilder httpClient(OkHttpClient httpClient) {
this.clientOptionsBuilder.httpClient(httpClient);
return this;
}

Expand Down
Loading