Skip to content

Commit

Permalink
🌿 update README
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 26, 2024
1 parent 271fa4f commit 03a1345
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
src/wrapper/
src/core/auth/OAuthTokenProvider.ts
src/index.ts

README.md
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ Instantiate and use the client with the following:
```typescript
import { ChariotClient } from "chariot";

const client = new ChariotClient({ token: "YOUR_TOKEN" });
const client = new ChariotClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
});
await client.nonprofits.create({
user: {
email: "ben.give@co.com",
Expand Down Expand Up @@ -59,6 +62,36 @@ try {
}
```

## Automatic Pagination

List endpoints are paginated. The SDK provides an iterator so that you
can simply loop over the items:

```ts
const result = await client.events.list();
for await (const event of result) {
console.log(event);
}
```

You can also iterate page-by-page:

```ts
let page = await client.events.list();
for (const event of page.data) {
console.log(event);
}
```

or manually:

```ts
while (page.hasNextPage()) {
page = page.getNextPage();
// ...
}
```

## Advanced

### Retries
Expand Down

0 comments on commit 03a1345

Please sign in to comment.