| 1 | // |
| 2 | // TWTRTimelineCursor.h |
| 3 | // TwitterKit |
| 4 | // |
| 5 | // Created by Kang Chen on 2/12/15. |
| 6 | // Copyright (c) 2015 Twitter. All rights reserved. |
| 7 | // |
| 8 | |
| 9 | #import <Foundation/Foundation.h> |
| 10 | |
| 11 | /** |
| 12 | This Model object is a generic type of `Cursor` to represent the range of Tweets |
| 13 | which have already been loaded from the Twitter API. A dataset that supports |
| 14 | "cursoring" splits of a set of results (or Tweets in our case) in pages. One |
| 15 | page is loaded at a time, and the cursor from the previous request is used to |
| 16 | calculated which set of Tweets should be requested. |
| 17 | |
| 18 | |
| 19 | ## Positions |
| 20 | For User, Search, and List Timelines generally corresponds to a real Tweet ID. |
| 21 | |
| 22 | newer Tweets |
| 23 | (not yet loaded) |
| 24 | |
| 25 | -- newest/highest Tweet -- maxPosition |
| 26 | |
| 27 | loaded Tweets |
| 28 | |
| 29 | -- oldest/lowest Tweet -- minPosition |
| 30 | minPosition - 1 |
| 31 | older Tweets |
| 32 | (not yet loaded) |
| 33 | |
| 34 | More: https://dev.twitter.com/overview/api/cursoring |
| 35 | |
| 36 | */ |
| 37 | @interface TWTRTimelineCursor : NSObject |
| 38 | |
| 39 | /** |
| 40 | * The ID of the Tweet highest up in a batch of Tweets received from a Timeline. |
| 41 | * Often this corresponds to the newest Tweet in terms of time. |
| 42 | * |
| 43 | * For User, Search, and List Timelines this corresponds to a real Tweet ID.. |
| 44 | */ |
| 45 | @property (nonatomic, copy, readonly) NSString *maxPosition; |
| 46 | |
| 47 | /** |
| 48 | * The ID of the Tweet lowest in a batch of Tweets received from a Timeline. This |
| 49 | * often corresponds to the oldest Tweet in terms of time. |
| 50 | * |
| 51 | */ |
| 52 | @property (nonatomic, copy, readonly) NSString *minPosition; |
| 53 | |
| 54 | - (instancetype)init __unavailable; |
| 55 | |
| 56 | /** |
| 57 | * Initialize a new cursor. |
| 58 | * |
| 59 | * @param maxPosition The highest (newest) Tweet ID received in this batch of Tweets. |
| 60 | * @param minPosition The lowest (oldest) Tweet ID received in this batch of Tweets. |
| 61 | * |
| 62 | * @return The initialized cursor to be passed back from a request for a Timeline from |
| 63 | * the Twitter API. |
| 64 | */ |
| 65 | - (instancetype)initWithMaxPosition:(NSString *)maxPosition minPosition:(NSString *)minPosition; |
| 66 | |
| 67 | @end |