internal void ResolveProfileImageUrl(string id, FbProfileImageSize size, Action <string> callback)
        {
            var request = new FbRequestBuilder($"/{id}?fields=picture.type({size.ToString().ToLower()})");

            Fb.API(request.RequestString, HttpMethod.GET,
                   graphResult =>
            {
                var result = new FbGetProfileImageUrlResult(graphResult);
                callback.Invoke(result.Url);
            });
        }
        internal void GetLoggedInUserInfo(Action <FbGetUserResult> callback)
        {
            var request = new FbRequestBuilder("/me?fields=id,name,first_name,last_name,email,gender,birthday,age_range,location,picture");

            Fb.API(request.RequestString, HttpMethod.GET,
                   graphResult =>
            {
                var result = new FbGetUserResult(graphResult);
                callback.Invoke(result);
            });
        }
        /// <summary>
        /// This edge allows you to:
        /// get the User's friends who have installed the app making the query
        /// get the User's total number of friends (including those who have not installed the app making the query)
        /// <para>Requires  <b>"user_friends" </b> permission
        /// <see href="https://developers.facebook.com/docs/graph-api/reference/user/friends"/> for information </para>
        /// </summary>
        /// <param name="limit">Result limit </param>
        /// <param name="callback">Request callback </param>
        /// <param name="fbCursor">Pagination cursor pointer </param>
        public void GetFriends(int limit, Action <FbGraphFriendsListResult> callback, FbCursor fbCursor = null)
        {
            var request = new FbRequestBuilder("/me?fields=friends");

            request.AddLimit(limit);
            request.AddCommand("fields", "first_name,id,last_name,name,link,locale,picture");
            request.AddCursor(fbCursor);

            Fb.API(request.RequestString, HttpMethod.GET,
                   graphResult =>
            {
                var result = new FbGraphFriendsListResult(graphResult);
                callback.Invoke(result);
            });
        }
        /// <summary>
        /// This is conflict free method
        /// (it can be executed from several places in the code and will only result in on facebook login request but all parties will get the result).
        ///
        /// The method will call combination of Init and Login methods.
        /// </summary>
        /// <param name="requestPublishPermissions">Use `true` if login request should be with publish permissions.</param>
        /// <param name="callback">Operation callback.</param>
        ///
        public static void ConfirmLoginStatus(bool requestPublishPermissions, Action <FbLoginUtilResult> callback)
        {
            s_Callbacks.Add(callback);
            if (Fb.IsLoggedIn)
            {
                if (!requestPublishPermissions || s_RequestPublishPermissions)
                {
                    DispatchLoginSucceeded();
                    return;
                }
            }

            if (s_WaitingLoginResult)
            {
                return;
            }

            s_WaitingLoginResult        = true;
            s_RequestPublishPermissions = requestPublishPermissions;
            if (Fb.IsInitialized)
            {
                OnInitCompleted();
            }
            else
            {
                Fb.Init(() =>
                {
                    if (Fb.IsInitialized)
                    {
                        OnInitCompleted();
                    }
                    else
                    {
                        DispatchLoginFailed();
                    }
                });
            }
        }
 static void OnInitCompleted()
 {
     if (Fb.IsLoggedIn)
     {
         DispatchLoginSucceeded();
     }
     else
     {
         if (s_RequestPublishPermissions)
         {
             Fb.Login(s_RequestPublishPermissions, result =>
             {
                 if (result.IsSucceeded)
                 {
                     DispatchLoginSucceeded();
                 }
                 else
                 {
                     DispatchLoginFailed();
                 }
             });
         }
     }
 }