commit | author | age
|
bad748
|
1 |
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
W |
2 |
// |
|
3 |
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, |
|
4 |
// copy, modify, and distribute this software in source code or binary form for use |
|
5 |
// in connection with the web services and APIs provided by Facebook. |
|
6 |
// |
|
7 |
// As with any software that integrates with the Facebook platform, your use of |
|
8 |
// this software is subject to the Facebook Developer Principles and Policies |
|
9 |
// [http://developers.facebook.com/policy/]. This copyright notice shall be |
|
10 |
// included in all copies or substantial portions of the software. |
|
11 |
// |
|
12 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
13 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
14 |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
15 |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
16 |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
17 |
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
18 |
|
|
19 |
#import <Foundation/Foundation.h> |
|
20 |
|
|
21 |
@class FBSDKAccessToken; |
|
22 |
|
9febd9
|
23 |
/** |
bad748
|
24 |
|
9febd9
|
25 |
Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error. |
bad748
|
26 |
*/ |
W |
27 |
typedef void (^FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)(NSArray *tokens, NSError *error) ; |
|
28 |
|
9febd9
|
29 |
/** |
bad748
|
30 |
|
9febd9
|
31 |
Callback block for removing a test user. |
bad748
|
32 |
*/ |
W |
33 |
typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ; |
|
34 |
|
|
35 |
|
9febd9
|
36 |
/** |
W |
37 |
Provides methods for managing test accounts for testing Facebook integration. |
bad748
|
38 |
|
9febd9
|
39 |
|
W |
40 |
Facebook allows developers to create test accounts for testing their applications' |
bad748
|
41 |
Facebook integration (see https://developers.facebook.com/docs/test_users/). This class |
W |
42 |
simplifies use of these accounts for writing tests. It is not designed for use in |
|
43 |
production application code. |
|
44 |
|
|
45 |
This class will make Graph API calls on behalf of your app to manage test accounts and requires |
|
46 |
an app id and app secret. You will typically use this class to write unit or integration tests. |
|
47 |
Make sure you NEVER include your app secret in your production app. |
|
48 |
*/ |
|
49 |
@interface FBSDKTestUsersManager : NSObject |
|
50 |
|
13e53a
|
51 |
- (instancetype)init NS_UNAVAILABLE; |
H |
52 |
+ (instancetype)new NS_UNAVAILABLE; |
|
53 |
|
9febd9
|
54 |
/** |
W |
55 |
construct or return the shared instance |
13e53a
|
56 |
@param appID the Facebook app id |
H |
57 |
@param appSecret the Facebook app secret |
bad748
|
58 |
*/ |
W |
59 |
+ (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; |
|
60 |
|
9febd9
|
61 |
/** |
W |
62 |
retrieve FBSDKAccessToken instances for test accounts with the specific permissions. |
13e53a
|
63 |
@param arraysOfPermissions an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] |
bad748
|
64 |
if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets |
W |
65 |
if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] |
|
66 |
for fetching a single test user. |
13e53a
|
67 |
@param createIfNotFound if YES, new test accounts are created if no test accounts existed that fit the permissions |
bad748
|
68 |
requirement |
13e53a
|
69 |
@param handler the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. |
bad748
|
70 |
If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. |
W |
71 |
|
9febd9
|
72 |
|
W |
73 |
If you are requesting test accounts with differing number of permissions, try to order |
bad748
|
74 |
`arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new |
W |
75 |
test accounts. |
|
76 |
*/ |
|
77 |
- (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions |
|
78 |
createIfNotFound:(BOOL)createIfNotFound |
|
79 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
80 |
|
9febd9
|
81 |
/** |
W |
82 |
add a test account with the specified permissions |
13e53a
|
83 |
@param permissions the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] |
H |
84 |
@param handler the callback handler |
bad748
|
85 |
*/ |
W |
86 |
- (void)addTestAccountWithPermissions:(NSSet *)permissions |
|
87 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
88 |
|
9febd9
|
89 |
/** |
W |
90 |
remove a test account for the given user id |
13e53a
|
91 |
@param userId the user id |
H |
92 |
@param handler the callback handler |
bad748
|
93 |
*/ |
W |
94 |
- (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; |
|
95 |
|
9febd9
|
96 |
/** |
W |
97 |
Make two test users friends with each other. |
13e53a
|
98 |
@param first the token of the first user |
H |
99 |
@param second the token of the second user |
|
100 |
@param callback the callback handler |
bad748
|
101 |
*/ |
W |
102 |
- (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; |
|
103 |
|
|
104 |
@end |