private bool GrantApiAccess(string apiKeyGrantedAccess, List <string> method_arr, bool isAsync, GrantApiAccessCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.permissions.grantApiAccess" } }; Utilities.AddRequiredParameter(parameterList, "permissions_apikey", apiKeyGrantedAccess); Utilities.AddJSONArray(parameterList, "method_arr", method_arr); if (isAsync) { SendRequestAsync <permissions_grantApiAccess_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state); return(true); } var response = SendRequest <permissions_grantApiAccess_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? true : response.TypedValue); }
private bool GrantApiAccess(string apiKeyGrantedAccess, List<string> method_arr, bool isAsync, GrantApiAccessCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.permissions.grantApiAccess" } }; Utilities.AddRequiredParameter(parameterList, "permissions_apikey", apiKeyGrantedAccess); Utilities.AddJSONArray(parameterList, "method_arr", method_arr); if (isAsync) { SendRequestAsync<permissions_grantApiAccess_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<permissions_grantApiAccess_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// This method gives another application access to certain API calls on behalf of the application calling it. The application granted access is specified by permissions_apikey. Which methods or namespaces can be called are specified in method_arr. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// api.Session.UserId = Constants.UserId; /// var method_arr = new List<string> { "admin" }; /// api.Permissions.GrantApiAccessAsync(Constants.WebApplicationKey2, method_arr, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="apiKeyGrantedAccess">The API key for the application that is being granted access.</param> /// <param name="method_arr">JSON array of methods and/or namespaces for which the access is granted. If this is not specified, access to all allowed methods is granted.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>The method returns a bool value indicating whether the call succeeded or failed. </returns> /// <remarks>The only namespace that can be granted access at this time is admin. </remarks> public bool GrantApiAccessAsync(string apiKeyGrantedAccess, List <string> method_arr, GrantApiAccessCallback callback, Object state) { return(GrantApiAccess(apiKeyGrantedAccess, method_arr, true, callback, state)); }
/// <summary> /// This method gives another application access to certain API calls on behalf of the application calling it. The application granted access is specified by permissions_apikey. Which methods or namespaces can be called are specified in method_arr. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// api.Session.UserId = Constants.UserId; /// var method_arr = new List<string> { "admin" }; /// api.Permissions.GrantApiAccessAsync(Constants.WebApplicationKey2, method_arr, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="apiKeyGrantedAccess">The API key for the application that is being granted access.</param> /// <param name="method_arr">JSON array of methods and/or namespaces for which the access is granted. If this is not specified, access to all allowed methods is granted.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>The method returns a bool value indicating whether the call succeeded or failed. </returns> /// <remarks>The only namespace that can be granted access at this time is admin. </remarks> public bool GrantApiAccessAsync(string apiKeyGrantedAccess, List<string> method_arr, GrantApiAccessCallback callback, Object state) { return GrantApiAccess(apiKeyGrantedAccess, method_arr, true, callback, state); }