{"action":"created","comment":{"url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/comments/94068351","pull_request_review_id":14598314,"id":94068351,"diff_hunk":"@@ -0,0 +1,332 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Web;\n+using System.Net.Http;\n+using System.Net;\n+using Newtonsoft.Json;\n+using BibliographicSystem.Models;\n+using System.Linq;\n+\n+namespace BibliographicSystem.SearchingMethods\n+{\n+    /// <summary>\n+    /// class for parsing get requests from MicrosoftAcademic\n+    /// </summary>\n+    public class MicrosoftAcademicParser\n+    {\n+        public MicrosoftAcademicParser(UserQuery userQuery)\n+        {\n+            this.userQuery = userQuery;\n+            response = new Response();\n+        }\n+\n+        /// <summary>\n+        /// a class for storing precise user request\n+        /// </summary>\n+        public class UserQuery\n+        {\n+            public string MainInput { get; set; }\n+            public string Authors { get; set; }\n+            public string Year { get; set; }\n+            public string Count { get; set; }\n+        }\n+\n+        /// <summary>\n+        /// returns list of articles\n+        /// </summary>\n+        /// <returns></returns>\n+        public List<CommonArticle> GetSearchResult()\n+        {\n+            var listOfArticles = new List<CommonArticle>();\n+            var expressions = GetListOfExpr();\n+            var count = (userQuery.Count == \"\"? \"10\" : userQuery.Count);\n+            foreach (var expression in expressions)\n+            {\n+                count = (Convert.ToInt32(count) - listOfArticles.Count).ToString();\n+                var responseStatusCode = MakeGetRequest(expression, count);\n+\n+                if (responseStatusCode == HttpStatusCode.OK)\n+                {\n+                    listOfArticles.AddRange(response.entities.Select(CopyData));\n+                }\n+                \n+                if (listOfArticles.Count.ToString() == userQuery.Count)\n+                {\n+                    break;\n+                }\n+            }\n+            \n+            return listOfArticles;\n+        }\n+\n+        /// <summary>\n+        /// makes get request to Microsoft Academic and returns response status code\n+        /// </summary>\n+        /// <param name=\"expression\">valid query string</param>\n+        /// <param name=\"count\">the number of articles, that the user wants to see</param>\n+        private HttpStatusCode MakeGetRequest(string expression, string count)\n+        {\n+            var client = new HttpClient();\n+            var queryString = HttpUtility.ParseQueryString(string.Empty);\n+\n+            // Request headers\n+            client.DefaultRequestHeaders.Add(\"Ocp-Apim-Subscription-Key\", \"a89fcc82bd8049738b2f76c667f0f52c\");\n+\n+            // Request parameters\n+            queryString[\"expr\"] = expression;\n+            queryString[\"model\"] = \"latest\";\n+            queryString[\"count\"] = count;\n+            queryString[\"offset\"] = \"0\";\n+            queryString[\"orderby\"] = \"\";\n+            queryString[\"attributes\"] = \"Ti,Y,AA.AuN,AA.AuId,CC,E\";\n+            var uri = \"https://api.projectoxford.ai/academic/v1.0/evaluate?\" + queryString;\n+\n+            var response = client.GetAsync(uri).Result;","path":"BibliographicSystem/SearchingMethods/MicrosoftAcademicParser.cs","position":84,"original_position":84,"commit_id":"f82baef0d489641dafbf881cae5f9f400a609459","original_commit_id":"f82baef0d489641dafbf881cae5f9f400a609459","user":{"login":"Ivan-Nebogatikov","id":15431898,"avatar_url":"https://avatars.githubusercontent.com/u/15431898?v=3","gravatar_id":"","url":"https://api.github.com/users/Ivan-Nebogatikov","html_url":"https://github.com/Ivan-Nebogatikov","followers_url":"https://api.github.com/users/Ivan-Nebogatikov/followers","following_url":"https://api.github.com/users/Ivan-Nebogatikov/following{/other_user}","gists_url":"https://api.github.com/users/Ivan-Nebogatikov/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivan-Nebogatikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivan-Nebogatikov/subscriptions","organizations_url":"https://api.github.com/users/Ivan-Nebogatikov/orgs","repos_url":"https://api.github.com/users/Ivan-Nebogatikov/repos","events_url":"https://api.github.com/users/Ivan-Nebogatikov/events{/privacy}","received_events_url":"https://api.github.com/users/Ivan-Nebogatikov/received_events","type":"User","site_admin":false},"body":"Уже есть поле с именем response","created_at":"2016-12-28T19:27:02Z","updated_at":"2016-12-28T19:39:58Z","html_url":"https://github.com/yurii-litvinov/Biblio2015/pull/23#discussion_r94068351","pull_request_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/comments/94068351"},"html":{"href":"https://github.com/yurii-litvinov/Biblio2015/pull/23#discussion_r94068351"},"pull_request":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23","id":99582456,"html_url":"https://github.com/yurii-litvinov/Biblio2015/pull/23","diff_url":"https://github.com/yurii-litvinov/Biblio2015/pull/23.diff","patch_url":"https://github.com/yurii-litvinov/Biblio2015/pull/23.patch","issue_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/23","number":23,"state":"open","locked":false,"title":"Search engines association","user":{"login":"amanenkova","id":15183830,"avatar_url":"https://avatars.githubusercontent.com/u/15183830?v=3","gravatar_id":"","url":"https://api.github.com/users/amanenkova","html_url":"https://github.com/amanenkova","followers_url":"https://api.github.com/users/amanenkova/followers","following_url":"https://api.github.com/users/amanenkova/following{/other_user}","gists_url":"https://api.github.com/users/amanenkova/gists{/gist_id}","starred_url":"https://api.github.com/users/amanenkova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amanenkova/subscriptions","organizations_url":"https://api.github.com/users/amanenkova/orgs","repos_url":"https://api.github.com/users/amanenkova/repos","events_url":"https://api.github.com/users/amanenkova/events{/privacy}","received_events_url":"https://api.github.com/users/amanenkova/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-28T19:09:38Z","updated_at":"2016-12-28T19:39:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3fb00738ec85841da1b66d21549ad637055855de","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23/commits","review_comments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23/comments","review_comment_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/23/comments","statuses_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/statuses/f82baef0d489641dafbf881cae5f9f400a609459","head":{"label":"yurii-litvinov:SearchEnginesAssociation","ref":"SearchEnginesAssociation","sha":"f82baef0d489641dafbf881cae5f9f400a609459","user":{"login":"yurii-litvinov","id":706768,"avatar_url":"https://avatars.githubusercontent.com/u/706768?v=3","gravatar_id":"","url":"https://api.github.com/users/yurii-litvinov","html_url":"https://github.com/yurii-litvinov","followers_url":"https://api.github.com/users/yurii-litvinov/followers","following_url":"https://api.github.com/users/yurii-litvinov/following{/other_user}","gists_url":"https://api.github.com/users/yurii-litvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/yurii-litvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurii-litvinov/subscriptions","organizations_url":"https://api.github.com/users/yurii-litvinov/orgs","repos_url":"https://api.github.com/users/yurii-litvinov/repos","events_url":"https://api.github.com/users/yurii-litvinov/events{/privacy}","received_events_url":"https://api.github.com/users/yurii-litvinov/received_events","type":"User","site_admin":false},"repo":{"id":70928979,"name":"Biblio2015","full_name":"yurii-litvinov/Biblio2015","owner":{"login":"yurii-litvinov","id":706768,"avatar_url":"https://avatars.githubusercontent.com/u/706768?v=3","gravatar_id":"","url":"https://api.github.com/users/yurii-litvinov","html_url":"https://github.com/yurii-litvinov","followers_url":"https://api.github.com/users/yurii-litvinov/followers","following_url":"https://api.github.com/users/yurii-litvinov/following{/other_user}","gists_url":"https://api.github.com/users/yurii-litvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/yurii-litvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurii-litvinov/subscriptions","organizations_url":"https://api.github.com/users/yurii-litvinov/orgs","repos_url":"https://api.github.com/users/yurii-litvinov/repos","events_url":"https://api.github.com/users/yurii-litvinov/events{/privacy}","received_events_url":"https://api.github.com/users/yurii-litvinov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yurii-litvinov/Biblio2015","description":null,"fork":true,"url":"https://api.github.com/repos/yurii-litvinov/Biblio2015","forks_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/forks","keys_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/teams","hooks_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/hooks","issue_events_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/events{/number}","events_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/events","assignees_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/assignees{/user}","branches_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/branches{/branch}","tags_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/tags","blobs_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/statuses/{sha}","languages_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/languages","stargazers_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/stargazers","contributors_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/contributors","subscribers_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/subscribers","subscription_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/subscription","commits_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/contents/{+path}","compare_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/merges","archive_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/downloads","issues_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues{/number}","pulls_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls{/number}","milestones_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/milestones{/number}","notifications_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/labels{/name}","releases_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/releases{/id}","deployments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/deployments","created_at":"2016-10-14T16:42:23Z","updated_at":"2016-11-13T12:12:41Z","pushed_at":"2016-12-28T19:09:39Z","git_url":"git://github.com/yurii-litvinov/Biblio2015.git","ssh_url":"git@github.com:yurii-litvinov/Biblio2015.git","clone_url":"https://github.com/yurii-litvinov/Biblio2015.git","svn_url":"https://github.com/yurii-litvinov/Biblio2015","homepage":null,"size":23320,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"yurii-litvinov:master","ref":"master","sha":"6d056a92eea8eb31fa3dd9fcf9e27db6349faa26","user":{"login":"yurii-litvinov","id":706768,"avatar_url":"https://avatars.githubusercontent.com/u/706768?v=3","gravatar_id":"","url":"https://api.github.com/users/yurii-litvinov","html_url":"https://github.com/yurii-litvinov","followers_url":"https://api.github.com/users/yurii-litvinov/followers","following_url":"https://api.github.com/users/yurii-litvinov/following{/other_user}","gists_url":"https://api.github.com/users/yurii-litvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/yurii-litvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurii-litvinov/subscriptions","organizations_url":"https://api.github.com/users/yurii-litvinov/orgs","repos_url":"https://api.github.com/users/yurii-litvinov/repos","events_url":"https://api.github.com/users/yurii-litvinov/events{/privacy}","received_events_url":"https://api.github.com/users/yurii-litvinov/received_events","type":"User","site_admin":false},"repo":{"id":70928979,"name":"Biblio2015","full_name":"yurii-litvinov/Biblio2015","owner":{"login":"yurii-litvinov","id":706768,"avatar_url":"https://avatars.githubusercontent.com/u/706768?v=3","gravatar_id":"","url":"https://api.github.com/users/yurii-litvinov","html_url":"https://github.com/yurii-litvinov","followers_url":"https://api.github.com/users/yurii-litvinov/followers","following_url":"https://api.github.com/users/yurii-litvinov/following{/other_user}","gists_url":"https://api.github.com/users/yurii-litvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/yurii-litvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurii-litvinov/subscriptions","organizations_url":"https://api.github.com/users/yurii-litvinov/orgs","repos_url":"https://api.github.com/users/yurii-litvinov/repos","events_url":"https://api.github.com/users/yurii-litvinov/events{/privacy}","received_events_url":"https://api.github.com/users/yurii-litvinov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yurii-litvinov/Biblio2015","description":null,"fork":true,"url":"https://api.github.com/repos/yurii-litvinov/Biblio2015","forks_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/forks","keys_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/teams","hooks_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/hooks","issue_events_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/events{/number}","events_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/events","assignees_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/assignees{/user}","branches_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/branches{/branch}","tags_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/tags","blobs_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/statuses/{sha}","languages_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/languages","stargazers_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/stargazers","contributors_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/contributors","subscribers_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/subscribers","subscription_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/subscription","commits_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/contents/{+path}","compare_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/merges","archive_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/downloads","issues_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues{/number}","pulls_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls{/number}","milestones_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/milestones{/number}","notifications_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/labels{/name}","releases_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/releases{/id}","deployments_url":"https://api.github.com/repos/yurii-litvinov/Biblio2015/deployments","created_at":"2016-10-14T16:42:23Z","updated_at":"2016-11-13T12:12:41Z","pushed_at":"2016-12-28T19:09:39Z","git_url":"git://github.com/yurii-litvinov/Biblio2015.git","ssh_url":"git@github.com:yurii-litvinov/Biblio2015.git","clone_url":"https://github.com/yurii-litvinov/Biblio2015.git","svn_url":"https://github.com/yurii-litvinov/Biblio2015","homepage":null,"size":23320,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23"},"html":{"href":"https://github.com/yurii-litvinov/Biblio2015/pull/23"},"issue":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/23"},"comments":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/yurii-litvinov/Biblio2015/statuses/f82baef0d489641dafbf881cae5f9f400a609459"}}}}
{"actor":{"display_login":"Ivan-Nebogatikov"}}