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/v1p1beta1/adaptation_client_config.json`.
 * This file defines retry strategy and timeouts for all API methods in this library.
 */ import * as gapicConfig from './adaptation_client_config.json' ; const version = require ( '../../../package.json' ) . version ; class memberof export class AdaptationClient { 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 ; } ; adaptationStub ? : 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 AdaptationClient ; 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 = { customClassPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}/customClasses/{custom_class}' ) , locationPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}' ) , phraseSetPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}/locations/{location}/phraseSets/{phrase_set}' ) , projectPathTemplate : new this . _gaxModule . PathTemplate ( 'projects/{project}' ) , } ; this . descriptors . page = { listPhraseSet : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'phraseSets' ) , listCustomClasses : new this . _gaxModule . PageDescriptor ( 'pageToken' , 'nextPageToken' , 'customClasses' ) , } ; this . _defaults = this . _gaxGrpc . constructSettings ( 'google.cloud.speech.v1p1beta1.Adaptation' , gapicConfig as gax . ClientConfig , opts . clientConfig || { } , { 'x-goog-api-client' : clientHeader . join ( ' ' ) } ) ; this . innerApiCalls = { } ; this . warn = gax . warn ; } returns { Promise } initialize ( ) { if ( this . adaptationStub ) { return this . adaptationStub ; } this . adaptationStub = this . _gaxGrpc . createStub ( this . _opts . fallback ? ( this . _protos as protobuf . Root ) . lookupService ( 'google.cloud.speech.v1p1beta1.Adaptation' ) : ( this . _protos as any ) . google . cloud . speech . v1p1beta1 . Adaptation , this . _opts , this . _providedCustomServicePath ) as Promise < { [ method ] : Function ; } > ; const adaptationStubMethods = [ 'createPhraseSet' , 'getPhraseSet' , 'listPhraseSet' , 'updatePhraseSet' , 'deletePhraseSet' , 'createCustomClass' , 'getCustomClass' , 'listCustomClasses' , 'updateCustomClass' , 'deleteCustomClass' , ] ; for ( const methodName of adaptationStubMethods ) { const callPromise = this . adaptationStub . 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 . adaptationStub ; } returns { string } static get servicePath ( ) { return 'speech.googleapis.com' ; } returns { string } static get apiEndpoint ( ) { return 'speech.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 . parent param { string } request . phraseSetId Required. The ID to use for the phrase set, which will become the final
     *   component of the phrase set's resource name.
     *
     *   This value should be 4-63 characters, and valid characters
     *   are / {@link 0-9|a-z} -/.
     *  param { google . cloud . speech . v1p1beta1 . PhraseSet } request . phraseSet 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 [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example createPhraseSet ( request ? , options ? ) ; createPhraseSet ( request , options , callback ) ; createPhraseSet ( request , callback ) ; createPhraseSet ( 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 . createPhraseSet ( 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 [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getPhraseSet ( request ? , options ? ) ; getPhraseSet ( request , options , callback ) ; getPhraseSet ( request , callback ) ; getPhraseSet ( 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 . getPhraseSet ( request , options , callback ) ; } param request param { google . cloud . speech . v1p1beta1 . PhraseSet } request . phraseSet 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 [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example updatePhraseSet ( request ? , options ? ) ; updatePhraseSet ( request , options , callback ) ; updatePhraseSet ( request , callback ) ; updatePhraseSet ( 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 ( { 'phrase_set.name' : request . phraseSet ! . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . updatePhraseSet ( 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 deletePhraseSet ( request ? , options ? ) ; deletePhraseSet ( request , options , callback ) ; deletePhraseSet ( request , callback ) ; deletePhraseSet ( 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 . deletePhraseSet ( request , options , callback ) ; } param request param { string } request . parent param { string } request . customClassId Required. The ID to use for the custom class, which will become the final
     *   component of the custom class' resource name.
     *
     *   This value should be 4-63 characters, and valid characters
     *   are / {@link 0-9|a-z} -/.
     *  param { google . cloud . speech . v1p1beta1 . CustomClass } request . customClass 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 [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example createCustomClass ( request ? , options ? ) ; createCustomClass ( request , options , callback ) ; createCustomClass ( request , callback ) ; createCustomClass ( 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 . createCustomClass ( 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 [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example getCustomClass ( request ? , options ? ) ; getCustomClass ( request , options , callback ) ; getCustomClass ( request , callback ) ; getCustomClass ( 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 . getCustomClass ( request , options , callback ) ; } param request param { google . cloud . speech . v1p1beta1 . CustomClass } request . customClass 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 [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass .
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     *  example updateCustomClass ( request ? , options ? ) ; updateCustomClass ( request , options , callback ) ; updateCustomClass ( request , callback ) ; updateCustomClass ( 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 ( { 'custom_class.name' : request . customClass ! . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . updateCustomClass ( 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 deleteCustomClass ( request ? , options ? ) ; deleteCustomClass ( request , options , callback ) ; deleteCustomClass ( request , callback ) ; deleteCustomClass ( 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 . deleteCustomClass ( request , options , callback ) ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken 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 [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet .
     *   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 `listPhraseSetAsync()`
     *   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.
      listPhraseSet ( request ? , options ? ) ; listPhraseSet ( request , options , callback ) ; listPhraseSet ( request , callback ) ; listPhraseSet ( 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 . listPhraseSet ( request , options , callback ) ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet 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 `listPhraseSetAsync()`
     *   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.
      listPhraseSetStream ( 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 [ 'listPhraseSet' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listPhraseSet . createStream ( this . innerApiCalls . listPhraseSet as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken 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
     *   [PhraseSet] google . cloud . speech . v1p1beta1 . PhraseSet . 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 listPhraseSetAsync ( 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 [ 'listPhraseSet' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listPhraseSet . asyncIterate ( this . innerApiCalls [ 'listPhraseSet' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . speech . v1p1beta1 . IPhraseSet > ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken 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 [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass .
     *   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 `listCustomClassesAsync()`
     *   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.
      listCustomClasses ( request ? , options ? ) ; listCustomClasses ( request , options , callback ) ; listCustomClasses ( request , callback ) ; listCustomClasses ( 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 . listCustomClasses ( request , options , callback ) ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken param { object } options Call options. See  https for more details.
     *  returns { Stream } *   An object stream which emits an object representing [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass 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 `listCustomClassesAsync()`
     *   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.
      listCustomClassesStream ( 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 [ 'listCustomClasses' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listCustomClasses . createStream ( this . innerApiCalls . listCustomClasses as gax . GaxCall , request , callSettings ) ; } param request param { string } request . parent param { number } request . pageSize param { string } request . pageToken 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
     *   [CustomClass] google . cloud . speech . v1p1beta1 . CustomClass . 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 listCustomClassesAsync ( 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 [ 'listCustomClasses' ] ; const callSettings = defaultCallSettings . merge ( options ) ; this . initialize ( ) ; return this . descriptors . page . listCustomClasses . asyncIterate ( this . innerApiCalls [ 'listCustomClasses' ] as GaxCall , request as unknown as RequestType , callSettings ) as AsyncIterable < protos . google . cloud . speech . v1p1beta1 . ICustomClass > ; } param { string } project param { string } location param { string } custom_class returns { string } customClassPath ( project , location , customClass ) { return this . pathTemplates . customClassPathTemplate . render ( { project : project , location : location , custom_class : customClass , } ) ; } param { string } customClassName returns { string } matchProjectFromCustomClassName ( customClassName ) { return this . pathTemplates . customClassPathTemplate . match ( customClassName ) . project ; } param { string } customClassName returns { string } matchLocationFromCustomClassName ( customClassName ) { return this . pathTemplates . customClassPathTemplate . match ( customClassName ) . location ; } param { string } customClassName returns { string } matchCustomClassFromCustomClassName ( customClassName ) { return this . pathTemplates . customClassPathTemplate . match ( customClassName ) . custom_class ; } 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 param { string } location param { string } phrase_set returns { string } phraseSetPath ( project , location , phraseSet ) { return this . pathTemplates . phraseSetPathTemplate . render ( { project : project , location : location , phrase_set : phraseSet , } ) ; } param { string } phraseSetName returns { string } matchProjectFromPhraseSetName ( phraseSetName ) { return this . pathTemplates . phraseSetPathTemplate . match ( phraseSetName ) . project ; } param { string } phraseSetName returns { string } matchLocationFromPhraseSetName ( phraseSetName ) { return this . pathTemplates . phraseSetPathTemplate . match ( phraseSetName ) . location ; } param { string } phraseSetName returns { string } matchPhraseSetFromPhraseSetName ( phraseSetName ) { return this . pathTemplates . phraseSetPathTemplate . match ( phraseSetName ) . phrase_set ; } 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 ; } returns { Promise } close ( ) { this . initialize ( ) ; if ( ! this . _terminated ) { return this . adaptationStub ! . then ( stub => { this . _terminated = true ; stub . close ( ) ; } ) ; } return Promise . resolve ( ) ; } }