Exemplo n.º 1
0
        //.getAll
        public Groups vimeo_groups_getAll(string user_id, ChannelsSortMethods sortMethod=ChannelsSortMethods.Default, int? page=null, int? per_page=null)
        {
            var parameters = new Dictionary<string, string>();
            if (!string.IsNullOrEmpty(user_id)) parameters.Add("user_id", user_id);
            if (sortMethod != ChannelsSortMethods.Default)
                parameters.Add("sort",
                    sortMethod == ChannelsSortMethods.Newest ? "newest" :
                    sortMethod == ChannelsSortMethods.Oldest ? "oldest" :
                    sortMethod == ChannelsSortMethods.Alphabetical ? "alphabetical" :
                    sortMethod == ChannelsSortMethods.MostVideos ? "most_videos" :
                    sortMethod == ChannelsSortMethods.MostSubscribed ? "most_subscribed" :
                    sortMethod == ChannelsSortMethods.MostRecentlyUpdated ? "most_recently_updated" : "");

            if (page.HasValue) parameters.Add("page", page.Value.ToString());
            if (per_page.HasValue) parameters.Add("per_page", per_page.Value.ToString());

            var x = ExecuteGetRequest("vimeo.groups.getAll", parameters);
            if (!IsResponseOK(x)) return null;
            return Groups.FromElement(x.Element("rsp").Element("groups"));
        }
Exemplo n.º 2
0
        //.getMembers
        public Contacts vimeo_groups_getMembers(string group_id, ChannelsSortMethods sortMethod=ChannelsSortMethods.Default, int? page=null, int? per_page=null)
        {
            var parameters = new Dictionary<string, string> { { "group_id", group_id } };
            if (page.HasValue) parameters.Add("page", page.Value.ToString());
            if (per_page.HasValue) parameters.Add("per_page", per_page.Value.ToString());
            var x = ExecuteGetRequest("vimeo.groups.getMembers", parameters);
            if (!IsResponseOK(x)) return null;

            var e = x.Element("rsp").Element("members");
            Contacts cs = new Contacts();
            cs.on_this_page = int.Parse(e.Attribute("on_this_page").Value);
            cs.page = int.Parse(e.Attribute("page").Value);
            cs.perpage = int.Parse(e.Attribute("perpage").Value);
            cs.total = int.Parse(e.Attribute("total").Value);

            foreach (var item in e.Elements("member"))
            {
                cs.Add(Contact.FromElement(item));
            }
            return cs;
        }
        //.getModerated
        public Channels vimeo_channels_getModerated(string user_id, ChannelsSortMethods sortMethod=ChannelsSortMethods.Default, int? page=null, int? per_page=null)
        {
            var parameters = new Dictionary<string, string>
            {{"user_id", user_id}};
            if (sortMethod != ChannelsSortMethods.Default)
                parameters.Add("sort",
                    sortMethod == ChannelsSortMethods.Newest ? "newest" :
                    sortMethod == ChannelsSortMethods.Oldest ? "oldest" :
                    sortMethod == ChannelsSortMethods.Alphabetical ? "alphabetical" :
                    sortMethod == ChannelsSortMethods.MostVideos ? "most_videos" :
                    sortMethod == ChannelsSortMethods.MostSubscribed ? "most_subscribed" :
                    sortMethod == ChannelsSortMethods.MostRecentlyUpdated ? "most_recently_updated" : "");

            if (page.HasValue) parameters.Add("page", page.Value.ToString());
            if (per_page.HasValue) parameters.Add("per_page", per_page.Value.ToString());
            var x = ExecuteGetRequest("vimeo.channels.getModerated", parameters);
            return !IsResponseOK(x) ? null : Channels.FromElement(x.Element("rsp").Element("channels"));
        }