commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRGuestSession.h |
|
3 |
// TwitterKit |
|
4 |
// |
|
5 |
// Copyright (c) 2015 Twitter. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <Foundation/Foundation.h> |
|
9 |
#import <TwitterCore/TWTRAuthSession.h> |
|
10 |
|
|
11 |
@class TWTRGuestSession; |
|
12 |
|
|
13 |
NS_ASSUME_NONNULL_BEGIN |
|
14 |
|
|
15 |
/** |
|
16 |
* Completion block called when guest login succeeds or fails. |
|
17 |
* |
|
18 |
* @param guestSession A `TWTRGuestSession` containing the OAuth tokens or nil. |
|
19 |
* @param error Error that will be non nil if the authentication request failed. |
|
20 |
*/ |
|
21 |
typedef void (^TWTRGuestLogInCompletion)(TWTRGuestSession *_Nullable guestSession, NSError *_Nullable error); |
|
22 |
|
|
23 |
/** |
|
24 |
* `TWTRGuestSession` represents a guest session authenticated with the Twitter API. See `TWTRSession` for user sessions. |
|
25 |
*/ |
|
26 |
@interface TWTRGuestSession : NSObject <TWTRBaseSession> |
|
27 |
|
|
28 |
/** |
|
29 |
* The bearer access token for guest auth. |
|
30 |
*/ |
|
31 |
@property (nonatomic, copy, readonly) NSString *accessToken; |
|
32 |
|
|
33 |
/** |
|
34 |
* The guest access token. |
|
35 |
*/ |
|
36 |
@property (nonatomic, copy, readonly) NSString *guestToken; |
|
37 |
|
|
38 |
/** |
|
39 |
* This property can be used to make a best guess about whether the token will |
|
40 |
* still be valid or not. |
|
41 |
* |
|
42 |
* Guest tokens expire after a short time interval but |
|
43 |
* the actual interval is not specified. This property will return YES if a sufficient |
|
44 |
* amount of time has passed indicating that the token is probably no longer valid. |
|
45 |
* In most situations you should make a request with the token and see if the API |
|
46 |
* accepts the token or not. |
|
47 |
*/ |
|
48 |
@property (nonatomic, readonly) BOOL probablyNeedsRefreshing; |
|
49 |
|
|
50 |
/** |
|
51 |
* Returns an `TWTRGuestSession` object initialized by copying the values from the dictionary or nil if the dictionary is missing. |
|
52 |
* |
|
53 |
* @param sessionDictionary (required) The dictionary received after successfull authentication from Twitter guest-only authentication. |
|
54 |
*/ |
|
55 |
- (instancetype)initWithSessionDictionary:(NSDictionary *)sessionDictionary; |
|
56 |
|
|
57 |
/** |
|
58 |
* Returns a `TWTRGuestSession` object |
|
59 |
* |
|
60 |
* @param accessToken the access token |
|
61 |
* @param guestToken the guest access token |
|
62 |
*/ |
|
63 |
- (instancetype)initWithAccessToken:(NSString *)accessToken guestToken:(nullable NSString *)guestToken; |
|
64 |
|
|
65 |
/** |
|
66 |
* Unavailable. Use `-initWithSessionDictionary:` instead. |
|
67 |
*/ |
|
68 |
- (instancetype)init NS_UNAVAILABLE; |
|
69 |
|
|
70 |
@end |
|
71 |
|
|
72 |
NS_ASSUME_NONNULL_END |