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; }
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); }
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); }
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; }
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); }); }
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()); }