diff --git a/templates/typescript_gapic/src/$version/$service_client.ts.njk b/templates/typescript_gapic/src/$version/$service_client.ts.njk index 2d7fef9aa..2f8f31f0f 100644 --- a/templates/typescript_gapic/src/$version/$service_client.ts.njk +++ b/templates/typescript_gapic/src/$version/$service_client.ts.njk @@ -567,12 +567,21 @@ export class {{ service.name }}Client { // -- Path templates -- // -------------------- {%- for template in service.pathTemplates %} + + /** + * Return a fully-qualified {{ template.name.toLowerCase() }} resource name string. + * +{%- for param in template.params %} + * @param {string} {{ param }} +{%- endfor %} + * @returns {string} Resource name string. + */ {{ template.name.toLowerCase() }}Path( {%- set paramJoiner = joiner() %} {%- for param in template.params %} {{-paramJoiner()-}}{{ param }}:string {%- endfor -%} - ){ + ) { return this._pathTemplates.{{ template.name.toLowerCase() }}PathTemplate.render({ {%- for param in template.params %} {{ param }}: {{ param }}, @@ -580,7 +589,15 @@ export class {{ service.name }}Client { }); } {%- for param in template.params %} - match{{ param.capitalize() }}From{{ template.name }}Name({{ template.name.toLowerCase() }}Name: string){ + + /** + * Parse the {{ param }} from {{ template.name }} resource. + * + * @param {string} {{ template.name.toLowerCase() }}Name + * A fully-qualified path representing {{ template.name }} resource. + * @returns {string} A string representing the {{ param }}. + */ + match{{ param.capitalize() }}From{{ template.name }}Name({{ template.name.toLowerCase() }}Name: string) { return this._pathTemplates.{{ template.name.toLowerCase() }}PathTemplate.match({{ template.name.toLowerCase() }}Name).{{ param }}; } {%- endfor %} diff --git a/typescript/test/testdata/redis/src/v1beta1/cloud_redis_client.ts.baseline b/typescript/test/testdata/redis/src/v1beta1/cloud_redis_client.ts.baseline index cf6ba8fbd..73b2470a3 100644 --- a/typescript/test/testdata/redis/src/v1beta1/cloud_redis_client.ts.baseline +++ b/typescript/test/testdata/redis/src/v1beta1/cloud_redis_client.ts.baseline @@ -885,32 +885,89 @@ export class CloudRedisClient { // -------------------- // -- Path templates -- // -------------------- - locationPath(project:string,location:string){ + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { return this._pathTemplates.locationPathTemplate.render({ project: project, location: location, }); } - matchProjectFromLocationName(locationName: string){ + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { return this._pathTemplates.locationPathTemplate.match(locationName).project; } - matchLocationFromLocationName(locationName: string){ + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { return this._pathTemplates.locationPathTemplate.match(locationName).location; } - instancePath(project:string,location:string,instance:string){ + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { return this._pathTemplates.instancePathTemplate.render({ project: project, location: location, instance: instance, }); } - matchProjectFromInstanceName(instanceName: string){ + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { return this._pathTemplates.instancePathTemplate.match(instanceName).project; } - matchLocationFromInstanceName(instanceName: string){ + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { return this._pathTemplates.instancePathTemplate.match(instanceName).location; } - matchInstanceFromInstanceName(instanceName: string){ + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { return this._pathTemplates.instancePathTemplate.match(instanceName).instance; } diff --git a/typescript/test/testdata/translate/src/v3beta1/translation_service_client.ts.baseline b/typescript/test/testdata/translate/src/v3beta1/translation_service_client.ts.baseline index 133291778..eb5636a1e 100644 --- a/typescript/test/testdata/translate/src/v3beta1/translation_service_client.ts.baseline +++ b/typescript/test/testdata/translate/src/v3beta1/translation_service_client.ts.baseline @@ -1025,32 +1025,89 @@ export class TranslationServiceClient { // -------------------- // -- Path templates -- // -------------------- - locationPath(project:string,location:string){ + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { return this._pathTemplates.locationPathTemplate.render({ project: project, location: location, }); } - matchProjectFromLocationName(locationName: string){ + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { return this._pathTemplates.locationPathTemplate.match(locationName).project; } - matchLocationFromLocationName(locationName: string){ + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { return this._pathTemplates.locationPathTemplate.match(locationName).location; } - glossaryPath(project:string,location:string,glossary:string){ + + /** + * Return a fully-qualified glossary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} glossary + * @returns {string} Resource name string. + */ + glossaryPath(project:string,location:string,glossary:string) { return this._pathTemplates.glossaryPathTemplate.render({ project: project, location: location, glossary: glossary, }); } - matchProjectFromGlossaryName(glossaryName: string){ + + /** + * Parse the project from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGlossaryName(glossaryName: string) { return this._pathTemplates.glossaryPathTemplate.match(glossaryName).project; } - matchLocationFromGlossaryName(glossaryName: string){ + + /** + * Parse the location from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGlossaryName(glossaryName: string) { return this._pathTemplates.glossaryPathTemplate.match(glossaryName).location; } - matchGlossaryFromGlossaryName(glossaryName: string){ + + /** + * Parse the glossary from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the glossary. + */ + matchGlossaryFromGlossaryName(glossaryName: string) { return this._pathTemplates.glossaryPathTemplate.match(glossaryName).glossary; }