Skip to content

Commit

Permalink
fix: add jsdoc to resource name methods (#152)
Browse files Browse the repository at this point in the history
* fix: add jsdoc to resource name methods

* fix: baselines
  • Loading branch information
alexander-fenster authored Nov 21, 2019
1 parent 654b3aa commit cc66e49
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 16 deletions.
21 changes: 19 additions & 2 deletions templates/typescript_gapic/src/$version/$service_client.ts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -567,20 +567,37 @@ 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 }},
{%- endfor %}
});
}
{%- 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit cc66e49

Please sign in to comment.