Class Service (3.7.4)
Stay organized with collections
Save and categorize content based on your preferences.
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
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 2024-04-30 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]