@assistant/actions
Version:
Actions API client for Node.js
506 lines (505 loc) • 29.1 kB
TypeScript
/// <reference types="node" />
import * as gax from 'google-gax';
import { Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback } from 'google-gax';
import { Transform } from 'stream';
import * as protos from '../../protos/protos';
/**
* Actions SDK API which allows developers to build projects using the SDK.
* @class
* @memberof v2
*/
export declare class ActionsSdkClient {
private _terminated;
private _opts;
private _gaxModule;
private _gaxGrpc;
private _protos;
private _defaults;
auth: gax.GoogleAuth;
descriptors: Descriptors;
innerApiCalls: {
[name: string]: Function;
};
pathTemplates: {
[name: string]: gax.PathTemplate;
};
actionsSdkStub?: Promise<{
[name: string]: Function;
}>;
/**
* Construct an instance of ActionsSdkClient.
*
* @param {object} [options] - The configuration object.
* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* The common options are:
* @param {object} [options.credentials] - Credentials object.
* @param {string} [options.credentials.client_email]
* @param {string} [options.credentials.private_key]
* @param {string} [options.email] - Account email address. Required when
* using a .pem or .p12 keyFilename.
* @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
* .p12 key downloaded from the Google Developers Console. If you provide
* a path to a JSON file, the projectId option below is not necessary.
* NOTE: .pem and .p12 require you to specify options.email as well.
* @param {number} [options.port] - The port on which to connect to
* the remote host.
* @param {string} [options.projectId] - The project ID from the Google
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
*/
constructor(opts?: ClientOptions);
/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize(): Promise<{
[name: string]: Function;
}>;
/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
static get servicePath(): string;
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* @returns {string} The DNS address for this service.
*/
static get apiEndpoint(): string;
/**
* The port for this API service.
* @returns {number} The default port for this service.
*/
static get port(): number;
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
* @returns {string[]} List of default scopes.
*/
static get scopes(): never[];
getProjectId(): Promise<string>;
getProjectId(callback: Callback<string, undefined, undefined>): void;
encryptSecret(request: protos.google.actions.sdk.v2.IEncryptSecretRequest, options?: CallOptions): Promise<[
protos.google.actions.sdk.v2.IEncryptSecretResponse,
protos.google.actions.sdk.v2.IEncryptSecretRequest | undefined,
{} | undefined
]>;
encryptSecret(request: protos.google.actions.sdk.v2.IEncryptSecretRequest, options: CallOptions, callback: Callback<protos.google.actions.sdk.v2.IEncryptSecretResponse, protos.google.actions.sdk.v2.IEncryptSecretRequest | null | undefined, {} | null | undefined>): void;
encryptSecret(request: protos.google.actions.sdk.v2.IEncryptSecretRequest, callback: Callback<protos.google.actions.sdk.v2.IEncryptSecretResponse, protos.google.actions.sdk.v2.IEncryptSecretRequest | null | undefined, {} | null | undefined>): void;
decryptSecret(request: protos.google.actions.sdk.v2.IDecryptSecretRequest, options?: CallOptions): Promise<[
protos.google.actions.sdk.v2.IDecryptSecretResponse,
protos.google.actions.sdk.v2.IDecryptSecretRequest | undefined,
{} | undefined
]>;
decryptSecret(request: protos.google.actions.sdk.v2.IDecryptSecretRequest, options: CallOptions, callback: Callback<protos.google.actions.sdk.v2.IDecryptSecretResponse, protos.google.actions.sdk.v2.IDecryptSecretRequest | null | undefined, {} | null | undefined>): void;
decryptSecret(request: protos.google.actions.sdk.v2.IDecryptSecretRequest, callback: Callback<protos.google.actions.sdk.v2.IDecryptSecretResponse, protos.google.actions.sdk.v2.IDecryptSecretRequest | null | undefined, {} | null | undefined>): void;
writeDraft(options?: CallOptions, callback?: Callback<protos.google.actions.sdk.v2.IDraft, protos.google.actions.sdk.v2.IWriteDraftRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
writeDraft(callback?: Callback<protos.google.actions.sdk.v2.IDraft, protos.google.actions.sdk.v2.IWriteDraftRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
writePreview(options?: CallOptions, callback?: Callback<protos.google.actions.sdk.v2.IPreview, protos.google.actions.sdk.v2.IWritePreviewRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
writePreview(callback?: Callback<protos.google.actions.sdk.v2.IPreview, protos.google.actions.sdk.v2.IWritePreviewRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
createVersion(options?: CallOptions, callback?: Callback<protos.google.actions.sdk.v2.IVersion, protos.google.actions.sdk.v2.ICreateVersionRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
createVersion(callback?: Callback<protos.google.actions.sdk.v2.IVersion, protos.google.actions.sdk.v2.ICreateVersionRequest | null | undefined, {} | null | undefined>): gax.CancellableStream;
/**
* Reads the entire content of the project draft.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the resource in the format `projects/{project}/draft`. The
* `{project}` is the cloud project ID associated with the project.
* @param {string} [request.clientSecretEncryptionKeyVersion]
* Optional. The version of the crypto key used to encrypt the account linking OAuth
* client secret. If not specified, the primary key version is used for
* encryption. Only relevant for projects with account linking with client
* secret.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits [ReadDraftResponse]{@link google.actions.sdk.v2.ReadDraftResponse} on 'data' event.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
* for more details and examples.
* @example
* const stream = client.readDraft(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
*/
readDraft(request?: protos.google.actions.sdk.v2.IReadDraftRequest, options?: CallOptions): gax.CancellableStream;
/**
* Reads the entire content of a project version.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the version resource in the format
* `projects/{project}/versions/{version}`. `{project}` is the
* cloud project ID associated with the project, `{version}` is the
* identifier of the version being read.
* @param {string} [request.clientSecretEncryptionKeyVersion]
* Optional. The version of the crypto key used to encrypt the account linking OAuth
* client secret. If not specified, the primary key version is used for
* encryption. Only relevant for projects with account linking with client
* secret.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits [ReadVersionResponse]{@link google.actions.sdk.v2.ReadVersionResponse} on 'data' event.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
* for more details and examples.
* @example
* const stream = client.readVersion(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
*/
readVersion(request?: protos.google.actions.sdk.v2.IReadVersionRequest, options?: CallOptions): gax.CancellableStream;
listSampleProjects(request: protos.google.actions.sdk.v2.IListSampleProjectsRequest, options?: CallOptions): Promise<[
protos.google.actions.sdk.v2.ISampleProject[],
protos.google.actions.sdk.v2.IListSampleProjectsRequest | null,
protos.google.actions.sdk.v2.IListSampleProjectsResponse
]>;
listSampleProjects(request: protos.google.actions.sdk.v2.IListSampleProjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.actions.sdk.v2.IListSampleProjectsRequest, protos.google.actions.sdk.v2.IListSampleProjectsResponse | null | undefined, protos.google.actions.sdk.v2.ISampleProject>): void;
listSampleProjects(request: protos.google.actions.sdk.v2.IListSampleProjectsRequest, callback: PaginationCallback<protos.google.actions.sdk.v2.IListSampleProjectsRequest, protos.google.actions.sdk.v2.IListSampleProjectsResponse | null | undefined, protos.google.actions.sdk.v2.ISampleProject>): void;
/**
* Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
* @param {Object} request
* The request object that will be sent.
* @param {number} [request.pageSize]
* Optional. The maximum number of sample projects to return. The service may return
* fewer than this value.
* If unspecified, at most 1000 sample projects will be returned. Values above
* 1000 will be coerced to 1000.
* @param {string} [request.pageToken]
* Optional. A page token, received from a previous 'ListSampleProjects' call.
* Provide this to retrieve the subsequent page.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits an object representing [SampleProject]{@link google.actions.sdk.v2.SampleProject} on 'data' event.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed. Note that it can affect your quota.
* We recommend using `listSampleProjectsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listSampleProjectsStream(request?: protos.google.actions.sdk.v2.IListSampleProjectsRequest, options?: CallOptions): Transform;
/**
* Equivalent to `listSampleProjects`, but returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {number} [request.pageSize]
* Optional. The maximum number of sample projects to return. The service may return
* fewer than this value.
* If unspecified, at most 1000 sample projects will be returned. Values above
* 1000 will be coerced to 1000.
* @param {string} [request.pageToken]
* Optional. A page token, received from a previous 'ListSampleProjects' call.
* Provide this to retrieve the subsequent page.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [SampleProject]{@link google.actions.sdk.v2.SampleProject}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* const iterable = client.listSampleProjectsAsync(request);
* for await (const response of iterable) {
* // process response
* }
*/
listSampleProjectsAsync(request?: protos.google.actions.sdk.v2.IListSampleProjectsRequest, options?: CallOptions): AsyncIterable<protos.google.actions.sdk.v2.ISampleProject>;
listReleaseChannels(request: protos.google.actions.sdk.v2.IListReleaseChannelsRequest, options?: CallOptions): Promise<[
protos.google.actions.sdk.v2.IReleaseChannel[],
protos.google.actions.sdk.v2.IListReleaseChannelsRequest | null,
protos.google.actions.sdk.v2.IListReleaseChannelsResponse
]>;
listReleaseChannels(request: protos.google.actions.sdk.v2.IListReleaseChannelsRequest, options: CallOptions, callback: PaginationCallback<protos.google.actions.sdk.v2.IListReleaseChannelsRequest, protos.google.actions.sdk.v2.IListReleaseChannelsResponse | null | undefined, protos.google.actions.sdk.v2.IReleaseChannel>): void;
listReleaseChannels(request: protos.google.actions.sdk.v2.IListReleaseChannelsRequest, callback: PaginationCallback<protos.google.actions.sdk.v2.IListReleaseChannelsRequest, protos.google.actions.sdk.v2.IListReleaseChannelsResponse | null | undefined, protos.google.actions.sdk.v2.IReleaseChannel>): void;
/**
* Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the resource in the format `projects/{project}`. The
* `{project}` is the cloud project ID associated with the project.
* @param {number} request.pageSize
* The maximum number of release channels to return. The service may return
* fewer than this value. If unspecified, at most 50 release channels will be
* returned.
* @param {string} request.pageToken
* A page token, received from a previous `ListReleaseChannels` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListReleaseChannels`
* must match the call that provided the page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits an object representing [ReleaseChannel]{@link google.actions.sdk.v2.ReleaseChannel} on 'data' event.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed. Note that it can affect your quota.
* We recommend using `listReleaseChannelsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listReleaseChannelsStream(request?: protos.google.actions.sdk.v2.IListReleaseChannelsRequest, options?: CallOptions): Transform;
/**
* Equivalent to `listReleaseChannels`, but returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the resource in the format `projects/{project}`. The
* `{project}` is the cloud project ID associated with the project.
* @param {number} request.pageSize
* The maximum number of release channels to return. The service may return
* fewer than this value. If unspecified, at most 50 release channels will be
* returned.
* @param {string} request.pageToken
* A page token, received from a previous `ListReleaseChannels` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListReleaseChannels`
* must match the call that provided the page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [ReleaseChannel]{@link google.actions.sdk.v2.ReleaseChannel}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* const iterable = client.listReleaseChannelsAsync(request);
* for await (const response of iterable) {
* // process response
* }
*/
listReleaseChannelsAsync(request?: protos.google.actions.sdk.v2.IListReleaseChannelsRequest, options?: CallOptions): AsyncIterable<protos.google.actions.sdk.v2.IReleaseChannel>;
listVersions(request: protos.google.actions.sdk.v2.IListVersionsRequest, options?: CallOptions): Promise<[
protos.google.actions.sdk.v2.IVersion[],
protos.google.actions.sdk.v2.IListVersionsRequest | null,
protos.google.actions.sdk.v2.IListVersionsResponse
]>;
listVersions(request: protos.google.actions.sdk.v2.IListVersionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.actions.sdk.v2.IListVersionsRequest, protos.google.actions.sdk.v2.IListVersionsResponse | null | undefined, protos.google.actions.sdk.v2.IVersion>): void;
listVersions(request: protos.google.actions.sdk.v2.IListVersionsRequest, callback: PaginationCallback<protos.google.actions.sdk.v2.IListVersionsRequest, protos.google.actions.sdk.v2.IListVersionsResponse | null | undefined, protos.google.actions.sdk.v2.IVersion>): void;
/**
* Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the resource in the format `projects/{project}`. The
* `{project}` is the cloud project ID associated with the project.
* @param {number} request.pageSize
* The maximum number of versions to return. The service may return
* fewer than this value. If unspecified, at most 50 versions will be
* returned.
* @param {string} request.pageToken
* A page token, received from a previous `ListVersions` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListVersions`
* must match the call that provided the page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits an object representing [Version]{@link google.actions.sdk.v2.Version} on 'data' event.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed. Note that it can affect your quota.
* We recommend using `listVersionsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listVersionsStream(request?: protos.google.actions.sdk.v2.IListVersionsRequest, options?: CallOptions): Transform;
/**
* Equivalent to `listVersions`, but returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the resource in the format `projects/{project}`. The
* `{project}` is the cloud project ID associated with the project.
* @param {number} request.pageSize
* The maximum number of versions to return. The service may return
* fewer than this value. If unspecified, at most 50 versions will be
* returned.
* @param {string} request.pageToken
* A page token, received from a previous `ListVersions` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListVersions`
* must match the call that provided the page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [Version]{@link google.actions.sdk.v2.Version}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* const iterable = client.listVersionsAsync(request);
* for await (const response of iterable) {
* // process response
* }
*/
listVersionsAsync(request?: protos.google.actions.sdk.v2.IListVersionsRequest, options?: CallOptions): AsyncIterable<protos.google.actions.sdk.v2.IVersion>;
/**
* Return a fully-qualified draft resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
draftPath(project: string): string;
/**
* Parse the project from Draft resource.
*
* @param {string} draftName
* A fully-qualified path representing Draft resource.
* @returns {string} A string representing the project.
*/
matchProjectFromDraftName(draftName: string): string | number;
/**
* Return a fully-qualified preview resource name string.
*
* @param {string} project
* @param {string} preview
* @returns {string} Resource name string.
*/
previewPath(project: string, preview: string): string;
/**
* Parse the project from Preview resource.
*
* @param {string} previewName
* A fully-qualified path representing Preview resource.
* @returns {string} A string representing the project.
*/
matchProjectFromPreviewName(previewName: string): string | number;
/**
* Parse the preview from Preview resource.
*
* @param {string} previewName
* A fully-qualified path representing Preview resource.
* @returns {string} A string representing the preview.
*/
matchPreviewFromPreviewName(previewName: string): string | number;
/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project: string): string;
/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName: string): string | number;
/**
* Return a fully-qualified releaseChannel resource name string.
*
* @param {string} project
* @param {string} release_channel
* @returns {string} Resource name string.
*/
releaseChannelPath(project: string, releaseChannel: string): string;
/**
* Parse the project from ReleaseChannel resource.
*
* @param {string} releaseChannelName
* A fully-qualified path representing ReleaseChannel resource.
* @returns {string} A string representing the project.
*/
matchProjectFromReleaseChannelName(releaseChannelName: string): string | number;
/**
* Parse the release_channel from ReleaseChannel resource.
*
* @param {string} releaseChannelName
* A fully-qualified path representing ReleaseChannel resource.
* @returns {string} A string representing the release_channel.
*/
matchReleaseChannelFromReleaseChannelName(releaseChannelName: string): string | number;
/**
* Return a fully-qualified sampleProject resource name string.
*
* @param {string} sample_project
* @returns {string} Resource name string.
*/
sampleProjectPath(sampleProject: string): string;
/**
* Parse the sample_project from SampleProject resource.
*
* @param {string} sampleProjectName
* A fully-qualified path representing SampleProject resource.
* @returns {string} A string representing the sample_project.
*/
matchSampleProjectFromSampleProjectName(sampleProjectName: string): string | number;
/**
* Return a fully-qualified version resource name string.
*
* @param {string} project
* @param {string} version
* @returns {string} Resource name string.
*/
versionPath(project: string, version: string): string;
/**
* Parse the project from Version resource.
*
* @param {string} versionName
* A fully-qualified path representing Version resource.
* @returns {string} A string representing the project.
*/
matchProjectFromVersionName(versionName: string): string | number;
/**
* Parse the version from Version resource.
*
* @param {string} versionName
* A fully-qualified path representing Version resource.
* @returns {string} A string representing the version.
*/
matchVersionFromVersionName(versionName: string): string | number;
/**
* Terminate the gRPC channel and close the client.
*
* The client will no longer be usable and all future behavior is undefined.
* @returns {Promise} A promise that resolves when the client is closed.
*/
close(): Promise<void>;
}