コード例 #1
0
ファイル: WikiNavigation.cs プロジェクト: blopeznet/pepper
        public async Task <NavigationResultSet> NavigationLinks()
        {
            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _navigationLinks);
            var json       = await _wikiaHttpClient.Get(requestUrl);

            return(JsonHelper.Deserialize <NavigationResultSet>(json));
        }
コード例 #2
0
        public async Task <WikiDataContainer> WikiVariables()
        {
            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _wikiVariablesUrl);
            var json       = await _wikiaHttpClient.Get(requestUrl);

            return(JsonHelper.Deserialize <WikiDataContainer>(json));
        }
コード例 #3
0
ファイル: WikiActivity.cs プロジェクト: blopeznet/pepper
        public async Task <ActivityResponseResult> Activity(ActivityRequestParameters requestParameters, ActivityEndpoint endpoint)
        {
            if (requestParameters == null)
            {
                throw new ArgumentNullException(nameof(requestParameters));
            }

            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, Endpoints[endpoint]);
            var parameters = GetParameters(requestParameters);
            var json       = await _wikiaHttpClient.Get(requestUrl, parameters);

            return(JsonHelper.Deserialize <ActivityResponseResult>(json));
        }
コード例 #4
0
ファイル: WikiSearch.cs プロジェクト: fablecode/wikia
        public async Task <LocalWikiSearchResultSet> SearchList(SearchListRequestParameter requestParameters)
        {
            if (requestParameters == null)
            {
                throw new ArgumentNullException(nameof(requestParameters));
            }

            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _searchList);
            var parameters = GetSearchListParameters(requestParameters);
            var json       = await _wikiaHttpClient.Get(requestUrl, parameters);

            return(JsonHelper.Deserialize <LocalWikiSearchResultSet>(json));
        }
コード例 #5
0
        public async Task <SearchSuggestionsPhrases> SuggestedPhrases(string query)
        {
            if (string.IsNullOrWhiteSpace(query))
            {
                throw new ArgumentException("Search suggestion query required.", nameof(query));
            }

            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _searchSuggestionsList);
            var parameters = new Dictionary <string, string> {
                ["query"] = query
            };
            var json = await _wikiaHttpClient.Get(requestUrl, parameters);

            return(JsonHelper.Deserialize <SearchSuggestionsPhrases>(json));
        }
コード例 #6
0
        public async Task <RelatedPages> Articles(RelatedArticlesRequestParameters requestParameters)
        {
            if (requestParameters == null)
            {
                throw new ArgumentNullException(nameof(requestParameters));
            }

            if (requestParameters.Ids == null || !requestParameters.Ids.Any())
            {
                throw new ArgumentException("Article Id(s) required.", nameof(requestParameters.Ids));
            }

            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _relatedPages);
            var parameters = GetArticlesParameters(requestParameters);
            var json       = await _wikiaHttpClient.Get(requestUrl, parameters);

            return(JsonHelper.Deserialize <RelatedPages>(json));
        }
コード例 #7
0
        public async Task <UserResultSet> Details(UserRequestParameters requestParameters)
        {
            if (requestParameters == null)
            {
                throw new ArgumentNullException(nameof(requestParameters));
            }

            if (requestParameters.Ids == null || !requestParameters.Ids.Any())
            {
                throw new ArgumentException("User Ids are required.", nameof(requestParameters.Ids));
            }

            if (requestParameters.Ids.Count > 100)
            {
                throw new ArgumentException("Maximum size of id list is 100", nameof(requestParameters.Ids));
            }

            var requestUrl = UrlHelper.GenerateApiUrl(_wikiApiUrl, _user);
            var parameters = GetDetailsParameters(requestParameters);
            var json       = await _wikiaHttpClient.Get(requestUrl, parameters);

            return(JsonHelper.Deserialize <UserResultSet>(json));
        }
コード例 #8
0
ファイル: WikiArticle.cs プロジェクト: fablecode/wikia
 private async Task <string> WebClient(string requestUrl, IDictionary <string, string> parameters)
 {
     return(await _wikiaHttpClient.Get(requestUrl, parameters));
 }