Beispiel #1
0
 public GetInfoArrayCache(Func <UInt32> getLengthCallback, GetInfoCallback <TName> createCallback, IntPtr handle, TName name)
 {
     _getLengthCallback = getLengthCallback;
     _createCallback    = createCallback;
     _handle            = handle;
     _name = name;
 }
Beispiel #2
0
    // Funcao
    public void GetInfo(string facebookId, GetInfoCallback callback)
    {
        if (FacebookAPIReady())
        {
            // Se o usuario solicitado for o proprio e nao existir token
            // fazer o "giro" do Facebook
            if (facebookId == USER_ME && !HasToken())
            {
                // Cacheia conexão e tenta novamente apos o "giro"
                GetFB().Login(
                    new FacebookAPIManager.GenerateState(facebookId, callback),
                    GetFB().HandleState
                    );

                // Enviar erro para o callback
                Debug.LogWarning(EMPTY_TOKEN);
                if (callback != null)
                {
                    callback(EMPTY_TOKEN, facebookId, null, null, null);
                }
                return;
            }

            // Caso contrario, fazer a conexão
            GetFB().StartCoroutine(
                GetFB().GetInfo(facebookId, callback)
                );
        }
    }
Beispiel #3
0
        private user_info GetInfo(long uid, bool isAsync, GetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.profile.getInfo" }
            };

            Utilities.AddRequiredParameter(parameterList, "uid", uid);

            if (isAsync)
            {
                SendRequestAsync(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <profile_getInfo_response>(callback), state);
                return(null);
            }

            return(SendRequest <profile_getInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)));
        }
 /// <summary>
 /// Returns all visible pages to the filters specified.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     List&lt;string&gt; fields = api.Pages.GetFields();
 ///     List&lt;long&gt; pageIds = new List&lt;long&gt; { Constants.PageId };
 ///     api.Pages.GetInfoAsync(fields, pageIds, Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;page&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="fields">List of desired fields in return.</param>
 /// <param name="page_ids">List of page IDs.</param>
 /// <param name="uid">The ID of the user. Defaults to the logged in user if the session_key is valid, and no page_ids are passed. Used to get the pages a given user is a fan of.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>The page info elements returned are those visible to the Facebook Platform.</returns>
 public void GetInfoAsync(List<string> fields, List<long> page_ids, long? uid, GetInfoCallback callback, Object state)
 {
     GetInfo(fields, page_ids, uid, true, callback, state);
 }
Beispiel #5
0
        private IList <page> GetInfo(List <string> fields, List <long> page_ids, long?uid, bool isAsync, GetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.pages.getInfo" }
            };

            Utilities.AddList(parameterList, "fields", fields);
            Utilities.AddList(parameterList, "page_ids", page_ids);
            Utilities.AddOptionalParameter(parameterList, "uid", uid);

            if (isAsync)
            {
                SendRequestAsync <pages_getInfo_response, IList <page> >(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <IList <page> >(callback), state, "page");
                return(null);
            }

            var response = SendRequest <pages_getInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? null : response.page);
        }
Beispiel #6
0
 /// <summary>
 /// Returns all visible pages to the filters specified.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     List&lt;string&gt; fields = api.Pages.GetFields();
 ///     List&lt;long&gt; pageIds = new List&lt;long&gt; { Constants.PageId };
 ///     api.Pages.GetInfoAsync(fields, pageIds, Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;page&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="fields">List of desired fields in return.</param>
 /// <param name="page_ids">List of page IDs.</param>
 /// <param name="uid">The ID of the user. Defaults to the logged in user if the session_key is valid, and no page_ids are passed. Used to get the pages a given user is a fan of.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>The page info elements returned are those visible to the Facebook Platform.</returns>
 public void GetInfoAsync(List <string> fields, List <long> page_ids, long?uid, GetInfoCallback callback, Object state)
 {
     GetInfo(fields, page_ids, uid, true, callback, state);
 }
Beispiel #7
0
	public void GetInfo(GetInfoCallback callback)
	{
        GetInfo(USER_ME, callback);
    }
