Exemple #1
0
        /// <summary>
        /// Enumerates all groups.
        /// </summary>
        public static List <Group> Enumerate()
        {
            var response = Server.Send(
                Server.group_url,
                null,
                "GET",
                null
                );

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                return(ParsedJson.ParseArray(reader.ReadToEnd()).ConvertAll(g => new Group(g)));
            }

            throw new Exception(Server.UnexpectedStatus(response.StatusCode));
        }
Exemple #2
0
        /// <summary>
        /// Enumerate events in which you participate.
        /// </summary>
        public static List <Event> Enumerate(UserSession session = null)
        {
            // Assume current session by default
            session = session ?? Server.FallbackToCurrentSession;

            var response = Server.Send(
                Server.event_url,
                session.token,
                "GET",
                null
                );

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                return(ParsedJson.ParseArray(reader.ReadToEnd()).ConvertAll(e => new Event(e)));
            }

            throw new Exception(Server.UnexpectedStatus(response.StatusCode));
        }