Package
@google-cloud/commonConstructors
(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
Name
Description
config
options
Properties
apiEndpoint
readonly
apiEndpoint
:
string
;
authClient
authClient
:
GoogleAuth<AuthClient>
;
baseUrl
baseUrl
:
string
;
interceptors
interceptors
:
Interceptor
[];
makeAuthenticatedRequest
makeAuthenticatedRequest
:
MakeAuthenticatedRequest
;
projectId
projectId
:
string
;
providedUserAgent
providedUserAgent
?:
string
;
timeout
timeout
?:
number
;
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
Type
Description
void
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
Name
Description
reqOpts
callback
Returns
Type
Description
void
requestStream(reqOpts)
requestStream
(
reqOpts
:
DecorateRequestOptions
)
:
r
.
Request
;
Make an authenticated API request.
Parameter
Name
Description
reqOpts
Returns
Type
Description
r. Request