diff --git a/README.rst b/README.rst index 727c4f4d..e14bfbad 100644 --- a/README.rst +++ b/README.rst @@ -282,12 +282,12 @@ Manually fetch pages with the nextPageCursor seam = Seam() - paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20}) + paginator = seam.create_paginator(seam.devices.list, {"limit": 20}) - connected_accounts, pagination = paginator.first_page() + devices, pagination = paginator.first_page() if pagination.has_next_page: - more_connected_accounts, _ = paginator.next_page(pagination.next_page_cursor) + more_devices, _ = paginator.next_page(pagination.next_page_cursor) Resume pagination ^^^^^^^^^^^^^^^^^ @@ -302,9 +302,9 @@ Get the first page on initial load and store the state (e.g., in memory or a fil seam = Seam() params = {"limit": 20} - paginator = seam.create_paginator(seam.connected_accounts.list, params) + paginator = seam.create_paginator(seam.devices.list, params) - connected_accounts, pagination = paginator.first_page() + devices, pagination = paginator.first_page() # Example: Store state for later use (e.g., in a file or database) pagination_state = { @@ -312,7 +312,7 @@ Get the first page on initial load and store the state (e.g., in memory or a fil "next_page_cursor": pagination.next_page_cursor, "has_next_page": pagination.has_next_page, } - with open("/tmp/seam_connected_accounts_list.json", "w") as f: + with open("/tmp/seam_devices_list.json", "w") as f: json.dump(pagination_state, f) 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: seam = Seam() # Example: Load state from where it was stored - with open("/tmp/seam_connected_accounts_list.json", "r") as f: + with open("/tmp/seam_devices_list.json", "r") as f: pagination_state = json.load(f) if pagination_state.get("has_next_page"): paginator = seam.create_paginator( - seam.connected_accounts.list, pagination_state["params"] + seam.devices.list, pagination_state["params"] ) - more_connected_accounts, _ = paginator.next_page( + more_devices, _ = paginator.next_page( pagination_state["next_page_cursor"] ) @@ -345,7 +345,7 @@ Iterate over all resources seam = Seam() - paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20}) + paginator = seam.create_paginator(seam.devices.list, {"limit": 20}) for account in paginator.flatten(): print(account.account_type_display_name) @@ -359,9 +359,9 @@ Return all resources across all pages as a list seam = Seam() - paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 20}) + paginator = seam.create_paginator(seam.devices.list, {"limit": 20}) - all_connected_accounts = paginator.flatten_to_list() + all_devices = paginator.flatten_to_list() Interacting with Multiple Workspaces ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~