예제 #1
0
 public static Guid GetAssociationId(int userID, StackSite site)
 {
     var stackAuthClient = new StackAuthClient(new UrlClient(), new JsonProtocol());
     var sites = stackAuthClient.GetSites();
     var siteClient = new StackyClient(version, apiKey, sites.Where(s => s.Name == site.Name).Single(), new UrlClient(), new JsonProtocol());
     var associationId = siteClient.GetUser(userID).AssociationId;
     return associationId;
 }
예제 #2
0
 public IEnumerable<Stacky.Question> GetQuestions(Stacky.Site site, string[] tags)
 {
     var siteClient = new StackyClient("1.0", "", site, new UrlClient(), new JsonProtocol());
     QuestionOptions qo = new QuestionOptions();
     qo.IncludeBody = true;
     qo.Max = 1000;
     qo.Tags = tags;
     return siteClient.GetQuestions(qo);
 }
예제 #3
0
 public IEnumerable<Stacky.Question> GetQuestions(string site)
 {
     Stacky.Site apiSite = GetSiteByName(site);
     var siteClient = new StackyClient("1.0", "", apiSite, new UrlClient(), new JsonProtocol());
     QuestionOptions qo = new QuestionOptions();
     qo.IncludeBody = true;
     qo.Max = 1000;
     return siteClient.GetQuestions(qo);
 }
예제 #4
0
        private static IEnumerable<Site> GetSites()
        {
            var stackAuthClient = new StackAuthClient(new UrlClient(), new JsonProtocol());
            var sites = stackAuthClient.GetSites().Where(s => s.State != SiteState.Linked_Meta);
            var siteCreation = new Dictionary<DateTime, Site>();
            foreach (var site in sites) {
                var siteClient = new StackyClient(cfg.Default.ApiVersion, cfg.Default.ApiKey, site, new UrlClient(), new JsonProtocol());
                var user = siteClient.GetUser(-1);
                siteCreation.Add(user.CreationDate, site);
            }
            sites = siteCreation.OrderBy(s => s.Key).Select(s => s.Value);

            return sites;
        }
예제 #5
0
        public MainPage()
        {
            InitializeComponent();

            StackyClient client = new StackyClient("0.9", "", Sites.StackOverflow, new UrlClient(), new JsonProtocol());
            client.GetUsers(users =>
            {
                DataContext = new MainPageViewModel(users);
                //MessageBox.Show(String.Format("There are {0} total users", users.TotalItems));
            }, error =>
            {
                MessageBox.Show(error.Message);
            });
        }
예제 #6
0
 public static BadgeCounts GetBadgeCounts(Site site, int userId)
 {
     var client = new StackyClient(cfg.AppSettings["ApiVersion"], cfg.AppSettings["ApiKey"], site, new UrlClient(), new JsonProtocol());
     var siteUser = client.GetUser(userId);
     return siteUser.BadgeCounts;
 }
		void SetSite(Site value)
		{
			m_site = value;
			m_client = new StackyClient("1.0", "P2aPrA4wOEiskh8pVm1UKg", m_site, new UrlClient(), new JsonProtocol());
		}