Ejemplo n.º 1
0
        BaseResponse <Badge> IBadges.GetRecentlyAwardedBadges(BadgeFilters filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Badges, "recipients")
                      .WithFilter(filters)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Badge> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 2
0
        BaseResponse <Badge> IBadges.GetAllTaggedBadges(BadgeFilters filters, string inName)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Badges, "tags")
                      .WithFilter(filters, inName)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Badge> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 3
0
        BaseResponse <Post> IPosts.GetAllPosts(PostFilter filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Posts)
                      .WithFilter(filters)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Post> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 4
0
        BaseResponse <Badge> IBadges.GetNonTaggedBadges(List <string> ids, BadgeFilters filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Badges, "name")
                      .WithFilter(filters)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Badge> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 5
0
        BaseResponse <Question> IAnswers.GetQuestionByAnswerIds(List <string> ids, AnswerFilters filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Answers)
                      .WithFilter(filters)
                      .WithIds(ids)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Question> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 6
0
        BaseResponse <Answer> IAnswers.GetAllAnswers(AnswerFilters filters)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Answers)
                      .WithFilter(filters)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Answer> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 7
0
        BaseResponse <Question> IQuestions.GetFeaturedQuestions(QuestionFilters filters)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Questions, "featured")
                      .WithFilter(filters)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Question> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 8
0
        BaseResponse <Comment> IQuestions.GetCommentsByQuestionIds(List <string> ids, QuestionFilters filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Questions)
                      .WithFilter(filters)
                      .WithIds(ids)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Comment> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 9
0
        BaseResponse <Post> IPosts.GetSuggestedEdits(List <string> ids, SuggestedEditFilter filters)
        {
            var url = ApiUrlBuilder.Initialize(_apiKey)
                      .ForClient(ClientType.Posts)
                      .WithFilter(filters)
                      .WithIds(ids, "suggested-edits")
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Post> >().ValidateApiResponse();

            return(response);
        }
        BaseResponse <SuggestedEdits> ISuggestedEdits.GetAllSuggestedEdits(SuggestedEditFilter filters)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Suggested_Edits)
                      .WithFilter(filters)
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <SuggestedEdits> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 11
0
        BaseResponse <Badge> IBadges.GetAllBadges(BadgeFilters filters, string inName)
        {
            MakeSure.ArgumentNotNullOrEmptyString(inName, nameof(inName));
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Badges)
                      .WithFilter(filters, inName)
                      .GetApiUrl();
            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Badge> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 12
0
        BaseResponse <Tags> ITags.GetRelatedTags(List <string> tags)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Tags)
                      .WithIds(tags, "related")
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Tags> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 13
0
        BaseResponse <Question> ITags.GetFrequentlyAskedQuestions(List <string> tags)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Tags)
                      .WithIds(tags, "faq")
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Question> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 14
0
        BaseResponse <TagSynonym> ITags.GetAllTagSynonyms(TagFilter filter)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Tags, "synonyms")
                      .WithFilter(filter)
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <TagSynonym> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 15
0
        BaseResponse <TagScore> ITags.GetTopAskers(string tag, string period)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Tags)
                      .WithTagAndPeriod(tag, $"top-askers/{period}")
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <TagScore> >().ValidateApiResponse();

            return(response);
        }
Ejemplo n.º 16
0
        BaseResponse <Tags> ITags.GetTagsByNames(List <string> tags, TagFilter filter)
        {
            var url = ApiUrlBuilder
                      .Initialize(_apiKey)
                      .ForClient(ClientType.Tags)
                      .WithFilter(filter)
                      .WithIds(tags, "info")
                      .GetApiUrl();

            var response = _httpClient.GetAsync(url).Result.ReadAsJsonAsync <Data <Tags> >().ValidateApiResponse();

            return(response);
        }