commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
|
17 |
|
a0a843
|
18 |
#import <TwitterCore/TWTRAuthConfig.h> |
H |
19 |
#import <TwitterCore/TWTRAuthSession.h> |
|
20 |
#import <TwitterCore/TWTRGuestSession.h> |
|
21 |
|
|
22 |
@class TWTRSession; |
|
23 |
|
|
24 |
NS_ASSUME_NONNULL_BEGIN |
|
25 |
|
|
26 |
/** |
|
27 |
* Completion block called when user login succeeds or fails. |
|
28 |
* |
|
29 |
* @param session Contains the OAuth tokens and minimal information associated with the logged in user or nil. |
|
30 |
* @param error Error that will be non nil if the authentication request failed. |
|
31 |
*/ |
|
32 |
typedef void (^TWTRLogInCompletion)(TWTRSession *_Nullable session, NSError *_Nullable error); |
|
33 |
|
|
34 |
/** |
|
35 |
* TWTRSession represents a user's session authenticated with the Twitter API. |
|
36 |
*/ |
|
37 |
@interface TWTRSession : NSObject <TWTRAuthSession> |
|
38 |
|
|
39 |
/** |
|
40 |
* The authorization token. |
|
41 |
*/ |
|
42 |
@property (nonatomic, copy, readonly) NSString *authToken; |
|
43 |
/** |
|
44 |
* The authorization token secret. |
|
45 |
*/ |
|
46 |
@property (nonatomic, copy, readonly) NSString *authTokenSecret; |
|
47 |
/** |
|
48 |
* The username associated with the access token. |
|
49 |
*/ |
|
50 |
@property (nonatomic, copy, readonly) NSString *userName; |
|
51 |
/** |
|
52 |
* The user ID associated with the access token. |
|
53 |
*/ |
|
54 |
@property (nonatomic, copy, readonly) NSString *userID; |
|
55 |
|
|
56 |
/** |
|
57 |
* Returns an `TWTRSession` object initialized by copying the values from the dictionary or nil if the dictionary is missing. |
|
58 |
* |
|
59 |
* @param sessionDictionary (required) The dictionary received after successfull authentication from Twitter OAuth. |
|
60 |
*/ |
|
61 |
- (instancetype)initWithSessionDictionary:(NSDictionary *)sessionDictionary; |
|
62 |
|
|
63 |
/** |
|
64 |
* Returns a `TWTRSession` object initialized by copying the values |
|
65 |
* from the dictionary returned from a Mobile SSO redirect URL. |
|
66 |
* |
|
67 |
* @param authDictionary (required) The dictionary received after successful |
|
68 |
* authentication from Twitter Mobile SSO. |
|
69 |
*/ |
|
70 |
- (instancetype)initWithSSOResponse:(NSDictionary *)authDictionary; |
|
71 |
|
|
72 |
/** |
|
73 |
* Returns an `TWTRSession` object initialized by copying the given tokens and user info. |
|
74 |
* |
|
75 |
* @param authToken (required) The authorization token for the session |
|
76 |
* @param authTokenSecret (required) The authorization token secret for the session |
|
77 |
* @param userName (required) The username for the user associated with the session. |
|
78 |
* @param userID (required) The unique ID for the user associated with the session. |
|
79 |
* |
|
80 |
* @return A `TWTRSession` object initialized with the provided parameters. |
|
81 |
*/ |
|
82 |
- (instancetype)initWithAuthToken:(NSString *)authToken authTokenSecret:(NSString *)authTokenSecret userName:(NSString *)userName userID:(NSString *)userID NS_DESIGNATED_INITIALIZER; |
|
83 |
|
|
84 |
/** |
|
85 |
* Unavailable. Use -initWithSessionDictionary: instead. |
|
86 |
*/ |
|
87 |
- (instancetype)init NS_UNAVAILABLE; |
|
88 |
|
|
89 |
@end |
|
90 |
|
|
91 |
NS_ASSUME_NONNULL_END |