1. lfoust
  2. stacky

Source

stacky / trunk / source / Stacky.Net35 / StackyClient / BadgeMethods.cs

lfoust 846c496 












lfoust 8bb745b 
lfoust 846c496 
lfoust 9611966 
lfoust 8bb745b 
lfoust 846c496 

lfoust 1494705 
lfoust 846c496 
lfoust 1494705 
lfoust 015ba47 

lfoust 1494705 
lfoust 015ba47 
lfoust 1494705 
lfoust 846c496 

lfoust 1494705 
lfoust 846c496 
lfoust 1494705 
lfoust 015ba47 

lfoust 1494705 
lfoust 015ba47 
lfoust 8bb745b 
lfoust 846c496 
lfoust 9611966 
lfoust 015ba47 

lfoust 73ab0e3 

lfoust 846c496 
lfoust 8bb745b 
lfoust 846c496 






using System.Collections.Generic;

namespace Stacky
{
    public partial class StackyClient
    {
        public virtual IEnumerable<Badge> GetBadges()
        {
            return GetBadges("badges", null);
        }

        private IEnumerable<Badge> GetBadges(string method, string[] urlArguments)
        {
            return MakeRequest<Badge>(method, urlArguments, new
            {
                site = this.SiteUrlName
            }).Items;
        }

        public virtual IEnumerable<User> GetUsersByBadge(int badgeId)
        {
            return GetUsersByBadge(badgeId, new BadgeByUserOptions());
        }

        public virtual IEnumerable<User> GetUsersByBadge(int badgeId, BadgeByUserOptions options)
        {
            return GetUsersByBadge(badgeId.ToArray(), options);
        }

        public virtual IPagedList<User> GetUsersByBadge(IEnumerable<int> badgeIds)
        {
            return GetUsersByBadge(badgeIds, new BadgeByUserOptions());
        }

        public virtual IPagedList<User> GetUsersByBadge(IEnumerable<int> badgeIds, BadgeByUserOptions options)
        {
            var response = MakeRequest<User>("badges", new string[] { badgeIds.Vectorize() }, new
            {
                site = this.SiteUrlName,
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                fromdate = GetDateValue(options.FromDate),
                todate = GetDateValue(options.ToDate),
            });
            return new PagedList<User>(response);
        }

        public virtual IEnumerable<Badge> GetTagBasedBadges()
        {
            return GetBadges("badges", new string[] { "tags" });
        }
    }
}