Skip to content

Recipe: Sync Object Changes #37

Description

@skunk-ink

Summary

Add a recipe showing how to use objectEvents() with cursor-based pagination to
incrementally sync object changes (new uploads, metadata updates, and deletions)
without re-fetching the full object list on every call.

What the recipe should cover

  • Perform an initial full fetch by calling sdk.objectEvents(nil, limit) (no cursor)
  • Persist the cursor after the first page: { after: event.updated_at, id: event.id }
    from the last event in the returned slice
  • On subsequent calls, pass the saved cursor to receive only newer events
  • Detect end-of-feed: when the returned slice is shorter than limit, all events
    have been consumed
  • Handle both event types:
    • deleted == false -> upsert the object into local state
    • deleted == true -> remove it (event.object will be None in this case)
  • Show a simple polling loop (e.g. check every 30 seconds) as a practical usage pattern

Proposed location

docs/recipes/sync-object-changes.md

Add to docs/nav.json under Recipes, directly after "List Pinned Objects".

Languages

Rust · Go · Python · JavaScript (Node) · JavaScript (Browser)

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request
No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions