import * as gax from 'google-gax' ; import { Callback , CallOptions , Descriptors , ClientOptions , PaginationCallback , GaxCall , } from 'google-gax' ; import { Transform } from 'stream' ; import { RequestType } from 'google-gax/build/src/apitypes' ; import * as protos from '../../protos/protos' ; import jsonProtos = require ( '../../protos/protos.json' ) ; /**
 * Client JSON configuration object, loaded from
 * `src/v2beta2/cloud_tasks_client_config.json`.
 * This file defines retry strategy and timeouts for all API methods in this library.
 */ import * as gapicConfig from './cloud_tasks_client_config.json' ; const version = require ( '../../../package.json' ) . version ; class memberof export class CloudTasksClient { private _terminated = false ; private _opts : ClientOptions ; private _providedCustomServicePath : boolean ; private _gaxModule : typeof gax | typeof gax . fallback ; private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ; private _protos : { } ; private _defaults : { [ method ] : gax . CallSettings ; } ; auth : gax . GoogleAuth ; descriptors : Descriptors = { page : { } , stream : { } , longrunning : { } , batching : { } , } ; warn : ( code : string , message : string , warnType ? : string ) => void ; innerApiCalls : { [ name ] : Function ; } ; pathTemplates : { [ name ] : gax . PathTemplate ; } ; cloudTasksStub ? : Promise < { [ name ] : Function ; } > ; param options param options . credentials param { string } options . credentials . client_email param { string } options . credentials . private_key param { string } options . email param { string } options . keyFilename param { number } options . port 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
     *      https ,
     *     your project ID will be detected automatically.
     *  param { string } options . apiEndpoint param { gax . ClientConfig } options . clientConfig - Client configuration override.
     *     Follows the structure of  gapicConfig .
     *  param { boolean } options . fallback constructor ( opts ? ) { const staticMembers = this . constructor as typeof CloudTasksClient ; const servicePath = opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ; this . _providedCustomServicePath = ! ! ( opts ?. servicePath || opts ?. apiEndpoint ) ; const port = opts ?. port || staticMembers . port ; const clientConfig = opts ?. clientConfig ?? { } ; const fallback = opts ?. fallback ?? ( typeof window !== 'undefined' && typeof window ?. fetch === 'function' ) ; opts = Object . assign ( { servicePath , port , clientConfig , fallback } , opts ) ; if ( servicePath !== staticMembers . servicePath && ! ( 'scopes' in opts ) ) { opts [ 'scopes' ] = staticMembers . scopes ; } this . _gaxModule = opts . fallback ? gax . fallback : gax ; this . _gaxGrpc = new this . _gaxModule . GrpcClient ( opts ) ; this . _opts = opts ; this . auth = this . _gaxGrpc . auth as gax . GoogleAuth ; this . auth . useJWTAccessWithScope = true ; this . auth . defaultServicePath = staticMembers . servicePath ; if ( servicePath === staticMembers . servicePath ) { this . auth . defaultScopes = staticMembers . scopes ; } const clientHeader = [ `gax/${ this . _gaxModule . version }` , `gapic/${ version }` ] ; if ( typeof process !== 'undefined' && 'versions' in process ) { clientHeader . push ( `gl-node/${ process . versions . node }` ) ; } else { clientHeader . push ( `gl-web/${ this . _gaxModule . version }` ) ; } if ( ! opts . fallback ) { clientHeader . push ( `grpc/${ this . _gaxGrpc . grpcVersion }` ) ; } else if ( opts . fallback === 'rest' ) { clientHeader . push ( `rest/${ this . _gaxGrpc . grpcVersion }` ) ; } if ( opts . libName && opts . libVersion ) { clientHeader . push ( `${ opts . libName }/${ opts . libVersion }` ) ; } this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ; this . pathTemplates = { locationPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}' ) , projectPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}' ) , queuePathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}/queues/{queue}' ) , taskPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' ) , } ; this . descriptors . page = { listQueues : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'queues' ) , listTasks : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'tasks' ) , } ; this . _defaults = this . _gaxGrpc . constructSettings ( 'google.cloud.tasks.v2beta2.CloudTasks' , gapicConfig as gax . ClientConfig , opts . clientConfig || { } , { 'x-goog-api-client' : clientHeader . join ( ' ' ) } ) ; this . innerApiCalls = { } ; this . warn = gax . warn ; } returns { Promise } initialize ( ) { if ( this . cloudTasksStub ) { return this . cloudTasksStub ; } this . cloudTasksStub = this . _gaxGrpc . createStub ( this . _opts . fallback ? ( this . _protos as protobuf . Root ) . lookupService ( 'google.cloud.tasks.v2beta2.CloudTasks' ) : ( this . _protos as any ) . google . cloud . tasks . v2beta2 . CloudTasks , this . _opts , this . _providedCustomServicePath ) as Promise < { [ method ] : Function ; } > ; const cloudTasksStubMethods = [ 'listQueues' , 'getQueue' , 'createQueue' , 'updateQueue' , 'deleteQueue' , 'purgeQueue' , 'pauseQueue' , 'resumeQueue' , 'getIamPolicy' , 'setIamPolicy' , 'testIamPermissions' , 'listTasks' , 'getTask' , 'createTask' , 'deleteTask' , 'leaseTasks' , 'acknowledgeTask' , 'renewLease' , 'cancelLease' , 'runTask' , ] ; for ( const methodName of cloudTasksStubMethods ) { const callPromise = this . cloudTasksStub . then ( stub => ( ... args ) => { if ( this . _terminated ) { return Promise . reject ( 'The client has already been closed.' ) ; } const func = stub [ methodName ] ; return func . apply ( stub , args ) ; } , ( err ) => ( ) => { throw err ; } ) ; const descriptor = this . descriptors . page [ methodName ] || undefined ; const apiCall = this . _gaxModule . createApiCall ( callPromise , this . _defaults [ methodName ] , descriptor ) ; this . innerApiCalls [ methodName ] = apiCall ; } return this . cloudTasksStub ; } returns { string } static get servicePath ( ) { return 'cloudtasks.googleapis.com' ; } returns { string } static get apiEndpoint ( ) { return 'cloudtasks.googleapis.com' ; } returns { number } static get port ( ) { return 443 ; } returns { string [ ] } static get scopes ( ) { return [ 'https://www.googleapis.com/auth/cloud-platform' ] ; } getProjectId ( ) ; getProjectId ( callback ) ; returns { Promise } getProjectId ( callback ? ) { if ( callback ) { this . auth . getProjectId ( callback ) ; return ; } return this . auth . getProjectId ( ) ; } param request param { string } request . name param { google . protobuf . FieldMask } request . readMask param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getQueue ( request ? , options ? ) ; getQueue ( request , options , callback ) ; getQueue ( request , callback ) ; getQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getQueue ( request , options , callback ) ; } param request param { string } request . parent Required. The location name in which the queue will be created.
     *   For example: `projects/PROJECT_ID/locations/LOCATION_ID`
     *
     *   The list of allowed locations can be obtained by calling Cloud
     *   Tasks' implementation of
     *    google . cloud . location . Locations . ListLocations .
     *  param { google . cloud . tasks . v2beta2 . Queue } request . queue Required. The queue to create.
     *
     *    google . cloud . tasks . v2beta2 . Queue . name cannot be the same as an existing queue.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example createQueue ( request ? , options ? ) ; createQueue ( request , options , callback ) ; createQueue ( request , callback ) ; createQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . createQueue ( request , options , callback ) ; } param request param { google . cloud . tasks . v2beta2 . Queue } request . queue Required. The queue to create or update.
     *
     *   The queue's  google . cloud . tasks . v2beta2 . Queue . name must be specified.
     *
     *   Output only fields cannot be modified using UpdateQueue.
     *   Any value specified for an output only field will be ignored.
     *   The queue's  google . cloud . tasks . v2beta2 . Queue . name cannot be changed.
     *  param { google . protobuf . FieldMask } request . updateMask param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example updateQueue ( request ? , options ? ) ; updateQueue ( request , options , callback ) ; updateQueue ( request , callback ) ; updateQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { 'queue.name' : request . queue ! . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . updateQueue ( request , options , callback ) ; } param request param { string } request . name param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Empty] google . protobuf . Empty .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example deleteQueue ( request ? , options ? ) ; deleteQueue ( request , options , callback ) ; deleteQueue ( request , callback ) ; deleteQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . deleteQueue ( request , options , callback ) ; } param request param { string } request . name param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example purgeQueue ( request ? , options ? ) ; purgeQueue ( request , options , callback ) ; purgeQueue ( request , callback ) ; purgeQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . purgeQueue ( request , options , callback ) ; } /**
     * Pauses the queue.
     *
     * If a queue is paused then the system will stop dispatching tasks
     * until the queue is resumed via
     *  google . cloud . tasks . v2beta2 . CloudTasks . ResumeQueue . Tasks can still be added
     * when the queue is paused. A queue is paused if its
     *  google . cloud . tasks . v2beta2 . Queue . state is  google . cloud . tasks . v2beta2 . Queue . State . PAUSED .
     *
     *  param request param { string } request . name param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example pauseQueue ( request ? , options ? ) ; pauseQueue ( request , options , callback ) ; pauseQueue ( request , callback ) ; pauseQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . pauseQueue ( request , options , callback ) ; } /**
     * Resume a queue.
     *
     * This method resumes a queue after it has been
     *  google . cloud . tasks . v2beta2 . Queue . State . PAUSED or
     *  google . cloud . tasks . v2beta2 . Queue . State . DISABLED . The state of a queue is stored
     * in the queue's  google . cloud . tasks . v2beta2 . Queue . state ; after calling this method it
     * will be set to  google . cloud . tasks . v2beta2 . Queue . State . RUNNING .
     *
     * WARNING: Resuming many high-QPS queues at the same time can
     * lead to target overloading. If you are resuming high-QPS
     * queues, follow the 500/50/5 pattern described in
     * [Managing Cloud Tasks Scaling
     * Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
     *
     *  param request param { string } request . name param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example resumeQueue ( request ? , options ? ) ; resumeQueue ( request , options , callback ) ; resumeQueue ( request , callback ) ; resumeQueue ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . resumeQueue ( request , options , callback ) ; } /**
     * Gets the access control policy for a  google . cloud . tasks . v2beta2 . Queue .
     * Returns an empty policy if the resource exists and does not have a policy
     * set.
     *
     * Authorization requires the following
     * [Google IAM](https://cloud.google.com/iam) permission on the specified
     * resource parent:
     *
     * * `cloudtasks.queues.getIamPolicy`
     *
     *  param request param { string } request . resource param { google . iam . v1 . GetPolicyOptions } request . options param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Policy] google . iam . v1 . Policy .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getIamPolicy ( request ? , options ? ) ; getIamPolicy ( request , options , callback ) ; getIamPolicy ( request , callback ) ; getIamPolicy ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getIamPolicy ( request , options , callback ) ; } /**
     * Sets the access control policy for a  google . cloud . tasks . v2beta2 . Queue . Replaces any existing
     * policy.
     *
     * Note: The Cloud Console does not check queue-level IAM permissions yet.
     * Project-level permissions are required to use the Cloud Console.
     *
     * Authorization requires the following
     * [Google IAM](https://cloud.google.com/iam) permission on the specified
     * resource parent:
     *
     * * `cloudtasks.queues.setIamPolicy`
     *
     *  param request param { string } request . resource param { google . iam . v1 . Policy } request . policy param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Policy] google . iam . v1 . Policy .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example setIamPolicy ( request ? , options ? ) ; setIamPolicy ( request , options , callback ) ; setIamPolicy ( request , callback ) ; setIamPolicy ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . setIamPolicy ( request , options , callback ) ; } /**
     * Returns permissions that a caller has on a  google . cloud . tasks . v2beta2 . Queue .
     * If the resource does not exist, this will return an empty set of
     * permissions, not a  google . rpc . Code . NOT_FOUND error.
     *
     * Note: This operation is designed to be used for building permission-aware
     * UIs and command-line tools, not for authorization checking. This operation
     * may "fail open" without warning.
     *
     *  param request param { string } request . resource param { string [ ] } request . permissions param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [TestIamPermissionsResponse] google . iam . v1 . TestIamPermissionsResponse .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example testIamPermissions ( request ? , options ? ) ; testIamPermissions ( request , options , callback ) ; testIamPermissions ( request , callback ) ; testIamPermissions ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { resource : request . resource || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . testIamPermissions ( request , options , callback ) ; } param request param { string } request . name param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Task] google . cloud . tasks . v2beta2 . Task .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getTask ( request ? , options ? ) ; getTask ( request , options , callback ) ; getTask ( request , callback ) ; getTask ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . getTask ( request , options , callback ) ; } /**
     * Creates a task and adds it to a queue.
     *
     * Tasks cannot be updated after creation; there is no UpdateTask command.
     *
     * * For  google . cloud . tasks . v2beta2 . AppEngineHttpTarget , the maximum task size is
     *   100KB.
     * * For  google . cloud . tasks . v2beta2 . PullTarget , the maximum task size is 1MB.
     *
     *  param request param { string } request . parent param { google . cloud . tasks . v2beta2 . Task } request . task Required. The task to add.
     *
     *   Task names have the following format:
     *   `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
     *   The user can optionally specify a task  google . cloud . tasks . v2beta2 . Task . name . If a
     *   name is not specified then the system will generate a random
     *   unique task id, which will be set in the task returned in the
     *    google . cloud . tasks . v2beta2 . Task . name .
     *
     *   If  google . cloud . tasks . v2beta2 . Task . schedule_time is not set or is in the
     *   past then Cloud Tasks will set it to the current time.
     *
     *   Task De-duplication:
     *
     *   Explicitly specifying a task ID enables task de-duplication.  If
     *   a task's ID is identical to that of an existing task or a task
     *   that was deleted or completed recently then the call will fail
     *   with  google . rpc . Code . ALREADY_EXISTS .
     *   If the task's queue was created using Cloud Tasks, then another task with
     *   the same name can't be created for ~1hour after the original task was
     *   deleted or completed. If the task's queue was created using queue.yaml or
     *   queue.xml, then another task with the same name can't be created
     *   for ~9days after the original task was deleted or completed.
     *
     *   Because there is an extra lookup cost to identify duplicate task
     *   names, these  google . cloud . tasks . v2beta2 . CloudTasks . CreateTask calls have significantly
     *   increased latency. Using hashed strings for the task id or for
     *   the prefix of the task id is recommended. Choosing task ids that
     *   are sequential or have sequential prefixes, for example using a
     *   timestamp, causes an increase in latency and error rates in all
     *   task commands. The infrastructure relies on an approximately
     *   uniform distribution of task ids to store and serve tasks
     *   efficiently.
     *  param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Task] google . cloud . tasks . v2beta2 . Task .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example createTask ( request ? , options ? ) ; createTask ( request , options , callback ) ; createTask ( request , callback ) ; createTask ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . createTask ( request , options , callback ) ; } param request param { string } request . name param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Empty] google . protobuf . Empty .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example deleteTask ( request ? , options ? ) ; deleteTask ( request , options , callback ) ; deleteTask ( request , callback ) ; deleteTask ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . deleteTask ( request , options , callback ) ; } /**
     * Leases tasks from a pull queue for
     *  google . cloud . tasks . v2beta2 . LeaseTasksRequest . lease_duration .
     *
     * This method is invoked by the worker to obtain a lease. The
     * worker must acknowledge the task via
     *  google . cloud . tasks . v2beta2 . CloudTasks . AcknowledgeTask after they have
     * performed the work associated with the task.
     *
     * The  google . cloud . tasks . v2beta2 . PullMessage . payload is intended to store data that
     * the worker needs to perform the work associated with the task. To
     * return the payloads in the  google . cloud . tasks . v2beta2 . LeaseTasksResponse , set
     *  google . cloud . tasks . v2beta2 . LeaseTasksRequest . response_view to
     *  google . cloud . tasks . v2beta2 . Task . View . FULL .
     *
     * A maximum of 10 qps of  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks * requests are allowed per
     * queue.  google . rpc . Code . RESOURCE_EXHAUSTED * is returned when this limit is
     * exceeded.  google . rpc . Code . RESOURCE_EXHAUSTED * is also returned when
     *  google . cloud . tasks . v2beta2 . RateLimits . max_tasks_dispatched_per_second * is exceeded.
     *
     *  param request param { string } request . parent param { number } request . maxTasks The maximum number of tasks to lease.
     *
     *   The system will make a best effort to return as close to as
     *   `max_tasks` as possible.
     *
     *   The largest that `max_tasks` can be is 1000.
     *
     *   The maximum total size of a  google . cloud . tasks . v2beta2 . LeaseTasksResponse is
     *   32 MB. If the sum of all task sizes requested reaches this limit,
     *   fewer tasks than requested are returned.
     *  param { google . protobuf . Duration } request . leaseDuration Required. The duration of the lease.
     *
     *   Each task returned in the  google . cloud . tasks . v2beta2 . LeaseTasksResponse will
     *   have its  google . cloud . tasks . v2beta2 . Task . schedule_time set to the current
     *   time plus the `lease_duration`. The task is leased until its
     *    google . cloud . tasks . v2beta2 . Task . schedule_time ; thus, the task will not be
     *   returned to another  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks call
     *   before its  google . cloud . tasks . v2beta2 . Task . schedule_time .
     *
     *
     *   After the worker has successfully finished the work associated
     *   with the task, the worker must call via
     *    google . cloud . tasks . v2beta2 . CloudTasks . AcknowledgeTask before the
     *    google . cloud . tasks . v2beta2 . Task . schedule_time . Otherwise the task will be
     *   returned to a later  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks call so
     *   that another worker can retry it.
     *
     *   The maximum lease duration is 1 week.
     *   `lease_duration` will be truncated to the nearest second.
     *  param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { string } request . filter `filter` can be used to specify a subset of tasks to lease.
     *
     *   When `filter` is set to `tag=<my-tag>` then the
     *    google . cloud . tasks . v2beta2 . LeaseTasksResponse will contain only tasks whose
     *    google . cloud . tasks . v2beta2 . PullMessage . tag is equal to `<my-tag>`. `<my-tag>` must be
     *   less than 500 characters.
     *
     *   When `filter` is set to `tag_function=oldest_tag()`, only tasks which have
     *   the same tag as the task with the oldest
     *    google . cloud . tasks . v2beta2 . Task . schedule_time will be returned.
     *
     *   Grammar Syntax:
     *
     *   * `filter = "tag=" tag | "tag_function=" function`
     *
     *   * `tag = string`
     *
     *   * `function = "oldest_tag()"`
     *
     *   The `oldest_tag()` function returns tasks which have the same tag as the
     *   oldest task (ordered by schedule time).
     *
     *   SDK compatibility: Although the SDK allows tags to be either
     *   string or
     *   [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
     *   only UTF-8 encoded tags can be used in Cloud Tasks. Tag which
     *   aren't UTF-8 encoded can't be used in the
     *    google . cloud . tasks . v2beta2 . LeaseTasksRequest . filter and the task's
     *    google . cloud . tasks . v2beta2 . PullMessage . tag will be displayed as empty in Cloud Tasks.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [LeaseTasksResponse] google . cloud . tasks . v2beta2 . LeaseTasksResponse .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example leaseTasks ( request ? , options ? ) ; leaseTasks ( request , options , callback ) ; leaseTasks ( request , callback ) ; leaseTasks ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . leaseTasks ( request , options , callback ) ; } /**
     * Acknowledges a pull task.
     *
     * The worker, that is, the entity that
     *  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks this task must call this method
     * to indicate that the work associated with the task has finished.
     *
     * The worker must acknowledge a task within the
     *  google . cloud . tasks . v2beta2 . LeaseTasksRequest . lease_duration or the lease
     * will expire and the task will become available to be leased
     * again. After the task is acknowledged, it will not be returned
     * by a later  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks ,
     *  google . cloud . tasks . v2beta2 . CloudTasks . GetTask , or
     *  google . cloud . tasks . v2beta2 . CloudTasks . ListTasks .
     *
     *  param request param { string } request . name param { google . protobuf . Timestamp } request . scheduleTime Required. The task's current schedule time, available in the
     *    google . cloud . tasks . v2beta2 . Task . schedule_time returned by
     *    google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks response or
     *    google . cloud . tasks . v2beta2 . CloudTasks . RenewLease response. This restriction is
     *   to ensure that your worker currently holds the lease.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Empty] google . protobuf . Empty .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example acknowledgeTask ( request ? , options ? ) ; acknowledgeTask ( request , options , callback ) ; acknowledgeTask ( request , callback ) ; acknowledgeTask ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . acknowledgeTask ( request , options , callback ) ; } /**
     * Renew the current lease of a pull task.
     *
     * The worker can use this method to extend the lease by a new
     * duration, starting from now. The new task lease will be
     * returned in the task's  google . cloud . tasks . v2beta2 . Task . schedule_time .
     *
     *  param request param { string } request . name param { google . protobuf . Timestamp } request . scheduleTime Required. The task's current schedule time, available in the
     *    google . cloud . tasks . v2beta2 . Task . schedule_time returned by
     *    google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks response or
     *    google . cloud . tasks . v2beta2 . CloudTasks . RenewLease response. This restriction is
     *   to ensure that your worker currently holds the lease.
     *  param { google . protobuf . Duration } request . leaseDuration param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Task] google . cloud . tasks . v2beta2 . Task .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example renewLease ( request ? , options ? ) ; renewLease ( request , options , callback ) ; renewLease ( request , callback ) ; renewLease ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . renewLease ( request , options , callback ) ; } /**
     * Cancel a pull task's lease.
     *
     * The worker can use this method to cancel a task's lease by
     * setting its  google . cloud . tasks . v2beta2 . Task . schedule_time to now. This will
     * make the task available to be leased to the next caller of
     *  google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks .
     *
     *  param request param { string } request . name param { google . protobuf . Timestamp } request . scheduleTime Required. The task's current schedule time, available in the
     *    google . cloud . tasks . v2beta2 . Task . schedule_time returned by
     *    google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks response or
     *    google . cloud . tasks . v2beta2 . CloudTasks . RenewLease response. This restriction is
     *   to ensure that your worker currently holds the lease.
     *  param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Task] google . cloud . tasks . v2beta2 . Task .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example cancelLease ( request ? , options ? ) ; cancelLease ( request , options , callback ) ; cancelLease ( request , callback ) ; cancelLease ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . cancelLease ( request , options , callback ) ; } /**
     * Forces a task to run now.
     *
     * When this method is called, Cloud Tasks will dispatch the task, even if
     * the task is already running, the queue has reached its  google . cloud . tasks . v2beta2 . RateLimits or
     * is  google . cloud . tasks . v2beta2 . Queue . State . PAUSED .
     *
     * This command is meant to be used for manual debugging. For
     * example,  google . cloud . tasks . v2beta2 . CloudTasks . RunTask can be used to retry a failed
     * task after a fix has been made or to manually force a task to be
     * dispatched now.
     *
     * The dispatched task is returned. That is, the task that is returned
     * contains the  google . cloud . tasks . v2beta2 . Task . status after the task is dispatched but
     * before the task is received by its target.
     *
     * If Cloud Tasks receives a successful response from the task's
     * target, then the task will be deleted; otherwise the task's
     *  google . cloud . tasks . v2beta2 . Task . schedule_time will be reset to the time that
     *  google . cloud . tasks . v2beta2 . CloudTasks . RunTask was called plus the retry delay specified
     * in the queue's  google . cloud . tasks . v2beta2 . RetryConfig .
     *
     *  google . cloud . tasks . v2beta2 . CloudTasks . RunTask returns
     *  google . rpc . Code . NOT_FOUND when it is called on a
     * task that has already succeeded or permanently failed.
     *
     *  google . cloud . tasks . v2beta2 . CloudTasks . RunTask cannot be called on a
     *  google . cloud . tasks . v2beta2 . PullMessage .
     *
     *  param request param { string } request . name param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is an object representing [Task] google . cloud . tasks . v2beta2 . Task .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example runTask ( request ? , options ? ) ; runTask ( request , options , callback ) ; runTask ( request , callback ) ; runTask ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . runTask ( request , options , callback ) ; } param request param { string } request . parent param { string } request . filter `filter` can be used to specify a subset of queues. Any  google . cloud . tasks . v2beta2 . Queue *   field can be used as a filter and several operators as supported.
     *   For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
     *   described in
     *   [Stackdriver's Advanced Logs
     *   Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
     *
     *   Sample filter "app_engine_http_target: *".
     *
     *   Note that using filters might cause fewer queues than the
     *   requested_page size to be returned.
     *  param { number } request . pageSize Requested page size.
     *
     *   The maximum page size is 9800. If unspecified, the page size will
     *   be the maximum. Fewer queues than requested might be returned,
     *   even if more queues exist; use the
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token in the
     *   response to determine if more queues exist.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListQueues *   method. It is an error to switch the value of the
     *    google . cloud . tasks . v2beta2 . ListQueuesRequest . filter while iterating through pages.
     *  param { google . protobuf . FieldMask } request . readMask param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is Array of [Queue] google . cloud . tasks . v2beta2 . Queue .
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed and will merge results from all the pages into this array.
     *   Note that it can affect your quota.
     *   We recommend using `listQueuesAsync()`
     *   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.
      listQueues ( request ? , options ? ) ; listQueues ( request , options , callback ) ; listQueues ( request , callback ) ; listQueues ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . listQueues ( request , options , callback ) ; } param request param { string } request . parent param { string } request . filter `filter` can be used to specify a subset of queues. Any  google . cloud . tasks . v2beta2 . Queue *   field can be used as a filter and several operators as supported.
     *   For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
     *   described in
     *   [Stackdriver's Advanced Logs
     *   Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
     *
     *   Sample filter "app_engine_http_target: *".
     *
     *   Note that using filters might cause fewer queues than the
     *   requested_page size to be returned.
     *  param { number } request . pageSize Requested page size.
     *
     *   The maximum page size is 9800. If unspecified, the page size will
     *   be the maximum. Fewer queues than requested might be returned,
     *   even if more queues exist; use the
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token in the
     *   response to determine if more queues exist.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListQueues *   method. It is an error to switch the value of the
     *    google . cloud . tasks . v2beta2 . ListQueuesRequest . filter while iterating through pages.
     *  param { google . protobuf . FieldMask } request . readMask param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [Queue] google . cloud . tasks . v2beta2 . Queue 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 `listQueuesAsync()`
     *   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.
      listQueuesStream ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listQueues' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listQueues . createStream ( this . innerApiCalls . listQueues as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent param { string } request . filter `filter` can be used to specify a subset of queues. Any  google . cloud . tasks . v2beta2 . Queue *   field can be used as a filter and several operators as supported.
     *   For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
     *   described in
     *   [Stackdriver's Advanced Logs
     *   Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
     *
     *   Sample filter "app_engine_http_target: *".
     *
     *   Note that using filters might cause fewer queues than the
     *   requested_page size to be returned.
     *  param { number } request . pageSize Requested page size.
     *
     *   The maximum page size is 9800. If unspecified, the page size will
     *   be the maximum. Fewer queues than requested might be returned,
     *   even if more queues exist; use the
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token in the
     *   response to determine if more queues exist.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListQueuesResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListQueues *   method. It is an error to switch the value of the
     *    google . cloud . tasks . v2beta2 . ListQueuesRequest . filter while iterating through pages.
     *  param { google . protobuf . FieldMask } request . readMask param { object } options Call options. See  https 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
     *   [Queue] google . cloud . tasks . v2beta2 . Queue . 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 listQueuesAsync ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listQueues' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listQueues . asyncIterate ( this . innerApiCalls [ 'listQueues' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . tasks . v2beta2 . IQueue > ; } /**
     * Lists the tasks in a queue.
     *
     * By default, only the  google . cloud . tasks . v2beta2 . Task . View . BASIC view is retrieved
     * due to performance considerations;
     *  google . cloud . tasks . v2beta2 . ListTasksRequest . response_view controls the
     * subset of information which is returned.
     *
     * The tasks may be returned in any order. The ordering may change at any
     * time.
     *
     *  param request param { string } request . parent param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { number } request . pageSize Maximum page size.
     *
     *   Fewer tasks than requested might be returned, even if more tasks exist; use
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token in the response to
     *   determine if more tasks exist.
     *
     *   The maximum page size is 1000. If unspecified, the page size will be the
     *   maximum.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListTasks *   method.
     *
     *   The page token is valid for only 2 hours.
     *  param { object } options Call options. See  https for more details.
     *  returns { Promise } - The promise which resolves to an array.
     *   The first element of the array is Array of [Task] google . cloud . tasks . v2beta2 . Task .
     *   The client library will perform auto-pagination by default: it will call the API as many
     *   times as needed and will merge results from all the pages into this array.
     *   Note that it can affect your quota.
     *   We recommend using `listTasksAsync()`
     *   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.
      listTasks ( request ? , options ? ) ; listTasks ( request , options , callback ) ; listTasks ( request , callback ) ; listTasks ( request ? , optionsOrCallback ? , callback ? ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback as CallOptions ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . listTasks ( request , options , callback ) ; } param request param { string } request . parent param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { number } request . pageSize Maximum page size.
     *
     *   Fewer tasks than requested might be returned, even if more tasks exist; use
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token in the response to
     *   determine if more tasks exist.
     *
     *   The maximum page size is 1000. If unspecified, the page size will be the
     *   maximum.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListTasks *   method.
     *
     *   The page token is valid for only 2 hours.
     *  param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [Task] google . cloud . tasks . v2beta2 . Task 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 `listTasksAsync()`
     *   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.
      listTasksStream ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listTasks' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listTasks . createStream ( this . innerApiCalls . listTasks as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent param { google . cloud . tasks . v2beta2 . Task . View } request . responseView The response_view specifies which subset of the  google . cloud . tasks . v2beta2 . Task will be
     *   returned.
     *
     *   By default response_view is  google . cloud . tasks . v2beta2 . Task . View . BASIC ; not all
     *   information is retrieved by default because some data, such as
     *   payloads, might be desirable to return only when needed because
     *   of its large size or because of the sensitivity of data that it
     *   contains.
     *
     *   Authorization for  google . cloud . tasks . v2beta2 . Task . View . FULL requires
     *   `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     *   permission on the  google . cloud . tasks . v2beta2 . Task resource.
     *  param { number } request . pageSize Maximum page size.
     *
     *   Fewer tasks than requested might be returned, even if more tasks exist; use
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token in the response to
     *   determine if more tasks exist.
     *
     *   The maximum page size is 1000. If unspecified, the page size will be the
     *   maximum.
     *  param { string } request . pageToken A token identifying the page of results to return.
     *
     *   To request the first page results, page_token must be empty. To
     *   request the next page of results, page_token must be the value of
     *    google . cloud . tasks . v2beta2 . ListTasksResponse . next_page_token returned
     *   from the previous call to  google . cloud . tasks . v2beta2 . CloudTasks . ListTasks *   method.
     *
     *   The page token is valid for only 2 hours.
     *  param { object } options Call options. See  https 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
     *   [Task] google . cloud . tasks . v2beta2 . Task . 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 listTasksAsync ( request ? , options ? ) { request = request || { } ; options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { parent : request . parent || '' , } ) ; const defaultCallSettings = this . _defaults [ 'listTasks' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listTasks . asyncIterate ( this . innerApiCalls [ 'listTasks' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . tasks . v2beta2 . ITask > ; } param { string } project param { string } location returns { string } locationPath ( project , location ) { return this . pathTemplates . locationPathTemplate . render ( { project : project , location : location , } ) ; } param { string } locationName returns { string } matchProjectFromLocationName ( locationName ) { return this . pathTemplates . locationPathTemplate . match ( locationName ) . project ; } param { string } locationName returns { string } matchLocationFromLocationName ( locationName ) { return this . pathTemplates . locationPathTemplate . match ( locationName ) . location ; } param { string } project returns { string } projectPath ( project ) { return this . pathTemplates . projectPathTemplate . render ( { project : project , } ) ; } param { string } projectName returns { string } matchProjectFromProjectName ( projectName ) { return this . pathTemplates . projectPathTemplate . match ( projectName ) . project ; } param { string } project param { string } location param { string } queue returns { string } queuePath ( project , location , queue ) { return this . pathTemplates . queuePathTemplate . render ( { project : project , location : location , queue : queue , } ) ; } param { string } queueName returns { string } matchProjectFromQueueName ( queueName ) { return this . pathTemplates . queuePathTemplate . match ( queueName ) . project ; } param { string } queueName returns { string } matchLocationFromQueueName ( queueName ) { return this . pathTemplates . queuePathTemplate . match ( queueName ) . location ; } param { string } queueName returns { string } matchQueueFromQueueName ( queueName ) { return this . pathTemplates . queuePathTemplate . match ( queueName ) . queue ; } param { string } project param { string } location param { string } queue param { string } task returns { string } taskPath ( project , location , queue , task ) { return this . pathTemplates . taskPathTemplate . render ( { project : project , location : location , queue : queue , task : task , } ) ; } param { string } taskName returns { string } matchProjectFromTaskName ( taskName ) { return this . pathTemplates . taskPathTemplate . match ( taskName ) . project ; } param { string } taskName returns { string } matchLocationFromTaskName ( taskName ) { return this . pathTemplates . taskPathTemplate . match ( taskName ) . location ; } param { string } taskName returns { string } matchQueueFromTaskName ( taskName ) { return this . pathTemplates . taskPathTemplate . match ( taskName ) . queue ; } param { string } taskName returns { string } matchTaskFromTaskName ( taskName ) { return this . pathTemplates . taskPathTemplate . match ( taskName ) . task ; } returns { Promise } close ( ) { this . initialize ( ) ; if ( ! this . _terminated ) { return this . cloudTasksStub ! . then ( stub => { this . _terminated = true ; stub . close ( ) ; } ) ; } return Promise . resolve ( ) ; } }