Skip to content

Commit

Permalink
chore: update parameter examples in tests and docs (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Dec 19, 2024
1 parent f855ad8 commit f9fa926
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,33 @@ for (Counterparty counterparty : page.items()) {
}
```

Use the `CounterpartyListParams` builder to set parameters:

```java
CounterpartyListParams params = CounterpartyListParams.builder()
.afterCursor("after_cursor")
.createdAtLowerBound(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.createdAtUpperBound(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.email("dev@stainlessapi.com")
.legalEntityId("legal_entity_id")
.metadata(CounterpartyListParams.Metadata.builder()
.putAdditionalProperty("foo", List.of("string"))
.build())
.name("name")
.perPage(0L)
.build();
CounterpartyListPage page1 = client.counterparties().list(params);

// Using the `from` method of the builder you can reuse previous params values:
CounterpartyListPage page2 = client.counterparties().list(CounterpartyListParams.builder()
.from(params)
.afterCursor("abc123...")
.build());

// Or easily get params for the next page by using the helper `getNextPageParams`:
CounterpartyListPage page3 = client.counterparties().list(params.getNextPageParams(page2));
```

See [Pagination](#pagination) below for more information on transparently working with lists of objects without worrying about fetching each page.

---
Expand Down

0 comments on commit f9fa926

Please sign in to comment.