ARTPaginatedResult

Objective-C

@interface ARTPaginatedResult<ItemType> : NSObject

Swift

class ARTPaginatedResult<ItemType> : NSObject, @unchecked Sendable where ItemType : AnyObject

Contains a page of results for message or presence history, stats, or REST presence requests. An ARTPaginatedResult response from a REST API paginated query is also accompanied by metadata that indicates the relative queries available to the ARTPaginatedResult object.

  • Contains the current page of results; for example, an array of ARTMessage or ARTPresenceMessage objects for a channel history request.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<ItemType> *_Nonnull items;

    Swift

    var items: [ItemType] { get }
  • Returns true if there are more pages available by calling next and returns false if this page is the last page available.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL hasNext;

    Swift

    var hasNext: Bool { get }
  • Returns true if this page is the last page and returns false if there are more pages available by calling next available.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isLast;

    Swift

    var isLast: Bool { get }
  • If you use this initializer, trying to call any of the methods or properties in ARTPaginatedResult will throw an exception; you must provide your own implementation in a subclass. This initializer exists purely to allow you to provide a mock implementation of this class in your tests.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Returns a new ARTPaginatedResult for the first page of results.

    Declaration

    Objective-C

    - (void)first:(nonnull void (^)(ARTPaginatedResult<ItemType> *_Nullable,
                                    ARTErrorInfo *_Nullable))callback;

    Swift

    func first(_ callback: @escaping (ARTPaginatedResult<ItemType>?, ARTErrorInfo?) -> Void)

    Parameters

    callback

    A callback for retriving an ARTPaginatedResult object with an array of ItemType objects.

  • Returns a new ARTPaginatedResult loaded with the next page of results. If there are no further pages, then nil is returned.

    Declaration

    Objective-C

    - (void)next:(nonnull void (^)(ARTPaginatedResult<ItemType> *_Nullable,
                                   ARTErrorInfo *_Nullable))callback;

    Swift

    func next(_ callback: @escaping (ARTPaginatedResult<ItemType>?, ARTErrorInfo?) -> Void)

    Parameters

    callback

    A callback for retriving an ARTPaginatedResult object with an array of ItemType objects.

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) ARTRestInternal *rest

    Swift

    var rest: ARTRestInternal { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) dispatch_queue_t userQueue

    Swift

    var userQueue: dispatch_queue_t { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) dispatch_queue_t queue

    Swift

    var queue: dispatch_queue_t { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSMutableURLRequest *relFirst

    Swift

    var relFirst: NSMutableURLRequest { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSMutableURLRequest *relCurrent

    Swift

    var relCurrent: NSMutableURLRequest { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSMutableURLRequest *relNext

    Swift

    var relNext: NSMutableURLRequest { get }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithItems:(NSArray *)items
                             rest:(ARTRestInternal *)rest
                         relFirst:(NSMutableURLRequest *)relFirst
                       relCurrent:(NSMutableURLRequest *)relCurrent
                          relNext:(NSMutableURLRequest *)relNext
                responseProcessor:(ARTPaginatedResultResponseProcessor)responseProcessor
                 wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents
                           logger:(ARTInternalLog *)logger NS_DESIGNATED_INITIALIZER;

    Swift

    init(items: [Any], rest: ARTRestInternal, relFirst: NSMutableURLRequest, relCurrent: NSMutableURLRequest, relNext: NSMutableURLRequest, responseProcessor: @escaping ARTPaginatedResultResponseProcessor, wrapperSDKAgents: [String : String]?, logger: InternalLog)
  • Undocumented

    Declaration

    Objective-C

    + (void)executePaginated:(ARTRestInternal *)rest
                 withRequest:(NSMutableURLRequest *)request
        andResponseProcessor:(ARTPaginatedResultResponseProcessor)responseProcessor
            wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents
                      logger:(ARTInternalLog *)logger
                    callback:(void (^)(ARTPaginatedResult<ItemType> *_Nullable result, ARTErrorInfo *_Nullable error))callback;

    Swift

    class func executePaginated(_ rest: ARTRestInternal, with request: NSMutableURLRequest, andResponseProcessor responseProcessor: @escaping ARTPaginatedResultResponseProcessor, wrapperSDKAgents: [String : String]?, logger: InternalLog, callback: @escaping (ARTPaginatedResult<ItemType>?, ARTErrorInfo?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, readonly) NSStringDictionary *wrapperSDKAgents

    Swift

    var wrapperSDKAgents: [String : String]? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) ARTInternalLog *logger

    Swift

    var logger: InternalLog { get }