@@ -392,7 +392,6 @@ DatastoreRequest.prototype.insert = function(entities, callback) {
392392 * - `MORE_RESULTS_AFTER_CURSOR`: There *may* be more results after the
393393 * specified end cursor.
394394 * - `NO_MORE_RESULTS`: There are no more results.
395- * @param {object } callback.apiResponse - The full API response.
396395 *
397396 * @example
398397 * //-
@@ -401,7 +400,7 @@ DatastoreRequest.prototype.insert = function(entities, callback) {
401400 * //-
402401 * var query = datastore.createQuery('Lion');
403402 *
404- * datastore.runQuery(query, function(err, entities, info, apiResponse ) {});
403+ * datastore.runQuery(query, function(err, entities, info) {});
405404 *
406405 * //-
407406 * // Or, if you're using a transaction object.
@@ -420,7 +419,6 @@ DatastoreRequest.prototype.insert = function(entities, callback) {
420419 * .on('error', console.error)
421420 * .on('data', function (entity) {})
422421 * .on('info', function(info) {})
423- * .on('response', function(apiResponse) {})
424422 * .on('end', function() {
425423 * // All entities retrieved.
426424 * });
@@ -453,21 +451,17 @@ DatastoreRequest.prototype.runQuery = function(query, options, callback) {
453451
454452 options = options || { } ;
455453
456- var apiResponse ;
457454 var info ;
458455
459456 if ( is . fn ( callback ) ) {
460457 // Run this method in stream mode and send the results back to the callback.
461458 this . runQuery ( query , options )
462459 . on ( 'error' , callback )
463- . on ( 'response' , function ( apiResponse_ ) {
464- apiResponse = apiResponse_ ;
465- } )
466460 . on ( 'info' , function ( info_ ) {
467461 info = info_ ;
468462 } )
469463 . pipe ( concat ( function ( results ) {
470- callback ( null , results , info , apiResponse ) ;
464+ callback ( null , results , info ) ;
471465 } ) ) ;
472466 return ;
473467 }
@@ -496,6 +490,8 @@ DatastoreRequest.prototype.runQuery = function(query, options, callback) {
496490 } ;
497491 }
498492
493+ this . request_ ( protoOpts , reqOpts , onResponse ) ;
494+
499495 function onResponse ( err , resp ) {
500496 if ( err ) {
501497 stream . destroy ( err ) ;
@@ -523,7 +519,6 @@ DatastoreRequest.prototype.runQuery = function(query, options, callback) {
523519 }
524520
525521 if ( resp . batch . moreResults !== 'NOT_FINISHED' ) {
526- stream . emit ( 'response' , resp ) ;
527522 stream . emit ( 'info' , info ) ;
528523 stream . push ( null ) ;
529524 return ;
@@ -546,8 +541,6 @@ DatastoreRequest.prototype.runQuery = function(query, options, callback) {
546541 } ) ;
547542 }
548543
549- this . request_ ( protoOpts , reqOpts , onResponse ) ;
550-
551544 return stream ;
552545} ;
553546
0 commit comments