Beispiel #8
0
    // Funcao
	public void GetInfo(string facebookId, GetInfoCallback callback)
    {
		if (FacebookAPIReady())
        {
            // Se o usuario solicitado for o proprio e nao existir token
            // fazer o "giro" do Facebook
			if (facebookId == USER_ME && !HasToken())
            {
                // Cacheia conexão e tenta novamente apos o "giro"
				GetFB().Login(
                    new FacebookAPIManager.GenerateState(facebookId, callback),
                    GetFB().HandleState
                );

                // Enviar erro para o callback
				Debug.LogWarning(EMPTY_TOKEN);
				if (callback != null)
					callback(EMPTY_TOKEN, facebookId, null, null, null);
				return;
            }

            // Caso contrario, fazer a conexão
			GetFB().StartCoroutine(
				GetFB().GetInfo(facebookId, callback)
			);
		}
	}
 /// <summary>
 /// Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Users.GetInfoAsync(Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;user&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="uid">A user ID.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method will return an empty result element.</returns>
 public void GetInfoAsync(long uid, GetInfoCallback callback, Object state)
 {
     GetInfoAsync(uid.ToString(), callback, state);
 }
Beispiel #10
0
 public void GetInfo(GetInfoCallback callback)
 {
     GetInfo(USER_ME, callback);
 }
        private IList<user> GetInfo(string uids, bool isAsync, GetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.users.getInfo" } };
            Utilities.AddOptionalParameter(parameterList, "uids", uids);
            if (string.IsNullOrEmpty(Session.SessionKey))
            {
                Utilities.AddRequiredParameter(parameterList, "fields",
                                  "first_name, last_name, name, pic_square, affiliations, locale");
            }
            else
            {
                Utilities.AddRequiredParameter(parameterList, "fields",
                                  "uid, about_me, activities, affiliations, birthday, books, current_location, education_history, email_hashes, first_name, hometown_location, hs_info, interests, is_app_user, last_name, locale, meeting_for, meeting_sex, movies, music, name, notes_count, pic, pic_with_logo, pic_big, pic_big_with_logo, pic_small, pic_small_with_logo, pic_square, pic_square_with_logo, political, profile_blurb, profile_update_time, profile_url, proxied_email, quotes, relationship_status, religion, sex, significant_other_id, status, timezone, tv, wall_count, work_history");
            }

            if (isAsync)
            {
                SendRequestAsync<users_getInfo_response, IList<user>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<user>>(callback), state, "user");
                return null;
            }

            var response = SendRequest<users_getInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? null : response.user;
        }
 /// <summary>
 /// Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     string uids = "658517591,824555570"; 
 ///     api.Users.GetInfoAsync(uids, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;user&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="uids">A comma-separated list of user IDs.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method will return an empty result element.</returns>
 public void GetInfoAsync(string uids, GetInfoCallback callback, Object state)
 {
     GetInfo(uids, true, callback, state);
 }
 /// <summary>
 /// Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     var uids = new List&lt;long&gt; { 658517591, 824555570 }; 
 ///     api.Users.GetInfoAsync(AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;user&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="uids">This is a List of user IDs.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method will return an empty result element.</returns>
 public void GetInfoAsync(List<long> uids, GetInfoCallback callback, Object state)
 {
     GetInfo(StringHelper.ConvertToCommaSeparated(uids), true, callback, state);
 }
        private IList<page> GetInfo(List<string> fields, List<long> page_ids, long? uid, bool isAsync, GetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.pages.getInfo" } };
            Utilities.AddList(parameterList, "fields", fields);
            Utilities.AddList(parameterList, "page_ids", page_ids);
            Utilities.AddOptionalParameter(parameterList, "uid", uid);

            if (isAsync)
            {
                SendRequestAsync<pages_getInfo_response, IList<page>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<page>>(callback), state, "page");
                return null;
            }

            var response = SendRequest<pages_getInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? null : response.page;
        }
Beispiel #15
0
 /// <summary>
 /// Returns the specified user's application info section for the calling application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret));
 ///     api.Session.UserId = Constants.UserId;
 ///     api.Profile.GetInfoAsync(Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(user_info result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="uid">The user ID of the user who added the application info section.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>This method returns a user_info object for the specified uid.</returns>
 public void GetInfoAsync(long uid, GetInfoCallback callback, Object state)
 {
     GetInfo(uid, true, callback, state);
 }
Beispiel #16
0
 public GetInfoStructCache(GetInfoCallback <TName> createCallback, IntPtr handle, TName name)
 {
     _createCallback = createCallback;
     _handle         = handle;
     _name           = name;
 }
 /// <summary>
 /// Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Users.GetInfoAsync(AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;user&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method will return an empty result element.</returns>
 public void GetInfoAsync(GetInfoCallback callback, Object state)
 {
     GetInfoAsync(Session.UserId, callback, state);
 }