@@ -23,7 +23,7 @@ import * as util from 'util';
2323
2424import  { DefaultTransporter ,  Transporter }  from  '../transporters' ; 
2525
26- import  { RequestCallback }  from  './../transporters' ; 
26+ import  { BodyResponseCallback }  from  './../transporters' ; 
2727import  Compute  from  './computeclient' ; 
2828import  IAMAuth  from  './iam' ; 
2929import  JWTAccess  from  './jwtaccess' ; 
@@ -95,7 +95,7 @@ export default class GoogleAuth {
9595
9696 /** 
9797 * Obtains the default project ID for the application.. 
98-  * @param  {function= } opt_callback  Optional callback. 
98+  * @param  {function= } callback  Optional callback. 
9999 */ 
100100 public  getDefaultProjectId ( callback : ProjectIdCallback )  { 
101101 // In implicit case, supports three environments. In order of precedence, 
@@ -161,15 +161,15 @@ export default class GoogleAuth {
161161
162162 /** 
163163 * Obtains the default service-level credentials for the application.. 
164-  * @param  {function= } opt_callback  Optional callback. 
164+  * @param  {function= } callback  Optional callback. 
165165 */ 
166166 public  getApplicationDefault ( 
167-  opt_callback : ( err : Error ,  credential : any ,  projectId : string )  =>  void )  { 
167+  callback ? : ( err : Error ,  credential : any ,  projectId : string )  =>  void )  { 
168168 // If we've already got a cached credential, just return it. 
169169 if  ( this . cachedCredential )  { 
170170 setImmediate ( ( )  =>  { 
171171 this . callback ( 
172-  opt_callback ,  null ,  this . cachedCredential ,  this . _cachedProjectId ) ; 
172+  callback ,  null ,  this . cachedCredential ,  this . _cachedProjectId ) ; 
173173 } ) ; 
174174 }  else  { 
175175 // Inject our own callback routine, which will cache the credential once 
@@ -181,12 +181,12 @@ export default class GoogleAuth {
181181 this . getDefaultProjectId ( ( err2 ,  projectId )  =>  { 
182182 setImmediate ( ( )  =>  { 
183183 // Ignore default project error 
184-  this . callback ( opt_callback ,  null ,  result ,  projectId ) ; 
184+  this . callback ( callback ,  null ,  result ,  projectId ) ; 
185185 } ) ; 
186186 } ) ; 
187187 }  else  { 
188188 setImmediate ( ( )  =>  { 
189-  this . callback ( opt_callback ,  err ,  result ) ; 
189+  this . callback ( callback ,  err ,  result ) ; 
190190 } ) ; 
191191 } 
192192 } ; 
@@ -246,12 +246,12 @@ export default class GoogleAuth {
246246
247247 /** 
248248 * Attempts to load default credentials from the environment variable path.. 
249-  * @param  {function= } opt_callback  Optional callback. 
249+  * @param  {function= } callback  Optional callback. 
250250 * @return  {boolean } Returns true if the callback has been executed; false otherwise. 
251251 * @api  private 
252252 */ 
253253 public  _tryGetApplicationCredentialsFromEnvironmentVariable ( 
254-  opt_callback : ( err : Error ,  result : any )  =>  void )  { 
254+  callback ? : ( err : Error ,  result : any )  =>  void )  { 
255255 const  credentialsPath  =  this . _getEnv ( 'GOOGLE_APPLICATION_CREDENTIALS' ) ; 
256256 if  ( ! credentialsPath  ||  credentialsPath . length  ===  0 )  { 
257257 return  false ; 
@@ -264,19 +264,19 @@ export default class GoogleAuth {
264264 'environment variable.' , 
265265 err ) ; 
266266 } 
267-  this . callback ( opt_callback ,  wrappedError ,  result ) ; 
267+  this . callback ( callback ,  wrappedError ,  result ) ; 
268268 } ) ; 
269269 return  true ; 
270270 } 
271271
272272 /** 
273273 * Attempts to load default credentials from a well-known file location 
274-  * @param  {function= } opt_callback  Optional callback. 
274+  * @param  {function= } callback  Optional callback. 
275275 * @return  {boolean } Returns true if the callback has been executed; false otherwise. 
276276 * @api  private 
277277 */ 
278278 public  _tryGetApplicationCredentialsFromWellKnownFile ( 
279-  opt_callback ?: ( err : Error ,  result : any )  =>  void )  { 
279+  callback ?: ( err : Error ,  result ? : any )  =>  void )  { 
280280 // First, figure out the location of the file, depending upon the OS type. 
281281 let  location  =  null ; 
282282 if  ( this . _isWindows ( ) )  { 
@@ -305,18 +305,18 @@ export default class GoogleAuth {
305305 return  false ; 
306306 } 
307307 // The file seems to exist. Try to use it. 
308-  this . _getApplicationCredentialsFromFilePath ( location ,  opt_callback ) ; 
308+  this . _getApplicationCredentialsFromFilePath ( location ,  callback ) ; 
309309 return  true ; 
310310 } 
311311
312312 /** 
313313 * Attempts to load default credentials from a file at the given path.. 
314314 * @param  {string= } filePath The path to the file to read. 
315-  * @param  {function= } opt_callback  Optional callback. 
315+  * @param  {function= } callback  Optional callback. 
316316 * @api  private 
317317 */ 
318318 public  _getApplicationCredentialsFromFilePath ( 
319-  filePath : string ,  opt_callback : ( err : Error ,  result ?: any )  =>  void )  { 
319+  filePath : string ,  callback : ( err : Error ,  result ?: any )  =>  void )  { 
320320 let  error  =  null ; 
321321 // Make sure the path looks like a string. 
322322 if  ( ! filePath  ||  filePath . length  ===  0 )  { 
@@ -346,27 +346,27 @@ export default class GoogleAuth {
346346 if  ( ! error )  { 
347347 try  { 
348348 const  stream  =  this . _createReadStream ( filePath ) ; 
349-  this . fromStream ( stream ,  opt_callback ) ; 
349+  this . fromStream ( stream ,  callback ) ; 
350350 }  catch  ( err )  { 
351351 error  =  this . createError ( 
352352 util . format ( 'Unable to read the file at %s.' ,  filePath ) ,  err ) ; 
353353 } 
354354 } 
355355 if  ( error )  { 
356-  this . callback ( opt_callback ,  error ) ; 
356+  this . callback ( callback ,  error ) ; 
357357 } 
358358 } 
359359
360360 /** 
361361 * Create a credentials instance using the given input options. 
362362 * @param  {object= } json The input object. 
363-  * @param  {function= } opt_callback  Optional callback. 
363+  * @param  {function= } callback  Optional callback. 
364364 */ 
365-  public  fromJSON ( json : any ,  opt_callback : ( err : Error ,  client ?: any )  =>  void )  { 
365+  public  fromJSON ( json : any ,  callback ? : ( err : Error ,  client ?: any )  =>  void )  { 
366366 let  client : UserRefreshClient | JWTClient  =  null ; 
367367 if  ( ! json )  { 
368368 this . callback ( 
369-  opt_callback , 
369+  callback , 
370370 new  Error ( 
371371 'Must pass in a JSON object containing the Google auth settings.' ) ) ; 
372372 return ; 
@@ -379,25 +379,24 @@ export default class GoogleAuth {
379379
380380 client . fromJSON ( json ,  ( err : Error )  =>  { 
381381 if  ( err )  { 
382-  this . callback ( opt_callback ,  err ) ; 
382+  this . callback ( callback ,  err ) ; 
383383 }  else  { 
384-  this . callback ( opt_callback ,  null ,  client ) ; 
384+  this . callback ( callback ,  null ,  client ) ; 
385385 } 
386386 } ) ; 
387387 } 
388388
389389 /** 
390390 * Create a credentials instance using the given input stream. 
391391 * @param  {object= } stream The input stream. 
392-  * @param  {function= } opt_callback  Optional callback. 
392+  * @param  {function= } callback  Optional callback. 
393393 */ 
394394 public  fromStream ( 
395-  stream : stream . Readable , 
396-  opt_callback : ( err : Error ,  result ?: any )  =>  void )  { 
395+  stream : stream . Readable ,  callback ?: ( err : Error ,  result ?: any )  =>  void )  { 
397396 if  ( ! stream )  { 
398397 setImmediate ( ( )  =>  { 
399398 this . callback ( 
400-  opt_callback , 
399+  callback , 
401400 new  Error ( 
402401 'Must pass in a stream containing the Google auth settings.' ) ) ; 
403402 } ) ; 
@@ -411,9 +410,9 @@ export default class GoogleAuth {
411410 stream . on ( 'end' ,  ( )  =>  { 
412411 try  { 
413412 const  data  =  JSON . parse ( s ) ; 
414-  this . fromJSON ( data ,  opt_callback ) ; 
413+  this . fromJSON ( data ,  callback ) ; 
415414 }  catch  ( err )  { 
416-  this . callback ( opt_callback ,  err ) ; 
415+  this . callback ( callback ,  err ) ; 
417416 } 
418417 } ) ; 
419418 } 
@@ -424,13 +423,13 @@ export default class GoogleAuth {
424423 * @param  {function= } - Optional callback function 
425424 */ 
426425 public  fromAPIKey ( 
427-  apiKey : string ,  opt_callback : ( err : Error ,  client ?: JWTClient )  =>  void )  { 
426+  apiKey : string ,  callback ? : ( err : Error ,  client ?: JWTClient )  =>  void )  { 
428427 const  client  =  new  this . JWTClient ( ) ; 
429428 client . fromAPIKey ( apiKey ,  ( err )  =>  { 
430429 if  ( err )  { 
431-  this . callback ( opt_callback ,  err ) ; 
430+  this . callback ( callback ,  err ) ; 
432431 }  else  { 
433-  this . callback ( opt_callback ,  null ,  client ) ; 
432+  this . callback ( callback ,  null ,  client ) ; 
434433 } 
435434 } ) ; 
436435 } 
@@ -499,7 +498,7 @@ export default class GoogleAuth {
499498 } 
500499
501500 // Executes the given callback if it is not null. 
502-  private  callback ( c : Function ,  ...args : any [ ] )  { 
501+  private  callback ( c : Function ,  err ?:  Error ,   ...args : any [ ] )  { 
503502 if  ( c )  { 
504503 return  c . apply ( null ,  Array . prototype . slice . call ( arguments ,  1 ) ) ; 
505504 } 
@@ -600,7 +599,7 @@ export default class GoogleAuth {
600599 * @param  {function } _callback Callback. 
601600 * @api  private 
602601 */ 
603-  private  _getGCEProjectId ( _callback : RequestCallback )  { 
602+  private  _getGCEProjectId ( _callback : BodyResponseCallback )  { 
604603 if  ( ! this . transporter )  { 
605604 this . transporter  =  new  DefaultTransporter ( ) ; 
606605 } 
0 commit comments