示例#1
0
        private int GetAllocation(IntegrationPointName name, bool isAsync, GetAllocationCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.admin.getAllocation" }
            };

            Utilities.AddRequiredParameter(parameterList, "integration_point_name", name.ToString());

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

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

            return(response == null ? default(int) : response.TypedValue);
        }
        private int GetAllocation(IntegrationPointName name, bool isAsync, GetAllocationCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> {{"method", "facebook.admin.getAllocation"}};
            Utilities.AddRequiredParameter(parameterList, "integration_point_name", name.ToString());

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

            var response = SendRequest<admin_getAllocation_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? default(int) : response.TypedValue;
        }
示例#3
0
 /// <summary>
 /// Returns the current allocation limit for your application for the specified integration point.
 /// </summary>
 /// <example>
 /// <code>
 /// private void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Admin.GetAllocationAsync(Admin.IntegrationPointName.requests_per_day, AsyncDemoCompleted, null);
 /// }
 ///
 /// private void AsyncDemoCompleted(int result, Object state, FacebookException e)
 /// {
 ///     int actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="name">Integration point name on which the allocation limit is requested</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 the allocation limit for your application for the specified integration point.</returns>
 public void GetAllocationAsync(IntegrationPointName name, GetAllocationCallback callback, Object state)
 {
     GetAllocation(name, true, callback, state);
 }
 /// <summary>
 /// Returns the current allocation limit for your application for the specified integration point.
 /// </summary>
 /// <example>
 /// <code>
 /// private void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Admin.GetAllocationAsync(Admin.IntegrationPointName.requests_per_day, AsyncDemoCompleted, null);
 /// }
 /// 
 /// private void AsyncDemoCompleted(int result, Object state, FacebookException e)
 /// {
 ///     int actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="name">Integration point name on which the allocation limit is requested</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 the allocation limit for your application for the specified integration point.</returns>
 public void GetAllocationAsync(IntegrationPointName name, GetAllocationCallback callback, Object state)
 {
     GetAllocation(name, true, callback, state);
 }