Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umbrella: add promise support #1714

Merged
merged 1 commit into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions packages/google-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@
"vision"
],
"dependencies": {
"@google-cloud/bigquery": "^0.3.0",
"@google-cloud/bigtable": "^0.4.0",
"@google-cloud/compute": "^0.2.0",
"@google-cloud/datastore": "^0.4.0",
"@google-cloud/dns": "^0.2.0",
"@google-cloud/language": "^0.3.0",
"@google-cloud/logging": "^0.3.0",
"@google-cloud/prediction": "^0.2.0",
"@google-cloud/pubsub": "^0.3.0",
"@google-cloud/resource": "^0.2.0",
"@google-cloud/speech": "^0.2.0",
"@google-cloud/storage": "^0.2.0",
"@google-cloud/translate": "^0.3.0",
"@google-cloud/vision": "^0.3.0",
"@google-cloud/bigquery": "^0.4.0",
"@google-cloud/bigtable": "^0.5.0",
"@google-cloud/compute": "^0.3.0",
"@google-cloud/datastore": "^0.5.0",
"@google-cloud/dns": "^0.3.0",
"@google-cloud/language": "^0.4.0",
"@google-cloud/logging": "^0.4.0",
"@google-cloud/prediction": "^0.3.0",
"@google-cloud/pubsub": "^0.4.0",
"@google-cloud/resource": "^0.3.0",
"@google-cloud/speech": "^0.3.0",
"@google-cloud/storage": "^0.3.0",
"@google-cloud/translate": "^0.4.0",
"@google-cloud/vision": "^0.4.0",
"extend": "^3.0.0"
},
"devDependencies": {
Expand Down
14 changes: 13 additions & 1 deletion packages/google-cloud/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ var apis = {
* true)
* @param {number} options.maxRetries - Maximum number of automatic retries
* attempted before returning the error. (default: 3)
* @param {function} options.promise - Custom promise module to use instead of
* native Promises.
*
* @example
* var gcloud = require('google-cloud')({
Expand Down Expand Up @@ -476,13 +478,23 @@ var apis = {
* bucket.getMetadata(function() {
* // This HTTP request was sent with the 'I win!' header specified above.
* });
*
* //-
* // By default any methods that return a Promise object will use the native
* // Promise constructor. If you wish to use a third-party library such as
* // Bluebird, you can specify this via the `promise` option.
* //-
* var gcloud = require('google-cloud')({
* promise: require('bluebird')
* });
*/
function gcloud(config) {
config = extend(true, { interceptors_: [] }, config);

var gcloudExposedApi = {
config_: config,
interceptors: config.interceptors_
interceptors: config.interceptors_,
promise: null
};

return Object.keys(apis).reduce(function(gcloudExposedApi, apiName) {
Expand Down