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