@@ -282,12 +282,12 @@ Manually fetch pages with the nextPageCursor
282
282
283
283
seam = Seam()
284
284
285
- paginator = seam.create_paginator(seam.connected_accounts .list, {" limit" : 20 })
285
+ paginator = seam.create_paginator(seam.devices .list, {" limit" : 20 })
286
286
287
- connected_accounts , pagination = paginator.first_page()
287
+ devices , pagination = paginator.first_page()
288
288
289
289
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)
291
291
292
292
Resume pagination
293
293
^^^^^^^^^^^^^^^^^
@@ -302,17 +302,17 @@ Get the first page on initial load and store the state (e.g., in memory or a fil
302
302
seam = Seam()
303
303
304
304
params = {" limit" : 20 }
305
- paginator = seam.create_paginator(seam.connected_accounts .list, params)
305
+ paginator = seam.create_paginator(seam.devices .list, params)
306
306
307
- connected_accounts , pagination = paginator.first_page()
307
+ devices , pagination = paginator.first_page()
308
308
309
309
# Example: Store state for later use (e.g., in a file or database)
310
310
pagination_state = {
311
311
" params" : params,
312
312
" next_page_cursor" : pagination.next_page_cursor,
313
313
" has_next_page" : pagination.has_next_page,
314
314
}
315
- with open (" /tmp/seam_connected_accounts_list .json" , " w" ) as f:
315
+ with open (" /tmp/seam_devices_list .json" , " w" ) as f:
316
316
json.dump(pagination_state, f)
317
317
318
318
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:
325
325
seam = Seam()
326
326
327
327
# 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:
329
329
pagination_state = json.load(f)
330
330
331
331
if pagination_state.get(" has_next_page" ):
332
332
paginator = seam.create_paginator(
333
- seam.connected_accounts .list, pagination_state[" params" ]
333
+ seam.devices .list, pagination_state[" params" ]
334
334
)
335
- more_connected_accounts , _ = paginator.next_page(
335
+ more_devices , _ = paginator.next_page(
336
336
pagination_state[" next_page_cursor" ]
337
337
)
338
338
@@ -345,7 +345,7 @@ Iterate over all resources
345
345
346
346
seam = Seam()
347
347
348
- paginator = seam.create_paginator(seam.connected_accounts .list, {" limit" : 20 })
348
+ paginator = seam.create_paginator(seam.devices .list, {" limit" : 20 })
349
349
350
350
for account in paginator.flatten():
351
351
print (account.account_type_display_name)
@@ -359,9 +359,9 @@ Return all resources across all pages as a list
359
359
360
360
seam = Seam()
361
361
362
- paginator = seam.create_paginator(seam.connected_accounts .list, {" limit" : 20 })
362
+ paginator = seam.create_paginator(seam.devices .list, {" limit" : 20 })
363
363
364
- all_connected_accounts = paginator.flatten_to_list()
364
+ all_devices = paginator.flatten_to_list()
365
365
366
366
Interacting with Multiple Workspaces
367
367
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments