{"action":"created","comment":{"url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/comments/89589178","pull_request_review_id":10133778,"id":89589178,"diff_hunk":"@@ -0,0 +1,144 @@\n+﻿using RestSharp;\n+using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Text;\n+using System.Threading.Tasks;\n+using Greg.Requests;\n+using Greg.Responses;\n+using System.Net;\n+using System.IO;\n+using Greg.Utility;\n+using Newtonsoft.Json;\n+\n+namespace Greg\n+{\n+    /// <summary>\n+    /// Package Manager REST Client for ACG API\n+    /// </summary>\n+    public class PackageManagerClient : IGregClient\n+    {\n+        private const string AFC_CODE = \"DY1ON1\";\n+        private readonly RestClient _client;\n+        private readonly RestClient _fileClient;\n+\n+        public string BaseUrl { get { return _client.BaseUrl.ToString(); } }\n+\n+        public readonly IAuthProvider _authProvider;\n+        public IAuthProvider AuthProvider\n+        {\n+            get { return _authProvider; }\n+        }\n+\n+        public PackageManagerClient(IAuthProvider provider, string packageManagerUrl, string fileStorageUrl)\n+        {\n+            _authProvider = provider;\n+            _client = new RestClient(packageManagerUrl);\n+            _fileClient = new RestClient(fileStorageUrl);\n+        }\n+\n+        /// <summary>\n+        /// For GET request we need to pass AFC(Affiliation Code) in request header.\n+        /// For all other request and Member requests we need to pass additional X-Session in request header. \n+        /// If reuest is for upload file _flieClient is used, as URL for ACG API and File Upload server are different.\n+        /// </summary>\n+        /// <param name=\"m\"></param>\n+        /// <returns></returns>\n+        private IRestResponse ExecuteInternal(Request m)\n+        {\n+            var req = new RestRequest(m.Path, m.HttpMethod);\n+\n+            m.Build(ref req);\n+\n+\n+            if (m.HttpMethod == Method.GET && !m.Path.Contains(\"members\"))\n+                SignRequest(req);\n+            else\n+                AuthProvider.SignRequest(ref req, _client);\n+\n+            if (((PackageManagerRequest)(m)).fileRequest)","path":"src/GregClient/PackageManagerClient.cs","position":65,"original_position":59,"commit_id":"c80ac44a18876d9eb75154c6d860c13e91c46e61","original_commit_id":"a64ff92450dab9a07dd7816d11a25043cc933ec8","user":{"login":"sharadkjaiswal","id":1754137,"avatar_url":"https://avatars.githubusercontent.com/u/1754137?v=3","gravatar_id":"","url":"https://api.github.com/users/sharadkjaiswal","html_url":"https://github.com/sharadkjaiswal","followers_url":"https://api.github.com/users/sharadkjaiswal/followers","following_url":"https://api.github.com/users/sharadkjaiswal/following{/other_user}","gists_url":"https://api.github.com/users/sharadkjaiswal/gists{/gist_id}","starred_url":"https://api.github.com/users/sharadkjaiswal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharadkjaiswal/subscriptions","organizations_url":"https://api.github.com/users/sharadkjaiswal/orgs","repos_url":"https://api.github.com/users/sharadkjaiswal/repos","events_url":"https://api.github.com/users/sharadkjaiswal/events{/privacy}","received_events_url":"https://api.github.com/users/sharadkjaiswal/received_events","type":"User","site_admin":false},"body":"This casting is not needed when input type will be PacakgeManagerRequest.","created_at":"2016-11-25T09:47:12Z","updated_at":"2016-11-25T09:47:12Z","html_url":"https://github.com/DynamoDS/PackageManagerClient/pull/15#discussion_r89589178","pull_request_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/comments/89589178"},"html":{"href":"https://github.com/DynamoDS/PackageManagerClient/pull/15#discussion_r89589178"},"pull_request":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15","id":95213228,"html_url":"https://github.com/DynamoDS/PackageManagerClient/pull/15","diff_url":"https://github.com/DynamoDS/PackageManagerClient/pull/15.diff","patch_url":"https://github.com/DynamoDS/PackageManagerClient/pull/15.patch","issue_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/15","number":15,"state":"open","locked":false,"title":"Added new client for ACG API","user":{"login":"jitnev","id":17825191,"avatar_url":"https://avatars.githubusercontent.com/u/17825191?v=3","gravatar_id":"","url":"https://api.github.com/users/jitnev","html_url":"https://github.com/jitnev","followers_url":"https://api.github.com/users/jitnev/followers","following_url":"https://api.github.com/users/jitnev/following{/other_user}","gists_url":"https://api.github.com/users/jitnev/gists{/gist_id}","starred_url":"https://api.github.com/users/jitnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitnev/subscriptions","organizations_url":"https://api.github.com/users/jitnev/orgs","repos_url":"https://api.github.com/users/jitnev/repos","events_url":"https://api.github.com/users/jitnev/events{/privacy}","received_events_url":"https://api.github.com/users/jitnev/received_events","type":"User","site_admin":false},"body":"Purpose:\r\n\r\nNew PackageManagerClient added to existing GregClient project.\r\n\r\n-New PackageManagerClient is REST client for ACG API.\r\n-It has only one Request type which returns the dynamic type in response.\r\n\r\nReviewers\r\n\r\n@sharadkjaiswal","created_at":"2016-11-24T17:31:37Z","updated_at":"2016-11-25T09:47:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a407de9eb0fdb1d07e735708824685a72cfaf00a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15/commits","review_comments_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15/comments","review_comment_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/15/comments","statuses_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/statuses/c80ac44a18876d9eb75154c6d860c13e91c46e61","head":{"label":"jitnev:PackageManagerClient","ref":"PackageManagerClient","sha":"c80ac44a18876d9eb75154c6d860c13e91c46e61","user":{"login":"jitnev","id":17825191,"avatar_url":"https://avatars.githubusercontent.com/u/17825191?v=3","gravatar_id":"","url":"https://api.github.com/users/jitnev","html_url":"https://github.com/jitnev","followers_url":"https://api.github.com/users/jitnev/followers","following_url":"https://api.github.com/users/jitnev/following{/other_user}","gists_url":"https://api.github.com/users/jitnev/gists{/gist_id}","starred_url":"https://api.github.com/users/jitnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitnev/subscriptions","organizations_url":"https://api.github.com/users/jitnev/orgs","repos_url":"https://api.github.com/users/jitnev/repos","events_url":"https://api.github.com/users/jitnev/events{/privacy}","received_events_url":"https://api.github.com/users/jitnev/received_events","type":"User","site_admin":false},"repo":{"id":74554892,"name":"PackageManagerClient","full_name":"jitnev/PackageManagerClient","owner":{"login":"jitnev","id":17825191,"avatar_url":"https://avatars.githubusercontent.com/u/17825191?v=3","gravatar_id":"","url":"https://api.github.com/users/jitnev","html_url":"https://github.com/jitnev","followers_url":"https://api.github.com/users/jitnev/followers","following_url":"https://api.github.com/users/jitnev/following{/other_user}","gists_url":"https://api.github.com/users/jitnev/gists{/gist_id}","starred_url":"https://api.github.com/users/jitnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitnev/subscriptions","organizations_url":"https://api.github.com/users/jitnev/orgs","repos_url":"https://api.github.com/users/jitnev/repos","events_url":"https://api.github.com/users/jitnev/events{/privacy}","received_events_url":"https://api.github.com/users/jitnev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jitnev/PackageManagerClient","description":".Net Client for Package Manager for Dynamo Visual Programming","fork":true,"url":"https://api.github.com/repos/jitnev/PackageManagerClient","forks_url":"https://api.github.com/repos/jitnev/PackageManagerClient/forks","keys_url":"https://api.github.com/repos/jitnev/PackageManagerClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jitnev/PackageManagerClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jitnev/PackageManagerClient/teams","hooks_url":"https://api.github.com/repos/jitnev/PackageManagerClient/hooks","issue_events_url":"https://api.github.com/repos/jitnev/PackageManagerClient/issues/events{/number}","events_url":"https://api.github.com/repos/jitnev/PackageManagerClient/events","assignees_url":"https://api.github.com/repos/jitnev/PackageManagerClient/assignees{/user}","branches_url":"https://api.github.com/repos/jitnev/PackageManagerClient/branches{/branch}","tags_url":"https://api.github.com/repos/jitnev/PackageManagerClient/tags","blobs_url":"https://api.github.com/repos/jitnev/PackageManagerClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jitnev/PackageManagerClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jitnev/PackageManagerClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/jitnev/PackageManagerClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jitnev/PackageManagerClient/statuses/{sha}","languages_url":"https://api.github.com/repos/jitnev/PackageManagerClient/languages","stargazers_url":"https://api.github.com/repos/jitnev/PackageManagerClient/stargazers","contributors_url":"https://api.github.com/repos/jitnev/PackageManagerClient/contributors","subscribers_url":"https://api.github.com/repos/jitnev/PackageManagerClient/subscribers","subscription_url":"https://api.github.com/repos/jitnev/PackageManagerClient/subscription","commits_url":"https://api.github.com/repos/jitnev/PackageManagerClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/jitnev/PackageManagerClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/jitnev/PackageManagerClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/jitnev/PackageManagerClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/jitnev/PackageManagerClient/contents/{+path}","compare_url":"https://api.github.com/repos/jitnev/PackageManagerClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jitnev/PackageManagerClient/merges","archive_url":"https://api.github.com/repos/jitnev/PackageManagerClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jitnev/PackageManagerClient/downloads","issues_url":"https://api.github.com/repos/jitnev/PackageManagerClient/issues{/number}","pulls_url":"https://api.github.com/repos/jitnev/PackageManagerClient/pulls{/number}","milestones_url":"https://api.github.com/repos/jitnev/PackageManagerClient/milestones{/number}","notifications_url":"https://api.github.com/repos/jitnev/PackageManagerClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jitnev/PackageManagerClient/labels{/name}","releases_url":"https://api.github.com/repos/jitnev/PackageManagerClient/releases{/id}","deployments_url":"https://api.github.com/repos/jitnev/PackageManagerClient/deployments","created_at":"2016-11-23T08:10:06Z","updated_at":"2016-11-23T08:10:08Z","pushed_at":"2016-11-25T08:59:42Z","git_url":"git://github.com/jitnev/PackageManagerClient.git","ssh_url":"git@github.com:jitnev/PackageManagerClient.git","clone_url":"https://github.com/jitnev/PackageManagerClient.git","svn_url":"https://github.com/jitnev/PackageManagerClient","homepage":"http://www.dynamopackages.com","size":6307,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DynamoDS:master","ref":"master","sha":"be959303b2cf92288e467b7cea3f342449375762","user":{"login":"DynamoDS","id":6528209,"avatar_url":"https://avatars.githubusercontent.com/u/6528209?v=3","gravatar_id":"","url":"https://api.github.com/users/DynamoDS","html_url":"https://github.com/DynamoDS","followers_url":"https://api.github.com/users/DynamoDS/followers","following_url":"https://api.github.com/users/DynamoDS/following{/other_user}","gists_url":"https://api.github.com/users/DynamoDS/gists{/gist_id}","starred_url":"https://api.github.com/users/DynamoDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DynamoDS/subscriptions","organizations_url":"https://api.github.com/users/DynamoDS/orgs","repos_url":"https://api.github.com/users/DynamoDS/repos","events_url":"https://api.github.com/users/DynamoDS/events{/privacy}","received_events_url":"https://api.github.com/users/DynamoDS/received_events","type":"Organization","site_admin":false},"repo":{"id":12445853,"name":"PackageManagerClient","full_name":"DynamoDS/PackageManagerClient","owner":{"login":"DynamoDS","id":6528209,"avatar_url":"https://avatars.githubusercontent.com/u/6528209?v=3","gravatar_id":"","url":"https://api.github.com/users/DynamoDS","html_url":"https://github.com/DynamoDS","followers_url":"https://api.github.com/users/DynamoDS/followers","following_url":"https://api.github.com/users/DynamoDS/following{/other_user}","gists_url":"https://api.github.com/users/DynamoDS/gists{/gist_id}","starred_url":"https://api.github.com/users/DynamoDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DynamoDS/subscriptions","organizations_url":"https://api.github.com/users/DynamoDS/orgs","repos_url":"https://api.github.com/users/DynamoDS/repos","events_url":"https://api.github.com/users/DynamoDS/events{/privacy}","received_events_url":"https://api.github.com/users/DynamoDS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DynamoDS/PackageManagerClient","description":".Net Client for Package Manager for Dynamo Visual Programming","fork":false,"url":"https://api.github.com/repos/DynamoDS/PackageManagerClient","forks_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/forks","keys_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/teams","hooks_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/hooks","issue_events_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/events{/number}","events_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/events","assignees_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/assignees{/user}","branches_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/branches{/branch}","tags_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/tags","blobs_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/statuses/{sha}","languages_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/languages","stargazers_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/stargazers","contributors_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/contributors","subscribers_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/subscribers","subscription_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/subscription","commits_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/contents/{+path}","compare_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/merges","archive_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/downloads","issues_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues{/number}","pulls_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls{/number}","milestones_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/milestones{/number}","notifications_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/labels{/name}","releases_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/releases{/id}","deployments_url":"https://api.github.com/repos/DynamoDS/PackageManagerClient/deployments","created_at":"2013-08-28T22:16:55Z","updated_at":"2016-04-21T22:42:35Z","pushed_at":"2016-11-25T08:59:42Z","git_url":"git://github.com/DynamoDS/PackageManagerClient.git","ssh_url":"git@github.com:DynamoDS/PackageManagerClient.git","clone_url":"https://github.com/DynamoDS/PackageManagerClient.git","svn_url":"https://github.com/DynamoDS/PackageManagerClient","homepage":"http://www.dynamopackages.com","size":6297,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15"},"html":{"href":"https://github.com/DynamoDS/PackageManagerClient/pull/15"},"issue":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/15"},"comments":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/DynamoDS/PackageManagerClient/statuses/c80ac44a18876d9eb75154c6d860c13e91c46e61"}}}}
{"actor":{"display_login":"sharadkjaiswal"}}