Skip to content

Commit 7d931e7

Browse files
feat(api): api update
1 parent 0c21885 commit 7d931e7

File tree

98 files changed

+3022
-1598
lines changed

Some content is hidden

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

98 files changed

+3022
-1598
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 45
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-9c32d7e477bd1c441abd65db0dfe6220948aa00face05fc8b57395e368ee2099.yml
3-
openapi_spec_hash: 3da940ffc5da8000a4f359c958ed341f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-03a89ccdf10add981e714ad74c145cd3a2408bd0223108bbfe01cef4256ef7ed.yml
3+
openapi_spec_hash: 4179c69ca2f55a9fcfab41710a2f452c
44
config_hash: 6d3585c0032e08d723d077d660fc8448

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ FinchClient client = FinchOkHttpClient.builder()
6060
.accessToken("My Access Token")
6161
.build();
6262

63-
HrisDirectoryListPage page = client.hris().directory().list();
63+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
64+
.addEntityId("550e8400-e29b-41d4-a716-446655440000")
65+
.build();
66+
HrisDirectoryListPage page = client.hris().directory().list(params);
6467
```
6568

6669
## Client configuration
@@ -166,7 +169,10 @@ FinchClient client = FinchOkHttpClient.builder()
166169
.accessToken("My Access Token")
167170
.build();
168171

169-
CompletableFuture<HrisDirectoryListPageAsync> page = client.async().hris().directory().list();
172+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
173+
.addEntityId("550e8400-e29b-41d4-a716-446655440000")
174+
.build();
175+
CompletableFuture<HrisDirectoryListPageAsync> page = client.async().hris().directory().list(params);
170176
```
171177

172178
Or create an asynchronous client from the beginning:
@@ -185,7 +191,10 @@ FinchClientAsync client = FinchOkHttpClientAsync.builder()
185191
.accessToken("My Access Token")
186192
.build();
187193

188-
CompletableFuture<HrisDirectoryListPageAsync> page = client.hris().directory().list();
194+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
195+
.addEntityId("550e8400-e29b-41d4-a716-446655440000")
196+
.build();
197+
CompletableFuture<HrisDirectoryListPageAsync> page = client.hris().directory().list(params);
189198
```
190199

191200
The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.
@@ -202,7 +211,10 @@ import com.tryfinch.api.core.http.HttpResponseFor;
202211
import com.tryfinch.api.models.HrisDirectoryListPage;
203212
import com.tryfinch.api.models.HrisDirectoryListParams;
204213

205-
HttpResponseFor<HrisDirectoryListPage> page = client.hris().directory().withRawResponse().list();
214+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
215+
.addEntityId("550e8400-e29b-41d4-a716-446655440000")
216+
.build();
217+
HttpResponseFor<HrisDirectoryListPage> page = client.hris().directory().withRawResponse().list(params);
206218

207219
int statusCode = page.statusCode();
208220
Headers headers = page.headers();
@@ -255,7 +267,7 @@ When using the synchronous client, the method returns an [`Iterable`](https://do
255267
import com.tryfinch.api.models.HrisDirectoryListPage;
256268
import com.tryfinch.api.models.IndividualInDirectory;
257269

258-
HrisDirectoryListPage page = client.hris().directory().list();
270+
HrisDirectoryListPage page = client.hris().directory().list(params);
259271

260272
// Process as an Iterable
261273
for (IndividualInDirectory directory : page.autoPager()) {
@@ -278,7 +290,7 @@ import com.tryfinch.api.models.IndividualInDirectory;
278290
import java.util.Optional;
279291
import java.util.concurrent.CompletableFuture;
280292

281-
CompletableFuture<HrisDirectoryListPageAsync> pageFuture = client.async().hris().directory().list();
293+
CompletableFuture<HrisDirectoryListPageAsync> pageFuture = client.async().hris().directory().list(params);
282294

283295
pageFuture.thenRun(page -> page.autoPager().subscribe(directory -> {
284296
System.out.println(directory);
@@ -327,7 +339,7 @@ To access individual page items and manually request the next page, use the `ite
327339
import com.tryfinch.api.models.HrisDirectoryListPage;
328340
import com.tryfinch.api.models.IndividualInDirectory;
329341

