Show / Hide Table of Contents

Class ServicePaginators

Collection of helper methods that can be used to provide an enumerator interface to any list operations of Service where multiple pages of data may be fetched. Two styles of enumerators are supported:

  • Enumerating over the Response objects returned by the list operation. These are referred to as ResponseEnumerators, and the methods are suffixed with ResponseEnumerator. For example: listUsersResponseEnumerator.
  • Enumerating over the resources/records being listed. These are referred to as RecordEnumerators, and the methods are suffixed with RecordEnumerator. For example: listUsersRecordEnumerator.
These enumerators abstract away the need to write code to manually handle pagination via looping and using the page tokens. They will automatically fetch more data from the service when required.

As an example, if we were using the ListUsers operation in IdentityService, then the iterator returned by calling a ResponseEnumerator method would iterate over the ListUsersResponse objects returned by each ListUsers call, whereas the enumerables returned by calling a RecordEnumerator method would iterate over the User records and we don't have to deal with ListUsersResponse objects at all. In either case, pagination will be automatically handled so we can iterate until there are no more responses or no more resources/records available.
Inheritance
object
ServicePaginators
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Oci.AnnouncementsService
Assembly: OCI.DotNetSDK.Announcementsservice.dll
Syntax
public class ServicePaginators

Constructors

ServicePaginators(ServiceClient)

Declaration
public ServicePaginators(ServiceClient client)
Parameters
Type Name Description
ServiceClient client

Methods

ListServicesRecordEnumerator(ListServicesRequest, RetryConfiguration, CancellationToken)

Creates a new enumerable which will iterate over the ServiceSummary objects contained in responses from the ListServices operation. This enumerable will fetch more data from the server as needed.

Declaration
public IEnumerable<ServiceSummary> ListServicesRecordEnumerator(ListServicesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ListServicesRequest request

The request object containing the details to send

RetryConfiguration retryConfiguration

The configuration for retrying, may be null

CancellationToken cancellationToken

The cancellation token object

Returns
Type Description
IEnumerable<ServiceSummary>

The enumerator, which supports a simple iteration over a collection of a specified type

ListServicesResponseEnumerator(ListServicesRequest, RetryConfiguration, CancellationToken)

Creates a new enumerable which will iterate over the responses received from the ListServices operation. This enumerable will fetch more data from the server as needed.

Declaration
public IEnumerable<ListServicesResponse> ListServicesResponseEnumerator(ListServicesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ListServicesRequest request

The request object containing the details to send

RetryConfiguration retryConfiguration

The configuration for retrying, may be null

CancellationToken cancellationToken

The cancellation token object

Returns
Type Description
IEnumerable<ListServicesResponse>

The enumerator, which supports a simple iteration over a collection of a specified type

In this article
Back to top