Example #1
0
        /// <summary>
        /// Gets the users permission status by calling the Facebook graph API.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="accessToken">The access token.</param>
        /// <returns>The users permission status is in the following format { { "permissionName", "granted|declined" } }.</returns>
        public virtual PermissionsStatus GetUserPermissionsStatus(string userId, string accessToken)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId");
            }

            if (accessToken == null)
            {
                throw new ArgumentNullException("accessToken");
            }

            FacebookClient client = _config.ClientProvider.CreateClient();

            client.AccessToken = accessToken;

            IList <IDictionary <string, string> > rawPermissionsStatus = client.GetCurrentUserPermissionsStatus();
            PermissionsStatus permissionsStatus = new PermissionsStatus(rawPermissionsStatus);

            return(permissionsStatus);
        }