GitHub PullRequestReviewCommentEvent at 2014-10-28 16:35:52
Repository: gcloud-node
Actor: stephenplusplus
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/19483649","id":19483649,"diff_hunk":"@@ -0,0 +1,293 @@\n+/*!\n+ * Copyright 2014 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/*!\n+ * @module bigquery/dataset\n+ */\n+\n+'use strict';\n+\n+var extend = require('extend');\n+\n+/**\n+ * @type {module:bigquery/table}\n+ * @private\n+ */\n+var Table = require('./table.js');\n+\n+/**\n+ * @type {module:common/util}\n+ * @private\n+ */\n+var util = require('../common/util.js');\n+\n+/*! Developer Documentation\n+ *\n+ * @param {module:bigquery} bigQuery - BigQuery instance.\n+ * @param {string} id - The ID of the Dataset.\n+ */\n+/**\n+ * Interact with your BigQuery dataset. Create a Dataset instance with\n+ * {module:bigquery#createDataset} or {module:bigquery#dataset}.\n+ *\n+ * @alias module:bigquery/dataset\n+ * @constructor\n+ */\n+function Dataset(bigQuery, id) {\n+  this.bigQuery = bigQuery;\n+  this.id = id;\n+  this.metadata = {};\n+}\n+\n+/**\n+ * Create a table given a tableId or configuration object.\n+ *\n+ * @param {object} options - Table id or configuration object.\n+ * @param {string} options.id - The id of the table.\n+ * @param {string|object} options.schema - A comma-separated list of name:type\n+ *     pairs. Valid types are \"string\", \"integer\", \"float\", \"boolean\", and\n+ *     \"timestamp\". If the type is omitted, it is assumed to be \"string\".\n+ *     Example: \"name:string, age:integer\". Schemas can also be specified as a\n+ *     JSON array of fields, which allows for nested and repeated fields. See\n+ *     https://cloud.google.com/bigquery/docs/reference/v2/tables#resource for\n+ *     more detailed information.\n+ * @param {function} callback - The callback function.\n+ *\n+ * @example\n+ * dataset.createTable('customers', function(err, table) {\n+ *   // Use the table.\n+ * });\n+ *\n+ * var tableConfig = {\n+ *   id: 'my-kittens',\n+ *   schema: 'id:integer,breed,name,dob:timestamp' // or json nested fields\n+ * };\n+ *\n+ * dataset.createTable(tableConfig, function(err, table) {\n+ *   // Use the table.\n+ * });\n+ */\n+Dataset.prototype.createTable = function(options, callback) {\n+  if (util.is(options.schema, 'string')) {\n+    options.schema = Table.createSchemaFromString_(options.schema);\n+  }\n+\n+  var body = {\n+    schema: options.schema,\n+    tableReference: {\n+      datasetId: this.id,\n+      projectId: this.bigQuery.projectId,\n+      tableId: options.id\n+    }\n+  };\n+\n+  delete options.id;\n+  delete options.schema;\n+\n+  extend(true, body, options);\n+\n+  this.makeReq_('POST', '/tables', null, body, function(err, resp) {\n+    if (err) {\n+      callback(err);\n+      return;\n+    }\n+\n+    var table = this.table(resp.tableReference.tableId);\n+    table.metadata = resp;\n+\n+    callback(null, table);\n+  }.bind(this));\n+};\n+\n+/**\n+ * Delete the dataset.\n+ *\n+ * @param {object=} options - The configuration object.\n+ * @param {boolean} options.force - Force delete dataset and all tables.\n+ *     (default: false)\n+ * @param {function} callback - The callback function.\n+ *\n+ * @example\n+ * //-\n+ * // Delete the dataset, only if it does not have any tables.\n+ * //-\n+ * dataset.delete(function(err) {});\n+ *\n+ * //-\n+ * // Delete the dataset and any tables it contains.\n+ * //-\n+ * dataset.delete({ force: true }, function(err) {});\n+ */\n+Dataset.prototype.delete = function(options, callback) {\n+  if (!callback) {\n+    callback = options;\n+    options = {};\n+  }\n+\n+  var query = {\n+    deleteContents: !!options.force\n+  };\n+\n+  this.makeReq_('DELETE', '', query, null, callback);\n+};\n+\n+/**\n+ * Get the metadata for the Dataset.\n+ *\n+ * @param {function} callback - The callback function.\n+ *\n+ * @example\n+ * dataset.getMetadata(function(err, metadata) {});\n+ */\n+Dataset.prototype.getMetadata = function(callback) {\n+  this.makeReq_('GET', '', null, null, function(err, resp) {\n+    if (err) {\n+      callback(err);\n+      return;\n+    }\n+\n+    this.metadata = resp;\n+\n+    callback(null, this.metadata);\n+  }.bind(this));","path":"lib/bigquery/dataset.js","position":165,"original_position":165,"commit_id":"1856c6582fb2beda1bfddd057ea27d7f5e2f9a01","original_commit_id":"1856c6582fb2beda1bfddd057ea27d7f5e2f9a01","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"body":"The system I usually go with is .bind(this) if there's only one function that needs it. I can see how that isn't really clear upon first glance, so I'll switch to that = this-ing.","created_at":"2014-10-28T16:35:52Z","updated_at":"2014-10-28T16:35:52Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264#discussion_r19483649","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/19483649"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264#discussion_r19483649"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264","id":23095748,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/264","number":264,"state":"open","locked":false,"title":"BigQuery","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"body":"## wip.\r\n\r\n### Docs: https://stephenplusplus.github.io/gcloud-node/#/docs/master/bigquery\r\n\r\nCarrying on from #262. Just opening this so anyone interested can follow along.\r\n","created_at":"2014-10-21T15:47:00Z","updated_at":"2014-10-28T16:35:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a634e565ddb2a9aa6807f6a25be247ca602d5ed3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/{number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/264/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/1856c6582fb2beda1bfddd057ea27d7f5e2f9a01","head":{"label":"stephenplusplus:spp--bigquery","ref":"spp--bigquery","sha":"1856c6582fb2beda1bfddd057ea27d7f5e2f9a01","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"repo":{"id":22482767,"name":"gcloud-node","full_name":"stephenplusplus/gcloud-node","owner":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=2","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stephenplusplus/gcloud-node","description":"Google Cloud Node Client Library","fork":true,"url":"https://api.github.com/repos/stephenplusplus/gcloud-node","forks_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/forks","keys_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/teams","hooks_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/hooks","issue_events_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/issues/events{/number}","events_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/events","assignees_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/assignees{/user}","branches_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/branches{/branch}","tags_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/tags","blobs_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/languages","stargazers_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/stargazers","contributors_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/contributors","subscribers_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/subscribers","subscription_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/subscription","commits_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/issues/comments/{number}","contents_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/contents/{+path}","compare_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/merges","archive_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/downloads","issues_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/issues{/number}","pulls_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/labels{/name}","releases_url":"https://api.github.com/repos/stephenplusplus/gcloud-node/releases{/id}","created_at":"2014-07-31T19:55:20Z","updated_at":"2014-07-31T19:55:38Z","pushed_at":"2014-10-28T16:15:22Z","git_url":"git://github.com/stephenplusplus/gcloud-node.git","ssh_url":"git@github.com:stephenplusplus/gcloud-node.git","clone_url":"https://github.com/stephenplusplus/gcloud-node.git","svn_url":"https://github.com/stephenplusplus/gcloud-node","homepage":"","size":7794,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"51abc0dbd59139aa7d44020f5fb5291e56ae660e","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=2","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":19483273,"name":"gcloud-node","full_name":"GoogleCloudPlatform/gcloud-node","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=2","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-node","description":"Google Cloud Client Library for Node.js","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/{number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/releases{/id}","created_at":"2014-05-06T06:18:00Z","updated_at":"2014-10-28T13:26:07Z","pushed_at":"2014-10-23T21:11:57Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-node.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-node.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-node.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-node","homepage":"https://googlecloudplatform.github.io/gcloud-node","size":10389,"stargazers_count":336,"watchers_count":336,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":19,"forks":39,"open_issues":19,"watchers":336,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/264"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/264"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/264/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/264/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/statuses/1856c6582fb2beda1bfddd057ea27d7f5e2f9a01"}}}}