Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / dialogflow / src / v2beta1 / session_entity_types_client.js
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 'use strict';
16
17 const gapicConfig = require('./session_entity_types_client_config.json');
18 const gax = require('google-gax');
19 const merge = require('lodash.merge');
20 const path = require('path');
21
22 const VERSION = require('../../package.json').version;
23
24 /**
25  * Entities are extracted from user input and represent parameters that are
26  * meaningful to your application. For example, a date range, a proper name
27  * such as a geographic location or landmark, and so on. Entities represent
28  * actionable data for your application.
29  *
30  * Session entity types are referred to as **User** entity types and are
31  * entities that are built for an individual user such as
32  * favorites, preferences, playlists, and so on. You can redefine a session
33  * entity type at the session level.
34  *
35  * For more information about entity types, see the
36  * [Dialogflow documentation](https://dialogflow.com/docs/entities).
37  *
38  * @class
39  * @memberof v2beta1
40  */
41 class SessionEntityTypesClient {
42   /**
43    * Construct an instance of SessionEntityTypesClient.
44    *
45    * @param {object} [options] - The configuration object. See the subsequent
46    *   parameters for more details.
47    * @param {object} [options.credentials] - Credentials object.
48    * @param {string} [options.credentials.client_email]
49    * @param {string} [options.credentials.private_key]
50    * @param {string} [options.email] - Account email address. Required when
51    *     using a .pem or .p12 keyFilename.
52    * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
53    *     .p12 key downloaded from the Google Developers Console. If you provide
54    *     a path to a JSON file, the projectId option below is not necessary.
55    *     NOTE: .pem and .p12 require you to specify options.email as well.
56    * @param {number} [options.port] - The port on which to connect to
57    *     the remote host.
58    * @param {string} [options.projectId] - The project ID from the Google
59    *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
60    *     the environment variable GCLOUD_PROJECT for your project ID. If your
61    *     app is running in an environment which supports
62    *     {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
63    *     your project ID will be detected automatically.
64    * @param {function} [options.promise] - Custom promise module to use instead
65    *     of native Promises.
66    * @param {string} [options.servicePath] - The domain name of the
67    *     API remote host.
68    */
69   constructor(opts) {
70     this._descriptors = {};
71
72     // Ensure that options include the service address and port.
73     opts = Object.assign(
74       {
75         clientConfig: {},
76         port: this.constructor.port,
77         servicePath: this.constructor.servicePath,
78       },
79       opts
80     );
81
82     // Create a `gaxGrpc` object, with any grpc-specific options
83     // sent to the client.
84     opts.scopes = this.constructor.scopes;
85     const gaxGrpc = new gax.GrpcClient(opts);
86
87     // Save the auth object to the client, for use by other methods.
88     this.auth = gaxGrpc.auth;
89
90     // Determine the client header string.
91     const clientHeader = [
92       `gl-node/${process.version}`,
93       `grpc/${gaxGrpc.grpcVersion}`,
94       `gax/${gax.version}`,
95       `gapic/${VERSION}`,
96     ];
97     if (opts.libName && opts.libVersion) {
98       clientHeader.push(`${opts.libName}/${opts.libVersion}`);
99     }
100
101     // Load the applicable protos.
102     const protos = merge(
103       {},
104       gaxGrpc.loadProto(
105         path.join(__dirname, '..', '..', 'protos'),
106         'google/cloud/dialogflow/v2beta1/session_entity_type.proto'
107       )
108     );
109
110     // This API contains "path templates"; forward-slash-separated
111     // identifiers to uniquely identify resources within the API.
112     // Create useful helper objects for these.
113     this._pathTemplates = {
114       sessionPathTemplate: new gax.PathTemplate(
115         'projects/{project}/agent/sessions/{session}'
116       ),
117       environmentSessionPathTemplate: new gax.PathTemplate(
118         'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}'
119       ),
120       sessionEntityTypePathTemplate: new gax.PathTemplate(
121         'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}'
122       ),
123       environmentSessionEntityTypePathTemplate: new gax.PathTemplate(
124         'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}'
125       ),
126     };
127
128     // Some of the methods on this service return "paged" results,
129     // (e.g. 50 results at a time, with tokens to get subsequent
130     // pages). Denote the keys used for pagination and results.
131     this._descriptors.page = {
132       listSessionEntityTypes: new gax.PageDescriptor(
133         'pageToken',
134         'nextPageToken',
135         'sessionEntityTypes'
136       ),
137     };
138
139     // Put together the default options sent with requests.
140     const defaults = gaxGrpc.constructSettings(
141       'google.cloud.dialogflow.v2beta1.SessionEntityTypes',
142       gapicConfig,
143       opts.clientConfig,
144       {'x-goog-api-client': clientHeader.join(' ')}
145     );
146
147     // Set up a dictionary of "inner API calls"; the core implementation
148     // of calling the API is handled in `google-gax`, with this code
149     // merely providing the destination and request information.
150     this._innerApiCalls = {};
151
152     // Put together the "service stub" for
153     // google.cloud.dialogflow.v2beta1.SessionEntityTypes.
154     const sessionEntityTypesStub = gaxGrpc.createStub(
155       protos.google.cloud.dialogflow.v2beta1.SessionEntityTypes,
156       opts
157     );
158
159     // Iterate over each of the methods that the service provides
160     // and create an API call method for each.
161     const sessionEntityTypesStubMethods = [
162       'listSessionEntityTypes',
163       'getSessionEntityType',
164       'createSessionEntityType',
165       'updateSessionEntityType',
166       'deleteSessionEntityType',
167     ];
168     for (const methodName of sessionEntityTypesStubMethods) {
169       this._innerApiCalls[methodName] = gax.createApiCall(
170         sessionEntityTypesStub.then(
171           stub =>
172             function() {
173               const args = Array.prototype.slice.call(arguments, 0);
174               return stub[methodName].apply(stub, args);
175             },
176           err =>
177             function() {
178               throw err;
179             }
180         ),
181         defaults[methodName],
182         this._descriptors.page[methodName]
183       );
184     }
185   }
186
187   /**
188    * The DNS address for this API service.
189    */
190   static get servicePath() {
191     return 'dialogflow.googleapis.com';
192   }
193
194   /**
195    * The port for this API service.
196    */
197   static get port() {
198     return 443;
199   }
200
201   /**
202    * The scopes needed to make gRPC calls for every method defined
203    * in this service.
204    */
205   static get scopes() {
206     return ['https://www.googleapis.com/auth/cloud-platform'];
207   }
208
209   /**
210    * Return the project ID used by this class.
211    * @param {function(Error, string)} callback - the callback to
212    *   be called with the current project Id.
213    */
214   getProjectId(callback) {
215     return this.auth.getProjectId(callback);
216   }
217
218   // -------------------
219   // -- Service calls --
220   // -------------------
221
222   /**
223    * Returns the list of all session entity types in the specified session.
224    *
225    * @param {Object} request
226    *   The request object that will be sent.
227    * @param {string} request.parent
228    *   Required. The session to list all session entity types from.
229    *   Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
230    *   `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
231    *   sessions/<Session ID>`.
232    *   If `Environment ID` is not specified, we assume default 'draft'
233    *   environment. If `User ID` is not specified, we assume default '-' user.
234    * @param {number} [request.pageSize]
235    *   The maximum number of resources contained in the underlying API
236    *   response. If page streaming is performed per-resource, this
237    *   parameter does not affect the return value. If page streaming is
238    *   performed per-page, this determines the maximum number of
239    *   resources in a page.
240    * @param {Object} [options]
241    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
242    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
243    * @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
244    *   The function which will be called with the result of the API call.
245    *
246    *   The second parameter to the callback is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
247    *
248    *   When autoPaginate: false is specified through options, it contains the result
249    *   in a single response. If the response indicates the next page exists, the third
250    *   parameter is set to be used for the next request object. The fourth parameter keeps
251    *   the raw response object of an object representing [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse}.
252    * @returns {Promise} - The promise which resolves to an array.
253    *   The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
254    *
255    *   When autoPaginate: false is specified through options, the array has three elements.
256    *   The first element is Array of [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} in a single response.
257    *   The second element is the next request object if the response
258    *   indicates the next page exists, or null. The third element is
259    *   an object representing [ListSessionEntityTypesResponse]{@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse}.
260    *
261    *   The promise has a method named "cancel" which cancels the ongoing API call.
262    *
263    * @example
264    *
265    * const dialogflow = require('dialogflow');
266    *
267    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
268    *   // optional auth parameters.
269    * });
270    *
271    * // Iterate over all elements.
272    * const formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
273    *
274    * client.listSessionEntityTypes({parent: formattedParent})
275    *   .then(responses => {
276    *     const resources = responses[0];
277    *     for (const resource of resources) {
278    *       // doThingsWith(resource)
279    *     }
280    *   })
281    *   .catch(err => {
282    *     console.error(err);
283    *   });
284    *
285    * // Or obtain the paged response.
286    * const formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
287    *
288    *
289    * const options = {autoPaginate: false};
290    * const callback = responses => {
291    *   // The actual resources in a response.
292    *   const resources = responses[0];
293    *   // The next request if the response shows that there are more responses.
294    *   const nextRequest = responses[1];
295    *   // The actual response object, if necessary.
296    *   // const rawResponse = responses[2];
297    *   for (const resource of resources) {
298    *     // doThingsWith(resource);
299    *   }
300    *   if (nextRequest) {
301    *     // Fetch the next page.
302    *     return client.listSessionEntityTypes(nextRequest, options).then(callback);
303    *   }
304    * }
305    * client.listSessionEntityTypes({parent: formattedParent}, options)
306    *   .then(callback)
307    *   .catch(err => {
308    *     console.error(err);
309    *   });
310    */
311   listSessionEntityTypes(request, options, callback) {
312     if (options instanceof Function && callback === undefined) {
313       callback = options;
314       options = {};
315     }
316     options = options || {};
317
318     return this._innerApiCalls.listSessionEntityTypes(
319       request,
320       options,
321       callback
322     );
323   }
324
325   /**
326    * Equivalent to {@link listSessionEntityTypes}, but returns a NodeJS Stream object.
327    *
328    * This fetches the paged responses for {@link listSessionEntityTypes} continuously
329    * and invokes the callback registered for 'data' event for each element in the
330    * responses.
331    *
332    * The returned object has 'end' method when no more elements are required.
333    *
334    * autoPaginate option will be ignored.
335    *
336    * @see {@link https://nodejs.org/api/stream.html}
337    *
338    * @param {Object} request
339    *   The request object that will be sent.
340    * @param {string} request.parent
341    *   Required. The session to list all session entity types from.
342    *   Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
343    *   `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
344    *   sessions/<Session ID>`.
345    *   If `Environment ID` is not specified, we assume default 'draft'
346    *   environment. If `User ID` is not specified, we assume default '-' user.
347    * @param {number} [request.pageSize]
348    *   The maximum number of resources contained in the underlying API
349    *   response. If page streaming is performed per-resource, this
350    *   parameter does not affect the return value. If page streaming is
351    *   performed per-page, this determines the maximum number of
352    *   resources in a page.
353    * @param {Object} [options]
354    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
355    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
356    * @returns {Stream}
357    *   An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} on 'data' event.
358    *
359    * @example
360    *
361    * const dialogflow = require('dialogflow');
362    *
363    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
364    *   // optional auth parameters.
365    * });
366    *
367    * const formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
368    * client.listSessionEntityTypesStream({parent: formattedParent})
369    *   .on('data', element => {
370    *     // doThingsWith(element)
371    *   }).on('error', err => {
372    *     console.log(err);
373    *   });
374    */
375   listSessionEntityTypesStream(request, options) {
376     options = options || {};
377
378     return this._descriptors.page.listSessionEntityTypes.createStream(
379       this._innerApiCalls.listSessionEntityTypes,
380       request,
381       options
382     );
383   }
384
385   /**
386    * Retrieves the specified session entity type.
387    *
388    * @param {Object} request
389    *   The request object that will be sent.
390    * @param {string} request.name
391    *   Required. The name of the session entity type. Format:
392    *   `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
393    *   Display Name>` or `projects/<Project ID>/agent/environments/<Environment
394    *   ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
395    *   Name>`. If `Environment ID` is not specified, we assume default 'draft'
396    *   environment. If `User ID` is not specified, we assume default '-' user.
397    * @param {Object} [options]
398    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
399    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
400    * @param {function(?Error, ?Object)} [callback]
401    *   The function which will be called with the result of the API call.
402    *
403    *   The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
404    * @returns {Promise} - The promise which resolves to an array.
405    *   The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
406    *   The promise has a method named "cancel" which cancels the ongoing API call.
407    *
408    * @example
409    *
410    * const dialogflow = require('dialogflow');
411    *
412    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
413    *   // optional auth parameters.
414    * });
415    *
416    * const formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
417    * client.getSessionEntityType({name: formattedName})
418    *   .then(responses => {
419    *     const response = responses[0];
420    *     // doThingsWith(response)
421    *   })
422    *   .catch(err => {
423    *     console.error(err);
424    *   });
425    */
426   getSessionEntityType(request, options, callback) {
427     if (options instanceof Function && callback === undefined) {
428       callback = options;
429       options = {};
430     }
431     options = options || {};
432
433     return this._innerApiCalls.getSessionEntityType(request, options, callback);
434   }
435
436   /**
437    * Creates a session entity type.
438    *
439    * @param {Object} request
440    *   The request object that will be sent.
441    * @param {string} request.parent
442    *   Required. The session to create a session entity type for.
443    *   Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
444    *   `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
445    *   sessions/<Session ID>`. If `Environment ID` is not specified, we assume
446    *   default 'draft' environment. If `User ID` is not specified, we assume
447    *   default '-' user.
448    * @param {Object} request.sessionEntityType
449    *   Required. The session entity type to create.
450    *
451    *   This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}
452    * @param {Object} [options]
453    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
454    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
455    * @param {function(?Error, ?Object)} [callback]
456    *   The function which will be called with the result of the API call.
457    *
458    *   The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
459    * @returns {Promise} - The promise which resolves to an array.
460    *   The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
461    *   The promise has a method named "cancel" which cancels the ongoing API call.
462    *
463    * @example
464    *
465    * const dialogflow = require('dialogflow');
466    *
467    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
468    *   // optional auth parameters.
469    * });
470    *
471    * const formattedParent = client.sessionPath('[PROJECT]', '[SESSION]');
472    * const sessionEntityType = {};
473    * const request = {
474    *   parent: formattedParent,
475    *   sessionEntityType: sessionEntityType,
476    * };
477    * client.createSessionEntityType(request)
478    *   .then(responses => {
479    *     const response = responses[0];
480    *     // doThingsWith(response)
481    *   })
482    *   .catch(err => {
483    *     console.error(err);
484    *   });
485    */
486   createSessionEntityType(request, options, callback) {
487     if (options instanceof Function && callback === undefined) {
488       callback = options;
489       options = {};
490     }
491     options = options || {};
492
493     return this._innerApiCalls.createSessionEntityType(
494       request,
495       options,
496       callback
497     );
498   }
499
500   /**
501    * Updates the specified session entity type.
502    *
503    * @param {Object} request
504    *   The request object that will be sent.
505    * @param {Object} request.sessionEntityType
506    *   Required. The entity type to update. Format:
507    *   `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
508    *   Display Name>` or `projects/<Project ID>/agent/environments/<Environment
509    *   ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
510    *   Name>`. If `Environment ID` is not specified, we assume default 'draft'
511    *   environment. If `User ID` is not specified, we assume default '-' user.
512    *
513    *   This object should have the same structure as [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}
514    * @param {Object} [request.updateMask]
515    *   Optional. The mask to control which fields get updated.
516    *
517    *   This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask}
518    * @param {Object} [options]
519    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
520    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
521    * @param {function(?Error, ?Object)} [callback]
522    *   The function which will be called with the result of the API call.
523    *
524    *   The second parameter to the callback is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
525    * @returns {Promise} - The promise which resolves to an array.
526    *   The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}.
527    *   The promise has a method named "cancel" which cancels the ongoing API call.
528    *
529    * @example
530    *
531    * const dialogflow = require('dialogflow');
532    *
533    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
534    *   // optional auth parameters.
535    * });
536    *
537    * const sessionEntityType = {};
538    * client.updateSessionEntityType({sessionEntityType: sessionEntityType})
539    *   .then(responses => {
540    *     const response = responses[0];
541    *     // doThingsWith(response)
542    *   })
543    *   .catch(err => {
544    *     console.error(err);
545    *   });
546    */
547   updateSessionEntityType(request, options, callback) {
548     if (options instanceof Function && callback === undefined) {
549       callback = options;
550       options = {};
551     }
552     options = options || {};
553
554     return this._innerApiCalls.updateSessionEntityType(
555       request,
556       options,
557       callback
558     );
559   }
560
561   /**
562    * Deletes the specified session entity type.
563    *
564    * @param {Object} request
565    *   The request object that will be sent.
566    * @param {string} request.name
567    *   Required. The name of the entity type to delete. Format:
568    *   `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
569    *   Display Name>` or `projects/<Project ID>/agent/environments/<Environment
570    *   ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
571    *   Name>`. If `Environment ID` is not specified, we assume default 'draft'
572    *   environment. If `User ID` is not specified, we assume default '-' user.
573    * @param {Object} [options]
574    *   Optional parameters. You can override the default settings for this call, e.g, timeout,
575    *   retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
576    * @param {function(?Error)} [callback]
577    *   The function which will be called with the result of the API call.
578    * @returns {Promise} - The promise which resolves when API call finishes.
579    *   The promise has a method named "cancel" which cancels the ongoing API call.
580    *
581    * @example
582    *
583    * const dialogflow = require('dialogflow');
584    *
585    * const client = new dialogflow.v2beta1.SessionEntityTypesClient({
586    *   // optional auth parameters.
587    * });
588    *
589    * const formattedName = client.sessionEntityTypePath('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]');
590    * client.deleteSessionEntityType({name: formattedName}).catch(err => {
591    *   console.error(err);
592    * });
593    */
594   deleteSessionEntityType(request, options, callback) {
595     if (options instanceof Function && callback === undefined) {
596       callback = options;
597       options = {};
598     }
599     options = options || {};
600
601     return this._innerApiCalls.deleteSessionEntityType(
602       request,
603       options,
604       callback
605     );
606   }
607
608   // --------------------
609   // -- Path templates --
610   // --------------------
611
612   /**
613    * Return a fully-qualified session resource name string.
614    *
615    * @param {String} project
616    * @param {String} session
617    * @returns {String}
618    */
619   sessionPath(project, session) {
620     return this._pathTemplates.sessionPathTemplate.render({
621       project: project,
622       session: session,
623     });
624   }
625
626   /**
627    * Return a fully-qualified environment_session resource name string.
628    *
629    * @param {String} project
630    * @param {String} environment
631    * @param {String} user
632    * @param {String} session
633    * @returns {String}
634    */
635   environmentSessionPath(project, environment, user, session) {
636     return this._pathTemplates.environmentSessionPathTemplate.render({
637       project: project,
638       environment: environment,
639       user: user,
640       session: session,
641     });
642   }
643
644   /**
645    * Return a fully-qualified session_entity_type resource name string.
646    *
647    * @param {String} project
648    * @param {String} session
649    * @param {String} entityType
650    * @returns {String}
651    */
652   sessionEntityTypePath(project, session, entityType) {
653     return this._pathTemplates.sessionEntityTypePathTemplate.render({
654       project: project,
655       session: session,
656       entity_type: entityType,
657     });
658   }
659
660   /**
661    * Return a fully-qualified environment_session_entity_type resource name string.
662    *
663    * @param {String} project
664    * @param {String} environment
665    * @param {String} user
666    * @param {String} session
667    * @param {String} entityType
668    * @returns {String}
669    */
670   environmentSessionEntityTypePath(
671     project,
672     environment,
673     user,
674     session,
675     entityType
676   ) {
677     return this._pathTemplates.environmentSessionEntityTypePathTemplate.render({
678       project: project,
679       environment: environment,
680       user: user,
681       session: session,
682       entity_type: entityType,
683     });
684   }
685
686   /**
687    * Parse the sessionName from a session resource.
688    *
689    * @param {String} sessionName
690    *   A fully-qualified path representing a session resources.
691    * @returns {String} - A string representing the project.
692    */
693   matchProjectFromSessionName(sessionName) {
694     return this._pathTemplates.sessionPathTemplate.match(sessionName).project;
695   }
696
697   /**
698    * Parse the sessionName from a session resource.
699    *
700    * @param {String} sessionName
701    *   A fully-qualified path representing a session resources.
702    * @returns {String} - A string representing the session.
703    */
704   matchSessionFromSessionName(sessionName) {
705     return this._pathTemplates.sessionPathTemplate.match(sessionName).session;
706   }
707
708   /**
709    * Parse the environmentSessionName from a environment_session resource.
710    *
711    * @param {String} environmentSessionName
712    *   A fully-qualified path representing a environment_session resources.
713    * @returns {String} - A string representing the project.
714    */
715   matchProjectFromEnvironmentSessionName(environmentSessionName) {
716     return this._pathTemplates.environmentSessionPathTemplate.match(
717       environmentSessionName
718     ).project;
719   }
720
721   /**
722    * Parse the environmentSessionName from a environment_session resource.
723    *
724    * @param {String} environmentSessionName
725    *   A fully-qualified path representing a environment_session resources.
726    * @returns {String} - A string representing the environment.
727    */
728   matchEnvironmentFromEnvironmentSessionName(environmentSessionName) {
729     return this._pathTemplates.environmentSessionPathTemplate.match(
730       environmentSessionName
731     ).environment;
732   }
733
734   /**
735    * Parse the environmentSessionName from a environment_session resource.
736    *
737    * @param {String} environmentSessionName
738    *   A fully-qualified path representing a environment_session resources.
739    * @returns {String} - A string representing the user.
740    */
741   matchUserFromEnvironmentSessionName(environmentSessionName) {
742     return this._pathTemplates.environmentSessionPathTemplate.match(
743       environmentSessionName
744     ).user;
745   }
746
747   /**
748    * Parse the environmentSessionName from a environment_session resource.
749    *
750    * @param {String} environmentSessionName
751    *   A fully-qualified path representing a environment_session resources.
752    * @returns {String} - A string representing the session.
753    */
754   matchSessionFromEnvironmentSessionName(environmentSessionName) {
755     return this._pathTemplates.environmentSessionPathTemplate.match(
756       environmentSessionName
757     ).session;
758   }
759
760   /**
761    * Parse the sessionEntityTypeName from a session_entity_type resource.
762    *
763    * @param {String} sessionEntityTypeName
764    *   A fully-qualified path representing a session_entity_type resources.
765    * @returns {String} - A string representing the project.
766    */
767   matchProjectFromSessionEntityTypeName(sessionEntityTypeName) {
768     return this._pathTemplates.sessionEntityTypePathTemplate.match(
769       sessionEntityTypeName
770     ).project;
771   }
772
773   /**
774    * Parse the sessionEntityTypeName from a session_entity_type resource.
775    *
776    * @param {String} sessionEntityTypeName
777    *   A fully-qualified path representing a session_entity_type resources.
778    * @returns {String} - A string representing the session.
779    */
780   matchSessionFromSessionEntityTypeName(sessionEntityTypeName) {
781     return this._pathTemplates.sessionEntityTypePathTemplate.match(
782       sessionEntityTypeName
783     ).session;
784   }
785
786   /**
787    * Parse the sessionEntityTypeName from a session_entity_type resource.
788    *
789    * @param {String} sessionEntityTypeName
790    *   A fully-qualified path representing a session_entity_type resources.
791    * @returns {String} - A string representing the entity_type.
792    */
793   matchEntityTypeFromSessionEntityTypeName(sessionEntityTypeName) {
794     return this._pathTemplates.sessionEntityTypePathTemplate.match(
795       sessionEntityTypeName
796     ).entity_type;
797   }
798
799   /**
800    * Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
801    *
802    * @param {String} environmentSessionEntityTypeName
803    *   A fully-qualified path representing a environment_session_entity_type resources.
804    * @returns {String} - A string representing the project.
805    */
806   matchProjectFromEnvironmentSessionEntityTypeName(
807     environmentSessionEntityTypeName
808   ) {
809     return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
810       environmentSessionEntityTypeName
811     ).project;
812   }
813
814   /**
815    * Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
816    *
817    * @param {String} environmentSessionEntityTypeName
818    *   A fully-qualified path representing a environment_session_entity_type resources.
819    * @returns {String} - A string representing the environment.
820    */
821   matchEnvironmentFromEnvironmentSessionEntityTypeName(
822     environmentSessionEntityTypeName
823   ) {
824     return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
825       environmentSessionEntityTypeName
826     ).environment;
827   }
828
829   /**
830    * Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
831    *
832    * @param {String} environmentSessionEntityTypeName
833    *   A fully-qualified path representing a environment_session_entity_type resources.
834    * @returns {String} - A string representing the user.
835    */
836   matchUserFromEnvironmentSessionEntityTypeName(
837     environmentSessionEntityTypeName
838   ) {
839     return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
840       environmentSessionEntityTypeName
841     ).user;
842   }
843
844   /**
845    * Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
846    *
847    * @param {String} environmentSessionEntityTypeName
848    *   A fully-qualified path representing a environment_session_entity_type resources.
849    * @returns {String} - A string representing the session.
850    */
851   matchSessionFromEnvironmentSessionEntityTypeName(
852     environmentSessionEntityTypeName
853   ) {
854     return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
855       environmentSessionEntityTypeName
856     ).session;
857   }
858
859   /**
860    * Parse the environmentSessionEntityTypeName from a environment_session_entity_type resource.
861    *
862    * @param {String} environmentSessionEntityTypeName
863    *   A fully-qualified path representing a environment_session_entity_type resources.
864    * @returns {String} - A string representing the entity_type.
865    */
866   matchEntityTypeFromEnvironmentSessionEntityTypeName(
867     environmentSessionEntityTypeName
868   ) {
869     return this._pathTemplates.environmentSessionEntityTypePathTemplate.match(
870       environmentSessionEntityTypeName
871     ).entity_type;
872   }
873 }
874
875 module.exports = SessionEntityTypesClient;