commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRSession.h |
|
3 |
// |
|
4 |
// Copyright (c) 2015 Twitter. All rights reserved. |
|
5 |
// |
|
6 |
|
|
7 |
#import <TwitterCore/TWTRAuthConfig.h> |
|
8 |
#import <TwitterCore/TWTRAuthSession.h> |
|
9 |
#import <TwitterCore/TWTRGuestSession.h> |
|
10 |
|
|
11 |
@class TWTRSession; |
|
12 |
|
|
13 |
NS_ASSUME_NONNULL_BEGIN |
|
14 |
|
|
15 |
/** |
|
16 |
* Completion block called when user login succeeds or fails. |
|
17 |
* |
|
18 |
* @param session Contains the OAuth tokens and minimal information associated with the logged in user or nil. |
|
19 |
* @param error Error that will be non nil if the authentication request failed. |
|
20 |
*/ |
|
21 |
typedef void (^TWTRLogInCompletion)(TWTRSession *_Nullable session, NSError *_Nullable error); |
|
22 |
|
|
23 |
/** |
|
24 |
* TWTRSession represents a user's session authenticated with the Twitter API. |
|
25 |
*/ |
|
26 |
@interface TWTRSession : NSObject <TWTRAuthSession> |
|
27 |
|
|
28 |
/** |
|
29 |
* The authorization token. |
|
30 |
*/ |
|
31 |
@property (nonatomic, copy, readonly) NSString *authToken; |
|
32 |
/** |
|
33 |
* The authorization token secret. |
|
34 |
*/ |
|
35 |
@property (nonatomic, copy, readonly) NSString *authTokenSecret; |
|
36 |
/** |
|
37 |
* The username associated with the access token. |
|
38 |
*/ |
|
39 |
@property (nonatomic, copy, readonly) NSString *userName; |
|
40 |
/** |
|
41 |
* The user ID associated with the access token. |
|
42 |
*/ |
|
43 |
@property (nonatomic, copy, readonly) NSString *userID; |
|
44 |
|
|
45 |
/** |
|
46 |
* Returns an `TWTRSession` object initialized by copying the values from the dictionary or nil if the dictionary is missing. |
|
47 |
* |
|
48 |
* @param sessionDictionary (required) The dictionary received after successfull authentication from Twitter OAuth. |
|
49 |
*/ |
|
50 |
- (instancetype)initWithSessionDictionary:(NSDictionary *)sessionDictionary; |
|
51 |
|
|
52 |
/** |
|
53 |
* Returns a `TWTRSession` object initialized by copying the values |
|
54 |
* from the dictionary returned from a Mobile SSO redirect URL. |
|
55 |
* |
|
56 |
* @param authDictionary (required) The dictionary received after successful |
|
57 |
* authentication from Twitter Mobile SSO. |
|
58 |
*/ |
|
59 |
- (instancetype)initWithSSOResponse:(NSDictionary *)authDictionary; |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns an `TWTRSession` object initialized by copying the given tokens and user info. |
|
63 |
* |
|
64 |
* @param authToken (required) The authorization token for the session |
|
65 |
* @param authTokenSecret (required) The authorization token secret for the session |
|
66 |
* @param userName (required) The username for the user associated with the session. |
|
67 |
* @param userID (required) The unique ID for the user associated with the session. |
|
68 |
* |
|
69 |
* @return A `TWTRSession` object initialized with the provided parameters. |
|
70 |
*/ |
|
71 |
- (instancetype)initWithAuthToken:(NSString *)authToken authTokenSecret:(NSString *)authTokenSecret userName:(NSString *)userName userID:(NSString *)userID NS_DESIGNATED_INITIALIZER; |
|
72 |
|
|
73 |
/** |
|
74 |
* Unavailable. Use -initWithSessionDictionary: instead. |
|
75 |
*/ |
|
76 |
- (instancetype)init NS_UNAVAILABLE; |
|
77 |
|
|
78 |
@end |
|
79 |
|
|
80 |
NS_ASSUME_NONNULL_END |