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
| Name | Description |
| config | ServiceConfig
Configuration object. |
| options | ServiceOptions
[Configuration object](#/docs). |
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.
| Type | Description |
|---|---|
| Promise <string> |
getProjectId(callback)
getProjectId
(
callback
:
(
err
:
Error
|
null
,
projectId
?:
string
)
=
>
void
)
:
void
;
| Name | Description |
| callback | (err: Error
| null, projectId?: string) => void
|
| Type | Description |
|---|---|
| void |
getProjectIdAsync()
protected
getProjectIdAsync
()
:
Promise<string>
;
| Type | Description |
|---|---|
| Promise <string> |
getRequestInterceptors()
getRequestInterceptors
()
:
Function
[];
Return the user's custom request interceptors.
| Type | Description |
|---|---|
| Function [] |
request(reqOpts, callback)
request
(
reqOpts
:
DecorateRequestOptions
,
callback
:
BodyResponseCallback
)
:
void
;
Make an authenticated API request.
| Name | Description |
| reqOpts | DecorateRequestOptions
Request options that are passed to |
| callback | BodyResponseCallback
The callback function passed to |
| Type | Description |
|---|---|
| void |
requestStream(reqOpts)
requestStream
(
reqOpts
:
DecorateRequestOptions
)
:
r
.
Request
;
Make an authenticated API request.
| Name | Description |
| reqOpts | DecorateRequestOptions
Request options that are passed to |
| Type | Description |
|---|---|
| r. Request |

