示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }