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 |
|
|
23 |
/*! |
|
24 |
@typedef |
|
25 |
|
|
26 |
@abstract Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error. |
|
27 |
*/ |
|
28 |
typedef void (^FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)(NSArray *tokens, NSError *error) ; |
|
29 |
|
|
30 |
/*! |
|
31 |
@typedef |
|
32 |
|
|
33 |
@abstract Callback block for removing a test user. |
|
34 |
*/ |
|
35 |
typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ; |
|
36 |
|
|
37 |
|
|
38 |
/*! |
|
39 |
@class FBSDKTestUsersManager |
|
40 |
@abstract Provides methods for managing test accounts for testing Facebook integration. |
|
41 |
|
|
42 |
@discussion Facebook allows developers to create test accounts for testing their applications' |
|
43 |
Facebook integration (see https://developers.facebook.com/docs/test_users/). This class |
|
44 |
simplifies use of these accounts for writing tests. It is not designed for use in |
|
45 |
production application code. |
|
46 |
|
|
47 |
This class will make Graph API calls on behalf of your app to manage test accounts and requires |
|
48 |
an app id and app secret. You will typically use this class to write unit or integration tests. |
|
49 |
Make sure you NEVER include your app secret in your production app. |
|
50 |
*/ |
|
51 |
@interface FBSDKTestUsersManager : NSObject |
|
52 |
|
|
53 |
/*! |
|
54 |
@abstract construct or return the shared instance |
|
55 |
@param appID the Facebook app id |
|
56 |
@param appSecret the Facebook app secret |
|
57 |
*/ |
|
58 |
+ (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; |
|
59 |
|
|
60 |
/*! |
|
61 |
@abstract retrieve FBSDKAccessToken instances for test accounts with the specific permissions. |
|
62 |
@param arraysOfPermissions an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] |
|
63 |
if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets |
|
64 |
if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] |
|
65 |
for fetching a single test user. |
|
66 |
@param createIfNotFound if YES, new test accounts are created if no test accounts existed that fit the permissions |
|
67 |
requirement |
|
68 |
@param handler the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. |
|
69 |
If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. |
|
70 |
|
|
71 |
@discussion If you are requesting test accounts with differing number of permissions, try to order |
|
72 |
`arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new |
|
73 |
test accounts. |
|
74 |
*/ |
|
75 |
- (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions |
|
76 |
createIfNotFound:(BOOL)createIfNotFound |
|
77 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
78 |
|
|
79 |
/*! |
|
80 |
@abstract add a test account with the specified permissions |
|
81 |
@param permissions the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] |
|
82 |
@param handler the callback handler |
|
83 |
*/ |
|
84 |
- (void)addTestAccountWithPermissions:(NSSet *)permissions |
|
85 |
completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; |
|
86 |
|
|
87 |
/*! |
|
88 |
@abstract remove a test account for the given user id |
|
89 |
@param userId the user id |
|
90 |
@param handler the callback handler |
|
91 |
*/ |
|
92 |
- (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; |
|
93 |
|
|
94 |
/*! |
|
95 |
@abstract Make two test users friends with each other. |
|
96 |
@param first the token of the first user |
|
97 |
@param second the token of the second user |
|
98 |
@param callback the callback handler |
|
99 |
*/ |
|
100 |
- (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; |
|
101 |
|
|
102 |
@end |