Beispiel #1
0
        public static List <Schemas.Rest.@event> GetEvents(this Facebook facebook, string userId, string[] eventIds, int?startTime, int?endTime, RsvpStatus?rsvpStatus, IDictionary <string, string> parameters)
        {
            if (parameters == null)
            {
                parameters = new Dictionary <string, string>();
            }

            if (!string.IsNullOrEmpty(userId))
            {
                parameters.Add("uid", userId);
            }

            var eids = FacebookUtils.ToCommaSeperatedValues(eventIds);

            if (!string.IsNullOrEmpty(eids))
            {
                parameters.Add("eids", eids);
            }

            if (startTime != null)
            {
                parameters.Add("start_time", startTime.Value.ToString());
            }

            if (endTime != null)
            {
                parameters.Add("end_time", endTime.Value.ToString());
            }

            if (rsvpStatus != null)
            {
                parameters.Add("rsvp_status", FacebookUtils.ToString(rsvpStatus.Value));
            }

            var result = facebook.GetUsingRestApi("events.get", parameters);

            return(result.Equals("{}", StringComparison.OrdinalIgnoreCase)
                       ? new List <Schemas.Rest.@event>()
                       : FacebookUtils.DeserializeObject <List <Schemas.Rest.@event> >(result));
        }