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
orARTPresenceMessage
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 returnsfalse
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 returnsfalse
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 ofItemType
objects. -
Returns a new
ARTPaginatedResult
loaded with the next page of results. If there are no further pages, thennil
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 ofItemType
objects.