Beispiel #1
0
        public void createEditDeleteTest()
        {
            var parent = _api;
            var target = parent.events;
            var event_info = new facebookevent { description = "event description",
                end_date = System.DateTime.Now.AddDays(7),
                event_subtype = "subtype",
                event_type = "type",
                location = "chicago",
                start_date = System.DateTime.Now.AddDays(1),
                name = "create event test" };
            var actual = target.create(event_info);
            Assert.IsTrue(actual > 0);

            event_info.name = "edited name";
            var e = target.edit(actual, event_info);
            Assert.IsTrue(e);
            var c = target.cancel(actual, "test cancel");
            Assert.IsTrue(c);
        }
Beispiel #2
0
        /// <summary>
        /// Create an event - You must pass the following parameters in the event_info array: 
        ///name 
        ///category 
        ///subcategory 
        ///location 
        ///start_time 
        ///end_time 
        ///Note: The start_time and end_time are the times that were input by the event creator, converted to UTC after assuming that they were in Pacific time (Daylight Savings or Standard, depending on the date of the event), then converted into Unix epoch time. 
        ///
        ///Optionally, you can pass the following parameters in the event_info array: 
        ///    
        ///street 
        ///phone 
        ///email 
        ///host_id 
        ///host 
        ///desc 
        ///privacy_type 
        ///tagline 
        /// </summary>
        /// <param name="event_info">key value pairs describin the event.</param>
        /// <returns>The eid of the created event</returns> 
        public long create(facebookevent event_info)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.events.create" } };
            var dict = new Dictionary<string,string>
            {
                {"description", event_info.description},
                {"end_time", event_info.end_time.ToString()},
                {"category", event_info.event_type},
                {"subcategory", event_info.event_subtype},
                {"host", event_info.host},
                {"location", event_info.location},
                {"name", event_info.name},
                {"start_time", event_info.start_time.ToString()},
                {"tagline", event_info.tagline}
            };
            _api.AddJSONAssociativeArray(parameterList, "event_info", dict);

            var response = _api.SendRequest(parameterList);
            return !string.IsNullOrEmpty(response) ? events_create_response.Parse(response).TypedValue : 0;
        }