-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPF_Twitter.h
More file actions
83 lines (63 loc) · 2.42 KB
/
PF_Twitter.h
File metadata and controls
83 lines (63 loc) · 2.42 KB
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
73
74
75
76
77
78
79
80
81
82
83
//
// PF_Twitter.h
//
// Copyright 2011-present Parse Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Parse/PFNullability.h>
PF_ASSUME_NONNULL_BEGIN
@class BFTask;
/*!
The `PF_Twitter` class is a simple interface for interacting with the Twitter REST API,
automating sign-in and OAuth signing of requests against the API.
*/
@interface PF_Twitter : NSObject
/*!
@abstract Consumer key of the application that is used to authorize with Twitter.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *consumerKey;
/*!
@abstract Consumer secret of the application that is used to authorize with Twitter.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *consumerSecret;
/*!
@abstract Auth token for the current user.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *authToken;
/*!
@abstract Auth token secret for the current user.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *authTokenSecret;
/*!
@abstract Twitter user id of the currently signed in user.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *userId;
/*!
@abstract Twitter screen name of the currently signed in user.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy) NSString *screenName;
/*!
@abstract Displays an auth dialog and populates the authToken, authTokenSecret, userId, and screenName properties
if the Twitter user grants permission to the application.
@returns The task, that encapsulates the work being done.
*/
- (BFTask *)authorizeInBackground;
/*!
@abstract Displays an auth dialog and populates the authToken, authTokenSecret, userId, and screenName properties
if the Twitter user grants permission to the application.
@param success Invoked upon successful authorization.
@param failure Invoked upon an error occurring in the authorization process.
@param cancel Invoked when the user cancels authorization.
*/
- (void)authorizeWithSuccess:(PF_NULLABLE void (^)(void))success
failure:(PF_NULLABLE void (^)(NSError *PF_NULLABLE_S error))failure
cancel:(PF_NULLABLE void (^)(void))cancel;
/*!
@abstract Adds a 3-legged OAuth signature to an `NSMutableURLRequest` based
upon the properties set for the Twitter object.
@discussion Use this function to sign requests being made to the Twitter API.
@param request Request to sign.
*/
- (void)signRequest:(PF_NULLABLE NSMutableURLRequest *)request;
@end
PF_ASSUME_NONNULL_END