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 |
|
9febd9
|
51 |
/** |
W |
52 |
construct or return the shared instance |
|
53 |
- Parameter appID: the Facebook app id |
|
54 |
- Parameter appSecret: the Facebook app secret |
bad748
|
55 |
*/ |
W |
56 |
+ (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; |
|
57 |
|
9febd9
|
58 |
/** |
W |
59 |
retrieve FBSDKAccessToken instances for test accounts with the specific permissions. |
|
60 |
- Parameter arraysOfPermissions: an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] |
bad748
|
61 |
if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets |
W |
62 |
if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] |
|
63 |
for fetching a single test user. |
9febd9
|
64 |
- Parameter createIfNotFound: if YES, new test accounts are created if no test accounts existed that fit the permissions |
bad748
|
65 |
requirement |
9febd9
|
66 |
- Parameter handler: the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. |
bad748
|
67 |
If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. |
W |
68 |
|
9febd9
|
69 |
|
W |
70 |
If you are requesting test accounts with differing number of permissions, try to order |
bad748
|
71 |
`arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new |
W |
72 |
test accounts. |
|
73 |
*/ |
|
74 |
- (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions |
|
75 |
createIfNotFound:(BOOL)createIfNotFound |
|
76 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
77 |
|
9febd9
|
78 |
/** |
W |
79 |
add a test account with the specified permissions |
|
80 |
- Parameter permissions: the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] |
|
81 |
- Parameter handler: the callback handler |
bad748
|
82 |
*/ |
W |
83 |
- (void)addTestAccountWithPermissions:(NSSet *)permissions |
|
84 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
85 |
|
9febd9
|
86 |
/** |
W |
87 |
remove a test account for the given user id |
|
88 |
- Parameter userId: the user id |
|
89 |
- Parameter handler: the callback handler |
bad748
|
90 |
*/ |
W |
91 |
- (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; |
|
92 |
|
9febd9
|
93 |
/** |
W |
94 |
Make two test users friends with each other. |
|
95 |
- Parameter first: the token of the first user |
|
96 |
- Parameter second: the token of the second user |
|
97 |
- Parameter callback: the callback handler |
bad748
|
98 |
*/ |
W |
99 |
- (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; |
|
100 |
|
|
101 |
@end |