{"action":"created","comment":{"url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/comments/201626857","pull_request_review_id":136162909,"id":201626857,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTYyNjg1Nw==","diff_hunk":"@@ -0,0 +1,202 @@\n+﻿using CosmosDb.GraphAPI.Recommender.Data.Entites;\n+using Microsoft.Azure.Documents;\n+using Microsoft.Azure.Documents.Client;\n+using Microsoft.Azure.Graphs.BulkImport;\n+using Microsoft.Azure.Graphs.Elements;\n+using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Threading.Tasks;\n+\n+namespace CosmosDb.GraphAPI.Recommender\n+{\n+    public static class GraphDBHelper\n+    {\n+        public static DocumentClient CreateClient(string documentServerEndPoint, string authKey)\n+        {\n+            return new DocumentClient(\n+                serviceEndpoint: new Uri(documentServerEndPoint),\n+                authKeyOrResourceToken: authKey,\n+                connectionPolicy: new ConnectionPolicy\n+                {\n+                    ConnectionMode = ConnectionMode.Direct,\n+                    ConnectionProtocol = Protocol.Tcp\n+                });\n+        }\n+\n+        // Database\n+\n+        public static async Task<Database> CreateDatabaseAsync(DocumentClient documentClient, string databaseId)\n+        {\n+            return await documentClient.CreateDatabaseAsync(new Database { Id = databaseId });\n+        }\n+\n+        public static Database GetDatabase(DocumentClient documentClient, string databaseId)\n+        {\n+            return documentClient.CreateDatabaseQuery()\n+                .Where(db => db.Id == databaseId)\n+                .AsEnumerable()\n+                .FirstOrDefault();\n+        }\n+\n+        public static async Task DeleteDatabaseAsync(DocumentClient documentClient, Database database)\n+        {\n+            if (database != null)\n+            {\n+                await documentClient.DeleteDatabaseAsync(database.SelfLink);\n+            }\n+        }\n+\n+        // Collection\n+\n+        public static async Task<DocumentCollection> CreateCollectionAsync(DocumentClient documentClient, \n+            Database database, string collectionId, string partitionKey, int throughput, bool isPartitionedGraph)\n+        {\n+            var collection = new DocumentCollection\n+            {\n+                Id = collectionId\n+            };\n+\n+            if (isPartitionedGraph)\n+            {\n+                if (string.IsNullOrWhiteSpace(partitionKey))\n+                {\n+                    throw new ArgumentNullException(\"PartionKey can't be null for a partitioned collection\");\n+                }\n+\n+                collection.PartitionKey.Paths.Add(\"/\" + partitionKey);\n+            }\n+\n+            return await documentClient.CreateDocumentCollectionAsync(\n+                database.SelfLink,\n+                collection,\n+                new RequestOptions { OfferThroughput = throughput });\n+        }\n+\n+        public static async Task DeleteCollectionAsync(DocumentClient documentClient, DocumentCollection documentCollection)\n+        {\n+            if (documentCollection != null)\n+            {\n+                await documentClient.DeleteDocumentCollectionAsync(documentCollection.SelfLink);\n+            }\n+        }\n+\n+\n+        public static async Task<DocumentCollection> GetCollectionAsync(DocumentClient documentClient, \n+            string databaseId, string collectionId)\n+        {\n+            return await documentClient.ReadDocumentCollectionAsync(\n+                UriFactory.CreateDocumentCollectionUri(databaseId, collectionId));\n+        }\n+\n+        // \n+        \n+        public static async Task<GraphBulkImport> CreateAndInitGraphImporterAsync(DocumentClient documentClient,\n+            string databaseId, DocumentCollection collection)\n+        {\n+            var graphBulkImport = new GraphBulkImport(documentClient, collection, useFlatProperty: false);\n+            await graphBulkImport.InitializeAsync();\n+            return graphBulkImport;\n+        }\n+\n+        public static async Task<GraphBulkImportResponse> AddVerticesAsync(GraphBulkImport graphImporter, ","path":"CosmosDb.GraphAPI.Recommender/GraphDBHelper.cs","position":102,"original_position":102,"commit_id":"03d412c91ef24b48e31b161ffd09aed1db5badf9","original_commit_id":"03d412c91ef24b48e31b161ffd09aed1db5badf9","user":{"login":"FSou1","id":1132431,"node_id":"MDQ6VXNlcjExMzI0MzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1132431?v=4","gravatar_id":"","url":"https://api.github.com/users/FSou1","html_url":"https://github.com/FSou1","followers_url":"https://api.github.com/users/FSou1/followers","following_url":"https://api.github.com/users/FSou1/following{/other_user}","gists_url":"https://api.github.com/users/FSou1/gists{/gist_id}","starred_url":"https://api.github.com/users/FSou1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FSou1/subscriptions","organizations_url":"https://api.github.com/users/FSou1/orgs","repos_url":"https://api.github.com/users/FSou1/repos","events_url":"https://api.github.com/users/FSou1/events{/privacy}","received_events_url":"https://api.github.com/users/FSou1/received_events","type":"User","site_admin":false},"body":"Same","created_at":"2018-07-11T09:41:17Z","updated_at":"2018-07-11T09:47:01Z","html_url":"https://github.com/FSou1/AzureSamples/pull/2#discussion_r201626857","pull_request_url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/comments/201626857"},"html":{"href":"https://github.com/FSou1/AzureSamples/pull/2#discussion_r201626857"},"pull_request":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2","id":200486111,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNDg2MTEx","html_url":"https://github.com/FSou1/AzureSamples/pull/2","diff_url":"https://github.com/FSou1/AzureSamples/pull/2.diff","patch_url":"https://github.com/FSou1/AzureSamples/pull/2.patch","issue_url":"https://api.github.com/repos/FSou1/AzureSamples/issues/2","number":2,"state":"open","locked":false,"title":"Uploading data has been added","user":{"login":"ruslanlbondar","id":13398872,"node_id":"MDQ6VXNlcjEzMzk4ODcy","avatar_url":"https://avatars0.githubusercontent.com/u/13398872?v=4","gravatar_id":"","url":"https://api.github.com/users/ruslanlbondar","html_url":"https://github.com/ruslanlbondar","followers_url":"https://api.github.com/users/ruslanlbondar/followers","following_url":"https://api.github.com/users/ruslanlbondar/following{/other_user}","gists_url":"https://api.github.com/users/ruslanlbondar/gists{/gist_id}","starred_url":"https://api.github.com/users/ruslanlbondar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruslanlbondar/subscriptions","organizations_url":"https://api.github.com/users/ruslanlbondar/orgs","repos_url":"https://api.github.com/users/ruslanlbondar/repos","events_url":"https://api.github.com/users/ruslanlbondar/events{/privacy}","received_events_url":"https://api.github.com/users/ruslanlbondar/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-10T18:31:04Z","updated_at":"2018-07-11T09:47:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1521f57c2756af30c158f8981c80f722d3b734d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2/commits","review_comments_url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2/comments","review_comment_url":"https://api.github.com/repos/FSou1/AzureSamples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FSou1/AzureSamples/issues/2/comments","statuses_url":"https://api.github.com/repos/FSou1/AzureSamples/statuses/03d412c91ef24b48e31b161ffd09aed1db5badf9","head":{"label":"ruslanlbondar:master","ref":"master","sha":"03d412c91ef24b48e31b161ffd09aed1db5badf9","user":{"login":"ruslanlbondar","id":13398872,"node_id":"MDQ6VXNlcjEzMzk4ODcy","avatar_url":"https://avatars0.githubusercontent.com/u/13398872?v=4","gravatar_id":"","url":"https://api.github.com/users/ruslanlbondar","html_url":"https://github.com/ruslanlbondar","followers_url":"https://api.github.com/users/ruslanlbondar/followers","following_url":"https://api.github.com/users/ruslanlbondar/following{/other_user}","gists_url":"https://api.github.com/users/ruslanlbondar/gists{/gist_id}","starred_url":"https://api.github.com/users/ruslanlbondar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruslanlbondar/subscriptions","organizations_url":"https://api.github.com/users/ruslanlbondar/orgs","repos_url":"https://api.github.com/users/ruslanlbondar/repos","events_url":"https://api.github.com/users/ruslanlbondar/events{/privacy}","received_events_url":"https://api.github.com/users/ruslanlbondar/received_events","type":"User","site_admin":false},"repo":{"id":138875008,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg4NzUwMDg=","name":"AzureSamples","full_name":"ruslanlbondar/AzureSamples","owner":{"login":"ruslanlbondar","id":13398872,"node_id":"MDQ6VXNlcjEzMzk4ODcy","avatar_url":"https://avatars0.githubusercontent.com/u/13398872?v=4","gravatar_id":"","url":"https://api.github.com/users/ruslanlbondar","html_url":"https://github.com/ruslanlbondar","followers_url":"https://api.github.com/users/ruslanlbondar/followers","following_url":"https://api.github.com/users/ruslanlbondar/following{/other_user}","gists_url":"https://api.github.com/users/ruslanlbondar/gists{/gist_id}","starred_url":"https://api.github.com/users/ruslanlbondar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruslanlbondar/subscriptions","organizations_url":"https://api.github.com/users/ruslanlbondar/orgs","repos_url":"https://api.github.com/users/ruslanlbondar/repos","events_url":"https://api.github.com/users/ruslanlbondar/events{/privacy}","received_events_url":"https://api.github.com/users/ruslanlbondar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ruslanlbondar/AzureSamples","description":null,"fork":true,"url":"https://api.github.com/repos/ruslanlbondar/AzureSamples","forks_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/forks","keys_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/teams","hooks_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/hooks","issue_events_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/issues/events{/number}","events_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/events","assignees_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/assignees{/user}","branches_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/branches{/branch}","tags_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/tags","blobs_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/statuses/{sha}","languages_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/languages","stargazers_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/stargazers","contributors_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/contributors","subscribers_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/subscribers","subscription_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/subscription","commits_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/contents/{+path}","compare_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/merges","archive_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/downloads","issues_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/issues{/number}","pulls_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/pulls{/number}","milestones_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/milestones{/number}","notifications_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/labels{/name}","releases_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/releases{/id}","deployments_url":"https://api.github.com/repos/ruslanlbondar/AzureSamples/deployments","created_at":"2018-06-27T11:54:53Z","updated_at":"2018-07-10T18:29:38Z","pushed_at":"2018-07-10T18:32:13Z","git_url":"git://github.com/ruslanlbondar/AzureSamples.git","ssh_url":"git@github.com:ruslanlbondar/AzureSamples.git","clone_url":"https://github.com/ruslanlbondar/AzureSamples.git","svn_url":"https://github.com/ruslanlbondar/AzureSamples","homepage":null,"size":71,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FSou1:master","ref":"master","sha":"7889b6cc75a8129a5f57876d6427b532ca951a4e","user":{"login":"FSou1","id":1132431,"node_id":"MDQ6VXNlcjExMzI0MzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1132431?v=4","gravatar_id":"","url":"https://api.github.com/users/FSou1","html_url":"https://github.com/FSou1","followers_url":"https://api.github.com/users/FSou1/followers","following_url":"https://api.github.com/users/FSou1/following{/other_user}","gists_url":"https://api.github.com/users/FSou1/gists{/gist_id}","starred_url":"https://api.github.com/users/FSou1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FSou1/subscriptions","organizations_url":"https://api.github.com/users/FSou1/orgs","repos_url":"https://api.github.com/users/FSou1/repos","events_url":"https://api.github.com/users/FSou1/events{/privacy}","received_events_url":"https://api.github.com/users/FSou1/received_events","type":"User","site_admin":false},"repo":{"id":137392450,"node_id":"MDEwOlJlcG9zaXRvcnkxMzczOTI0NTA=","name":"AzureSamples","full_name":"FSou1/AzureSamples","owner":{"login":"FSou1","id":1132431,"node_id":"MDQ6VXNlcjExMzI0MzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1132431?v=4","gravatar_id":"","url":"https://api.github.com/users/FSou1","html_url":"https://github.com/FSou1","followers_url":"https://api.github.com/users/FSou1/followers","following_url":"https://api.github.com/users/FSou1/following{/other_user}","gists_url":"https://api.github.com/users/FSou1/gists{/gist_id}","starred_url":"https://api.github.com/users/FSou1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FSou1/subscriptions","organizations_url":"https://api.github.com/users/FSou1/orgs","repos_url":"https://api.github.com/users/FSou1/repos","events_url":"https://api.github.com/users/FSou1/events{/privacy}","received_events_url":"https://api.github.com/users/FSou1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/FSou1/AzureSamples","description":null,"fork":false,"url":"https://api.github.com/repos/FSou1/AzureSamples","forks_url":"https://api.github.com/repos/FSou1/AzureSamples/forks","keys_url":"https://api.github.com/repos/FSou1/AzureSamples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FSou1/AzureSamples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FSou1/AzureSamples/teams","hooks_url":"https://api.github.com/repos/FSou1/AzureSamples/hooks","issue_events_url":"https://api.github.com/repos/FSou1/AzureSamples/issues/events{/number}","events_url":"https://api.github.com/repos/FSou1/AzureSamples/events","assignees_url":"https://api.github.com/repos/FSou1/AzureSamples/assignees{/user}","branches_url":"https://api.github.com/repos/FSou1/AzureSamples/branches{/branch}","tags_url":"https://api.github.com/repos/FSou1/AzureSamples/tags","blobs_url":"https://api.github.com/repos/FSou1/AzureSamples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FSou1/AzureSamples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FSou1/AzureSamples/git/refs{/sha}","trees_url":"https://api.github.com/repos/FSou1/AzureSamples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FSou1/AzureSamples/statuses/{sha}","languages_url":"https://api.github.com/repos/FSou1/AzureSamples/languages","stargazers_url":"https://api.github.com/repos/FSou1/AzureSamples/stargazers","contributors_url":"https://api.github.com/repos/FSou1/AzureSamples/contributors","subscribers_url":"https://api.github.com/repos/FSou1/AzureSamples/subscribers","subscription_url":"https://api.github.com/repos/FSou1/AzureSamples/subscription","commits_url":"https://api.github.com/repos/FSou1/AzureSamples/commits{/sha}","git_commits_url":"https://api.github.com/repos/FSou1/AzureSamples/git/commits{/sha}","comments_url":"https://api.github.com/repos/FSou1/AzureSamples/comments{/number}","issue_comment_url":"https://api.github.com/repos/FSou1/AzureSamples/issues/comments{/number}","contents_url":"https://api.github.com/repos/FSou1/AzureSamples/contents/{+path}","compare_url":"https://api.github.com/repos/FSou1/AzureSamples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FSou1/AzureSamples/merges","archive_url":"https://api.github.com/repos/FSou1/AzureSamples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FSou1/AzureSamples/downloads","issues_url":"https://api.github.com/repos/FSou1/AzureSamples/issues{/number}","pulls_url":"https://api.github.com/repos/FSou1/AzureSamples/pulls{/number}","milestones_url":"https://api.github.com/repos/FSou1/AzureSamples/milestones{/number}","notifications_url":"https://api.github.com/repos/FSou1/AzureSamples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FSou1/AzureSamples/labels{/name}","releases_url":"https://api.github.com/repos/FSou1/AzureSamples/releases{/id}","deployments_url":"https://api.github.com/repos/FSou1/AzureSamples/deployments","created_at":"2018-06-14T18:07:41Z","updated_at":"2018-06-27T15:54:17Z","pushed_at":"2018-07-10T18:34:20Z","git_url":"git://github.com/FSou1/AzureSamples.git","ssh_url":"git@github.com:FSou1/AzureSamples.git","clone_url":"https://github.com/FSou1/AzureSamples.git","svn_url":"https://github.com/FSou1/AzureSamples","homepage":null,"size":31,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2"},"html":{"href":"https://github.com/FSou1/AzureSamples/pull/2"},"issue":{"href":"https://api.github.com/repos/FSou1/AzureSamples/issues/2"},"comments":{"href":"https://api.github.com/repos/FSou1/AzureSamples/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FSou1/AzureSamples/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/FSou1/AzureSamples/statuses/03d412c91ef24b48e31b161ffd09aed1db5badf9"}},"author_association":"NONE"}}
{"actor":{"display_login":"FSou1"}}