DBPAPERCursor

Objective-C

@interface DBPAPERCursor : NSObject <DBSerializable, NSCopying>

Swift

class DBPAPERCursor : NSObject, DBSerializable, NSCopying

The Cursor struct.

This class implements the DBSerializable protocol (serialize and deserialize instance methods), which is required for all Obj-C SDK API route objects.

Instance fields

  • The actual cursor value.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull value;

    Swift

    var value: String { get }
  • Expiration time of value. Some cursors might have expiration time assigned. This is a UTC value after which the cursor is no longer valid and the API starts returning an error. If cursor expires a new one needs to be obtained and pagination needs to be restarted. Some cursors might be short-lived some cursors might be long-lived. This really depends on the sorting type and order, e.g.: 1. on one hand, listing docs created by the user, sorted by the created time ascending will have undefinite expiration because the results cannot change while the iteration is happening. This cursor would be suitable for long term polling. 2. on the other hand, listing docs sorted by the last modified time will have a very short expiration as docs do get modified very often and the modified time can be changed while the iteration is happening thus altering the results.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *expiration;

    Swift

    var expiration: Date? { get }

Constructors

  • Full constructor for the struct (exposes all instance variables).

    Declaration

    Objective-C

    - (nonnull instancetype)initWithValue:(nonnull NSString *)value
                               expiration:(nullable NSDate *)expiration;

    Swift

    init(value: String, expiration: Date?)

    Parameters

    value

    The actual cursor value.

    expiration

    Expiration time of value. Some cursors might have expiration time assigned. This is a UTC value after which the cursor is no longer valid and the API starts returning an error. If cursor expires a new one needs to be obtained and pagination needs to be restarted. Some cursors might be short-lived some cursors might be long-lived. This really depends on the sorting type and order, e.g.: 1. on one hand, listing docs created by the user, sorted by the created time ascending will have undefinite expiration because the results cannot change while the iteration is happening. This cursor would be suitable for long term polling. 2. on the other hand, listing docs sorted by the last modified time will have a very short expiration as docs do get modified very often and the modified time can be changed while the iteration is happening thus altering the results.

    Return Value

    An initialized instance.

  • Convenience constructor (exposes only non-nullable instance variables with no default value).

    Declaration

    Objective-C

    - (nonnull instancetype)initWithValue:(nonnull NSString *)value;

    Swift

    init(value: String)

    Parameters

    value

    The actual cursor value.

    Return Value

    An initialized instance.