sdk(P1.7): auto-pagination iterators for every paginated list method
Each limit/offset list method gains an iterator twin that walks pages transparently and stops on the first short page — same endpoints, no new API surface: Python generators (iter_tenant_streams / _stream_events / _windows / _checkpoints / iter_fork_evidence / iter_tenant_ivc_epochs), TypeScript async iterators (for await ... of client.iterTenantStreamEvents(...)), and a Go Iterator with Next(ctx) returning (nil, nil) at exhaustion, plus Iter* twins on the client. Tests drain a 3-page mocked response set in order and confirm a short first page ends iteration after exactly one request. READMEs updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
16
README.md
16
README.md
@@ -129,6 +129,22 @@ client, _ := attesto.NewClient(apiKey, attesto.WithHeadStore(attesto.NewFileHead
|
||||
client, _ = attesto.NewClient(apiKey, attesto.WithHeadStore(nil))
|
||||
```
|
||||
|
||||
## Iterating long listings
|
||||
|
||||
Paginated `List*` methods have `Iter*` twins that walk limit/offset pages
|
||||
transparently; `Next` returns `(nil, nil)` when the listing is exhausted:
|
||||
|
||||
```go
|
||||
it := client.IterTenantStreamEvents("str_...", 200)
|
||||
for {
|
||||
event, err := it.Next(ctx)
|
||||
if err != nil || event == nil {
|
||||
break
|
||||
}
|
||||
process(event)
|
||||
}
|
||||
```
|
||||
|
||||
## Verify anchors on-chain
|
||||
|
||||
`VerifyAnchorOnchain` checks an anchor epoch against the chain itself — one raw
|
||||
|
||||
Reference in New Issue
Block a user