Skip to content

Commit 1ddeb30

Browse files
committed
docs: Use devices for pagination examples
1 parent d4a921b commit 1ddeb30

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ Manually fetch pages with the nextPageCursor
282282
283283
seam = Seam()
284284
285-
paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20})
285+
paginator = seam.create_paginator(seam.devices.list, {"limit": 20})
286286
287-
connected_accounts, pagination = paginator.first_page()
287+
devices, pagination = paginator.first_page()
288288
289289
if pagination.has_next_page:
290-
more_connected_accounts, _ = paginator.next_page(pagination.next_page_cursor)
290+
more_devices, _ = paginator.next_page(pagination.next_page_cursor)
291291
292292
Resume pagination
293293
^^^^^^^^^^^^^^^^^
@@ -302,17 +302,17 @@ Get the first page on initial load and store the state (e.g., in memory or a fil
302302
seam = Seam()
303303
304304
params = {"limit": 20}
305-
paginator = seam.create_paginator(seam.connected_accounts.list, params)
305+
paginator = seam.create_paginator(seam.devices.list, params)
306306
307-
connected_accounts, pagination = paginator.first_page()
307+
devices, pagination = paginator.first_page()
308308
309309
# Example: Store state for later use (e.g., in a file or database)
310310
pagination_state = {
311311
"params": params,
312312
"next_page_cursor": pagination.next_page_cursor,
313313
"has_next_page": pagination.has_next_page,
314314
}
315-
with open("/tmp/seam_connected_accounts_list.json", "w") as f:
315+
with open("/tmp/seam_devices_list.json", "w") as f:
316316
json.dump(pagination_state, f)
317317
318318
Get the next page at a later time using the stored state:
@@ -325,14 +325,14 @@ Get the next page at a later time using the stored state:
325325
seam = Seam()
326326
327327
# Example: Load state from where it was stored
328-
with open("/tmp/seam_connected_accounts_list.json", "r") as f:
328+
with open("/tmp/seam_devices_list.json", "r") as f:
329329
pagination_state = json.load(f)
330330
331331
if pagination_state.get("has_next_page"):
332332
paginator = seam.create_paginator(
333-
seam.connected_accounts.list, pagination_state["params"]
333+
seam.devices.list, pagination_state["params"]
334334
)
335-
more_connected_accounts, _ = paginator.next_page(
335+
more_devices, _ = paginator.next_page(
336336
pagination_state["next_page_cursor"]
337337
)
338338
@@ -345,7 +345,7 @@ Iterate over all resources
345345
346346
seam = Seam()
347347
348-
paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20})
348+
paginator = seam.create_paginator(seam.devices.list, {"limit": 20})
349349
350350
for account in paginator.flatten():
351351
print(account.account_type_display_name)
@@ -359,9 +359,9 @@ Return all resources across all pages as a list
359359
360360
seam = Seam()
361361
362-
paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20})
362+
paginator = seam.create_paginator(seam.devices.list, {"limit": 20})
363363
364-
all_connected_accounts = paginator.flatten_to_list()
364+
all_devices = paginator.flatten_to_list()
365365
366366
Interacting with Multiple Workspaces
367367
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)