330-
HrisDirectoryListPage page = client.hris().directory().list();
342+
HrisDirectoryListPage page = client.hris().directory().list(params);
331343
while (true) {
332344
for (IndividualInDirectory directory : page.items()) {
333345
System.out.println(directory);
@@ -422,7 +434,9 @@ To set a custom timeout, configure the method call using the `timeout` method:
422434
```java
423435
import com.tryfinch.api.models.HrisDirectoryListPage;
424436

425-
HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());
437+
HrisDirectoryListPage page = client.hris().directory().list(
438+
params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()
439+
);
426440
```
427441

428442
Or configure the default for all method calls at the client level:
@@ -544,7 +558,9 @@ To set a documented parameter or property to an undocumented or not yet supporte
544558
```java
545559
import com.tryfinch.api.models.HrisDirectoryListParams;
546560

547-
HrisDirectoryListParams params = HrisDirectoryListParams.builder().build();
561+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
562+
.addEntityId("550e8400-e29b-41d4-a716-446655440000")
563+
.build();
548564
```
549565

550566
The most straightforward way to create a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt) is using its `from(...)` method:
@@ -592,11 +608,10 @@ To forcibly omit a required parameter or property, pass [`JsonMissing`](finch-ja
592608

593609
```java
594610
import com.tryfinch.api.core.JsonMissing;
595-
import com.tryfinch.api.models.AccessTokenCreateParams;
596611
import com.tryfinch.api.models.HrisDirectoryListParams;
597612

598-
HrisDirectoryListParams params = AccessTokenCreateParams.builder()
599-
.code(JsonMissing.of())
613+
HrisDirectoryListParams params = HrisDirectoryListParams.builder()
614+
.entityIds(JsonMissing.of())
600615
.build();
601616
```
602617

@@ -673,7 +688,9 @@ Or configure the method call to validate the response using the `responseValidat
673688
```java
674689
import com.tryfinch.api.models.HrisDirectoryListPage;
675690

676-
HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().responseValidation(true).build());
691+
HrisDirectoryListPage page = client.hris().directory().list(
692+
params, RequestOptions.builder().responseValidation(true).build()
693+
);
677694
```
678695

679696
Or configure the default for all method calls at the client level:

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

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ private constructor(
2727
private val clientType: JsonField<ClientType>,
2828
private val connectionId: JsonField<String>,
2929
private val connectionType: JsonField<ConnectionType>,
30+
private val entityIds: JsonField<List<String>>,
3031
private val products: JsonField<List<String>>,
3132
private val providerId: JsonField<String>,
3233
private val tokenType: JsonField<String>,
@@ -50,6 +51,9 @@ private constructor(
5051
@JsonProperty("connection_type")
5152
@ExcludeMissing
5253
connectionType: JsonField<ConnectionType> = JsonMissing.of(),
54+
@JsonProperty("entity_ids")
55+
@ExcludeMissing
56+
entityIds: JsonField<List<String>> = JsonMissing.of(),
5357
@JsonProperty("products")
5458
@ExcludeMissing
5559
products: JsonField<List<String>> = JsonMissing.of(),
@@ -67,6 +71,7 @@ private constructor(
6771
clientType,
6872
connectionId,
6973
connectionType,
74+
entityIds,
7075
products,
7176
providerId,
7277
tokenType,
@@ -110,6 +115,14 @@ private constructor(
110115
*/
111116
fun connectionType(): ConnectionType = connectionType.getRequired("connection_type")
112117

118+
/**
119+
* An array of entity IDs that can be accessed with this access token
120+
*
121+
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
122+
* missing or null (e.g. if the server responded with an unexpected value).
123+
*/
124+
fun entityIds(): List<String> = entityIds.getRequired("entity_ids")
125+
113126
/**
114127
* An array of the authorized products associated with the `access_token`
115128
*
@@ -197,6 +210,15 @@ private constructor(
197210
@ExcludeMissing
198211
fun _connectionType(): JsonField<ConnectionType> = connectionType
199212

213+
/**
214+
* Returns the raw JSON value of [entityIds].
215+
*
216+
* Unlike [entityIds], this method doesn't throw if the JSON field has an unexpected type.
217+
*/
218+
@JsonProperty("entity_ids")
219+
@ExcludeMissing
220+
fun _entityIds(): JsonField<List<String>> = entityIds
221+
200222
/**
201223
* Returns the raw JSON value of [products].
202224
*
@@ -268,6 +290,7 @@ private constructor(
268290
* .clientType()
269291
* .connectionId()
270292
* .connectionType()
293+
* .entityIds()
271294
* .products()
272295
* .providerId()
273296
* .tokenType()
@@ -283,6 +306,7 @@ private constructor(
283306
private var clientType: JsonField<ClientType>? = null
284307
private var connectionId: JsonField<String>? = null
285308
private var connectionType: JsonField<ConnectionType>? = null
309+
private var entityIds: JsonField<MutableList<String>>? = null
286310
private var products: JsonField<MutableList<String>>? = null
287311
private var providerId: JsonField<String>? = null
288312
private var tokenType: JsonField<String>? = null
@@ -297,6 +321,7 @@ private constructor(
297321
clientType = createAccessTokenResponse.clientType
298322
connectionId = createAccessTokenResponse.connectionId
299323
connectionType = createAccessTokenResponse.connectionType
324+
entityIds = createAccessTokenResponse.entityIds.map { it.toMutableList() }
300325
products = createAccessTokenResponse.products.map { it.toMutableList() }
301326
providerId = createAccessTokenResponse.providerId
302327
tokenType = createAccessTokenResponse.tokenType
@@ -363,6 +388,32 @@ private constructor(
363388
this.connectionType = connectionType
364389
}
365390

391+
/** An array of entity IDs that can be accessed with this access token */
392+
fun entityIds(entityIds: List<String>) = entityIds(JsonField.of(entityIds))
393+
394+
/**
395+
* Sets [Builder.entityIds] to an arbitrary JSON value.
396+
*
397+
* You should usually call [Builder.entityIds] with a well-typed `List<String>` value
398+
* instead. This method is primarily for setting the field to an undocumented or not yet
399+
* supported value.
400+
*/
401+
fun entityIds(entityIds: JsonField<List<String>>) = apply {
402+
this.entityIds = entityIds.map { it.toMutableList() }
403+
}
404+
405+
/**
406+
* Adds a single [String] to [entityIds].
407+
*
408+
* @throws IllegalStateException if the field was previously set to a non-list.
409+
*/
410+
fun addEntityId(entityId: String) = apply {
411+
entityIds =
412+
(entityIds ?: JsonField.of(mutableListOf())).also {
413+
checkKnown("entityIds", it).add(entityId)
414+
}
415+
}
416+
366417
/** An array of the authorized products associated with the `access_token` */
367418
fun products(products: List<String>) = products(JsonField.of(products))
368419

@@ -493,6 +544,7 @@ private constructor(
493544
* .clientType()
494545
* .connectionId()
495546
* .connectionType()
547+
* .entityIds()
496548
* .products()
497549
* .providerId()
498550
* .tokenType()
@@ -506,6 +558,7 @@ private constructor(
506558
checkRequired("clientType", clientType),
507559
checkRequired("connectionId", connectionId),
508560
checkRequired("connectionType", connectionType),
561+
checkRequired("entityIds", entityIds).map { it.toImmutable() },
509562
checkRequired("products", products).map { it.toImmutable() },
510563
checkRequired("providerId", providerId),
511564
checkRequired("tokenType", tokenType),
@@ -527,6 +580,7 @@ private constructor(
527580
clientType().validate()
528581
connectionId()
529582
connectionType().validate()
583+
entityIds()
530584
products()
531585
providerId()
532586
tokenType()
@@ -555,6 +609,7 @@ private constructor(
555609
(clientType.asKnown().getOrNull()?.validity() ?: 0) +
556610
(if (connectionId.asKnown().isPresent) 1 else 0) +
557611
(connectionType.asKnown().getOrNull()?.validity() ?: 0) +
612+
(entityIds.asKnown().getOrNull()?.size ?: 0) +
558613
(products.asKnown().getOrNull()?.size ?: 0) +
559614
(if (providerId.asKnown().isPresent) 1 else 0) +
560615
(if (tokenType.asKnown().isPresent) 1 else 0) +
@@ -838,6 +893,7 @@ private constructor(
838893
clientType == other.clientType &&
839894
connectionId == other.connectionId &&
840895
connectionType == other.connectionType &&
896+
entityIds == other.entityIds &&
841897
products == other.products &&
842898
providerId == other.providerId &&
843899
tokenType == other.tokenType &&
@@ -853,6 +909,7 @@ private constructor(
853909
clientType,
854910
connectionId,
855911
connectionType,
912+
entityIds,
856913
products,
857914
providerId,
858915
tokenType,
@@ -866,5 +923,5 @@ private constructor(
866923
override fun hashCode(): Int = hashCode
867924

868925
override fun toString() =
869-
"CreateAccessTokenResponse{accessToken=$accessToken, clientType=$clientType, connectionId=$connectionId, connectionType=$connectionType, products=$products, providerId=$providerId, tokenType=$tokenType, accountId=$accountId, companyId=$companyId, customerId=$customerId, additionalProperties=$additionalProperties}"
926+
"CreateAccessTokenResponse{accessToken=$accessToken, clientType=$clientType, connectionId=$connectionId, connectionType=$connectionType, entityIds=$entityIds, products=$products, providerId=$providerId, tokenType=$tokenType, accountId=$accountId, companyId=$companyId, customerId=$customerId, additionalProperties=$additionalProperties}"
870927
}

0 commit comments

Comments
 (0)