diff --git a/.travis.yml b/.travis.yml index 999472a095e..c1e17b12c62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,21 @@ branches: - master env: global: - - secure: "B1vanjI2TMf+YnmbcF5HWAMNnmT+CFr2EB1CCIcyoWqs2RIBvgiDH0gDR46iUDdfPRSt3Eokaru1fY8ptZDRnrt3oKokWp4ZrRO0x7uUGbkGfdmHHxnOlUA1m9rVhaOBCWl5opfaA8ncWcXwdWZGg7HWpS7EfTNr2dIr7lAC2mU=" + - secure: "a9Qx7y7dIWXEdppdmPW5g6CJQpUWUmd3sKWcJPKMfcg+xVHEBhPl9PCt/2jGK1sxstTDiwrVaV1NKpG4qD03UVot2zX28o1mM7JY6rDAl709rvKveegDeC9vo+U/BWid3lq/Impl37X0YYGY+spEcptI6bnvWxa6d7MGPCx3L2c=" - GH_OWNER: GoogleCloudPlatform - GH_PROJECT_NAME: gcloud-node script: - npm run lint - npm run test after_success: - - git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} site > /dev/null 2>&1 - - cd site - - if git checkout gh-pages; then git checkout -b gh-pages; fi + - git submodule add -b master https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} master > /dev/null 2>&1 + - cd master + - npm install + - npm run docs + - git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages > /dev/null 2>&1 + - cd ghpages - git rm -r . - cp -R ../docs/* . - - cp ../docs/.* . - git add -f . - git config user.email "sawchuk@gmail.com" - git config user.name "stephenplusplus" diff --git a/docs/components/docs/docs.html b/docs/components/docs/docs.html new file mode 100644 index 00000000000..9184f13f685 --- /dev/null +++ b/docs/components/docs/docs.html @@ -0,0 +1,126 @@ + + +
+
+

Node.js

+
+ +
+
+

{{module[0].toUpperCase() + module.substr(1)}}

+

+ First, install gcloud with npm and require it into your project: +

+
$ npm install --save gcloud
+
var gcloud = require('gcloud');
+ +
+

+ The gcloud.datastore object gives you some convenience methods, as well as exposes a Dataset function. This will allow you to create a Dataset, which is the object from which you will interact with the Google Cloud Datastore. +

+
+var datastore = gcloud.datastore; +var dataset = new datastore.Dataset();
+

+ See the Dataset documentation for examples of how to query the datastore, save entities, run a transaction, and others. +

+
+ +
+

+ The gcloud.storage object contains a Bucket object, which is how you will interact with your Google Cloud Storage bucket. +

+
+var storage = gcloud.storage; +var bucket = new storage.Bucket({ + bucketName: 'MyBucket' +});
+

+ See examples below for more on how to upload a file, read from your bucket's files, create signed URLs, and more. +

+
+
+ +
+

+ {{method.name}} +

+

+ {{method.name}} +

+

+

Parameters

+ + + + + + + + +
{{param.name}}
+

Returns

+

+

Example

+
+
+
+
+ + +
diff --git a/docs/components/docs/docs.js b/docs/components/docs/docs.js new file mode 100644 index 00000000000..7204d6b79d5 --- /dev/null +++ b/docs/components/docs/docs.js @@ -0,0 +1,175 @@ +angular + .module('gcloud.docs', ['ngRoute', 'hljs']) + .config(function($routeProvider) { + 'use strict'; + + function filterDocJson($sce) { + // Transform JSON response to remove extraneous objects, such as copyright + // notices & use strict directives. + function formatHtml(str) { + return str + .replace(/\s+/g, ' ') + .replace(/
/g, ' ') + .replace(/`([^`]*)`/g, '$1'); + } + function detectLinks(str) { + var regex = { + withCode: /{@linkcode ([^<]*)<\/a>/g, + withTitle: /\[([^\]]*)]{@link [^}]*}<\/a>/g, + withoutTitle: /{@link [^}]*}<\/a>/g + }; + var a = document.createElement('a'); + return str + .replace(regex.withTitle, function(match, title, link) { + a.href = link; + a.innerText = title; + return a.outerHTML; + }) + .replace(regex.withoutTitle, function(match, link) { + a.href = link; + a.innerText = link.replace(/^http\s*:\/\//, ''); + return a.outerHTML; + }) + .replace(regex.withCode, function(match, link, text) { + a.href = link; + a.innerText = text; + return '' + a.outerHTML + ''; + }); + } + function detectModules(str) { + var regex = { + see: /{*module:([^}]*)}*/g + }; + var a = document.createElement('a'); + return str.replace(regex.see, function(match, module) { + a.href = '/gcloud-node/#/docs/' + module; + a.innerText = module; + return a.outerHTML; + }); + } + function reduceModules(acc, type, index, types) { + var CUSTOM_TYPES = ['query', 'dataset']; + if (CUSTOM_TYPES.indexOf(type.toLowerCase()) > -1) { + if (types[index - 1]) { + type = types[index - 1] + '/' + type; + delete types[index - 1]; + } + } + acc.push(detectModules(type)); + return acc; + } + return function(data) { + return data.data + .filter(function(obj) { + return obj.isPrivate === false && obj.ignore === false; + }) + .map(function(obj) { + return { + data: obj, + name: obj.ctx.name, + description: $sce.trustAsHtml( + formatHtml(detectLinks(detectModules(obj.description.full)))), + params: obj.tags.filter(function(tag) { + return tag.type === 'param'; + }) + .map(function(tag) { + tag.description = $sce.trustAsHtml( + formatHtml(tag.description.replace(/^- /, ''))); + tag.types = $sce.trustAsHtml(tag.types.reduceRight( + reduceModules, []).join(', ')); + return tag; + }), + returns: obj.tags.filter(function(tag) { + return tag.type === 'return'; + }) + .map(function(tag) { + return $sce.trustAsHtml( + tag.types.reduceRight(reduceModules, [])[0]) + })[0], + example: obj.tags.filter(function(tag) { + return tag.type === 'example' + }) + .map(function(tag) { + return tag.string; + })[0] + }; + }) + .sort(function(a, b) { + return a.name > b.name; + }); + }; + } + + $routeProvider + .when('/docs', { + controller: 'DocsCtrl', + templateUrl: '/gcloud-node/components/docs/docs.html', + resolve: { + methods: function($http, $sce) { + return $http.get('/gcloud-node/json/index.json') + .then(filterDocJson($sce)); + } + } + }) + .when('/docs/:module', { + controller: 'DocsCtrl', + templateUrl: '/gcloud-node/components/docs/docs.html', + resolve: { + methods: function($http, $route, $sce) { + var module = $route.current.params.module; + return $http.get('/gcloud-node/json/' + module + '/index.json') + .then(filterDocJson($sce)); + } + } + }) + .when('/docs/:module/:class', { + controller: 'DocsCtrl', + templateUrl: '/gcloud-node/components/docs/docs.html', + resolve: { + methods: function($q, $http, $route, $sce) { + var module = $route.current.params.module; + var cl = $route.current.params.class; + return $http.get('/gcloud-node/json/' + module + '/' + cl + '.json') + .then(filterDocJson($sce)); + } + } + }); + }) + .controller('DocsCtrl', function($location, $scope, $routeParams, methods) { + 'use strict'; + + $scope.isActiveUrl = function(url) { + return url.replace(/^\/gcloud-node\/#/, '') === $location.path(); + }; + + $scope.isActiveDoc = function(doc) { + return doc.toLowerCase() === $routeParams.module; + }; + + $scope.methods = methods; + $scope.module = $routeParams.module; + $scope.pages = [ + { + title: 'gcloud', + url: '/gcloud-node/#/docs' + }, + { + title: 'Datastore', + url: '/gcloud-node/#/docs/datastore', + pages: [ + { + title: 'Dataset', + url: '/dataset' + }, + { + title: 'Query', + url: '/query' + } + ] + }, + { + title: 'Storage', + url: '/gcloud-node/#/docs/storage' + } + ]; + }); diff --git a/docs/css/main.css b/docs/css/main.css new file mode 100755 index 00000000000..4fd1a4dc936 --- /dev/null +++ b/docs/css/main.css @@ -0,0 +1,1285 @@ +/*! HTML5 Boilerplate v4.3.0 | MIT License | http://h5bp.com/ */ + +/* + * What follows is the result of much research on cross-browser styling. + * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, + * Kroc Camen, and the H5BP dev community and team. + */ + +/* ========================================================================== + Base styles: opinionated defaults + ========================================================================== */ + +html, +button, +input, +select, +textarea { + color: #222; +} + +html { + font-size: 1em; + line-height: 1.4; +} + +/* + * Remove text-shadow in selection highlight: h5bp.com/i + * These selection rule sets have to be separate. + * Customize the background color to match your design. + */ + +::-moz-selection { + background: #b3d4fc; + text-shadow: none; +} + +::selection { + background: #b3d4fc; + text-shadow: none; +} + +/* + * A better looking default horizontal rule + */ + +hr { + display: block; + height: 1px; + border: 0; + border-top: 1px solid #ccc; + margin: 1em 0; + padding: 0; +} + +/* + * Remove the gap between images, videos, audio and canvas and the bottom of + * their containers: h5bp.com/i/440 + */ + +audio, +canvas, +img, +video { + vertical-align: middle; +} + +/* + * Remove default fieldset styles. + */ + +fieldset { + border: 0; + margin: 0; + padding: 0; +} + +/* + * Allow only vertical resizing of textareas. + */ + +textarea { + resize: vertical; +} + +/* ========================================================================== + Browse Happy prompt + ========================================================================== */ + +.browsehappy { + margin: 0.2em 0; + background: #ccc; + color: #000; + padding: 0.2em 0; +} + +/* ========================================================================== + Author's custom styles + ========================================================================== */ + +html { + height: 100%; + background: #fff; +} + +body { + height: 100%; + font-family: 'Roboto', sans-serif; + color: #5d6061; +} + + +/* Global Elements + ========================================================================== */ + +pre { + border: 1px solid rgba(0,0,0,0.2); + /* Border Radius */ + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + background: #fff; + font-size: 0.9em; + line-height: 1.6em; +} + +pre, +code { + font-family: Monaco, 'Droid Sans Mono', monospace !important; +} + +img { + max-width: 100%; +} + +h1, h2, h3, h4, h5, h6 { + font-weight: normal; + font-weight: 300; +} + +/* Header + ========================================================================== */ + +.page-header, +.hero-banner { + background: #4285f4; + color: #fff; +} + +.page-header { + position: relative; + padding: 1em; +} + +.page-header.fixed { + position: fixed; + z-index: 2; + top: 0; + width: 100%; + padding: 0; +} + +/* + Logo +*/ + +.logo { + margin: 0; + width: 13em; + font-size: 1em; + line-height: normal; +} + +.page-header.fixed .logo { + width: auto; +} + +.page-header.fixed a { + color: #fff; + text-decoration: none; +} + +.page-header.fixed a:hover { + opacity: 0.4; +} + +.page-header.fixed .logo img { + position: relative; + top: -0.2em; + width: 2em; + margin: 0 0.5em; +} + +.page-header.fixed .gcloud { + display: inline-block; + padding: 0.4em 0 0.6em 0.6em; + border-left: 1px solid rgba(255,255,255,0.2); + font-family: 'Open Sans', sans-serif; + font-weight: 300; + font-size: 1.4em; +} + +/* + Menu +*/ + +.nav-current { + display: block; + position: absolute; + top: 1.2em; + right: 1em; + width: 24px; + height: 20px; + background: url(../img/icon-menu.svg) no-repeat; + text-indent: -90000px; + cursor: pointer; +} + +.page-header.fixed .nav-current { + top: 1em; +} + +.menu { + display: none; + position: absolute; + top: 3.6em; + right: 0; + width: 100%; + margin: 0; + padding: 0; + background: #2570ec; + /* Box Shadow */ + -webkit-box-shadow: 5px 5px 8px rgba(0,16,41,0.3); + -moz-box-shadow: 5px 5px 8px rgba(0,16,41,0.3); + box-shadow: 5px 5px 8px rgba(0,16,41,0.3); + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.page-header.fixed .menu { + top: 3.3em; +} + +.menu a { + display: block; + padding: 1em; + border-top: 1px solid rgba(255,255,255,0.2); + color: #fff; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.menu a:hover { + background: #1a65e0; +} + +.menu-icon { + margin-right: 0.5em; +} + +/* + Open Menu + */ + +.main-nav.open .nav-current { + opacity: 0.4; +} + +.main-nav.open .menu { + display: block; +} + + + +/* Home Content + ========================================================================== */ + +/* + Main Content +*/ + +.main { + font-size: 0.9em; + line-height: 1.8em; +} + +.container { + padding: 2.8em 2em; +} + +.block-title { + margin-top: 0; + font-size: 1.6em; +} + +/* + Hero Banner +*/ + +.hero-banner h1 { + margin: 0 0 0.6em; + font-family: 'Open Sans', sans-serif; + font-size: 3.5em; + font-weight: 300; +} + +.hero-banner p { + margin-bottom: 2.2em; + font-size: 0.9em; + line-height: 1.6em; +} + +.hero-banner h2 { + margin-bottom: 0.2em; + font-size: 1.3em; +} + +.hero-banner pre { + margin: 0; + padding: 1em; + border: none; + background: #2a74ed; +} + +/* + What is it? + */ +.about pre { + font-size: 110%; +} + +/* + Featuring +*/ + +.featuring .block-title { + text-align: center; +} + +.featuring p { + font-size: 0.9em; + line-height: 1.6em; +} + +.featuring-links { + list-style: none; + margin: 0; + padding: 0; +} + +.btn, +.ext-link { + display: block; +} + +.btn { + padding: 1em; + border: none; + /* Border Radius */ + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + background: #db4437; + color: #fff; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.btn:hover { + background: #f24f41; +} + +.btn img { + margin-right: 0.5em; +} + +.featuring-links .btn { + margin-bottom: 1em; + padding: 1.5em; + font-size: 1.1em; + text-align: center; +} + +.featuring-links .btn img { + width: 2em; +} + +.ext-link { + display: block; + padding: 1em; + border-bottom: 1px solid rgba(0,0,0,0.1); + color: #5d6061; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.ext-link:hover { + background: #f6f6f6; +} + +.ext-link img { + opacity: 0.5; + margin-right: 0.5em; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.ext-link:hover img { + opacity: 0.7; +} + +.pagination { + margin: 2em 0 0; + padding: 0; + list-style: none; + text-decoration: none; + text-align: center; +} + +.pagination li { + display: inline-block; + width: 1em; + height: 1em; + margin: 0 0.2em; +} + +.pagination a { + display: block; + width: 100%; + height: 100%; + border: 1px solid rgba(0,0,0,0.2); + /* Border Radius */ + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + background: #fff; + text-indent: -90000px; +} + +.pagination a:hover { + background: rgba(0,0,0,0.1); +} + +.pagination .current, +.pagination .current:hover { + background: #db4437; + border-color: #db4437; +} + +/* + About +*/ + +.about { + background: #eee; +} + +.about h4 { + margin-bottom: 0; + font-size: 1.2em; + font-weight: bold; + color: #4285f4; +} + +/* + FAQ +*/ + +.faq-btn, +.faq-questions { + max-width: 20em; + margin: 0; + padding: 0; + list-style: none; +} + +.faq-btn { + position: relative; + margin-bottom: 2em; +} + +.faq-btn .current { + background: #e6eefc url(../img/icon-dropdown-faq.svg) 95% 50% no-repeat; +} + +.faq-btn .current, +.faq-questions a { + display: block; + padding: 1em; + border: 1px solid #a7bfe8; + color: #2b70e2; + cursor: pointer; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.faq-questions { + display: none; + position: absolute; + width: 100%; +} + +.faq-questions a { + border-top: none; + background: #e6eefc; +} + +.faq-questions a:hover { + background: #fcfdff; +} + +/* + Open FAQ button + */ + +.faq-btn.open .current { + background-color: #c6d7f6; + /* Box Shadow */ + -webkit-box-shadow: inset 0 0 10px rgba(16,71,163,0.3); + -moz-box-shadow: inset 0 0 10px rgba(16,71,163,0.3); + box-shadow: inset 0 0 10px rgba(16,71,163,0.3); + color: #1555bf; +} + +.faq-btn.open .faq-questions { + display: block; +} + + +/* Docs Content + ========================================================================== */ + +.docs-header { + position: relative; + padding: 7em 2em 4em; + background: #f8f8f8; + border-bottom: 1px solid rgba(0,0,0,0.05); +} + +/* + Page Title +*/ + +.page-title { + margin: 0; + font-family: 'Open Sans', sans-serif; + font-weight: 300; + color: #4285f4; + font-size: 2.4em; + line-height: 1em; +} + +/* + Versions +*/ + +.versions { + display: inline-block; + margin-top: 2em; +} + +.versions span, +.versions a { + display: block; +} + +.v-current { + font-size: 1.2em; + color: #2b70e2; +} + +.v-current i { + font-size: 0.7em; +} + +.v-btn { + padding: 0.5em; + border: 1px solid rgba(0,0,0,0.2); + background: rgba(0,0,0,0.07); + font-size: 0.8em; + color: rgba(0,0,0,0.6); + text-align: center; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.v-btn:hover { + background: rgba(0,0,0,0.02); +} + +.v-btn img { + position: relative; + top: -0.1em; + opacity: 0.3; +} + +.v-list { + color: rgba(0,0,0,0.2); +} + +.v-list a { + color: #4285f4; + text-decoration: none; +} + +.v-list a:hover { + text-decoration: underline; +} + +/* + Content + */ + + +.content { + padding: 1em 2em; +} + +.content pre, +.table { + border: 0; + margin-bottom: 2em; +} + +.content h2, .content h3, .content h4, .content h5, .content h6 { + margin: 2em 0 0.5em; +} + +.content>h2:first-child { + margin-top: 1em; +} + +/* + Tables + */ + +.table { + text-align: left; +} + +.table th, +.table td { + padding: 0.3em 1em; + border: 1px solid #cfcfcf; +} + +.table th[scope="col"] { + border-color: #2264d0; + background: #4285f4; + color: #fff; +} + +.table th[scope="row"] { + background: #f6f6f6; +} + +/* + Side Nav + */ + + .side-nav { + padding-bottom: 3em; + background: #efefef; + } + +.side-nav a { + display: block; + padding: 0.3em 2em; + color: #5d6061; + text-decoration: none; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.side-nav a:hover { + background: rgba(255,255,255,0.7); +} + +.side-nav .current, +.side-nav .current:hover { + background: #e2e2e2; +} + +.side-nav ul { + margin: 0; + padding: 0; +} + +.side-nav .sub-sections a { + padding-left: 4em; +} + +.side-nav .external-links { + margin-top: 2em; +} + +.external-links img { + margin-right: 0.3em; + opacity: 0.3; + /* Transitions */ + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + -o-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.external-links a:hover img { + opacity: 0.6; +} + + + +/* ========================================================================== + Helper classes + ========================================================================== */ + +/* + * Image replacement + */ + +.ir { + background-color: transparent; + border: 0; + overflow: hidden; + /* IE 6/7 fallback */ + *text-indent: -9999px; +} + +.ir:before { + content: ""; + display: block; + width: 0; + height: 150%; +} + +/* + * Hide from both screenreaders and browsers: h5bp.com/u + */ + +.hidden { + display: none !important; + visibility: hidden; +} + +/* + * Hide only visually, but have it available for screenreaders: h5bp.com/v + */ + +.visuallyhidden { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +/* + * Extends the .visuallyhidden class to allow the element to be focusable + * when navigated to via the keyboard: h5bp.com/p + */ + +.visuallyhidden.focusable:active, +.visuallyhidden.focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; +} + +/* + * Hide visually and from screenreaders, but maintain layout + */ + +.invisible { + visibility: hidden; +} + +/* + * Clearfix: contain floats + * + * For modern browsers + * 1. The space content is one way to avoid an Opera bug when the + * `contenteditable` attribute is included anywhere else in the document. + * Otherwise it causes space to appear at the top and bottom of elements + * that receive the `clearfix` class. + * 2. The use of `table` rather than `block` is only necessary if using + * `:before` to contain the top-margins of child elements. + */ + +.clearfix:before, +.clearfix:after { + content: " "; /* 1 */ + display: table; /* 2 */ +} + +.clearfix:after { + clear: both; +} + +/* + * For IE 6/7 only + * Include this rule to trigger hasLayout and contain floats. + */ + +.clearfix { + *zoom: 1; +} + +/* ========================================================================== + EXAMPLE Media Queries for Responsive Design. + These examples override the primary ('mobile first') styles. + Modify as content requires. + ========================================================================== */ + +@media only screen and (min-width: 35em) { + + /* + Main + */ + + .main { + font-size: 1em; + } + + /* + Featuring + */ + + .featuring-links { + text-align: center; + } + + .featuring-links li { + display: inline-block; + } + + .featuring-links li:first-child { + display: block; + } + + .featuring-links .btn { + display: inline-block; + padding: 1em 2.4em; + } + + .ext-link { + display: inline-block; + padding: 0.8em 1.2em; + border: none; + /* Border Radius */ + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + } + + .pagination li { + width: 0.6em; + height: 0.6em; + } + +} + +@media only screen and (min-width: 45em) { + + /* + Docs Header + */ + + .versions { + position: absolute; + top: 6em; + right: 2em; + margin: 0; + } + + .v-btn { + font-size: 0.7em; + line-height: normal; + } + +} + +@media only screen and (min-width: 50em) { + + /* + Header + */ + + .page-header { + padding: 1.6em; + } + + .page-header.fixed .logo img { + margin: 0 0.8em; + } + + .page-header.fixed .gcloud { + padding: 0 0 0 1em; + height: 70px; + line-height: 70px; + } + + /* + Logo + */ + + .logo { + width: 280px; + } + + /* + Menu + */ + + .main-nav { + position: absolute; + top: 1.2em; + left: 21.5em; + } + + .page-header.fixed .main-nav { + top: 0; + left: 11.5em; + } + + .nav-current { + position: relative; + top: 0; + left: 0; + padding: 0.8em 1.6em; + width: 150px; + height: auto; + border: 1px solid rgba(255,255,255,0.4); + background: url(../img/icon-dropdown.svg) 90% 50% no-repeat; + text-indent: 0; + } + + .page-header.fixed .nav-current { + top: 0; + padding: 0 1.6em; + height: 70px; + border: 1px solid rgba(255,255,255,0.2); + border-top: none; + border-bottom: none; + line-height: 70px; + } + + .nav-current:hover { + background-color: rgba(255,255,255,0.1); + } + + .menu { + top: 3em; + left: 0; + } + + .menu a { + padding: 1.2em 1.5em; + } + + .page-header.fixed .menu { + top: 70px; + } + + /* + Docs Header + */ + + .docs-header { + padding-top: 7.7em; + } + + .versions { + top: 7em; + } + + /* + Content + */ + + .container, + .content { + width: 80%; + margin: 0 auto; + padding: 2em 0; + } + + /* + Hero Banner + */ + + .hero-banner { + padding: 2em 0; + } + + .hero-banner h1 { + font-size: 5em; + margin-bottom: 0.8em; + } + + .hero-banner p { + font-size: 1em; + line-height: 2em; + } + + /* + Featuring + */ + + .featuring .block-title { + margin-bottom: 1.4em; + } + +} + +@media only screen and (min-width: 60em) { + + /* + Content + */ + + .container { + width: 90%; + max-width: 1020px; + font-size: 0.9em; + } + + .col { + width: 46%; + } + + .col-left { + float: left; + } + + .col-right { + float: right; + } + + .block-title { + font-size: 2em; + } + + /* + Hero Banner + */ + + .hero-banner { + padding-bottom: 0; + } + + .hero-banner .col-right { + padding-top: 3.6em; + } + + .hero-banner h1 { + font-size: 5.6em; + } + + .hero-banner p { + font-size: 1.1em; + } + + .hero-banner h2 { + font-size: 1.3em; + margin-bottom: 0.4em; + } + + .hero-banner pre { + font-size: 1.1em; + padding: 1em 1.5em; + } + + /* + Featuring + */ + + .featuring { + text-align: center; + } + + .featuring-links li { + font-size: 1em; + } + + .featuring-links li:first-child { + display: inline-block; + } + + .featuring-links .btn { + margin-right: 0.5em; + } + + .ext-link { + padding: 0.5em 1.2em; + } + + .featuring p { + max-width: 80%; + margin: 0 auto; + font-size: 1em; + } + + /* + About + */ + + .about .col-right { + padding-top: 2.4em; + } + + /* + FAQ + */ + + .faq .answer { + -moz-column-count: 2; + -moz-column-gap: 50px; + -webkit-column-count: 2; + -webkit-column-gap: 50px; + column-count: 2; + column-gap: 50px; + } + + /* + Docs Page + */ + + .lang-page { + background: url(../img/lang-bg.png) repeat-y; + } + + .docs-header { + margin-left: 240px; + } + + .content { + width: 100%; + max-width: 1070px; + padding-left: 290px; + padding-right: 2em; + /* Box Sizing */ + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + font-size: 0.9em; + } + + .side-nav { + position: absolute; + top: 0; + left: 0; + width: 240px; + padding-top: 7.7em; + background: none; + font-size: 0.9em; + } + + .side-nav a { + padding-left: 2.5em; + } + +} + +@media print, + (-o-min-device-pixel-ratio: 5/4), + (-webkit-min-device-pixel-ratio: 1.25), + (min-resolution: 120dpi) { + /* Style adjustments for high resolution devices */ +} + +/* ========================================================================== + Print styles. + Inlined to avoid required HTTP connection: h5bp.com/r + ========================================================================== */ + +@media print { + * { + background: transparent !important; + color: #000 !important; /* Black prints faster: h5bp.com/s */ + box-shadow: none !important; + text-shadow: none !important; + } + + a, + a:visited { + text-decoration: underline; + } + + a[href]:after { + content: " (" attr(href) ")"; + } + + abbr[title]:after { + content: " (" attr(title) ")"; + } + + /* + * Don't show links for images, or javascript/internal links + */ + + .ir a:after, + a[href^="javascript:"]:after, + a[href^="#"]:after { + content: ""; + } + + pre, + blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + + thead { + display: table-header-group; /* h5bp.com/t */ + } + + tr, + img { + page-break-inside: avoid; + } + + img { + max-width: 100% !important; + } + + @page { + margin: 0.5cm; + } + + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + + h2, + h3 { + page-break-after: avoid; + } +} diff --git a/docs/css/normalize.css b/docs/css/normalize.css new file mode 100755 index 00000000000..42e24d6880b --- /dev/null +++ b/docs/css/normalize.css @@ -0,0 +1,527 @@ +/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ + +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * Known issue: no IE 6 support. + */ + +[hidden] { + display: none; +} + +/* ========================================================================== + Base + ========================================================================== */ + +/** + * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * `em` units. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-size: 100%; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Address `font-family` inconsistency between `textarea` and other form + * elements. + */ + +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +/** + * Address margins handled incorrectly in IE 6/7. + */ + +body { + margin: 0; +} + +/* ========================================================================== + Links + ========================================================================== */ + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ + +a:focus { + outline: thin dotted; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* ========================================================================== + Typography + ========================================================================== */ + +/** + * Address font sizes and margins set differently in IE 6/7. + * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * Address styling not present in IE 7/8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address differences between Firefox and other browsers. + * Known issue: no IE 6/7 normalization. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Address styling not present in IE 6/7/8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address margins set differently in IE 6/7. + */ + +p, +pre { + margin: 1em 0; +} + +/** + * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} + +/** + * Improve readability of pre-formatted text in all browsers. + */ + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * Address CSS quotes not supported in IE 6/7. + */ + +q { + quotes: none; +} + +/** + * Address `quotes` property not supported in Safari 4. + */ + +q:before, +q:after { + content: ''; + content: none; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* ========================================================================== + Lists + ========================================================================== */ + +/** + * Address margins set differently in IE 6/7. + */ + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * Address paddings set differently in IE 6/7. + */ + +menu, +ol, +ul { + padding: 0 0 0 40px; +} + +/** + * Correct list images handled incorrectly in IE 7. + */ + +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + Embedded content + ========================================================================== */ + +/** + * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * 2. Improve image quality when scaled in IE 7. + */ + +img { + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + Figures + ========================================================================== */ + +/** + * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. + */ + +figure { + margin: 0; +} + +/* ========================================================================== + Forms + ========================================================================== */ + +/** + * Correct margin displayed oddly in IE 6/7. + */ + +form { + margin: 0; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct color not being inherited in IE 6/7/8/9. + * 2. Correct text not wrapping in Firefox 3. + * 3. Correct alignment displayed oddly in IE 6/7. + */ + +legend { + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ +} + +/** + * 1. Correct font size not being inherited in all browsers. + * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * and Chrome. + * 3. Improve appearance and consistency in all browsers. + */ + +button, +input, +select, +textarea { + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ +} + +/** + * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +button, +input { + line-height: normal; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * Known issue: inner spacing remains in IE 6. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * 1. Address box sizing set to content-box in IE 8/9. + * 2. Remove excess padding in IE 8/9. + * 3. Remove excess padding in IE 7. + * Known issue: excess padding remains in IE 6. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari 5 and Chrome + * on OS X. + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Remove inner padding and border in Firefox 3+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * 2. Improve readability and alignment in all browsers. + */ + +textarea { + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ +} + +/* ========================================================================== + Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/docs/dataset.html b/docs/dataset.html deleted file mode 100644 index d5369c319d0..00000000000 --- a/docs/dataset.html +++ /dev/null @@ -1,1696 +0,0 @@ - - - - - JSDoc: Module: datastore/dataset - - - - - - - - - - -
- -

Module: datastore/dataset

- - - - - -
- -
-

- datastore/dataset -

- -
- -
-
- - -
-

new (require("datastore/dataset"))(optionsopt)

- - -
-
- - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
options - - -object - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
projectId - - -string - - - -

Dataset ID. This is your project ID from - the Google Developers Console.

keyFilename - - -string - - - -

Full path to the JSON key downloaded - from the Google Developers Console.

namespace - - -string - - - -

Namespace to isolate transactions to.

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
var dataset = new datastore.Dataset({
-  projectId: 'my-project',
-  keyFilename: '/path/to/keyfile.json'
-});
- - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -

Methods

- -
- -
-

allocateIds(incompleteKey, n, callback)

- - -
-
- - -
-

Generate IDs without creating entities.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
incompleteKey - - -Key - - - -

The key object to complete.

n - - -number - - - -

How many IDs to generate.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
// The following call will create 100 new IDs from the Company kind, which
-// exists under the default namespace.
-var incompleteKey = datastore.key('Company', null);
-dataset.allocateIds(incompleteKey, 100, function(err, keys) {});
-
-// You may prefer to create IDs from a non-default namespace by providing an
-// incomplete key with a namespace. Similar to the previous example, the call
-// below will create 100 new IDs, but from the Company kind that exists under
-// the "ns-test" namespace.
-var incompleteKey = datastore.key('ns-test', 'Company', null);
-dataset.allocateIds(incompleteKey, 100, function(err, keys) {});
- - -
- - - -
-

createQuery(namespaceopt, kinds) → {module:datastore/query}

- - -
-
- - -
-

Create a query from the current dataset to query the specified kinds, scoped -to the namespace provided at the initialization of the dataset.

-

Dataset query reference: http://goo.gl/Cag0r6

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
namespace - - -string - - - - - - <optional>
- - - - - -

Optional namespace.

kinds - - -string -| - -array - - - - - - - - - -

Kinds to query.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
- - - -
-

delete(key, callback)

- - -
-
- - -
-

Delete all entities identified with the specified key(s) in the current -transaction.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -Key -| - -Array.<Key> - - - -

Datastore key object(s).

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
// Delete a single entity.
-dataset.delete(datastore.key('Company', 123), function(err) {});
-
-// Delete multiple entities at once.
-dataset.delete([
-  datastore.key('Company', 123),
-  datastore.key('Product', 'Computer')
-], function(err) {});
- - -
- - - -
-

get(key, callback)

- - -
-
- - -
-

Retrieve the entities identified with the specified key(s) in the current -transaction. Get operations require a valid key to retrieve the -key-identified entity from Datastore.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -module:datastore/entity~Key -| - -Array.<module:datastore/entity~Key> - - - -

Datastore key object(s).

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
dataset.get([
-  datastore.key('Company', 123),
-  datastore.key('Product', 'Computer')
-], function(err, entities) {});
- - -
- - - -
-

key()

- - -
-
- - -
-

Helper to create a Key object, scoped to the dataset's namespace by default.

-

You may also specify a configuration object to define a namespace and path.

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
var key;
-
-// Create a key from the dataset's namespace.
-key = dataset.key('Company', 123);
-
-// Create a key from a provided namespace and path.
-key = dataset.key({
-  namespace: 'My-NS',
-  path: ['Company', 123]
-});
- - -
- - - -
-

runInTransaction(fn, callback)

- - -
-
- - -
-

Run a function in the context of a new transaction. Transactions allow you to -perform multiple operations, committing your changes atomically.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fn - - -function - - - -

The function to run in the context of a transaction.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
dataset.transaction(function(transaction, done) {
-  // From the `transaction` object, execute dataset methods as usual.
-  // Call `done` when you're ready to commit all of the changes.
-  transaction.get(datastore.key('Company', 123), function(err, entity) {
-    if (err) {
-      transaction.rollback(done);
-      return;
-    }
-
-    done();
-  });
-}, function(err) {});
- - -
- - - -
-

runQuery(query, callback)

- - -
-
- - -
-

Datastore allows you to query entities by kind, filter them by property -filters, and sort them by a property name. Projection and pagination are also -supported. If more results are available, a query to retrieve the next page -is provided to the callback function.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
query - - -module:datastore/query - - - -

Query object.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
// Retrieve 5 companies.
-dataset.runQuery(queryObject, function(err, entities, nextQuery) {
-  // `nextQuery` is not null if there are more results.
-  if (nextQuery) {
-    dataset.runQuery(nextQuery, function(err, entities, nextQuery) {});
-  }
-});
- - -
- - - -
-

save(entities, callback)

- - -
-
- - -
-

Insert or update the specified object(s) in the current transaction. If a -key is incomplete, its associated object is inserted and its generated -identifier is returned to the callback.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
entities - - -object -| - -Array.<object> - - - -

Datastore key object(s).

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -Key - - - -

Datastore key object.

data - - -object - - - -

Data to save with the provided key.

-
callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
// Save a single entity.
-dataset.save({
-  key: datastore.key('Company', null),
-  data: {
-    rating: '10'
-  }
-}, function(err, key) {
-  // Because we gave an incomplete key as an argument, `key` will be
-  // populated with the complete, generated key.
-});
-
-// Save multiple entities at once.
-dataset.save([
-  {
-    key: datastore.key('Company', 123),
-    data: {
-      HQ: 'Dallas, TX'
-    }
-  },
-  {
-    key: datastore.key('Product', 'Computer'),
-    data: {
-      vendor: 'Dell'
-    }
-  }
-], function(err, keys) {});
- - -
- -
- - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/dataset.js.html b/docs/dataset.js.html deleted file mode 100644 index 089ef142f65..00000000000 --- a/docs/dataset.js.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - JSDoc: Source: datastore/dataset.js - - - - - - - - - - -
- -

Source: datastore/dataset.js

- - - - - -
-
-
/**
- * Copyright 2014 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @module datastore/dataset
- */
-
-'use strict';
-
-/**
- * @private
- * @type module:common/connection
- */
-var conn = require('../common/connection.js');
-
-/**
- * @private
- * @type module:datastore/entity
- */
-var entity = require('./entity.js');
-
-/**
- * @private
- * @type module:datastore/pb
- */
-var pb = require('./pb.js');
-
-/**
- * @private
- * @type module:datastore/query
- */
-var Query = require('./query.js');
-
-/**
- * @private
- * @type module:datastore/transaction
- */
-var Transaction = require('./transaction.js');
-
-/**
- * @private
- * @type module:common/util
- */
-var util = require('../common/util.js');
-
-/**
- * Scopes for Google Datastore access.
- * @private
- * @const {array} SCOPES
- */
-var SCOPES = [
-  'https://www.googleapis.com/auth/datastore',
-  'https://www.googleapis.com/auth/userinfo.email'
-];
-
-/**
- * Intract with a dataset from the
- * [Google Cloud Datastore]{@link https://developers.google.com/datastore/}.
- *
- * @constructor
- * @alias module:datastore/dataset
- *
- * @param {object=} options
- * @param {string} options.projectId - Dataset ID. This is your project ID from
- *     the Google Developers Console.
- * @param {string} options.keyFilename - Full path to the JSON key downloaded
- *     from the Google Developers Console.
- * @param {string} options.namespace - Namespace to isolate transactions to.
- *
- * @example
- * var dataset = new datastore.Dataset({
- *   projectId: 'my-project',
- *   keyFilename: '/path/to/keyfile.json'
- * });
- */
-function Dataset(options) {
-  options = options || {};
-
-  this.connection = new conn.Connection({
-    keyFilename: options.keyFilename,
-    scopes: SCOPES
-  });
-  this.id = options.projectId;
-  this.namespace = options.namespace;
-  this.transaction = this.createTransaction_();
-}
-
-/**
- * Helper to create a Key object, scoped to the dataset's namespace by default.
- *
- * You may also specify a configuration object to define a namespace and path.
- *
- * @example
- * var key;
- *
- * // Create a key from the dataset's namespace.
- * key = dataset.key('Company', 123);
- *
- * // Create a key from a provided namespace and path.
- * key = dataset.key({
- *   namespace: 'My-NS',
- *   path: ['Company', 123]
- * });
- */
-Dataset.prototype.key = function(keyConfig) {
-  if (!util.is(keyConfig, 'object')) {
-    keyConfig = {
-      namespace: this.namespace,
-      path: util.toArray(arguments)
-    };
-  }
-  return new entity.Key(keyConfig);
-};
-
-
-/**
- * Create a query from the current dataset to query the specified kinds, scoped
- * to the namespace provided at the initialization of the dataset.
- *
- * *Dataset query reference: {@link http://goo.gl/Cag0r6}*
- *
- * @borrows {module:datastore/query} as createQuery
- * @see {module:datastore/query}
- *
- * @param {string=} namespace - Optional namespace.
- * @param {string|array} kinds - Kinds to query.
- * @return {module:datastore/query}
- */
-Dataset.prototype.createQuery = function(namespace, kinds) {
-  if (arguments.length === 1) {
-    kinds = util.arrayize(namespace);
-    namespace = this.namespace;
-  }
-  return new Query(namespace, util.arrayize(kinds));
-};
-
-/**
- * Retrieve the entities identified with the specified key(s) in the current
- * transaction. Get operations require a valid key to retrieve the
- * key-identified entity from Datastore.
- *
- * @borrows {module:datastore/transaction#get} as get
- *
- * @param {module:datastore/entity~Key|module:datastore/entity~Key[]} key -
- *     Datastore key object(s).
- * @param {function} callback - The callback function.
- *
- * @example
- * dataset.get([
- *   datastore.key('Company', 123),
- *   datastore.key('Product', 'Computer')
- * ], function(err, entities) {});
- */
-Dataset.prototype.get = function(key, callback) {
-  this.transaction.get(key, callback);
-};
-
-/**
- * Insert or update the specified object(s) in the current transaction. If a
- * key is incomplete, its associated object is inserted and its generated
- * identifier is returned to the callback.
- *
- * @borrows {module:datastore/transaction#save} as save
- *
- * @param {object|object[]} entities - Datastore key object(s).
- * @param {Key} entities.key - Datastore key object.
- * @param {object} entities.data - Data to save with the provided key.
- * @param {function} callback - The callback function.
- *
- * @example
- * // Save a single entity.
- * dataset.save({
- *   key: datastore.key('Company', null),
- *   data: {
- *     rating: '10'
- *   }
- * }, function(err, key) {
- *   // Because we gave an incomplete key as an argument, `key` will be
- *   // populated with the complete, generated key.
- * });
- *
- * // Save multiple entities at once.
- * dataset.save([
- *   {
- *     key: datastore.key('Company', 123),
- *     data: {
- *       HQ: 'Dallas, TX'
- *     }
- *   },
- *   {
- *     key: datastore.key('Product', 'Computer'),
- *     data: {
- *       vendor: 'Dell'
- *     }
- *   }
- * ], function(err, keys) {});
- */
-Dataset.prototype.save = function(key, obj, callback) {
-  this.transaction.save(key, obj, callback);
-};
-
-/**
- * Delete all entities identified with the specified key(s) in the current
- * transaction.
- *
- * @param {Key|Key[]} key - Datastore key object(s).
- * @param {function} callback - The callback function.
- *
- * @borrows {module:datastore/transaction#delete} as delete
- *
- * @example
- * // Delete a single entity.
- * dataset.delete(datastore.key('Company', 123), function(err) {});
- *
- * // Delete multiple entities at once.
- * dataset.delete([
- *   datastore.key('Company', 123),
- *   datastore.key('Product', 'Computer')
- * ], function(err) {});
- */
-Dataset.prototype.delete = function(key, callback) {
-  this.transaction.delete(key, callback);
-};
-
-/**
- * Datastore allows you to query entities by kind, filter them by property
- * filters, and sort them by a property name. Projection and pagination are also
- * supported. If more results are available, a query to retrieve the next page
- * is provided to the callback function.
- *
- * @borrows {module:datastore/transaction#runQuery} as runQuery
- *
- * @param {module:datastore/query} query - Query object.
- * @param {function} callback - The callback function.
- *
- * @example
- * // Retrieve 5 companies.
- * dataset.runQuery(queryObject, function(err, entities, nextQuery) {
- *   // `nextQuery` is not null if there are more results.
- *   if (nextQuery) {
- *     dataset.runQuery(nextQuery, function(err, entities, nextQuery) {});
- *   }
- * });
- */
-Dataset.prototype.runQuery = function(q, callback) {
-  this.transaction.runQuery(q, callback);
-};
-
-/**
- * Run a function in the context of a new transaction. Transactions allow you to
- * perform multiple operations, committing your changes atomically.
- *
- * @borrows {module:datastore/transaction#begin} as runInTransaction
- *
- * @param {function} fn - The function to run in the context of a transaction.
- * @param {function} callback - The callback function.
- *
- * @example
- * dataset.transaction(function(transaction, done) {
- *   // From the `transaction` object, execute dataset methods as usual.
- *   // Call `done` when you're ready to commit all of the changes.
- *   transaction.get(datastore.key('Company', 123), function(err, entity) {
- *     if (err) {
- *       transaction.rollback(done);
- *       return;
- *     }
- *
- *     done();
- *   });
- * }, function(err) {});
- */
-Dataset.prototype.runInTransaction = function(fn, callback) {
-  var newTransaction = this.createTransaction_();
-  newTransaction.begin(function(err) {
-    if (err) {
-      return callback(err);
-    }
-    fn(newTransaction, newTransaction.finalize.bind(newTransaction, callback));
-  });
-};
-
-/**
- * Generate IDs without creating entities.
- *
- * @param {Key} incompleteKey - The key object to complete.
- * @param {number} n - How many IDs to generate.
- * @param {function} callback - The callback function.
- *
- * @example
- * // The following call will create 100 new IDs from the Company kind, which
- * // exists under the default namespace.
- * var incompleteKey = datastore.key('Company', null);
- * dataset.allocateIds(incompleteKey, 100, function(err, keys) {});
- *
- * // You may prefer to create IDs from a non-default namespace by providing an
- * // incomplete key with a namespace. Similar to the previous example, the call
- * // below will create 100 new IDs, but from the Company kind that exists under
- * // the "ns-test" namespace.
- * var incompleteKey = datastore.key('ns-test', 'Company', null);
- * dataset.allocateIds(incompleteKey, 100, function(err, keys) {});
- */
-Dataset.prototype.allocateIds = function(incompleteKey, n, callback) {
-  if (entity.isKeyComplete(incompleteKey)) {
-    throw new Error('An incomplete key should be provided.');
-  }
-  var incompleteKeys = [];
-  for (var i = 0; i < n; i++) {
-    incompleteKeys.push(entity.keyToKeyProto(incompleteKey));
-  }
-  this.transaction.makeReq(
-      'allocateIds',
-      new pb.AllocateIdsRequest({ key: incompleteKeys }),
-      pb.AllocateIdsResponse, function(err, resp) {
-    if (err) {
-      return callback(err);
-    }
-    var keys = [];
-    (resp.key || []).forEach(function(k) {
-      keys.push(entity.keyFromKeyProto(k));
-    });
-    callback(null ,keys);
-  });
-};
-
-/**
- * Create a new Transaction object using the existing connection and dataset.
- *
- * @private
- * @return {module:datastore/transaction}
- */
-Dataset.prototype.createTransaction_ = function() {
-  return new Transaction(this.connection, this.id);
-};
-
-module.exports = Dataset;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/home.html b/docs/home.html new file mode 100755 index 00000000000..c61b75938b8 --- /dev/null +++ b/docs/home.html @@ -0,0 +1,81 @@ + + +
+
+
+
+

gcloud

+

Node idiomatic client for Google Cloud services.

+
+ +
+

One-line npm install

+
$ npm install --save gcloud
+
+
+
+ +
+ +
+ +
+
+
+

What is it?

+ +

Node idiomatic client for Google Cloud services.

+
+ +
+

Sample code

+ +
+var gcloud = require('gcloud'); + +var datastore = gcloud.datastore; +// new datastore.Dataset(); + +var storage = gcloud.storage; +// new storage.Bucket();
+ +
+
+
+ +
diff --git a/docs/home.js b/docs/home.js new file mode 100644 index 00000000000..1968653ad1c --- /dev/null +++ b/docs/home.js @@ -0,0 +1,10 @@ +angular + .module('gcloud', ['ngRoute', 'hljs', 'gcloud.docs']) + .config(function($routeProvider) { + 'use strict'; + + $routeProvider + .when('/', { + templateUrl: '/gcloud-node/home.html' + }); + }); diff --git a/docs/img/.gitignore b/docs/img/.gitignore new file mode 100755 index 00000000000..e69de29bb2d diff --git a/docs/img/icon-dropdown-faq.svg b/docs/img/icon-dropdown-faq.svg new file mode 100755 index 00000000000..786bcdc7d13 --- /dev/null +++ b/docs/img/icon-dropdown-faq.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/docs/img/icon-dropdown.svg b/docs/img/icon-dropdown.svg new file mode 100755 index 00000000000..3642565ff6b --- /dev/null +++ b/docs/img/icon-dropdown.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/docs/img/icon-lang-nodejs.svg b/docs/img/icon-lang-nodejs.svg new file mode 100755 index 00000000000..24a4addc3c5 --- /dev/null +++ b/docs/img/icon-lang-nodejs.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/docs/img/icon-lang-python.svg b/docs/img/icon-lang-python.svg new file mode 100755 index 00000000000..bc4737703c3 --- /dev/null +++ b/docs/img/icon-lang-python.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/docs/img/icon-lang-ruby.svg b/docs/img/icon-lang-ruby.svg new file mode 100755 index 00000000000..acfaab8d6ea --- /dev/null +++ b/docs/img/icon-lang-ruby.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/docs/img/icon-link-github.svg b/docs/img/icon-link-github.svg new file mode 100755 index 00000000000..2404f8b0be0 --- /dev/null +++ b/docs/img/icon-link-github.svg @@ -0,0 +1,19 @@ + + + + + + diff --git a/docs/img/icon-link-package-manager.svg b/docs/img/icon-link-package-manager.svg new file mode 100755 index 00000000000..3a12655fe6f --- /dev/null +++ b/docs/img/icon-link-package-manager.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/docs/img/icon-link-stackoverflow.svg b/docs/img/icon-link-stackoverflow.svg new file mode 100755 index 00000000000..e1a1f789a89 --- /dev/null +++ b/docs/img/icon-link-stackoverflow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/docs/img/icon-menu.svg b/docs/img/icon-menu.svg new file mode 100755 index 00000000000..98d3e7073cd --- /dev/null +++ b/docs/img/icon-menu.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/docs/img/icon-table-check.svg b/docs/img/icon-table-check.svg new file mode 100755 index 00000000000..7934bef97f0 --- /dev/null +++ b/docs/img/icon-table-check.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/docs/img/lang-bg.png b/docs/img/lang-bg.png new file mode 100755 index 00000000000..654e12af341 Binary files /dev/null and b/docs/img/lang-bg.png differ diff --git a/docs/img/logo-full.svg b/docs/img/logo-full.svg new file mode 100755 index 00000000000..3b84037fccc --- /dev/null +++ b/docs/img/logo-full.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/img/logo.svg b/docs/img/logo.svg new file mode 100755 index 00000000000..6c515095c5a --- /dev/null +++ b/docs/img/logo.svg @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/docs/index.html b/docs/index.html old mode 100644 new mode 100755 index a8a94255763..e8490f58d57 --- a/docs/index.html +++ b/docs/index.html @@ -1,391 +1,42 @@ - - - + + + + + + - JSDoc: Module: gcloud - - - - - - - - - - -
- -

Module: gcloud

- - - - - -
- -
-

- gcloud -

- -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Members

- -
- -
-

(static) datastore :module:datastore

- - -
-
- -
-

Google Cloud Datastore is a -fully managed, schemaless database for storing non-relational data. Use this -object to create a Dataset to interact with your data, an "Int", and a -"Double" representation.

-
- - - -
Type:
- - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var datastore = gcloud.datastore;
-
-// datastore:
-// {
-//   Dataset: function() {},
-//   double: function() {},
-//   int: function() {}
-// }
- - -
- - - -
-

(static) pubsub :module:pubsub

- - -
-
- -
-

Experimental

-

Google Cloud Pub/Sub -is a reliable, many-to-many, asynchronous messaging service from Google Cloud -Platform.

-

Note: Google Cloud Pub/Sub API is available as a Limited Preview and the -client library we provide is currently experimental. The API and/or the -client might be changed in backward-incompatible ways. This API is not -subject to any SLA or deprecation policy. Request to be whitelisted to use it -by filling the -Limited Preview application form.

-
- - - -
Type:
-
    -
  • - -module:pubsub - - -
  • -
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var pubsub = gcloud.pubsub;
-
-var conn = new pubsub.Connection({
-  projectId: YOUR_PROJECT_ID,
-  keyFilename: '/path/to/the/key.json'
-});
- - -
- - - -
-

(static) storage :module:storage

- - -
-
- -
-

Google Cloud Storage allows you to store data on Google infrastructure. Read -Google Cloud Storage API docs -for more information.

-

You need to create a Google Cloud Storage bucket to use this client library. -Follow the steps on -Google Cloud Storage docs to -create a bucket.

-
- - - -
Type:
- - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var storage = gcloud.storage;
-
-// storage:
-// {
-//   Bucket: function() {}
-// }
- - -
- -
- - - - - - - -
- -
- - - - -
- - - -
- - - - - - \ No newline at end of file +
+ + + + + + + + + + + diff --git a/docs/index.js.html b/docs/index.js.html deleted file mode 100644 index 233c7915aa2..00000000000 --- a/docs/index.js.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - JSDoc: Source: datastore/index.js - - - - - - - - - - -
- -

Source: datastore/index.js

- - - - - -
-
-
/**
- * Copyright 2014 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @module datastore
- */
-
-'use strict';
-
-/**
- * @private
- * @type module:datastore/entity
- */
-var entity = require('./entity');
-
-/** @alias module:datastore */
-var datastore = {};
-
-/**
- * @see {module:datastore/dataset}
- *
- * @example
- * var gcloud = require('gcloud');
- * var datastore = gcloud.datastore;
- *
- * // Create a Dataset object.
- * var dataset = new datastore.Dataset();
- */
-datastore.Dataset = require('./dataset');
-
-/**
- * Helper function to get a Datastore Integer object.
- *
- * @example
- * var gcloud = require('gcloud');
- *
- * // Create an Integer.
- * var sevenInteger = gcloud.datastore.int(7);
- */
-datastore.int = function(value) {
-  return new entity.Int(value);
-};
-
-/**
- * Helper function to get a Datastore Double object.
- *
- * @example
- * var gcloud = require('gcloud');
- *
- * // Create a Double.
- * var threeDouble = gcloud.datastore.double(3.0);
- */
-datastore.double = function(value) {
-  return new entity.Double(value);
-};
-
-module.exports = datastore;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/index.js_.html b/docs/index.js_.html deleted file mode 100644 index 48ef2a469f3..00000000000 --- a/docs/index.js_.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - JSDoc: Source: index.js - - - - - - - - - - -
- -

Source: index.js

- - - - - -
-
-
/**
- * Copyright 2014 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @module gcloud
- */
-
-'use strict';
-
-/** @alias module:gcloud */
-var gcloud = {};
-
-/**
- * [Google Cloud Datastore]{@link https://developers.google.com/datastore/} is a
- * fully managed, schemaless database for storing non-relational data. Use this
- * object to create a Dataset to interact with your data, an "Int", and a
- * "Double" representation.
- *
- * @type {module:datastore}
- * @see {module:datastore}
- *
- * @return {object}
- *
- * @example
- * var gcloud = require('gcloud');
- * var datastore = gcloud.datastore;
- *
- * // datastore:
- * // {
- * //   Dataset: function() {},
- * //   double: function() {},
- * //   int: function() {}
- * // }
- */
-gcloud.datastore = require('./datastore');
-
-/**
- * **Experimental**
- *
- * [Google Cloud Pub/Sub]{@link https://developers.google.com/pubsub/overview}
- * is a reliable, many-to-many, asynchronous messaging service from Google Cloud
- * Platform.
- *
- * Note: Google Cloud Pub/Sub API is available as a Limited Preview and the
- * client library we provide is currently experimental. The API and/or the
- * client might be changed in backward-incompatible ways. This API is not
- * subject to any SLA or deprecation policy. Request to be whitelisted to use it
- * by filling the
- * [Limited Preview application form]{@link http://goo.gl/sO0wTu}.
- *
- * @type {module:pubsub}
- *
- * @return {object}
- *
- * @example
- * var gcloud = require('gcloud');
- * var pubsub = gcloud.pubsub;
- *
- * var conn = new pubsub.Connection({
- *   projectId: YOUR_PROJECT_ID,
- *   keyFilename: '/path/to/the/key.json'
- * });
- */
-gcloud.pubsub = require('./pubsub');
-
-/**
- * Google Cloud Storage allows you to store data on Google infrastructure. Read
- * [Google Cloud Storage API docs]{@link https://developers.google.com/storage/}
- * for more information.
- *
- * You need to create a Google Cloud Storage bucket to use this client library.
- * Follow the steps on
- * [Google Cloud Storage docs]{@link https://developers.google.com/storage/} to
- * create a bucket.
-
- * @type {module:storage}
- * @see {module:storage}
- *
- * @return {object}
- *
- * @example
- * var gcloud = require('gcloud');
- * var storage = gcloud.storage;
- *
- * // storage:
- * // {
- * //   Bucket: function() {}
- * // }
- */
-gcloud.storage = require('./storage');
-
-module.exports = gcloud;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/index.js__.html b/docs/index.js__.html deleted file mode 100644 index 79aeea6d313..00000000000 --- a/docs/index.js__.html +++ /dev/null @@ -1,471 +0,0 @@ - - - - - JSDoc: Source: storage/index.js - - - - - - - - - - -
- -

Source: storage/index.js

- - - - - -
-
-
/**
- * Copyright 2014 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @module storage
- */
-
-'use strict';
-
-var duplexify = require('duplexify');
-var nodeutil = require('util');
-var stream = require('stream');
-var uuid = require('node-uuid');
-
-/**
- * @private
- * @type module:common/connection
- */
-var conn = require('../common/connection.js');
-
-/**
- * @private
- * @type module:common/util
- */
-var util = require('../common/util.js');
-
-/**
- * Required scopes for Google Cloud Storage API.
- * @private
- * @const {array}
- */
-var SCOPES = ['https://www.googleapis.com/auth/devstorage.full_control'];
-
-/**
- * @private
- * @const {string}
- */
-var STORAGE_BASE_URL = 'https://www.googleapis.com/storage/v1/b';
-
-/**
- * @private
- * @const {string}
- */
-var STORAGE_UPLOAD_BASE_URL = 'https://www.googleapis.com/upload/storage/v1/b';
-
-/**
- * Readable stream implementation to stream the given buffer.
- *
- * @private
- *
- * @constructor
- *
- * @param {buffer} buffer - The buffer to stream.
- */
-function BufferStream(buffer) {
-  stream.Readable.call(this);
-  this.data = buffer;
-}
-
-nodeutil.inherits(BufferStream, stream.Readable);
-
-/**
- * Push the provided buffer to the stream.
- */
-BufferStream.prototype._read = function() {
-  this.push(this.data);
-  this.push(null);
-};
-
-/**
- * Google Cloud Storage allows you to store data on Google infrastructure. See
- * the guide on {@link https://developers.google.com/storage} to create a
- * bucket.
- *
- * @alias module:storage
-
- * @throws if a bucket name isn't provided.
- *
- * @param {object} options - Configuration options.
- * @param {string} options.bucketName - Name of the bucket.
- * @param {string} options.keyFilename - Full path to the JSON key downloaded
- *     from the Google Developers Console.
- *
- * @example
- * var gcloud = require('gcloud');
- * var storage = gcloud.storage;
- * var bucket;
- *
- * // From Google Compute Engine
- * bucket = new storage.Bucket({
- *   bucketName: YOUR_BUCKET_NAME
- * });
- *
- * // From elsewhere
- * bucket = new storage.Bucket({
- *   bucketName: YOUR_BUCKET_NAME,
- *   keyFilename: '/path/to/the/key.json'
- * });
- */
-function Bucket(options) {
-  if (!options.bucketName) {
-    throw Error('A bucket name is needed to use Google Cloud Storage');
-  }
-  this.bucketName = options.bucketName;
-  this.conn = new conn.Connection({
-    keyFilename: options.keyFilename,
-    scopes: SCOPES
-  });
-}
-
-/**
- * List files from the current bucket.
- *
- * @param {object=} query - Query object.
- * @param {string} query.delimeter - Results will contain only objects whose
- *     names, aside from the prefix, do not contain delimiter. Objects whose
- *     names, aside from the prefix, contain delimiter will have their name
- *     truncated after the delimiter, returned in prefixes. Duplicate prefixes
- *     are omitted.
- * @param {string} query.prefix - Filters results to objects whose names begin
- *     with this prefix.
- * @param {number} query.maxResults - Maximum number of items plus prefixes to
- *     return.
- * @param {string} query.pageToken - A previously-returned page token
- *     representing part of the larger set of results to view.
- * @param {function} callback - The callback function.
- *
- * @example
- * bucket.list(function(err, files, nextQuery) {
- *   if (nextQuery) {
- *     // nextQuery will be non-null if there are more results.
- *     bucket.list(nextQuery, function(err, files, nextQuery) {});
- *   }
- * });
- *
- * // Fetch using a query.
- * bucket.list({ maxResults: 5 }, function(err, files, nextQuery) {});
- */
-Bucket.prototype.list = function(query, callback) {
-  if (arguments.length === 1) {
-    callback = query;
-    query = {};
-  }
-  this.makeReq('GET', 'o', query, true, function(err, resp) {
-    if (err) {
-      return callback(err);
-    }
-    var nextQuery = null;
-    if (resp.nextPageToken) {
-      nextQuery = util.extend({}, query);
-      nextQuery.pageToken = resp.nextPageToken;
-    }
-    callback(null, resp.items, nextQuery);
-  });
-};
-
-/**
- * Stat a file.
- *
- * @param {string} name - Name of the remote file.
- * @param {function} callback - The callback function.
- *
- * @example
- * bucket.stat('filename', function(err, metadata){});
- */
-Bucket.prototype.stat = function(name, callback) {
-  var path = util.format('o/{name}', { name: name });
-  this.makeReq('GET', path, null, true, callback);
-};
-
-/**
- * Copy an existing file. If no bucket name is provided for the destination
- * file, the current bucket name will be used.
- *
- * @throws if the destination filename is not provided.
- *
- * @param {string} name - Name of the existing file.
- * @param {object} metadata - Destination file metadata object.
- * @param {string} metadata.name - Name of the destination file.
- * @param {string=} metadata.bucket - Destination bucket for the file. If none
- *     is provided, the source's bucket name is used.
- * @param {function=} callback - The callback function.
- *
- * @example
- * bucket.copy('filename', {
- *    bucket: 'destination-bucket',
- *    name: 'destination-filename'
- * }, function(err) {});
- */
-Bucket.prototype.copy = function(name, metadata, callback) {
-  callback = callback || util.noop;
-  if (!metadata.name) {
-    throw new Error('Destination file should have a name.');
-  }
-  if (!metadata.bucket) {
-    metadata.bucket = this.bucketName;
-  }
-  var path = util.format('o/{srcName}/copyTo/b/{destBucket}/o/{destName}', {
-    srcName: name,
-    destBucket: metadata.bucket,
-    destName: metadata.name
-  });
-  delete metadata.name;
-  delete metadata.bucket;
-  this.makeReq('POST', path, null, metadata, callback);
-};
-
-/**
- * Remove a file.
- *
- * @param {string} name - Name of the file to remove.
- * @param {function} callback - The callback function.
- *
- * @example
- * bucket.remove('filename', function(err) {});
- */
-Bucket.prototype.remove = function(name, callback) {
-  var path = util.format('o/{name}', { name: name });
-  this.makeReq('DELETE', path, null, true, callback);
-};
-
-/**
- * Create a readable stream to read contents of the provided remote file. It
- * can be piped to a write stream, or listened to for 'data' events to read a
- * file's contents.
- *
- * @param {string} name - Name of the remote file.
- * @return {ReadStream}
- *
- * @example
- * // Create a readable stream and write the file contents to "local-file-path".
- * var fs = require('fs');
- *
- * bucket.createReadStream('remote-file-name')
- *    .pipe(fs.createWriteStream('local-file-path'))
- *    .on('error', function(err) {});
- */
-Bucket.prototype.createReadStream = function(name) {
-  var that = this;
-  var dup = duplexify();
-  this.stat(name, function(err, metadata) {
-    if (err) {
-      dup.emit('error', err);
-      return;
-    }
-    that.conn.createAuthorizedReq(
-        { uri: metadata.mediaLink }, function(err, req) {
-      if (err) {
-        dup.emit('error', err);
-        return;
-      }
-      dup.setReadable(that.conn.requester(req));
-    });
-  });
-  return dup;
-};
-
-/**
- * Create a Duplex to handle the upload of a file.
- *
- * @param {string} name - Name of the remote file to create.
- * @param {object=} metadata - Optional metadata.
- * @return {stream}
- *
- * @example
- * // Read from a local file and pipe to your bucket.
- * var fs = require('fs');
- *
- * fs.createReadStream('local-file-path')
- *     .pipe(bucket.createWriteStream('remote-file-name'))
- *     .on('error', function(err) {})
- *     .on('complete', function(fileObject) {});
- */
-Bucket.prototype.createWriteStream = function(name, metadata) {
-  var dup = duplexify();
-  this.getWritableStream_(name, (metadata || {}), function(err, writable) {
-    if (err) {
-      dup.emit('error', err);
-      return;
-    }
-    writable.on('complete', function(res) {
-      util.handleResp(null, res, res.body, function(err, data) {
-        if (err) {
-          dup.emit('error', err);
-          return;
-        }
-        dup.emit('complete', data);
-      });
-    });
-    dup.setWritable(writable);
-    dup.pipe(writable);
-  });
-  return dup;
-};
-
-/**
- * Write the provided data to the destination with optional metadata.
- *
- * @param {string} name - Name of the remote file toc reate.
- * @param {object|string|buffer} options - Configuration object or data.
- * @param {object=} options.metadata - Optional metadata.
- * @param {function=} callback - The callback function.
- *
- * @example
- * // Upload "Hello World" as file contents. `data` can be any string or buffer.
- * bucket.write('filename', {
- *   data: 'Hello World'
- * }, function(err) {});
- *
- * // A shorthand for the above.
- * bucket.write('filename', 'Hello World', function(err) {});
- */
-Bucket.prototype.write = function(name, options, callback) {
-  callback = callback || util.noop;
-  var data = typeof options === 'object' ? options.data : options;
-  var metadata = options.metadata || {};
-
-  if (typeof data === 'undefined') {
-    // metadata only write
-    this.makeReq('PATCH', 'o/' + name, null, metadata, callback);
-    return;
-  }
-
-  if (typeof data === 'string' || data instanceof Buffer) {
-    new BufferStream(data).pipe(this.createWriteStream(name, metadata))
-        .on('error', callback)
-        .on('complete', callback.bind(null, null));
-  }
-};
-
-/**
- * Get a remote stream to begin piping a readable stream to.
- *
- * @private
- *
- * @param {string} name - The desired name of the file.
- * @param {object} metadata - File descriptive metadata.
- * @param {function} callback - The callback function.
- */
-Bucket.prototype.getWritableStream_ = function(name, metadata, callback) {
-  var boundary = uuid.v4();
-  var that = this;
-  metadata.contentType = metadata.contentType || 'text/plain';
-  this.conn.createAuthorizedReq({
-    method: 'POST',
-    uri: util.format('{base}/{bucket}/o', {
-      base: STORAGE_UPLOAD_BASE_URL,
-      bucket: this.bucketName
-    }),
-    qs: {
-      name: name,
-      uploadType: 'multipart'
-    },
-    headers: {
-      'Content-Type': 'multipart/related; boundary="' + boundary + '"'
-    }
-  }, function(err, req) {
-    if (err) {
-      callback(err);
-      return;
-    }
-    var remoteStream = that.conn.requester(req);
-    remoteStream.callback = util.noop;
-    remoteStream.write('--' + boundary + '\n');
-    remoteStream.write('Content-Type: application/json\n\n');
-    remoteStream.write(JSON.stringify(metadata));
-    remoteStream.write('\n\n');
-    remoteStream.write('--' + boundary + '\n');
-    remoteStream.write('Content-Type: ' + metadata.contentType + '\n\n');
-    var oldEndFn = remoteStream.end;
-    remoteStream.end = function(data, encoding, callback) {
-      data = (data || '') + '\n--' + boundary + '--\n';
-      remoteStream.write(data, encoding, callback);
-      oldEndFn.apply(this);
-    };
-    callback(null, remoteStream);
-  });
-};
-
-/**
- * Make a new request object from the provided arguments and wrap the callback
- * to intercept non-successful responses.
- *
- * @param {string} method - Action.
- * @param {string} path - Request path.
- * @param {*} query - Request query object.
- * @param {*} body - Request body contents.
- * @param {function} callback - The callback function.
- */
-Bucket.prototype.makeReq = function(method, path, query, body, callback) {
-  var reqOpts = {
-    method: method,
-    qs: query,
-    uri: util.format('{base}/{bucket}/{path}', {
-      base: STORAGE_BASE_URL,
-      bucket: this.bucketName,
-      path: path
-    })
-  };
-  if (body) {
-    reqOpts.json = body;
-  }
-  this.conn.req(reqOpts, function(err, res, body) {
-    util.handleResp(err, res, body, callback);
-  });
-};
-
-module.exports.Bucket = Bucket;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/json/datastore/dataset.json b/docs/json/datastore/dataset.json new file mode 100644 index 00000000000..9f3895929d7 --- /dev/null +++ b/docs/json/datastore/dataset.json @@ -0,0 +1,644 @@ +[ + { + "tags": [], + "description": { + "full": "

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

", + "summary": "

Copyright 2014 Google Inc. All Rights Reserved.

", + "body": "

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

" + }, + "isPrivate": false, + "ignore": true + }, + { + "tags": [], + "description": { + "full": "

@module datastore/dataset

", + "summary": "

@module datastore/dataset

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "'use strict';" + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:common/connection

", + "summary": "

@type module:common/connection

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var conn = require('../common/connection.js');", + "ctx": { + "type": "declaration", + "name": "conn", + "value": "require('../common/connection.js')", + "string": "conn" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:datastore/entity

", + "summary": "

@type module:datastore/entity

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var entity = require('./entity.js');", + "ctx": { + "type": "declaration", + "name": "entity", + "value": "require('./entity.js')", + "string": "entity" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:datastore/pb

", + "summary": "

@type module:datastore/pb

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var pb = require('./pb.js');", + "ctx": { + "type": "declaration", + "name": "pb", + "value": "require('./pb.js')", + "string": "pb" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:datastore/query

", + "summary": "

@type module:datastore/query

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var Query = require('./query.js');", + "ctx": { + "type": "declaration", + "name": "Query", + "value": "require('./query.js')", + "string": "Query" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:datastore/transaction

", + "summary": "

@type module:datastore/transaction

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var Transaction = require('./transaction.js');", + "ctx": { + "type": "declaration", + "name": "Transaction", + "value": "require('./transaction.js')", + "string": "Transaction" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:common/util

", + "summary": "

@type module:common/util

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var util = require('../common/util.js');", + "ctx": { + "type": "declaration", + "name": "util", + "value": "require('../common/util.js')", + "string": "util" + } + }, + { + "tags": [ + { + "type": "const", + "string": "{array} SCOPES" + }, + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

Scopes for Google Datastore access.

", + "summary": "

Scopes for Google Datastore access.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var SCOPES = [\n 'https://www.googleapis.com/auth/datastore',\n 'https://www.googleapis.com/auth/userinfo.email'\n];", + "ctx": { + "type": "declaration", + "name": "SCOPES", + "value": "[", + "string": "SCOPES" + } + }, + { + "tags": [ + { + "type": "constructor", + "string": "" + }, + { + "type": "alias", + "string": "module:datastore/dataset " + }, + { + "type": "param", + "types": [ + "object=" + ], + "name": "options", + "description": "" + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "options.projectId", + "description": "- Dataset ID. This is your project ID from the Google Developers Console." + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "options.keyFilename", + "description": "- Full path to the JSON key downloaded from the Google Developers Console. Alternatively, you may provide a\n `credentials` object." + }, + { + "type": "param", + "types": [ + "object=" + ], + "name": "options.credentials", + "description": "- Credentials object, used in place of a `keyFilename`." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "options.namespace", + "description": "- Namespace to isolate transactions to. " + }, + { + "type": "example", + "string": "var dataset = new datastore.Dataset({\n projectId: 'my-project',\n keyFilename: '/path/to/keyfile.json'\n});" + } + ], + "description": { + "full": "

Interact with a dataset from the
[Google Cloud Datastore]{@link https://developers.google.com/datastore/}.

", + "summary": "

Interact with a dataset from the
[Google Cloud Datastore]{@link https://developers.google.com/datastore/}.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "function Dataset(options) {\n options = options || {};\n\n this.connection = new conn.Connection({\n credentials: options.credentials,\n keyFilename: options.keyFilename,\n scopes: SCOPES\n });\n this.id = options.projectId;\n this.namespace = options.namespace;\n this.transaction = this.createTransaction_();\n}", + "ctx": { + "type": "function", + "name": "Dataset", + "string": "Dataset()" + } + }, + { + "tags": [ + { + "type": "example", + "string": "var key;\n\n// Create a key from the dataset's namespace.\nkey = dataset.key('Company', 123);\n\n// Create a key from a provided namespace and path.\nkey = dataset.key({\n namespace: 'My-NS',\n path: ['Company', 123]\n});" + } + ], + "description": { + "full": "

Helper to create a Key object, scoped to the dataset's namespace by default.

You may also specify a configuration object to define a namespace and path.

", + "summary": "

Helper to create a Key object, scoped to the dataset's namespace by default.

", + "body": "

You may also specify a configuration object to define a namespace and path.

" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.key = function(keyConfig) {\n if (!util.is(keyConfig, 'object')) {\n keyConfig = {\n namespace: this.namespace,\n path: util.toArray(arguments)\n };\n }\n return new entity.Key(keyConfig);\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "key", + "string": "Dataset.prototype.key()" + } + }, + { + "tags": [ + { + "type": "borrows", + "otherMemberName": "{module:datastore/query}", + "thisMemberName": "createQuery" + }, + { + "type": "see", + "local": "{module:datastore/query} " + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "namespace", + "description": "- Optional namespace." + }, + { + "type": "param", + "types": [ + "string", + "array" + ], + "name": "kinds", + "description": "- Kinds to query." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + } + ], + "description": { + "full": "

Create a query from the current dataset to query the specified kinds, scoped
to the namespace provided at the initialization of the dataset.

Dataset query reference: {@link http://goo.gl/Cag0r6}

", + "summary": "

Create a query from the current dataset to query the specified kinds, scoped
to the namespace provided at the initialization of the dataset.

", + "body": "

Dataset query reference: {@link http://goo.gl/Cag0r6}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.createQuery = function(namespace, kinds) {\n if (arguments.length === 1) {\n kinds = util.arrayize(namespace);\n namespace = this.namespace;\n }\n return new Query(namespace, util.arrayize(kinds));\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "createQuery", + "string": "Dataset.prototype.createQuery()" + } + }, + { + "tags": [ + { + "type": "borrows", + "otherMemberName": "{module:datastore/transaction#get}", + "thisMemberName": "get " + }, + { + "type": "param", + "types": [ + "Key", + "Key[]" + ], + "name": "key", + "description": "- Datastore key object(s)." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "dataset.get([\n dataset.key('Company', 123),\n dataset.key('Product', 'Computer')\n], function(err, entities) {});" + } + ], + "description": { + "full": "

Retrieve the entities identified with the specified key(s) in the current
transaction. Get operations require a valid key to retrieve the
key-identified entity from Datastore.

", + "summary": "

Retrieve the entities identified with the specified key(s) in the current
transaction. Get operations require a valid key to retrieve the
key-identified entity from Datastore.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.get = function(key, callback) {\n this.transaction.get(key, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "get", + "string": "Dataset.prototype.get()" + } + }, + { + "tags": [ + { + "type": "borrows", + "otherMemberName": "{module:datastore/transaction#save}", + "thisMemberName": "save " + }, + { + "type": "param", + "types": [ + "object", + "object[]" + ], + "name": "entities", + "description": "- Datastore key object(s)." + }, + { + "type": "param", + "types": [ + "Key" + ], + "name": "entities.key", + "description": "- Datastore key object." + }, + { + "type": "param", + "types": [ + "object" + ], + "name": "entities.data", + "description": "- Data to save with the provided key." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "// Save a single entity.\ndataset.save({\n key: dataset.key('Company', null),\n data: {\n rating: '10'\n }\n}, function(err, key) {\n // Because we gave an incomplete key as an argument, `key` will be\n // populated with the complete, generated key.\n});\n\n// Save multiple entities at once.\ndataset.save([\n {\n key: dataset.key('Company', 123),\n data: {\n HQ: 'Dallas, TX'\n }\n },\n {\n key: dataset.key('Product', 'Computer'),\n data: {\n vendor: 'Dell'\n }\n }\n], function(err, keys) {});" + } + ], + "description": { + "full": "

Insert or update the specified object(s) in the current transaction. If a
key is incomplete, its associated object is inserted and its generated
identifier is returned to the callback.

", + "summary": "

Insert or update the specified object(s) in the current transaction. If a
key is incomplete, its associated object is inserted and its generated
identifier is returned to the callback.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.save = function(key, obj, callback) {\n this.transaction.save(key, obj, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "save", + "string": "Dataset.prototype.save()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "Key", + "Key[]" + ], + "name": "key", + "description": "- Datastore key object(s)." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "borrows", + "otherMemberName": "{module:datastore/transaction#delete}", + "thisMemberName": "delete " + }, + { + "type": "example", + "string": "// Delete a single entity.\ndataset.delete(dataset.key('Company', 123), function(err) {});\n\n// Delete multiple entities at once.\ndataset.delete([\n dataset.key('Company', 123),\n dataset.key('Product', 'Computer')\n], function(err) {});" + } + ], + "description": { + "full": "

Delete all entities identified with the specified key(s) in the current
transaction.

", + "summary": "

Delete all entities identified with the specified key(s) in the current
transaction.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.delete = function(key, callback) {\n this.transaction.delete(key, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "delete", + "string": "Dataset.prototype.delete()" + } + }, + { + "tags": [ + { + "type": "borrows", + "otherMemberName": "{module:datastore/transaction#runQuery}", + "thisMemberName": "runQuery " + }, + { + "type": "param", + "types": [ + "module:datastore", + "query" + ], + "name": "query", + "description": "- Query object." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "// Retrieve 5 companies.\ndataset.runQuery(queryObject, function(err, entities, nextQuery) {\n // `nextQuery` is not null if there are more results.\n if (nextQuery) {\n dataset.runQuery(nextQuery, function(err, entities, nextQuery) {});\n }\n});" + } + ], + "description": { + "full": "

Datastore allows you to query entities by kind, filter them by property
filters, and sort them by a property name. Projection and pagination are also
supported. If more results are available, a query to retrieve the next page
is provided to the callback function.

", + "summary": "

Datastore allows you to query entities by kind, filter them by property
filters, and sort them by a property name. Projection and pagination are also
supported. If more results are available, a query to retrieve the next page
is provided to the callback function.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.runQuery = function(q, callback) {\n this.transaction.runQuery(q, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "runQuery", + "string": "Dataset.prototype.runQuery()" + } + }, + { + "tags": [ + { + "type": "borrows", + "otherMemberName": "{module:datastore/transaction#begin}", + "thisMemberName": "runInTransaction " + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "fn", + "description": "- The function to run in the context of a transaction." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "dataset.runInTransaction(function(transaction, done) {\n // From the `transaction` object, execute dataset methods as usual.\n // Call `done` when you're ready to commit all of the changes.\n transaction.get(dataset.key('Company', 123), function(err, entity) {\n if (err) {\n transaction.rollback(done);\n return;\n }\n\n done();\n });\n}, function(err) {});" + } + ], + "description": { + "full": "

Run a function in the context of a new transaction. Transactions allow you to
perform multiple operations, committing your changes atomically.

", + "summary": "

Run a function in the context of a new transaction. Transactions allow you to
perform multiple operations, committing your changes atomically.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.runInTransaction = function(fn, callback) {\n var newTransaction = this.createTransaction_();\n newTransaction.begin(function(err) {\n if (err) {\n callback(err);\n return;\n }\n fn(newTransaction, newTransaction.finalize.bind(newTransaction, callback));\n });\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "runInTransaction", + "string": "Dataset.prototype.runInTransaction()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "Key" + ], + "name": "incompleteKey", + "description": "- The key object to complete." + }, + { + "type": "param", + "types": [ + "number" + ], + "name": "n", + "description": "- How many IDs to generate." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "// The following call will create 100 new IDs from the Company kind, which\n// exists under the default namespace.\nvar incompleteKey = dataset.key('Company', null);\ndataset.allocateIds(incompleteKey, 100, function(err, keys) {});\n\n// You may prefer to create IDs from a non-default namespace by providing an\n// incomplete key with a namespace. Similar to the previous example, the call\n// below will create 100 new IDs, but from the Company kind that exists under\n// the \"ns-test\" namespace.\nvar incompleteKey = dataset.key('ns-test', 'Company', null);\ndataset.allocateIds(incompleteKey, 100, function(err, keys) {});" + } + ], + "description": { + "full": "

Generate IDs without creating entities.

", + "summary": "

Generate IDs without creating entities.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Dataset.prototype.allocateIds = function(incompleteKey, n, callback) {\n if (entity.isKeyComplete(incompleteKey)) {\n throw new Error('An incomplete key should be provided.');\n }\n var incompleteKeys = [];\n for (var i = 0; i < n; i++) {\n incompleteKeys.push(entity.keyToKeyProto(incompleteKey));\n }\n this.transaction.makeReq(\n 'allocateIds',\n new pb.AllocateIdsRequest({ key: incompleteKeys }),\n pb.AllocateIdsResponse, function(err, resp) {\n if (err) {\n callback(err);\n return;\n }\n var keys = [];\n (resp.key || []).forEach(function(k) {\n keys.push(entity.keyFromKeyProto(k));\n });\n callback(null ,keys);\n });\n};", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "allocateIds", + "string": "Dataset.prototype.allocateIds()" + } + }, + { + "tags": [ + { + "type": "return", + "types": [ + "module:datastore", + "transaction" + ], + "description": "" + }, + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

Create a new Transaction object using the existing connection and dataset.

", + "summary": "

Create a new Transaction object using the existing connection and dataset.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "Dataset.prototype.createTransaction_ = function() {\n return new Transaction(this.connection, this.id);\n};\n\nmodule.exports = Dataset;", + "ctx": { + "type": "method", + "constructor": "Dataset", + "cons": "Dataset", + "name": "createTransaction_", + "string": "Dataset.prototype.createTransaction_()" + } + } +] \ No newline at end of file diff --git a/docs/json/datastore/index.json b/docs/json/datastore/index.json new file mode 100644 index 00000000000..50627dce26f --- /dev/null +++ b/docs/json/datastore/index.json @@ -0,0 +1,159 @@ +[ + { + "tags": [], + "description": { + "full": "

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

", + "summary": "

Copyright 2014 Google Inc. All Rights Reserved.

", + "body": "

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

" + }, + "isPrivate": false, + "ignore": true + }, + { + "tags": [], + "description": { + "full": "

@module datastore

", + "summary": "

@module datastore

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "'use strict';" + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:datastore/entity

", + "summary": "

@type module:datastore/entity

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var entity = require('./entity');", + "ctx": { + "type": "declaration", + "name": "entity", + "value": "require('./entity')", + "string": "entity" + } + }, + { + "tags": [], + "description": { + "full": "

@alias module:datastore

", + "summary": "

@alias module:datastore

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "var datastore = {};", + "ctx": { + "type": "declaration", + "name": "datastore", + "value": "{}", + "string": "datastore" + } + }, + { + "tags": [ + { + "type": "example", + "string": "var gcloud = require('gcloud');\nvar datastore = gcloud.datastore;\n\n// Create a Dataset object.\nvar dataset = new datastore.Dataset();" + } + ], + "description": { + "full": "

@see {module:datastore/dataset}

", + "summary": "

@see {module:datastore/dataset}

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "datastore.Dataset = require('./dataset');", + "ctx": { + "type": "property", + "receiver": "datastore", + "name": "Dataset", + "value": "require('./dataset')", + "string": "datastore.Dataset" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "number" + ], + "name": "value", + "description": "- The integer value." + }, + { + "type": "return", + "types": [ + "object" + ], + "description": "" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\n\n// Create an Integer.\nvar sevenInteger = gcloud.datastore.int(7);" + } + ], + "description": { + "full": "

Helper function to get a Datastore Integer object.

", + "summary": "

Helper function to get a Datastore Integer object.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "datastore.int = function(value) {\n return new entity.Int(value);\n};", + "ctx": { + "type": "method", + "receiver": "datastore", + "name": "int", + "string": "datastore.int()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "number" + ], + "name": "value", + "description": "- The double value." + }, + { + "type": "return", + "types": [ + "object" + ], + "description": "" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\n\n// Create a Double.\nvar threeDouble = gcloud.datastore.double(3.0);" + } + ], + "description": { + "full": "

Helper function to get a Datastore Double object.

", + "summary": "

Helper function to get a Datastore Double object.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "datastore.double = function(value) {\n return new entity.Double(value);\n};\n\nmodule.exports = datastore;", + "ctx": { + "type": "method", + "receiver": "datastore", + "name": "double", + "string": "datastore.double()" + } + } +] \ No newline at end of file diff --git a/docs/json/datastore/query.json b/docs/json/datastore/query.json new file mode 100644 index 00000000000..0b5795d3077 --- /dev/null +++ b/docs/json/datastore/query.json @@ -0,0 +1,449 @@ +[ + { + "tags": [], + "description": { + "full": "

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

", + "summary": "

Copyright 2014 Google Inc. All Rights Reserved.

", + "body": "

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

" + }, + "isPrivate": false, + "ignore": true + }, + { + "tags": [], + "description": { + "full": "

@module datastore/query

", + "summary": "

@module datastore/query

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "'use strict';" + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type {module:common/util}

", + "summary": "

@type {module:common/util}

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var util = require('../common/util.js');", + "ctx": { + "type": "declaration", + "name": "util", + "value": "require('../common/util.js')", + "string": "util" + } + }, + { + "tags": [ + { + "type": "constructor", + "string": "" + }, + { + "type": "alias", + "string": "module:datastore/query " + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "namespace", + "description": "- Namespace to query entities from." + }, + { + "type": "param", + "types": [ + "string[]" + ], + "name": "kinds", + "description": "- Kinds to query. " + }, + { + "type": "example", + "string": "var query;\n\n// If your dataset was scoped to a namespace at initialization, your query\n// will likewise be scoped to that namespace.\nquery = dataset.createQuery(['Lion', 'Chimp']);\n\n// However, you may override the namespace per query.\nquery = dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);\n\n// You may also remove the namespace altogether.\nquery = dataset.createQuery(null, ['Lion', 'Chimp']);" + } + ], + "description": { + "full": "

Build a Query object.

Queries should be built with
{@linkcode module:datastore/dataset#createQuery} and run via
{@linkcode module:datastore/dataset#runQuery}.

Reference: {@link http://goo.gl/Cag0r6}

", + "summary": "

Build a Query object.

", + "body": "

Queries should be built with
{@linkcode module:datastore/dataset#createQuery} and run via
{@linkcode module:datastore/dataset#runQuery}.

Reference: {@link http://goo.gl/Cag0r6}

" + }, + "isPrivate": false, + "ignore": false, + "code": "function Query(namespace, kinds) {\n if (!kinds) {\n kinds = namespace;\n namespace = null;\n }\n\n this.namespace = namespace || null;\n this.kinds = kinds;\n\n this.filters = [];\n this.orders = [];\n this.groupByVal = [];\n this.selectVal = [];\n\n // pagination\n this.startVal = null;\n this.endVal = null;\n this.limitVal = -1;\n this.offsetVal = -1;\n}", + "ctx": { + "type": "function", + "name": "Query", + "string": "Query()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "filter", + "description": "- Property + Operator (=, <, >, <=, >=)." + }, + { + "type": "param", + "types": [ + "*" + ], + "name": "value", + "description": "- Value to compare property to." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "// List all companies named Google that have less than 400 employees.\nvar companyQuery = query\n .filter('name =', 'Google');\n .filter('size <', 400);\n\n// To filter by key, use `__key__` for the property name. Filter on keys\n// stored as properties is not currently supported.\nvar keyQuery = query.filter('__key__ =', dataset.key('Company', 'Google'));" + } + ], + "description": { + "full": "

Datastore allows querying on properties. Supported comparison operators
are =, <, >, <=, and >=. "Not equal" and IN operators are
currently not supported.

To filter by ancestors, see {@linkcode module:datastore/query#hasAncestor}.

Reference: {@link http://goo.gl/ENCx7e}

", + "summary": "

Datastore allows querying on properties. Supported comparison operators
are =, <, >, <=, and >=. "Not equal" and IN operators are
currently not supported.

", + "body": "

To filter by ancestors, see {@linkcode module:datastore/query#hasAncestor}.

Reference: {@link http://goo.gl/ENCx7e}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.filter = function(filter, value) {\n // TODO: Add filter validation.\n var q = util.extend(this, new Query());\n filter = filter.trim();\n var fieldName = filter.replace(/[>|<|=|>=|<=]*$/, '').trim();\n var op = filter.substr(fieldName.length, filter.length).trim();\n q.filters = q.filters || [];\n q.filters.push({ name: fieldName, op: op, val: value });\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "filter", + "string": "Query.prototype.filter()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "Key" + ], + "name": "key", + "description": "- Key object to filter by." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "var ancestoryQuery = query.hasAncestor(dataset.key('Parent', 123));" + } + ], + "description": { + "full": "

Filter a query by ancestors.

Reference: {@link http://goo.gl/1qfpkZ}

", + "summary": "

Filter a query by ancestors.

", + "body": "

Reference: {@link http://goo.gl/1qfpkZ}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.hasAncestor = function(key) {\n var q = util.extend(this, new Query());\n this.filters.push({ name: '__key__', op: 'HAS_ANCESTOR', val: key });\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "hasAncestor", + "string": "Query.prototype.hasAncestor()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "property", + "description": "- Optional operator (+, -) and property to order by." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "// Sort by size ascendingly.\nvar companiesAscending = companyQuery.order('size');\n\n// Sort by size descendingly.\nvar companiesDescending = companyQuery.order('-size');" + } + ], + "description": { + "full": "

Sort the results by a property name ascendingly or descendingly. By default,
an ascending sort order will be used.

Reference: {@link http://goo.gl/mfegFR}

", + "summary": "

Sort the results by a property name ascendingly or descendingly. By default,
an ascending sort order will be used.

", + "body": "

Reference: {@link http://goo.gl/mfegFR}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.order = function(property) {\n var q = util.extend(this, new Query());\n var sign = '+';\n if (property[0] === '-' || property[0] === '+') {\n sign = property[0];\n property = property.substr(1);\n }\n q.orders = q.orders || [];\n q.orders.push({ name: property, sign: sign });\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "order", + "string": "Query.prototype.order()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "array" + ], + "name": "properties", + "description": "- Properties to group by." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "var groupedQuery = companyQuery.groupBy(['name', 'size']);" + } + ], + "description": { + "full": "

Group query results by a list of properties.

", + "summary": "

Group query results by a list of properties.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.groupBy = function(fieldNames) {\n var fields = util.arrayize(fieldNames);\n var q = util.extend(this, new Query());\n q.groupByVal = fields;\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "groupBy", + "string": "Query.prototype.groupBy()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "array" + ], + "name": "fieldNames", + "description": "- Properties to return from the matched entities." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "// Only retrieve the name and size properties.\nvar selectQuery = companyQuery.select(['name', 'size']);" + } + ], + "description": { + "full": "

Retrieve only select properties from the matched entities.

Reference: [Projection Queries]{@link http://goo.gl/EfsrJl}

", + "summary": "

Retrieve only select properties from the matched entities.

", + "body": "

Reference: [Projection Queries]{@link http://goo.gl/EfsrJl}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.select = function(fieldNames) {\n var q = util.extend(this, new Query());\n q.selectVal = fieldNames;\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "select", + "string": "Query.prototype.select()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "cursorToken", + "description": "- The starting cursor token." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "var cursorToken = 'X';\n\n// Retrieve results starting from cursorToken.\nvar startQuery = companyQuery.start(cursorToken);" + } + ], + "description": { + "full": "

Set a starting cursor to a query.

Reference: {@link http://goo.gl/WuTGRI}

", + "summary": "

Set a starting cursor to a query.

", + "body": "

Reference: {@link http://goo.gl/WuTGRI}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.start = function(start) {\n var q = util.extend(this, new Query());\n q.startVal = start;\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "start", + "string": "Query.prototype.start()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "cursorToken", + "description": "- The ending cursor token." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "var cursorToken = 'X';\n\n// Retrieve results limited to the extent of cursorToken.\nvar endQuery = companyQuery.end(cursorToken);" + } + ], + "description": { + "full": "

Set an ending cursor to a query.

Reference: {@link http://goo.gl/WuTGRI}

", + "summary": "

Set an ending cursor to a query.

", + "body": "

Reference: {@link http://goo.gl/WuTGRI}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.end = function(end) {\n var q = util.extend(this, new Query());\n q.endVal = end;\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "end", + "string": "Query.prototype.end()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "number" + ], + "name": "n", + "description": "- The number of results to limit the query to." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "// Limit the results to 10 entities.\nvar limitQuery = companyQuery.limit(10);" + } + ], + "description": { + "full": "

Set a limit on a query.

Reference: {@link http://goo.gl/f0VZ0n}

", + "summary": "

Set a limit on a query.

", + "body": "

Reference: {@link http://goo.gl/f0VZ0n}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.limit = function(n) {\n var q = util.extend(this, new Query());\n q.limitVal = n;\n return q;\n};", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "limit", + "string": "Query.prototype.limit()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "number" + ], + "name": "n", + "description": "- The offset to start from after the start cursor." + }, + { + "type": "return", + "types": [ + "module:datastore", + "query" + ], + "description": "" + }, + { + "type": "example", + "string": "// Start from the 101st result.\nvar offsetQuery = companyQuery.offset(100);" + } + ], + "description": { + "full": "

Set an offset on a query.

Reference: {@link http://goo.gl/f0VZ0n}

", + "summary": "

Set an offset on a query.

", + "body": "

Reference: {@link http://goo.gl/f0VZ0n}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Query.prototype.offset = function(n) {\n var q = util.extend(this, new Query());\n q.offsetVal = n;\n return q;\n};\n\nmodule.exports = Query;", + "ctx": { + "type": "method", + "constructor": "Query", + "cons": "Query", + "name": "offset", + "string": "Query.prototype.offset()" + } + } +] \ No newline at end of file diff --git a/docs/json/index.json b/docs/json/index.json new file mode 100644 index 00000000000..e47e6a33553 --- /dev/null +++ b/docs/json/index.json @@ -0,0 +1,148 @@ +[ + { + "tags": [], + "description": { + "full": "

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

", + "summary": "

Copyright 2014 Google Inc. All Rights Reserved.

", + "body": "

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

" + }, + "isPrivate": false, + "ignore": true + }, + { + "tags": [], + "description": { + "full": "

@module gcloud

", + "summary": "

@module gcloud

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "'use strict';" + }, + { + "tags": [], + "description": { + "full": "

@alias module:gcloud

", + "summary": "

@alias module:gcloud

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "var gcloud = {};", + "ctx": { + "type": "declaration", + "name": "gcloud", + "value": "{}", + "string": "gcloud" + } + }, + { + "tags": [ + { + "type": "type", + "types": [ + "module:datastore" + ] + }, + { + "type": "return", + "types": [ + "module:datastore" + ], + "description": "" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\nvar datastore = gcloud.datastore;\n\n// datastore:\n// {\n// Dataset: function() {},\n// double: function() {},\n// int: function() {}\n// }" + } + ], + "description": { + "full": "

[Google Cloud Datastore]{@link https://developers.google.com/datastore/} is a
fully managed, schemaless database for storing non-relational data. Use this
object to create a Dataset to interact with your data, an "Int", and a
"Double" representation.

", + "summary": "

[Google Cloud Datastore]{@link https://developers.google.com/datastore/} is a
fully managed, schemaless database for storing non-relational data. Use this
object to create a Dataset to interact with your data, an "Int", and a
"Double" representation.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "gcloud.datastore = require('./datastore');", + "ctx": { + "type": "property", + "receiver": "gcloud", + "name": "datastore", + "value": "require('./datastore')", + "string": "gcloud.datastore" + } + }, + { + "tags": [ + { + "type": "type", + "types": [ + "module:pubsub" + ] + }, + { + "type": "return", + "types": [ + "object" + ], + "description": "" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\nvar pubsub = gcloud.pubsub;\n\nvar conn = new pubsub.Connection({\n projectId: YOUR_PROJECT_ID,\n keyFilename: '/path/to/the/key.json'\n});" + } + ], + "description": { + "full": "

Experimental

[Google Cloud Pub/Sub]{@link https://developers.google.com/pubsub/overview}
is a reliable, many-to-many, asynchronous messaging service from Google Cloud
Platform.

Note: Google Cloud Pub/Sub API is available as a Limited Preview and the
client library we provide is currently experimental. The API and/or the
client might be changed in backward-incompatible ways. This API is not
subject to any SLA or deprecation policy. Request to be whitelisted to use it
by filling the
[Limited Preview application form]{@link http://goo.gl/sO0wTu}.

", + "summary": "

Experimental

", + "body": "

[Google Cloud Pub/Sub]{@link https://developers.google.com/pubsub/overview}
is a reliable, many-to-many, asynchronous messaging service from Google Cloud
Platform.

Note: Google Cloud Pub/Sub API is available as a Limited Preview and the
client library we provide is currently experimental. The API and/or the
client might be changed in backward-incompatible ways. This API is not
subject to any SLA or deprecation policy. Request to be whitelisted to use it
by filling the
[Limited Preview application form]{@link http://goo.gl/sO0wTu}.

" + }, + "isPrivate": false, + "ignore": false, + "code": "gcloud.pubsub = require('./pubsub');", + "ctx": { + "type": "property", + "receiver": "gcloud", + "name": "pubsub", + "value": "require('./pubsub')", + "string": "gcloud.pubsub" + } + }, + { + "tags": [ + { + "type": "type", + "types": [ + "module:storage" + ] + }, + { + "type": "return", + "types": [ + "module:storage" + ], + "description": "" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\nvar storage = gcloud.storage;\n\n// storage:\n// {\n// Bucket: function() {}\n// }" + } + ], + "description": { + "full": "

Google Cloud Storage allows you to store data on Google infrastructure. Read
[Google Cloud Storage API docs]{@link https://developers.google.com/storage/}
for more information.

You need to create a Google Cloud Storage bucket to use this client library.
Follow the steps on
[Google Cloud Storage docs]{@link https://developers.google.com/storage/} to
create a bucket.

", + "summary": "

Google Cloud Storage allows you to store data on Google infrastructure. Read
[Google Cloud Storage API docs]{@link https://developers.google.com/storage/}
for more information.

", + "body": "

You need to create a Google Cloud Storage bucket to use this client library.
Follow the steps on
[Google Cloud Storage docs]{@link https://developers.google.com/storage/} to
create a bucket.

" + }, + "isPrivate": false, + "ignore": false, + "code": "gcloud.storage = require('./storage');\n\nmodule.exports = gcloud;", + "ctx": { + "type": "property", + "receiver": "gcloud", + "name": "storage", + "value": "require('./storage')", + "string": "gcloud.storage" + } + } +] \ No newline at end of file diff --git a/docs/json/storage/index.json b/docs/json/storage/index.json new file mode 100644 index 00000000000..53fae39623f --- /dev/null +++ b/docs/json/storage/index.json @@ -0,0 +1,809 @@ +[ + { + "tags": [], + "description": { + "full": "

Copyright 2014 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

", + "summary": "

Copyright 2014 Google Inc. All Rights Reserved.

", + "body": "

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0\n

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

" + }, + "isPrivate": false, + "ignore": true + }, + { + "tags": [], + "description": { + "full": "

@module storage

", + "summary": "

@module storage

", + "body": "" + }, + "isPrivate": false, + "ignore": true, + "code": "'use strict';\n\nvar crypto = require('crypto');\nvar duplexify = require('duplexify');\nvar nodeutil = require('util');\nvar stream = require('stream');\nvar uuid = require('node-uuid');" + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:common/connection

", + "summary": "

@type module:common/connection

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var conn = require('../common/connection.js');", + "ctx": { + "type": "declaration", + "name": "conn", + "value": "require('../common/connection.js')", + "string": "conn" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@type module:common/util

", + "summary": "

@type module:common/util

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var util = require('../common/util.js');", + "ctx": { + "type": "declaration", + "name": "util", + "value": "require('../common/util.js')", + "string": "util" + } + }, + { + "tags": [ + { + "type": "const", + "string": "{array}" + }, + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

Required scopes for Google Cloud Storage API.

", + "summary": "

Required scopes for Google Cloud Storage API.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var SCOPES = ['https://www.googleapis.com/auth/devstorage.full_control'];", + "ctx": { + "type": "declaration", + "name": "SCOPES", + "value": "['https://www.googleapis.com/auth/devstorage.full_control']", + "string": "SCOPES" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@const {string}

", + "summary": "

@const {string}

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var STORAGE_BASE_URL = 'https://www.googleapis.com/storage/v1/b';", + "ctx": { + "type": "declaration", + "name": "STORAGE_BASE_URL", + "value": "'https://www.googleapis.com/storage/v1/b'", + "string": "STORAGE_BASE_URL" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

@const {string}

", + "summary": "

@const {string}

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "var STORAGE_UPLOAD_BASE_URL = 'https://www.googleapis.com/upload/storage/v1/b';", + "ctx": { + "type": "declaration", + "name": "STORAGE_UPLOAD_BASE_URL", + "value": "'https://www.googleapis.com/upload/storage/v1/b'", + "string": "STORAGE_UPLOAD_BASE_URL" + } + }, + { + "tags": [ + { + "type": "constructor", + "string": "" + }, + { + "type": "param", + "types": [ + "buffer" + ], + "name": "buffer", + "description": "- The buffer to stream. " + }, + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

Readable stream implementation to stream the given buffer.

", + "summary": "

Readable stream implementation to stream the given buffer.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "function BufferStream(buffer) {\n stream.Readable.call(this);\n this.data = buffer;\n}\n\nnodeutil.inherits(BufferStream, stream.Readable);", + "ctx": { + "type": "function", + "name": "BufferStream", + "string": "BufferStream()" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + } + ], + "description": { + "full": "

Push the provided buffer to the stream.

", + "summary": "

Push the provided buffer to the stream.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "BufferStream.prototype._read = function() {\n this.push(this.data);\n this.push(null);\n};", + "ctx": { + "type": "method", + "constructor": "BufferStream", + "cons": "BufferStream", + "name": "_read", + "string": "BufferStream.prototype._read()" + } + }, + { + "tags": [ + { + "type": "alias", + "string": "module:storage " + }, + { + "type": "throws", + "types": [ + "if" + ], + "description": "a bucket name isn't provided. " + }, + { + "type": "param", + "types": [ + "object" + ], + "name": "options", + "description": "- Configuration options." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "options.bucketName", + "description": "- Name of the bucket." + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "options.keyFilename", + "description": "- Full path to the JSON key downloaded from the Google Developers Console. Alternatively, you may provide a\n `credentials` object." + }, + { + "type": "param", + "types": [ + "object=" + ], + "name": "options.credentials", + "description": "- Credentials object, used in place of a `keyFilename`.\n" + }, + { + "type": "example", + "string": "var gcloud = require('gcloud');\nvar storage = gcloud.storage;\nvar bucket;\n\n// From Google Compute Engine\nbucket = new storage.Bucket({\n bucketName: YOUR_BUCKET_NAME\n});\n\n// From elsewhere\nbucket = new storage.Bucket({\n bucketName: YOUR_BUCKET_NAME,\n keyFilename: '/path/to/the/key.json'\n});" + } + ], + "description": { + "full": "

Google Cloud Storage allows you to store data on Google infrastructure. See
the guide on {@link https://developers.google.com/storage} to create a
bucket.

", + "summary": "

Google Cloud Storage allows you to store data on Google infrastructure. See
the guide on {@link https://developers.google.com/storage} to create a
bucket.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "function Bucket(options) {\n if (!options.bucketName) {\n throw Error('A bucket name is needed to use Google Cloud Storage');\n }\n this.bucketName = options.bucketName;\n this.conn = new conn.Connection({\n credentials: options.credentials,\n keyFilename: options.keyFilename,\n scopes: SCOPES\n });\n}", + "ctx": { + "type": "function", + "name": "Bucket", + "string": "Bucket()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "object=" + ], + "name": "query", + "description": "- Query object." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "query.delimeter", + "description": "- Results will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose\n names, aside from the prefix, contain delimiter will have their name\n truncated after the delimiter, returned in prefixes. Duplicate prefixes\n are omitted." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "query.prefix", + "description": "- Filters results to objects whose names begin with this prefix." + }, + { + "type": "param", + "types": [ + "number" + ], + "name": "query.maxResults", + "description": "- Maximum number of items plus prefixes to return." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "query.pageToken", + "description": "- A previously-returned page token representing part of the larger set of results to view." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "bucket.list(function(err, files, nextQuery) {\n if (nextQuery) {\n // nextQuery will be non-null if there are more results.\n bucket.list(nextQuery, function(err, files, nextQuery) {});\n }\n});\n\n// Fetch using a query.\nbucket.list({ maxResults: 5 }, function(err, files, nextQuery) {});" + } + ], + "description": { + "full": "

List files from the current bucket.

", + "summary": "

List files from the current bucket.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.list = function(query, callback) {\n if (arguments.length === 1) {\n callback = query;\n query = {};\n }\n this.makeReq('GET', 'o', query, true, function(err, resp) {\n if (err) {\n callback(err);\n return;\n }\n var nextQuery = null;\n if (resp.nextPageToken) {\n nextQuery = util.extend({}, query);\n nextQuery.pageToken = resp.nextPageToken;\n }\n callback(null, resp.items, nextQuery);\n });\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "list", + "string": "Bucket.prototype.list()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the remote file." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "bucket.stat('filename', function(err, metadata){});" + } + ], + "description": { + "full": "

Stat a file.

", + "summary": "

Stat a file.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.stat = function(name, callback) {\n var path = util.format('o/{name}', { name: name });\n this.makeReq('GET', path, null, true, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "stat", + "string": "Bucket.prototype.stat()" + } + }, + { + "tags": [ + { + "type": "throws", + "types": [ + "if" + ], + "description": "the destination filename is not provided. " + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the existing file." + }, + { + "type": "param", + "types": [ + "object" + ], + "name": "metadata", + "description": "- Destination file metadata object." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "metadata.name", + "description": "- Name of the destination file." + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "metadata.bucket", + "description": "- Destination bucket for the file. If none is provided, the source's bucket name is used." + }, + { + "type": "param", + "types": [ + "function=" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "bucket.copy('filename', {\n bucket: 'destination-bucket',\n name: 'destination-filename'\n}, function(err) {});" + } + ], + "description": { + "full": "

Copy an existing file. If no bucket name is provided for the destination
file, the current bucket name will be used.

", + "summary": "

Copy an existing file. If no bucket name is provided for the destination
file, the current bucket name will be used.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.copy = function(name, metadata, callback) {\n callback = callback || util.noop;\n if (!metadata.name) {\n throw new Error('Destination file should have a name.');\n }\n if (!metadata.bucket) {\n metadata.bucket = this.bucketName;\n }\n var path = util.format('o/{srcName}/copyTo/b/{destBucket}/o/{destName}', {\n srcName: name,\n destBucket: metadata.bucket,\n destName: metadata.name\n });\n delete metadata.name;\n delete metadata.bucket;\n this.makeReq('POST', path, null, metadata, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "copy", + "string": "Bucket.prototype.copy()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the file to remove." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "bucket.remove('filename', function(err) {});" + } + ], + "description": { + "full": "

Remove a file.

", + "summary": "

Remove a file.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.remove = function(name, callback) {\n var path = util.format('o/{name}', { name: name });\n this.makeReq('DELETE', path, null, true, callback);\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "remove", + "string": "Bucket.prototype.remove()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "object" + ], + "name": "options", + "description": "- Configuration object." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "options.action", + "description": "- \"read\", \"write\", or \"delete\"" + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "options.contentMd5", + "description": "- The MD5 digest value in base64. If you provide this, the client must provide this HTTP header with this same\n value in its request." + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "options.contentType", + "description": "- If you provide this value, the client must provide this HTTP header set to the same value." + }, + { + "type": "param", + "types": [ + "number" + ], + "name": "options.expires", + "description": "- Timestamp (seconds since epoch) when this link will expire." + }, + { + "type": "param", + "types": [ + "string=" + ], + "name": "options.extensionHeaders", + "description": "- If these headers are used, the server will check to make sure that the client provides matching values." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "options.resource", + "description": "- Resource to allow access to." + }, + { + "type": "return", + "types": [ + "string" + ], + "description": "" + }, + { + "type": "example", + "string": "var signedUrl = bucket.getSignedUrl({\n action: 'read',\n expires: Math.round(Date.now() / 1000) + (60 * 60 * 24 * 14), // 2 weeks.\n resource: 'my-dog.jpg'\n});" + } + ], + "description": { + "full": "

Get a signed URL to allow limited time access to a resource.

{@link https://developers.google.com/storage/docs/accesscontrol#Signed-URLs}

", + "summary": "

Get a signed URL to allow limited time access to a resource.

", + "body": "

{@link https://developers.google.com/storage/docs/accesscontrol#Signed-URLs}

" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.getSignedUrl = function(options) {\n options.action = {\n read: 'GET',\n write: 'PUT',\n delete: 'DELETE'\n }[options.action];\n\n options.resource = util.format('/{bucket}/{resource}', {\n bucket: this.bucketName,\n resource: options.resource\n });\n\n var sign = crypto.createSign('RSA-SHA256');\n sign.update([\n options.action,\n (options.contentMd5 || ''),\n (options.contentType || ''),\n options.expires,\n (options.extensionHeaders || '') + options.resource\n ].join('\\n'));\n var signature = sign.sign(this.conn.credentials.private_key, 'base64');\n\n return [\n 'http://storage.googleapis.com' + options.resource,\n '?GoogleAccessId=' + this.conn.credentials.client_email,\n '&Expires=' + options.expires,\n '&Signature=' + encodeURIComponent(signature)\n ].join('');\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "getSignedUrl", + "string": "Bucket.prototype.getSignedUrl()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the remote file." + }, + { + "type": "return", + "types": [ + "ReadStream" + ], + "description": "" + }, + { + "type": "example", + "string": "// Create a readable stream and write the file contents to \"local-file-path\".\nvar fs = require('fs');\n\nbucket.createReadStream('remote-file-name')\n .pipe(fs.createWriteStream('local-file-path'))\n .on('error', function(err) {});" + } + ], + "description": { + "full": "

Create a readable stream to read contents of the provided remote file. It
can be piped to a write stream, or listened to for 'data' events to read a
file's contents.

", + "summary": "

Create a readable stream to read contents of the provided remote file. It
can be piped to a write stream, or listened to for 'data' events to read a
file's contents.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.createReadStream = function(name) {\n var that = this;\n var dup = duplexify();\n this.stat(name, function(err, metadata) {\n if (err) {\n dup.emit('error', err);\n return;\n }\n that.conn.createAuthorizedReq(\n { uri: metadata.mediaLink }, function(err, req) {\n if (err) {\n dup.emit('error', err);\n return;\n }\n dup.setReadable(that.conn.requester(req));\n });\n });\n return dup;\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "createReadStream", + "string": "Bucket.prototype.createReadStream()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the remote file to create." + }, + { + "type": "param", + "types": [ + "object=" + ], + "name": "metadata", + "description": "- Optional metadata." + }, + { + "type": "return", + "types": [ + "stream" + ], + "description": "" + }, + { + "type": "example", + "string": "// Read from a local file and pipe to your bucket.\nvar fs = require('fs');\n\nfs.createReadStream('local-file-path')\n .pipe(bucket.createWriteStream('remote-file-name'))\n .on('error', function(err) {})\n .on('complete', function(fileObject) {});" + } + ], + "description": { + "full": "

Create a Duplex to handle the upload of a file.

", + "summary": "

Create a Duplex to handle the upload of a file.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.createWriteStream = function(name, metadata) {\n var dup = duplexify();\n this.getWritableStream_(name, (metadata || {}), function(err, writable) {\n if (err) {\n dup.emit('error', err);\n return;\n }\n writable.on('complete', function(res) {\n util.handleResp(null, res, res.body, function(err, data) {\n if (err) {\n dup.emit('error', err);\n return;\n }\n dup.emit('complete', data);\n });\n });\n dup.setWritable(writable);\n dup.pipe(writable);\n });\n return dup;\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "createWriteStream", + "string": "Bucket.prototype.createWriteStream()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- Name of the remote file toc reate." + }, + { + "type": "param", + "types": [ + "object", + "string", + "buffer" + ], + "name": "options", + "description": "- Configuration object or data." + }, + { + "type": "param", + "types": [ + "object=" + ], + "name": "options.metadata", + "description": "- Optional metadata." + }, + { + "type": "param", + "types": [ + "function=" + ], + "name": "callback", + "description": "- The callback function. " + }, + { + "type": "example", + "string": "// Upload \"Hello World\" as file contents. `data` can be any string or buffer.\nbucket.write('filename', {\n data: 'Hello World'\n}, function(err) {});\n\n// A shorthand for the above.\nbucket.write('filename', 'Hello World', function(err) {});" + } + ], + "description": { + "full": "

Write the provided data to the destination with optional metadata.

", + "summary": "

Write the provided data to the destination with optional metadata.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.write = function(name, options, callback) {\n callback = callback || util.noop;\n var data = typeof options === 'object' ? options.data : options;\n var metadata = options.metadata || {};\n\n if (typeof data === 'undefined') {\n // metadata only write\n this.makeReq('PATCH', 'o/' + name, null, metadata, callback);\n return;\n }\n\n if (typeof data === 'string' || data instanceof Buffer) {\n new BufferStream(data).pipe(this.createWriteStream(name, metadata))\n .on('error', callback)\n .on('complete', callback.bind(null, null));\n }\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "write", + "string": "Bucket.prototype.write()" + } + }, + { + "tags": [ + { + "type": "private", + "visibility": "private" + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "name", + "description": "- The desired name of the file." + }, + { + "type": "param", + "types": [ + "object" + ], + "name": "metadata", + "description": "- File descriptive metadata." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function." + } + ], + "description": { + "full": "

Get a remote stream to begin piping a readable stream to.

", + "summary": "

Get a remote stream to begin piping a readable stream to.

", + "body": "" + }, + "isPrivate": true, + "ignore": false, + "code": "Bucket.prototype.getWritableStream_ = function(name, metadata, callback) {\n var boundary = uuid.v4();\n var that = this;\n metadata.contentType = metadata.contentType || 'text/plain';\n this.conn.createAuthorizedReq({\n method: 'POST',\n uri: util.format('{base}/{bucket}/o', {\n base: STORAGE_UPLOAD_BASE_URL,\n bucket: this.bucketName\n }),\n qs: {\n name: name,\n uploadType: 'multipart'\n },\n headers: {\n 'Content-Type': 'multipart/related; boundary=\"' + boundary + '\"'\n }\n }, function(err, req) {\n if (err) {\n callback(err);\n return;\n }\n var remoteStream = that.conn.requester(req);\n remoteStream.callback = util.noop;\n remoteStream.write('--' + boundary + '\\n');\n remoteStream.write('Content-Type: application/json\\n\\n');\n remoteStream.write(JSON.stringify(metadata));\n remoteStream.write('\\n\\n');\n remoteStream.write('--' + boundary + '\\n');\n remoteStream.write('Content-Type: ' + metadata.contentType + '\\n\\n');\n var oldEndFn = remoteStream.end;\n remoteStream.end = function(data, encoding, callback) {\n data = (data || '') + '\\n--' + boundary + '--\\n';\n remoteStream.write(data, encoding, callback);\n oldEndFn.apply(this);\n };\n callback(null, remoteStream);\n });\n};", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "getWritableStream_", + "string": "Bucket.prototype.getWritableStream_()" + } + }, + { + "tags": [ + { + "type": "param", + "types": [ + "string" + ], + "name": "method", + "description": "- Action." + }, + { + "type": "param", + "types": [ + "string" + ], + "name": "path", + "description": "- Request path." + }, + { + "type": "param", + "types": [ + "*" + ], + "name": "query", + "description": "- Request query object." + }, + { + "type": "param", + "types": [ + "*" + ], + "name": "body", + "description": "- Request body contents." + }, + { + "type": "param", + "types": [ + "function" + ], + "name": "callback", + "description": "- The callback function." + } + ], + "description": { + "full": "

Make a new request object from the provided arguments and wrap the callback
to intercept non-successful responses.

", + "summary": "

Make a new request object from the provided arguments and wrap the callback
to intercept non-successful responses.

", + "body": "" + }, + "isPrivate": false, + "ignore": false, + "code": "Bucket.prototype.makeReq = function(method, path, query, body, callback) {\n var reqOpts = {\n method: method,\n qs: query,\n uri: util.format('{base}/{bucket}/{path}', {\n base: STORAGE_BASE_URL,\n bucket: this.bucketName,\n path: path\n })\n };\n if (body) {\n reqOpts.json = body;\n }\n this.conn.req(reqOpts, function(err, res, body) {\n util.handleResp(err, res, body, callback);\n });\n};\n\nmodule.exports.Bucket = Bucket;", + "ctx": { + "type": "method", + "constructor": "Bucket", + "cons": "Bucket", + "name": "makeReq", + "string": "Bucket.prototype.makeReq()" + } + } +] \ No newline at end of file diff --git a/docs/module-datastore.html b/docs/module-datastore.html deleted file mode 100644 index 3cfbb74e55f..00000000000 --- a/docs/module-datastore.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - JSDoc: Module: datastore - - - - - - - - - - -
- -

Module: datastore

- - - - - -
- -
-

- datastore -

- -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Members

- -
- -
-

(static) Dataset

- - -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var datastore = gcloud.datastore;
-
-// Create a Dataset object.
-var dataset = new datastore.Dataset();
- - -
- -
- - - -

Methods

- -
- -
-

(static) double()

- - -
-
- - -
-

Helper function to get a Datastore Double object.

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
var gcloud = require('gcloud');
-
-// Create a Double.
-var threeDouble = gcloud.datastore.double(3.0);
- - -
- - - -
-

(static) int()

- - -
-
- - -
-

Helper function to get a Datastore Integer object.

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
var gcloud = require('gcloud');
-
-// Create an Integer.
-var sevenInteger = gcloud.datastore.int(7);
- - -
- -
- - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/module-gcloud.html b/docs/module-gcloud.html deleted file mode 100644 index a8a94255763..00000000000 --- a/docs/module-gcloud.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - JSDoc: Module: gcloud - - - - - - - - - - -
- -

Module: gcloud

- - - - - -
- -
-

- gcloud -

- -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Members

- -
- -
-

(static) datastore :module:datastore

- - -
-
- -
-

Google Cloud Datastore is a -fully managed, schemaless database for storing non-relational data. Use this -object to create a Dataset to interact with your data, an "Int", and a -"Double" representation.

-
- - - -
Type:
- - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var datastore = gcloud.datastore;
-
-// datastore:
-// {
-//   Dataset: function() {},
-//   double: function() {},
-//   int: function() {}
-// }
- - -
- - - -
-

(static) pubsub :module:pubsub

- - -
-
- -
-

Experimental

-

Google Cloud Pub/Sub -is a reliable, many-to-many, asynchronous messaging service from Google Cloud -Platform.

-

Note: Google Cloud Pub/Sub API is available as a Limited Preview and the -client library we provide is currently experimental. The API and/or the -client might be changed in backward-incompatible ways. This API is not -subject to any SLA or deprecation policy. Request to be whitelisted to use it -by filling the -Limited Preview application form.

-
- - - -
Type:
-
    -
  • - -module:pubsub - - -
  • -
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var pubsub = gcloud.pubsub;
-
-var conn = new pubsub.Connection({
-  projectId: YOUR_PROJECT_ID,
-  keyFilename: '/path/to/the/key.json'
-});
- - -
- - - -
-

(static) storage :module:storage

- - -
-
- -
-

Google Cloud Storage allows you to store data on Google infrastructure. Read -Google Cloud Storage API docs -for more information.

-

You need to create a Google Cloud Storage bucket to use this client library. -Follow the steps on -Google Cloud Storage docs to -create a bucket.

-
- - - -
Type:
- - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - -
Example
- -
var gcloud = require('gcloud');
-var storage = gcloud.storage;
-
-// storage:
-// {
-//   Bucket: function() {}
-// }
- - -
- -
- - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/module-storage.html b/docs/module-storage.html deleted file mode 100644 index 20b9743fc01..00000000000 --- a/docs/module-storage.html +++ /dev/null @@ -1,2070 +0,0 @@ - - - - - JSDoc: Module: storage - - - - - - - - - - -
- -

Module: storage

- - - - - -
- -
-

- storage -

- -
- -
-
- - -
-

(require("storage"))(options)

- - -
-
- - -
-

Google Cloud Storage allows you to store data on Google infrastructure. See -the guide on https://developers.google.com/storage to create a -bucket.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -object - - - -

Configuration options.

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucketName - - -string - - - -

Name of the bucket.

keyFilename - - -string - - - -

Full path to the JSON key downloaded - from the Google Developers Console.

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - -
Throws:
- - - -
- - if a bucket name isn't provided. - -
- - - - - - - -
Example
- -
var gcloud = require('gcloud');
-var storage = gcloud.storage;
-var bucket;
-
-// From Google Compute Engine
-bucket = new storage.Bucket({
-  bucketName: YOUR_BUCKET_NAME
-});
-
-// From elsewhere
-bucket = new storage.Bucket({
-  bucketName: YOUR_BUCKET_NAME,
-  keyFilename: '/path/to/the/key.json'
-});
- - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -

Methods

- -
- -
-

copy(name, metadata, callbackopt)

- - -
-
- - -
-

Copy an existing file. If no bucket name is provided for the destination -file, the current bucket name will be used.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - -

Name of the existing file.

metadata - - -object - - - - - - - - - -

Destination file metadata object.

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - -

Name of the destination file.

bucket - - -string - - - - - - <optional>
- - - - - -

Destination bucket for the file. If none - is provided, the source's bucket name is used.

-
callback - - -function - - - - - - <optional>
- - - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - -
Throws:
- - - -
- - if the destination filename is not provided. - -
- - - - - - - -
Example
- -
bucket.copy('filename', {
-   bucket: 'destination-bucket',
-   name: 'destination-filename'
-}, function(err) {});
- - -
- - - -
-

createReadStream(name) → {ReadStream}

- - -
-
- - -
-

Create a readable stream to read contents of the provided remote file. It -can be piped to a write stream, or listened to for 'data' events to read a -file's contents.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - -

Name of the remote file.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -ReadStream - - -
-
- - - - -
Example
- -
// Create a readable stream and write the file contents to "local-file-path".
-var fs = require('fs');
-
-bucket.createReadStream('remote-file-name')
-   .pipe(fs.createWriteStream('local-file-path'))
-   .on('error', function(err) {});
- - -
- - - -
-

createWriteStream(name, metadataopt) → {stream}

- - -
-
- - -
-

Create a Duplex to handle the upload of a file.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - -

Name of the remote file to create.

metadata - - -object - - - - - - <optional>
- - - - - -

Optional metadata.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -stream - - -
-
- - - - -
Example
- -
// Read from a local file and pipe to your bucket.
-var fs = require('fs');
-
-fs.createReadStream('local-file-path')
-    .pipe(bucket.createWriteStream('remote-file-name'))
-    .on('error', function(err) {})
-    .on('complete', function(fileObject) {});
- - -
- - - -
-

list(queryopt, callback)

- - -
-
- - -
-

List files from the current bucket.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
query - - -object - - - - - - <optional>
- - - - - -

Query object.

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
delimeter - - -string - - - -

Results will contain only objects whose - names, aside from the prefix, do not contain delimiter. Objects whose - names, aside from the prefix, contain delimiter will have their name - truncated after the delimiter, returned in prefixes. Duplicate prefixes - are omitted.

prefix - - -string - - - -

Filters results to objects whose names begin - with this prefix.

maxResults - - -number - - - -

Maximum number of items plus prefixes to - return.

pageToken - - -string - - - -

A previously-returned page token - representing part of the larger set of results to view.

-
callback - - -function - - - - - - - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
bucket.list(function(err, files, nextQuery) {
-  if (nextQuery) {
-    // nextQuery will be non-null if there are more results.
-    bucket.list(nextQuery, function(err, files, nextQuery) {});
-  }
-});
-
-// Fetch using a query.
-bucket.list({ maxResults: 5 }, function(err, files, nextQuery) {});
- - -
- - - -
-

makeReq(method, path, query, body, callback)

- - -
-
- - -
-

Make a new request object from the provided arguments and wrap the callback -to intercept non-successful responses.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
method - - -string - - - -

Action.

path - - -string - - - -

Request path.

query - - -* - - - -

Request query object.

body - - -* - - - -

Request body contents.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-

remove(name, callback)

- - -
-
- - -
-

Remove a file.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - -

Name of the file to remove.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
bucket.remove('filename', function(err) {});
- - -
- - - -
-

stat(name, callback)

- - -
-
- - -
-

Stat a file.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - -

Name of the remote file.

callback - - -function - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
bucket.stat('filename', function(err, metadata){});
- - -
- - - -
-

write(name, options, callbackopt)

- - -
-
- - -
-

Write the provided data to the destination with optional metadata.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - -

Name of the remote file toc reate.

options - - -object -| - -string -| - -buffer - - - - - - - - - -

Configuration object or data.

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
metadata - - -object - - - - - - <optional>
- - - - - -

Optional metadata.

-
callback - - -function - - - - - - <optional>
- - - - - -

The callback function.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
// Upload "Hello World" as file contents. `data` can be any string or buffer.
-bucket.write('filename', {
-  data: 'Hello World'
-}, function(err) {});
-
-// A shorthand for the above.
-bucket.write('filename', 'Hello World', function(err) {});
- - -
- -
- - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/query.html b/docs/query.html deleted file mode 100644 index 1546f978e50..00000000000 --- a/docs/query.html +++ /dev/null @@ -1,1640 +0,0 @@ - - - - - JSDoc: Module: datastore/query - - - - - - - - - - -
- -

Module: datastore/query

- - - - - -
- -
-

- datastore/query -

- -
- -
-
- - -
-

new (require("datastore/query"))(namespaceopt, kinds)

- - -
-
- - -
-

Build a Query object.

-

Queries should be built with -module:datastore/dataset#createQuery and run via -module:datastore/dataset#runQuery.

-

Reference: http://goo.gl/Cag0r6

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
namespace - - -string - - - - - - <optional>
- - - - - -

Namespace to query entities from.

kinds - - -Array.<string> - - - - - - - - - -

Kinds to query.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Example
- -
var query;
-
-// If your dataset was scoped to a namespace at initialization, your query
-// will likewise be scoped to that namespace.
-query = dataset.createQuery(['Lion', 'Chimp']);
-
-// However, you may override the namespace per query.
-query = dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);
-
-// You may also remove the namespace altogether.
-query = dataset.createQuery(null, ['Lion', 'Chimp']);
- - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -

Methods

- -
- -
-

end(cursorToken) → {module:datastore/query}

- - -
-
- - -
-

Set an ending cursor to a query.

-

Reference: http://goo.gl/WuTGRI

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
cursorToken - - -string - - - -

The ending cursor token.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
var cursorToken = 'X';
-
-// Retrieve results limited to the extent of cursorToken.
-var endQuery = companyQuery.end(cursorToken);
- - -
- - - -
-

filter(filter, value) → {module:datastore/query}

- - -
-
- - -
-

Datastore allows querying on properties. Supported comparison operators -are =, <, >, <=, and >=. "Not equal" and IN operators are -currently not supported.

-

To filter by ancestors, see module:datastore/query#hasAncestor.

-

Reference: http://goo.gl/ENCx7e

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
filter - - -string - - - -

Property + Operator (=, <, >, <=, >=).

value - - -* - - - -

Value to compare property to.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
// List all companies named Google that have less than 400 employees.
-var companyQuery = query
-  .filter('name =', 'Google');
-  .filter('size <', 400);
-
-// To filter by key, use `__key__` for the property name. Filter on keys
-// stored as properties is not currently supported.
-var keyQuery = query.filter('__key__ =', datastore.key('Company', 'Google'));
- - -
- - - -
-

groupBy(properties) → {module:datastore/query}

- - -
-
- - -
-

Group query results by a list of properties.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
properties - - -array - - - -

Properties to group by.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
var groupedQuery = companyQuery.groupBy(['name', 'size']);
- - -
- - - -
-

hasAncestor(key) → {module:datastore/query}

- - -
-
- - -
-

Filter a query by ancestors.

-

Reference: http://goo.gl/1qfpkZ

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -datastore/entity~Key - - - -

Key object to filter by.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
var ancestoryQuery = query.hasAncestor(datastore.key('Parent', 123));
- - -
- - - -
-

limit(n) → {module:datastore/query}

- - -
-
- - -
-

Set a limit on a query.

-

Reference: http://goo.gl/f0VZ0n

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
n - - -number - - - -

The number of results to limit the query to.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
// Limit the results to 10 entities.
-var limitQuery = companyQuery.limit(10);
- - -
- - - -
-

offset(n) → {module:datastore/query}

- - -
-
- - -
-

Set an offset on a query.

-

Reference: http://goo.gl/f0VZ0n

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
n - - -number - - - -

The offset to start from after the start cursor.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
// Start from the 101st result.
-var offsetQuery = companyQuery.offset(100);
- - -
- - - -
-

order(property) → {module:datastore/query}

- - -
-
- - -
-

Sort the results by a property name ascendingly or descendingly. By default, -an ascending sort order will be used.

-

Reference: http://goo.gl/mfegFR

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
property - - -string - - - -

Optional operator (+, -) and property to order by.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
// Sort by size ascendingly.
-var companiesAscending = companyQuery.order('size');
-
-// Sort by size descendingly.
-var companiesDescending = companyQuery.order('-size');
- - -
- - - -
-

select(fieldNames) → {module:datastore/query}

- - -
-
- - -
-

Retrieve only select properties from the matched entities.

-

Reference: Projection Queries

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fieldNames - - -array - - - -

Properties to return from the matched entities.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
// Only retrieve the name and size properties.
-var selectQuery = companyQuery.select(['name', 'size']);
- - -
- - - -
-

start(cursorToken) → {module:datastore/query}

- - -
-
- - -
-

Set a starting cursor to a query.

-

Reference: http://goo.gl/WuTGRI

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
cursorToken - - -string - - - -

The starting cursor token.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -module:datastore/query - - -
-
- - - - -
Example
- -
var cursorToken = 'X';
-
-// Retrieve results starting from cursorToken.
-var startQuery = companyQuery.start(cursorToken);
- - -
- -
- - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/query.js.html b/docs/query.js.html deleted file mode 100644 index 31bc107f481..00000000000 --- a/docs/query.js.html +++ /dev/null @@ -1,313 +0,0 @@ - - - - - JSDoc: Source: datastore/query.js - - - - - - - - - - -
- -

Source: datastore/query.js

- - - - - -
-
-
/**
- * Copyright 2014 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @module datastore/query
- */
-
-'use strict';
-
-var util = require('../common/util.js');
-
-/**
- * Build a Query object.
- *
- * **Queries should be built with
- * {@linkcode module:datastore/dataset#createQuery} and run via
- * {@linkcode module:datastore/dataset#runQuery}.**
- *
- * *Reference: {@link http://goo.gl/Cag0r6}*
- *
- * @constructor
- * @alias module:datastore/query
- *
- * @param {string=} namespace - Namespace to query entities from.
- * @param {string[]} kinds - Kinds to query.
- *
- * @example
- * var query;
- *
- * // If your dataset was scoped to a namespace at initialization, your query
- * // will likewise be scoped to that namespace.
- * query = dataset.createQuery(['Lion', 'Chimp']);
- *
- * // However, you may override the namespace per query.
- * query = dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);
- *
- * // You may also remove the namespace altogether.
- * query = dataset.createQuery(null, ['Lion', 'Chimp']);
- */
-function Query(namespace, kinds) {
-  if (!kinds) {
-    kinds = namespace;
-    namespace = null;
-  }
-
-  this.namespace = namespace || null;
-  this.kinds = kinds;
-
-  this.filters = [];
-  this.orders = [];
-  this.groupByVal = [];
-  this.selectVal = [];
-
-  // pagination
-  this.startVal = null;
-  this.endVal = null;
-  this.limitVal = -1;
-  this.offsetVal = -1;
-}
-
-/**
- * Datastore allows querying on properties. Supported comparison operators
- * are `=`, `<`, `>`, `<=`, and `>=`. "Not equal" and `IN` operators are
- * currently not supported.
- *
- * *To filter by ancestors, see {@linkcode module:datastore/query#hasAncestor}.*
- *
- * *Reference: {@link http://goo.gl/ENCx7e}*
- *
- * @param {string} filter - Property + Operator (=, <, >, <=, >=).
- * @param {*} value - Value to compare property to.
- * @return {module:datastore/query}
- *
- * @example
- * // List all companies named Google that have less than 400 employees.
- * var companyQuery = query
- *   .filter('name =', 'Google');
- *   .filter('size <', 400);
- *
- * // To filter by key, use `__key__` for the property name. Filter on keys
- * // stored as properties is not currently supported.
- * var keyQuery = query.filter('__key__ =', datastore.key('Company', 'Google'));
- */
-Query.prototype.filter = function(filter, value) {
-  // TODO: Add filter validation.
-  var q = util.extend(this, new Query());
-  filter = filter.trim();
-  var fieldName = filter.replace(/[>|<|=|>=|<=]*$/, '').trim();
-  var op = filter.substr(fieldName.length, filter.length).trim();
-  q.filters = q.filters || [];
-  q.filters.push({ name: fieldName, op: op, val: value });
-  return q;
-};
-
-/**
- * Filter a query by ancestors.
- *
- * *Reference: {@link http://goo.gl/1qfpkZ}*
- *
- * @param {datastore/entity~Key} key - Key object to filter by.
- * @return {module:datastore/query}
- *
- * @example
- * var ancestoryQuery = query.hasAncestor(datastore.key('Parent', 123));
- */
-Query.prototype.hasAncestor = function(key) {
-  var q = util.extend(this, new Query());
-  this.filters.push({ name: '__key__', op: 'HAS_ANCESTOR', val: key });
-  return q;
-};
-
-/**
- * Sort the results by a property name ascendingly or descendingly. By default,
- * an ascending sort order will be used.
- *
- * *Reference: {@link http://goo.gl/mfegFR}*
- *
- * @param {string} property - Optional operator (+, -) and property to order by.
- * @return {module:datastore/query}
- *
- * @example
- * // Sort by size ascendingly.
- * var companiesAscending = companyQuery.order('size');
- *
- * // Sort by size descendingly.
- * var companiesDescending = companyQuery.order('-size');
- */
-Query.prototype.order = function(property) {
-  var q = util.extend(this, new Query());
-  var sign = '+';
-  if (property[0] === '-' || property[0] === '+') {
-    sign = property[0];
-    property = property.substr(1);
-  }
-  q.orders = q.orders || [];
-  q.orders.push({ name: property, sign: sign });
-  return q;
-};
-
-/**
- * Group query results by a list of properties.
- *
- * @param {array} properties - Properties to group by.
- * @return {module:datastore/query}
- *
- * @example
- * var groupedQuery = companyQuery.groupBy(['name', 'size']);
- */
-Query.prototype.groupBy = function(fieldNames) {
-  var fields = util.arrayize(fieldNames);
-  var q = util.extend(this, new Query());
-  q.groupByVal = fields;
-  return q;
-};
-
-/**
- * Retrieve only select properties from the matched entities.
- *
- * *Reference: [Projection Queries]{@link http://goo.gl/EfsrJl}*
- *
- * @param {array} fieldNames - Properties to return from the matched entities.
- * @return {module:datastore/query}
- *
- * @example
- * // Only retrieve the name and size properties.
- * var selectQuery = companyQuery.select(['name', 'size']);
- */
-Query.prototype.select = function(fieldNames) {
-  var q = util.extend(this, new Query());
-  q.selectVal = fieldNames;
-  return q;
-};
-
-/**
- * Set a starting cursor to a query.
- *
- * *Reference: {@link http://goo.gl/WuTGRI}*
- *
- * @param {string} cursorToken - The starting cursor token.
- * @return {module:datastore/query}
- *
- * @example
- * var cursorToken = 'X';
- *
- * // Retrieve results starting from cursorToken.
- * var startQuery = companyQuery.start(cursorToken);
- */
-Query.prototype.start = function(start) {
-  var q = util.extend(this, new Query());
-  q.startVal = start;
-  return q;
-};
-
-/**
- * Set an ending cursor to a query.
- *
- * *Reference: {@link http://goo.gl/WuTGRI}*
- *
- * @param {string} cursorToken - The ending cursor token.
- * @return {module:datastore/query}
- *
- * @example
- * var cursorToken = 'X';
- *
- * // Retrieve results limited to the extent of cursorToken.
- * var endQuery = companyQuery.end(cursorToken);
- */
-Query.prototype.end = function(end) {
-  var q = util.extend(this, new Query());
-  q.endVal = end;
-  return q;
-};
-
-/**
- * Set a limit on a query.
- *
- * *Reference: {@link http://goo.gl/f0VZ0n}*
- *
- * @param {number} n - The number of results to limit the query to.
- * @return {module:datastore/query}
- *
- * @example
- * // Limit the results to 10 entities.
- * var limitQuery = companyQuery.limit(10);
- */
-Query.prototype.limit = function(n) {
-  var q = util.extend(this, new Query());
-  q.limitVal = n;
-  return q;
-};
-
-/**
- * Set an offset on a query.
- *
- * *Reference: {@link http://goo.gl/f0VZ0n}*
- *
- * @param {number} n - The offset to start from after the start cursor.
- * @return {module:datastore/query}
- *
- * @example
- * // Start from the 101st result.
- * var offsetQuery = companyQuery.offset(100);
- */
-Query.prototype.offset = function(n) {
-  var q = util.extend(this, new Query());
-  q.offsetVal = n;
-  return q;
-};
-
-module.exports = Query;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js deleted file mode 100644 index 8d52f7eafdb..00000000000 --- a/docs/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = 'line' + lineNumber; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/docs/scripts/prettify/Apache-License-2.0.txt b/docs/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d6456956733..00000000000 --- a/docs/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/docs/scripts/prettify/lang-css.js b/docs/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f59067..00000000000 --- a/docs/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/docs/scripts/prettify/prettify.js b/docs/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7e6a0..00000000000 --- a/docs/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p p:first-child -{ - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; -} - -.disabled { - color: #454545; -} diff --git a/docs/styles/prettify-jsdoc.css b/docs/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e3748..00000000000 --- a/docs/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/docs/styles/prettify-tomorrow.css b/docs/styles/prettify-tomorrow.css deleted file mode 100644 index aa2908c251e..00000000000 --- a/docs/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: #718c00; } - - /* a keyword */ - .kwd { - color: #8959a8; } - - /* a comment */ - .com { - color: #8e908c; } - - /* a type name */ - .typ { - color: #4271ae; } - - /* a literal value */ - .lit { - color: #f5871f; } - - /* punctuation */ - .pun { - color: #4d4d4c; } - - /* lisp open bracket */ - .opn { - color: #4d4d4c; } - - /* lisp close bracket */ - .clo { - color: #4d4d4c; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Menlo, Monaco, Consolas, monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/lib/datastore/dataset.js b/lib/datastore/dataset.js index 66d26a2145e..ed0e71b3db8 100644 --- a/lib/datastore/dataset.js +++ b/lib/datastore/dataset.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,52 +14,52 @@ * limitations under the License. */ -/** +/*! * @module datastore/dataset */ 'use strict'; /** - * @private * @type module:common/connection + * @private */ var conn = require('../common/connection.js'); /** - * @private * @type module:datastore/entity + * @private */ var entity = require('./entity.js'); /** - * @private * @type module:datastore/pb + * @private */ var pb = require('./pb.js'); /** - * @private * @type module:datastore/query + * @private */ var Query = require('./query.js'); /** - * @private * @type module:datastore/transaction + * @private */ var Transaction = require('./transaction.js'); /** - * @private * @type module:common/util + * @private */ var util = require('../common/util.js'); /** * Scopes for Google Datastore access. - * @private * @const {array} SCOPES + * @private */ var SCOPES = [ 'https://www.googleapis.com/auth/datastore', @@ -67,7 +67,7 @@ var SCOPES = [ ]; /** - * Intract with a dataset from the + * Interact with a dataset from the * [Google Cloud Datastore]{@link https://developers.google.com/datastore/}. * * @constructor @@ -158,8 +158,7 @@ Dataset.prototype.createQuery = function(namespace, kinds) { * * @borrows {module:datastore/transaction#get} as get * - * @param {module:datastore/entity~Key|module:datastore/entity~Key[]} key - - * Datastore key object(s). + * @param {Key|Key[]} key - Datastore key object(s). * @param {function} callback - The callback function. * * @example @@ -344,8 +343,8 @@ Dataset.prototype.allocateIds = function(incompleteKey, n, callback) { /** * Create a new Transaction object using the existing connection and dataset. * - * @private * @return {module:datastore/transaction} + * @private */ Dataset.prototype.createTransaction_ = function() { return new Transaction(this.connection, this.id); diff --git a/lib/datastore/entity.js b/lib/datastore/entity.js index 5fe63dd2ad6..c73c042836c 100644 --- a/lib/datastore/entity.js +++ b/lib/datastore/entity.js @@ -167,7 +167,7 @@ module.exports.entityFromEntityProto = entityFromEntityProto; * Convert a key protocol object to a Key object. * * @param {object} proto - The key protocol object to convert. - * @return {module:datastore/entity~Key} + * @return {Key} * * @example * var key = keyFromKeyProto({ @@ -202,7 +202,7 @@ module.exports.keyFromKeyProto = keyFromKeyProto; /** * Convert a Key object to a key protocol object. * - * @param {module:datastore/entity~Key} key - The Key object to convert. + * @param {Key} key - The Key object to convert. * @return {object} * * @example @@ -264,7 +264,7 @@ module.exports.keyToKeyProto = keyToKeyProto; * * // entityObjects: * // { - * // key: {module:datastore/entity~Key}, + * // key: {}, * // data: { * // fieldName: 'value' * // } @@ -286,7 +286,7 @@ module.exports.formatArray = formatArray; /** * Check if a key is complete. * - * @param {module:datastore/entity~Key} key - The Key object. + * @param {Key} key - The Key object. * @return {boolean} * * @example diff --git a/lib/datastore/index.js b/lib/datastore/index.js index 2fb207a0a19..1ee836ac2e6 100644 --- a/lib/datastore/index.js +++ b/lib/datastore/index.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,19 +14,21 @@ * limitations under the License. */ -/** +/*! * @module datastore */ 'use strict'; /** - * @private * @type module:datastore/entity + * @private */ var entity = require('./entity'); -/** @alias module:datastore */ +/*! + * @alias module:datastore + */ var datastore = {}; /** @@ -44,6 +46,9 @@ datastore.Dataset = require('./dataset'); /** * Helper function to get a Datastore Integer object. * + * @param {number} value - The integer value. + * @return {object} + * * @example * var gcloud = require('gcloud'); * @@ -57,6 +62,9 @@ datastore.int = function(value) { /** * Helper function to get a Datastore Double object. * + * @param {number} value - The double value. + * @return {object} + * * @example * var gcloud = require('gcloud'); * diff --git a/lib/datastore/query.js b/lib/datastore/query.js index 8ec31340510..d86d9e90b9f 100644 --- a/lib/datastore/query.js +++ b/lib/datastore/query.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,12 +14,16 @@ * limitations under the License. */ -/** +/*! * @module datastore/query */ 'use strict'; +/** + * @type {module:common/util} + * @private + */ var util = require('../common/util.js'); /** @@ -110,7 +114,7 @@ Query.prototype.filter = function(filter, value) { * * *Reference: {@link http://goo.gl/1qfpkZ}* * - * @param {datastore/entity~Key} key - Key object to filter by. + * @param {Key} key - Key object to filter by. * @return {module:datastore/query} * * @example diff --git a/lib/datastore/transaction.js b/lib/datastore/transaction.js index 68faecfc39e..6c1f512a129 100644 --- a/lib/datastore/transaction.js +++ b/lib/datastore/transaction.js @@ -189,7 +189,7 @@ Transaction.prototype.finalize = function(callback) { * transaction. Get operations require a valid key to retrieve the * key-identified entity from Datastore. * - * @param {module:datastore/entity~Key|module:datastore/entity~Key[]} key - + * @param {Key|Key[]} key - * Datastore key object(s). * @param {function} callback - The callback function. * diff --git a/lib/index.js b/lib/index.js index 26723947b97..c693970ce71 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +14,15 @@ * limitations under the License. */ -/** +/*! * @module gcloud */ 'use strict'; -/** @alias module:gcloud */ +/*! + * @alias module:gcloud + */ var gcloud = {}; /** @@ -30,9 +32,8 @@ var gcloud = {}; * "Double" representation. * * @type {module:datastore} - * @see {module:datastore} * - * @return {object} + * @return {module:datastore} * * @example * var gcloud = require('gcloud'); @@ -87,9 +88,8 @@ gcloud.pubsub = require('./pubsub'); * create a bucket. * @type {module:storage} - * @see {module:storage} * - * @return {object} + * @return {module:storage} * * @example * var gcloud = require('gcloud'); diff --git a/lib/storage/index.js b/lib/storage/index.js index 28fc21a3922..6330947d549 100644 --- a/lib/storage/index.js +++ b/lib/storage/index.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +14,7 @@ * limitations under the License. */ -/** +/*! * @module storage */ @@ -27,44 +27,44 @@ var stream = require('stream'); var uuid = require('node-uuid'); /** - * @private * @type module:common/connection + * @private */ var conn = require('../common/connection.js'); /** - * @private * @type module:common/util + * @private */ var util = require('../common/util.js'); /** * Required scopes for Google Cloud Storage API. - * @private * @const {array} + * @private */ var SCOPES = ['https://www.googleapis.com/auth/devstorage.full_control']; /** - * @private * @const {string} + * @private */ var STORAGE_BASE_URL = 'https://www.googleapis.com/storage/v1/b'; /** - * @private * @const {string} + * @private */ var STORAGE_UPLOAD_BASE_URL = 'https://www.googleapis.com/upload/storage/v1/b'; /** * Readable stream implementation to stream the given buffer. * - * @private - * * @constructor * * @param {buffer} buffer - The buffer to stream. + * + * @private */ function BufferStream(buffer) { stream.Readable.call(this); @@ -75,6 +75,7 @@ nodeutil.inherits(BufferStream, stream.Readable); /** * Push the provided buffer to the stream. + * @private */ BufferStream.prototype._read = function() { this.push(this.data); @@ -258,13 +259,11 @@ Bucket.prototype.remove = function(name, callback) { * @return {string} * * @example - * ```js * var signedUrl = bucket.getSignedUrl({ * action: 'read', * expires: Math.round(Date.now() / 1000) + (60 * 60 * 24 * 14), // 2 weeks. * resource: 'my-dog.jpg' * }); - * ``` */ Bucket.prototype.getSignedUrl = function(options) { options.action = { diff --git a/package.json b/package.json index 0c7c34e1f10..f73576097f7 100644 --- a/package.json +++ b/package.json @@ -54,15 +54,15 @@ }, "devDependencies": { "coveralls": "^2.11.1", + "dox": "^0.4.6", "istanbul": "^0.3.0", - "jsdoc": "^3.3.0-alpha9", "jshint": "^2.5.2", "mocha": "^1.21.3", "sandboxed-module": "^1.0.1", "tmp": "0.0.24" }, "scripts": { - "docs": "jsdoc -c .jsdoc.json && cp docs/module-gcloud.html docs/index.html", + "docs": "dox < lib/index.js > docs/json/index.json & dox < lib/datastore/dataset.js > docs/json/datastore/dataset.json & dox < lib/datastore/index.js > docs/json/datastore/index.json & dox < lib/datastore/query.js > docs/json/datastore/query.json & dox < lib/storage/index.js > docs/json/storage/index.json", "lint": "jshint lib/ regression/ test/", "test": "mocha --recursive --reporter spec", "regression-test": "mocha regression/datastore.js regression/storage.js --reporter spec --timeout 15000",