Skip to content

Commit 05cbfa7

Browse files
committed
feat: remove redundant endpoint, add sandbox client options (not yet used) (#130)
1 parent e64d66a commit 05cbfa7

17 files changed

Lines changed: 44 additions & 556 deletions

File tree

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ implementation("com.tryfinch.api:finch-java:0.14.0")
4444

4545
Use `FinchOkHttpClient.builder()` to configure the client.
4646

47-
Alternately, set the environment with `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` or `FINCH_WEBHOOK_SECRET`, and use `FinchOkHttpClient.fromEnv()` to read from the environment.
47+
Alternately, set the environment with `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_SANDBOX_CLIENT_ID`, `FINCH_SANDBOX_CLIENT_SECRET` or `FINCH_WEBHOOK_SECRET`, and use `FinchOkHttpClient.fromEnv()` to read from the environment.
4848

4949
```java
5050
FinchClient client = FinchOkHttpClient.fromEnv();
@@ -56,11 +56,13 @@ FinchClient client = FinchOkHttpClient.builder()
5656
.build();
5757
```
5858

59-
| Property | Environment variable | Required | Default value |
60-
| ------------- | ---------------------- | -------- | ------------- |
61-
| clientId | `FINCH_CLIENT_ID` | false ||
62-
| clientSecret | `FINCH_CLIENT_SECRET` | false ||
63-
| webhookSecret | `FINCH_WEBHOOK_SECRET` | false ||
59+
| Property | Environment variable | Required | Default value |
60+
| ------------------- | ----------------------------- | -------- | ------------- |
61+
| clientId | `FINCH_CLIENT_ID` | false ||
62+
| clientSecret | `FINCH_CLIENT_SECRET` | false ||
63+
| sandboxClientId | `FINCH_SANDBOX_CLIENT_ID` | false ||
64+
| sandboxClientSecret | `FINCH_SANDBOX_CLIENT_SECRET` | false ||
65+
| webhookSecret | `FINCH_WEBHOOK_SECRET` | false ||
6466

6567
Read the documentation for more configuration options.
6668

finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ class FinchOkHttpClient private constructor() {
6868

6969
fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
7070

71+
fun sandboxClientId(sandboxClientId: String?) = apply {
72+
clientOptions.sandboxClientId(sandboxClientId)
73+
}
74+
75+
fun sandboxClientSecret(sandboxClientSecret: String?) = apply {
76+
clientOptions.sandboxClientSecret(sandboxClientSecret)
77+
}
78+
7179
fun webhookSecret(webhookSecret: String?) = apply {
7280
clientOptions.webhookSecret(webhookSecret)
7381
}

finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ class FinchOkHttpClientAsync private constructor() {
6868

6969
fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
7070

71+
fun sandboxClientId(sandboxClientId: String?) = apply {
72+
clientOptions.sandboxClientId(sandboxClientId)
73+
}
74+
75+
fun sandboxClientSecret(sandboxClientSecret: String?) = apply {
76+
clientOptions.sandboxClientSecret(sandboxClientSecret)
77+
}
78+
7179
fun webhookSecret(webhookSecret: String?) = apply {
7280
clientOptions.webhookSecret(webhookSecret)
7381
}

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ interface FinchClient {
2626

2727
fun jobs(): JobService
2828

29-
fun auth(): AuthService
30-
3129
fun sandbox(): SandboxService
3230

3331
fun getAccessToken(

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ interface FinchClientAsync {
2727

2828
fun jobs(): JobServiceAsync
2929

30-
fun auth(): AuthServiceAsync
31-
3230
fun sandbox(): SandboxServiceAsync
3331

3432
fun getAccessToken(

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ constructor(
4545

4646
private val jobs: JobServiceAsync by lazy { JobServiceAsyncImpl(clientOptions) }
4747

48-
private val auth: AuthServiceAsync by lazy { AuthServiceAsyncImpl(clientOptions) }
49-
5048
private val sandbox: SandboxServiceAsync by lazy { SandboxServiceAsyncImpl(clientOptions) }
5149

5250
private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
@@ -68,8 +66,6 @@ constructor(
6866

6967
override fun jobs(): JobServiceAsync = jobs
7068

71-
override fun auth(): AuthServiceAsync = auth
72-
7369
override fun sandbox(): SandboxServiceAsync = sandbox
7470

7571
override fun getAccessToken(

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ constructor(
4242

4343
private val jobs: JobService by lazy { JobServiceImpl(clientOptions) }
4444

45-
private val auth: AuthService by lazy { AuthServiceImpl(clientOptions) }
46-
4745
private val sandbox: SandboxService by lazy { SandboxServiceImpl(clientOptions) }
4846

4947
private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
@@ -65,8 +63,6 @@ constructor(
6563

6664
override fun jobs(): JobService = jobs
6765

68-
override fun auth(): AuthService = auth
69-
7066
override fun sandbox(): SandboxService = sandbox
7167

7268
override fun getAccessToken(

finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ private constructor(
1818
@get:JvmName("accessToken") val accessToken: String?,
1919
@get:JvmName("clientId") val clientId: String?,
2020
@get:JvmName("clientSecret") val clientSecret: String?,
21+
@get:JvmName("sandboxClientId") val sandboxClientId: String?,
22+
@get:JvmName("sandboxClientSecret") val sandboxClientSecret: String?,
2123
@get:JvmName("webhookSecret") val webhookSecret: String?,
2224
@get:JvmName("headers") val headers: ListMultimap<String, String>,
2325
@get:JvmName("responseValidation") val responseValidation: Boolean,
@@ -44,6 +46,8 @@ private constructor(
4446
private var accessToken: String? = null
4547
private var clientId: String? = null
4648
private var clientSecret: String? = null
49+
private var sandboxClientId: String? = null
50+
private var sandboxClientSecret: String? = null
4751
private var webhookSecret: String? = null
4852

4953
fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
@@ -85,11 +89,21 @@ private constructor(
8589

8690
fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret }
8791

92+
fun sandboxClientId(sandboxClientId: String?) = apply {
93+
this.sandboxClientId = sandboxClientId
94+
}
95+
96+
fun sandboxClientSecret(sandboxClientSecret: String?) = apply {
97+
this.sandboxClientSecret = sandboxClientSecret
98+
}
99+
88100
fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret }
89101

90102
fun fromEnv() = apply {
91103
System.getenv("FINCH_CLIENT_ID")?.let { clientId(it) }
92104
System.getenv("FINCH_CLIENT_SECRET")?.let { clientSecret(it) }
105+
System.getenv("FINCH_SANDBOX_CLIENT_ID")?.let { sandboxClientId(it) }
106+
System.getenv("FINCH_SANDBOX_CLIENT_SECRET")?.let { sandboxClientSecret(it) }
93107
System.getenv("FINCH_WEBHOOK_SECRET")?.let { webhookSecret(it) }
94108
}
95109

@@ -119,6 +133,8 @@ private constructor(
119133
accessToken,
120134
clientId,
121135
clientSecret,
136+
sandboxClientId,
137+
sandboxClientSecret,
122138
webhookSecret,
123139
headers.toUnmodifiable(),
124140
responseValidation,

0 commit comments

Comments
 (0)