Example #1
0
 /// <summary>
 /// Returns the current allocation limits for your application for the specified integration points. Allocation limits are determined daily.
 /// </summary>
 /// <returns>The requested allocation</returns>
 public int getAllocation(IntegrationPointName name)
 {
     var parameterList = new Dictionary<string, string> {{"method", "facebook.admin.getAllocation"}};
     _api.AddRequiredParameter(parameterList, "integration_point_name", name.ToString());
     var response = _api.SendRequest(parameterList);
     return !string.IsNullOrEmpty(response) ? admin_getAllocation_response.Parse(response).TypedValue : 0;
 }
Example #2
0
        /// <summary>
        /// Returns the current allocation limits for your application for the specified integration points. Allocation limits are determined daily.
        /// </summary>
        /// <returns>The requested allocation</returns>
        public int getAllocation(IntegrationPointName name)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.admin.getAllocation" }
            };

            _api.AddRequiredParameter(parameterList, "integration_point_name", name.ToString());
            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? admin_getAllocation_response.Parse(response).TypedValue : 0);
        }
Example #3
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);
        }
Example #4
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);
 }
Example #5
0
 /// <summary>
 /// Returns the current allocation limit for your application for the specified integration point.
 /// </summary>
 /// <example>
 /// <code>
 /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey));
 /// int requests = api.Admin.GetAllocation(Admin.IntegrationPointName.requests_per_day);
 /// </code>
 /// </example>
 /// <param name="name">Integration point name on which the allocation limit is requested</param>
 /// <returns>This method returns the allocation limit for your application for the specified integration point.</returns>
 public int GetAllocation(IntegrationPointName name)
 {
     return(GetAllocation(name, false, null, null));
 }
        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;
        }
 /// <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>
 /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey));
 /// int requests = api.Admin.GetAllocation(Admin.IntegrationPointName.requests_per_day);
 /// </code>
 /// </example>
 /// <param name="name">Integration point name on which the allocation limit is requested</param>
 /// <returns>This method returns the allocation limit for your application for the specified integration point.</returns>
 public int GetAllocation(IntegrationPointName name)
 {
     return GetAllocation(name, false, null, null);
 }