LogoLogo
  • Platform Overview
  • 🗺️Guides
    • Getting Started
    • Users
      • Integrate the User SDK
      • Registration
      • Authentication
      • SDK Releases
      • API Reference
    • Entitlements
      • Administrative API
        • Integrating the Administrative API
        • Entitlement Definitions
        • Managing Entitlements Sets
        • Managing Entitlements Sequences
        • Managing User Entitlements
        • API Schema
      • End-user API
        • Integrate the Entitlements SDK
        • Redeeming Entitlements
        • Retrieving Entitlements
        • SDK Releases
        • API Reference
    • Sudos
      • Integrate the Sudo Profiles SDK
      • Sudo Entitlements
      • Manage Sudos
      • SDK Releases
      • API Reference
    • Telephony
      • Integrate the Telephony SDK
      • Manage Phone Numbers
      • Text Messaging
      • Voice Calling
      • Telephony Simulator
      • SDK Releases
      • API Reference
    • Email
      • Integrate the Email SDK
      • Email Entitlements
      • Manage Email Addresses
      • Sending & Receiving Email
      • Manage Email Folders
      • Draft Email Messages
      • Manage Email Address Blocklists
      • Email Address Public Information
      • Pagination
      • Caching
      • Configuration Data
      • Email Notifications
      • SDK Releases
      • API Reference
    • Decentralized Identity
      • Edge Agent
        • Relay SDK
          • Integrate the Relay SDK
          • Relay Entitlements
          • Manage Relay Postboxes
          • Manage Relay Messages
          • Receiving Messages
          • SDK Releases
        • Edge Agent SDK
          • Integrate the Edge Agent SDK
          • Agent Management
          • Manage Wallets
          • Establishing Connections
          • Manage Connections
          • Messaging
          • Manage DIDs
          • Accepting New Credentials
          • Manage Credentials
          • Present Credentials for Verification
          • Utilize Alternative Cryptography Providers
          • SDK Releases
          • Standards and Protocols
      • Cloud Agent
        • Cloud Agent Admin API
          • Integrate the Cloud Agent Admin API
          • Aries Interop Profile (AIP)
            • Connection Exchanges
            • Credential Exchanges
            • Proof Exchanges
          • Connections
          • Basic Messages
          • Credentials
            • Anoncreds Credentials
              • Schemas
              • Credential Definitions
            • W3C Credentials
          • Audit Logs
          • API Schema
          • Error Codes
          • Standards and Protocols
    • Virtual Cards
      • Integrate the Virtual Cards SDK
      • Virtual Cards Entitlements
      • Virtual Cards Transaction Velocity Constraints
      • Key Management
      • Manage Funding Sources
      • Manage Virtual Cards
      • Manage Transactions
      • Configuration Data
      • Pagination
      • Caching
      • SDK Releases
      • API Reference
    • Virtual Cards Simulator
      • Integrate the Virtual Cards Simulator SDK
      • Simulate Authorizations
      • Simulate Debits
      • Simulate Refunds
      • Simulate Reversals
      • Merchants and Currencies
      • SDK Releases
      • API Reference
    • Virtual Private Network
      • Integrate the VPN SDK
      • VPN Entitlements
      • Manage Servers
      • Manage Connection
      • Observe VPN Related Events
      • SDK Releases
      • API Reference
      • Frequently Asked Questions
    • Secure ID Verification
      • Integrate the Secure ID Verification SDK
      • List Supported Countries
      • Verify an Identity
      • Check Secure ID Verification Status
      • Use the Secure ID Verification Simulator
      • SDK Releases
      • API Reference
    • Password Manager
      • Integrate the Password Manager SDK
      • Accessing the Password Manager
      • Managing Password Vaults
      • Managing Password Vault Items
      • Vault Import and Export
      • Password Utilities
      • Password Manager Entitlements
      • Password Vault Security
      • SDK Releases
      • API Reference
    • Ad/Tracker Blocker
      • Integrate the Ad/Tracker Blocker SDK
      • Manage Rulesets
      • Blocking Ads and Trackers
      • Manage Exceptions
      • SDK Releases
      • API Reference
    • Site Reputation
      • Integrate the Site Reputation SDK
      • Use the Site Reputation SDK
      • SDK Releases
      • API Reference
  • 💡Concepts
    • Sudo Digital Identities
  • 🧱Development
    • Versioning
  • 🏢Administration
    • Admin Console Roles
  • ❓Get Help
    • Request a Demo
    • Report an Issue
Powered by GitBook
On this page
  1. Guides
  2. Email

Pagination

Provides the ability to separate and traverse through pages of data

Various APIs provide the ability to query results in a paginated form. These APIs will typically have an optional nextToken input property to facilitate pagination. By default, if a limit is not provided, or set as undefined/nil/null, the default limit will be 10.

When specifying a large number of records in a query, an upper limit of 1MB is enforced on the data retrieved. If the 1MB limit is hit, the data will be returned as a page and require using the next token of the result to query the next page of results.

The following types support pagination:

  • Email Addresses

  • Email Messages

  • Email Folders

If intending to use pagination, the first call to an API should not include a nextToken, otherwise the result will return an error. When a paginated API call is successful, the output response will contain a nextToken property.

When using a query that supports pagination, it is important to always check the nextToken. Due to the nature of the data access from the service, it is possible to retrieve a result with no data but potentially have another page of information to retrieve which may contain results.

To access the next page of a query API, use the previously returned nextToken in the subsequent API call. If a successful response does not return a nextToken, or it is set to undefined/nil/null, the pagination results have been exhausted and there are no more pages to retrieve.

When using subsequent calls for pagination, ensure that the input information (e.g. limit) is the same for each call, otherwise unexpected behavior will occur. For example, if the first call uses an input property of limit = 8, then each subsequent call must use a limit of 8.

Pagination Example

Below is an example usage of getEmailAddresses for a user with four email addresses and paginating through the results:

const output: EmailAddress[] = []
let nextToken: string | undefined = undefined
try {
  do {
    const listOutput = await emailClient.listEmailAddresses({
      cachePolicy: CachePolicy.RemoteOnly,
      limit = 2,
      nextToken, // `undefined` on first invocation
    })
    output.push(...listOutput.items)
    nextToken = listOutput.nextToken
  } while (nextToken)
} catch {
  // Handle/notify user of errors
}

The first iteration of the do...while loop will have the listOutput return an array of items containing two EmailAddress objects, as well as a populated nextToken which is used in the subsequent call in the next iteration. The second iteration will have the listOutput return an array of items containing two EmailAddress objects, however the nextToken will be undefined as there are no more objects for the query to fetch.

Below is an example usage of listEmailAddresses for a user with 4 email addresses:

var output: ListOutput<EmailAddress>?
var input = ListEmailAddressesInput(limit: 2, nextToken: nil)
do {
  output = try await emailClient.listEmailAddresses(withInput: input)
  /*
   * This output will contain an `items` array of 2 Email Address objects, as
   * well as a non-`nil` `nextToken` which is used in the subsequent call.
   */
  input = ListEmailAddressesInput(limit: 2, nextToken: output.nextToken)
  output = try await emailClient.listEmailAddresses(withInput: input)
  /*
   * This output will also contain 2 Email Address objects in the `items` array, however the
   * `nextToken` will be `nil`, as there are no more objects for the user to
   * fetch.
   */
} catch {
  // Handle/notify user of errors
}
PreviousEmail Address Public InformationNextCaching

Last updated 7 months ago

🗺️