Send feedback
Class Service (3.8.1) Stay organized with collections
Save and categorize content based on your preferences.
Version 3.8.1 keyboard_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
authClient
:
GoogleAuth
;
Property Value
baseUrl
Property Value
interceptors
interceptors
:
Interceptor
[];
Property Value
makeAuthenticatedRequest
makeAuthenticatedRequest
:
MakeAuthenticatedRequest
;
Property Value
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
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
getRequestInterceptors()
getRequestInterceptors
()
:
Function
[];
Return the user's custom request interceptors.
Returns
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
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 2025-09-04 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 2025-09-04 UTC."],[],[],null,[]]