Send feedback
Class Service (3.7.4)
Stay organized with collections
Save and categorize content based on your preferences.
Version 3.7.4keyboard_arrow_down
Package
@google-cloud/common
Constructors
(constructor)(config, options)
constructor ( config : ServiceConfig , options ?: ServiceOptions );
Service is a base class, meant to be inherited from by a "service," like BigQuery or Storage.
This handles making authenticated requests by exposing a makeReq_ function.
module:common/service
Parameters
Properties
apiEndpoint
readonly apiEndpoint : string ;
Property Value
authClient
Property Value
Type
Description
GoogleAuth
baseUrl
Property Value
interceptors
interceptors : Interceptor [];
Property Value
makeAuthenticatedRequest
makeAuthenticatedRequest : MakeAuthenticatedRequest ;
Property Value
Type
Description
MakeAuthenticatedRequest
projectId
Property Value
providedUserAgent
providedUserAgent ?: string ;
Property Value
timeout
Property Value
Methods
getProjectId()
getProjectId () : Promise<string> ;
Get and update the Service's project ID.
Returns
Type
Description
Promise <string>
getProjectId(callback)
getProjectId ( callback : ( err : Error | null , projectId ?: string ) = > void ) : void ;
Parameter
Name
Description
callback
(err: Error | null, projectId?: string) => void
Returns
getProjectIdAsync()
protected getProjectIdAsync () : Promise<string> ;
Returns
Type
Description
Promise <string>
getRequestInterceptors()
getRequestInterceptors () : Function [];
Return the user's custom request interceptors.
Returns
Type
Description
Function []
request(reqOpts, callback)
request ( reqOpts : DecorateRequestOptions , callback : BodyResponseCallback ) : void ;
Make an authenticated API request.
Parameters
Returns
requestStream(reqOpts)
requestStream ( reqOpts : DecorateRequestOptions ) : r . Request ;
Make an authenticated API request.
Parameter
Returns
Type
Description
r.Request
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-03-09 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-09 UTC."],[],[]]