/// <summary> /// Checks whether the user has opted in to an extended application permission. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Users.HasAppPermissionAsync(Enums.ExtendedPermissions.email, Constants.UserId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="ext_perm">String identifier for the extended permission that is being checked for. Must be one of email, read_stream, publish_stream, offline_access, status_update, photo_upload, {create_event, rsvp_event, sms, video_upload, create_note, share_item.</param> /// <param name="uid">The user ID of the user whose permissions you are checking. If this parameter is not specified, then it defaults to the session user. Note: This parameter applies only to Web applications. Facebook ignores this parameter if it is passed by a desktop application.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns true or false.</returns> public void HasAppPermissionAsync(Enums.ExtendedPermissions ext_perm, long uid, HasAppPermissionCallback callback, Object state) { HasAppPermission(ext_perm, uid, true, callback, state); }
private bool HasAppPermission(Enums.ExtendedPermissions ext_perm, long uid, bool isAsync, HasAppPermissionCallback callback, Object state) { var parameterList = new Dictionary<string, string> { {"method", "facebook.users.hasAppPermission"}, {"ext_perm", ext_perm.ToString()} }; Utilities.AddOptionalParameter(parameterList, "uid", uid); if (isAsync) { SendRequestAsync<users_hasAppPermission_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return false; } var response = SendRequest<users_hasAppPermission_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Checks whether the user has opted in to an extended application permission. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Users.HasAppPermissionAsync(Enums.ExtendedPermissions.email, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="ext_perm">String identifier for the extended permission that is being checked for. Must be one of email, read_stream, publish_stream, offline_access, status_update, photo_upload, {create_event, rsvp_event, sms, video_upload, create_note, share_item.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns true or false.</returns> public void HasAppPermissionAsync(Enums.ExtendedPermissions ext_perm, HasAppPermissionCallback callback, Object state) { HasAppPermissionAsync(ext_perm, 0, callback, state); }