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 |
|
|
18 |
/** |
|
19 |
This header is private to the Twitter Core SDK and not exposed for public SDK consumption |
|
20 |
*/ |
a0a843
|
21 |
|
H |
22 |
#import <TwitterCore/TWTRAuthConfig.h> |
|
23 |
#import <TwitterCore/TWTRAuthSession.h> |
|
24 |
#import <TwitterCore/TWTRGuestSession.h> |
|
25 |
|
|
26 |
@class TWTRSession; |
|
27 |
|
|
28 |
NS_ASSUME_NONNULL_BEGIN |
|
29 |
|
|
30 |
/** |
|
31 |
* Completion block called when user login succeeds or fails. |
|
32 |
* |
|
33 |
* @param session Contains the OAuth tokens and minimal information associated with the logged in user or nil. |
|
34 |
* @param error Error that will be non nil if the authentication request failed. |
|
35 |
*/ |
|
36 |
typedef void (^TWTRLogInCompletion)(TWTRSession *_Nullable session, NSError *_Nullable error); |
|
37 |
|
|
38 |
/** |
|
39 |
* TWTRSession represents a user's session authenticated with the Twitter API. |
|
40 |
*/ |
|
41 |
@interface TWTRSession : NSObject <TWTRAuthSession> |
|
42 |
|
|
43 |
/** |
|
44 |
* The authorization token. |
|
45 |
*/ |
|
46 |
@property (nonatomic, copy, readonly) NSString *authToken; |
|
47 |
/** |
|
48 |
* The authorization token secret. |
|
49 |
*/ |
|
50 |
@property (nonatomic, copy, readonly) NSString *authTokenSecret; |
|
51 |
/** |
|
52 |
* The username associated with the access token. |
|
53 |
*/ |
|
54 |
@property (nonatomic, copy, readonly) NSString *userName; |
|
55 |
/** |
|
56 |
* The user ID associated with the access token. |
|
57 |
*/ |
|
58 |
@property (nonatomic, copy, readonly) NSString *userID; |
|
59 |
|
|
60 |
/** |
|
61 |
* Returns an `TWTRSession` object initialized by copying the values from the dictionary or nil if the dictionary is missing. |
|
62 |
* |
|
63 |
* @param sessionDictionary (required) The dictionary received after successfull authentication from Twitter OAuth. |
|
64 |
*/ |
|
65 |
- (instancetype)initWithSessionDictionary:(NSDictionary *)sessionDictionary; |
|
66 |
|
|
67 |
/** |
|
68 |
* Returns a `TWTRSession` object initialized by copying the values |
|
69 |
* from the dictionary returned from a Mobile SSO redirect URL. |
|
70 |
* |
|
71 |
* @param authDictionary (required) The dictionary received after successful |
|
72 |
* authentication from Twitter Mobile SSO. |
|
73 |
*/ |
|
74 |
- (instancetype)initWithSSOResponse:(NSDictionary *)authDictionary; |
|
75 |
|
|
76 |
/** |
|
77 |
* Returns an `TWTRSession` object initialized by copying the given tokens and user info. |
|
78 |
* |
|
79 |
* @param authToken (required) The authorization token for the session |
|
80 |
* @param authTokenSecret (required) The authorization token secret for the session |
|
81 |
* @param userName (required) The username for the user associated with the session. |
|
82 |
* @param userID (required) The unique ID for the user associated with the session. |
|
83 |
* |
|
84 |
* @return A `TWTRSession` object initialized with the provided parameters. |
|
85 |
*/ |
|
86 |
- (instancetype)initWithAuthToken:(NSString *)authToken authTokenSecret:(NSString *)authTokenSecret userName:(NSString *)userName userID:(NSString *)userID NS_DESIGNATED_INITIALIZER; |
|
87 |
|
|
88 |
/** |
|
89 |
* Unavailable. Use -initWithSessionDictionary: instead. |
|
90 |
*/ |
|
91 |
- (instancetype)init NS_UNAVAILABLE; |
|
92 |
|
|
93 |
@end |
|
94 |
|
|
95 |
NS_ASSUME_NONNULL_END |