Skip to content

Commit

Permalink
chore(cloud-rad): Add code fencing (#743)
Browse files Browse the repository at this point in the history
Code examples need code fencing around them to distingish from
rich text for TSDoc.

Internally b/179483748

Script used:
https://github.com/fhinkel/cloud-rad-script/blob/main/fixExampleComments.js
  • Loading branch information
fhinkel authored Nov 5, 2021
1 parent 32021fd commit 8307ad0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/google-cloud-translate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,35 @@ import * as v2 from './v2';
* @module {constructor} @google-cloud/translate
* @alias nodejs-translate
*
* @example <caption>Install the v3 client library with <a
* href="https://www.npmjs.com/">npm</a>:</caption>
* @example Install the v3 client library with <a href="https://www.npmjs.com/">npm</a>:
* ```
* npm install --save @google-cloud/translate
*
* @example <caption>Import the v3 client library:</caption>
* ```
* @example Import the v3 client library:
* ```
* const {TranslationServiceClient} = require('@google-cloud/translate');
*
* @example <caption>Create a v3 client that uses <a
* href="https://goo.gl/64dyYX">Application Default Credentials
* (ADC)</a>:</caption>
* ```
* @example Create a v3 client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:
* ```
* const client = new TranslationServiceClient();
*
* ```
* @example <caption>include:samples/quickstart.js</caption>
* region_tag:translate_quickstart
* Full quickstart example:
*
* @example <caption>Install the v3beta1 client library:</caption>
* @example Install the v3beta1 client library:
* ```
* npm install --save @google-cloud/translate
*
* @example <caption>Import the v3beta1 client library:</caption>
* ```
* @example Import the v3beta1 client library:
* ```
* const {TranslationServiceClient} =
* require('@google-cloud/translate').v3beta1;
* ```
*/
import * as v3beta1 from './v3beta1';
import * as v3 from './v3';
Expand Down
6 changes: 6 additions & 0 deletions packages/google-cloud-translate/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ export interface TranslateConfig extends GoogleAuthOptions {
* @param {ClientConfig} [options] Configuration options.
*
* @example
* ```
* //-
* // <h3>Custom Translation API</h3>
* //
* // The environment variable, `GOOGLE_CLOUD_TRANSLATE_ENDPOINT`, is honored as
* // a custom backend which our library will send requests to.
* //-
*
* ```
* @example <caption>include:samples/quickstart.js</caption>
* region_tag:translate_quickstart
* Full quickstart example:
Expand Down Expand Up @@ -188,6 +190,7 @@ export class Translate extends Service {
* @returns {Promise<DetectResponse>}
*
* @example
* ```
* const {Translate} = require('@google-cloud/translate');
*
* const translate = new Translate();
Expand Down Expand Up @@ -237,6 +240,7 @@ export class Translate extends Service {
* const apiResponse = data[2];
* });
*
* ```
* @example <caption>include:samples/translate.js</caption>
* region_tag:translate_detect_language
* Here's a full example:
Expand Down Expand Up @@ -439,6 +443,7 @@ export class Translate extends Service {
* @returns {Promise<TranslateResponse>}
*
* @example
* ```
* //-
* // Pass a string and a language code to get the translation.
* //-
Expand Down Expand Up @@ -489,6 +494,7 @@ export class Translate extends Service {
* const apiResponse = data[1];
* });
*
* ```
* @example <caption>include:samples/translate.js</caption>
* region_tag:translate_translate_text
* Full translation example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
* for more details and examples.
* @example
* ```
* const [response] = await client.translateText(request);
* ```
*/
translateText(
request?: protos.google.cloud.translation.v3.ITranslateTextRequest,
Expand Down Expand Up @@ -630,7 +632,9 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
* for more details and examples.
* @example
* ```
* const [response] = await client.detectLanguage(request);
* ```
*/
detectLanguage(
request?: protos.google.cloud.translation.v3.IDetectLanguageRequest,
Expand Down Expand Up @@ -754,7 +758,9 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
* for more details and examples.
* @example
* ```
* const [response] = await client.getSupportedLanguages(request);
* ```
*/
getSupportedLanguages(
request?: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest,
Expand Down Expand Up @@ -905,7 +911,9 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
* for more details and examples.
* @example
* ```
* const [response] = await client.translateDocument(request);
* ```
*/
translateDocument(
request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest,
Expand Down Expand Up @@ -993,7 +1001,9 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
* for more details and examples.
* @example
* ```
* const [response] = await client.getGlossary(request);
* ```
*/
getGlossary(
request?: protos.google.cloud.translation.v3.IGetGlossaryRequest,
Expand Down Expand Up @@ -1146,8 +1156,10 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const [operation] = await client.batchTranslateText(request);
* const [response] = await operation.promise();
* ```
*/
batchTranslateText(
request?: protos.google.cloud.translation.v3.IBatchTranslateTextRequest,
Expand Down Expand Up @@ -1207,10 +1219,12 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const decodedOperation = await checkBatchTranslateTextProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* ```
*/
async checkBatchTranslateTextProgress(
name: string
Expand Down Expand Up @@ -1346,8 +1360,10 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const [operation] = await client.batchTranslateDocument(request);
* const [response] = await operation.promise();
* ```
*/
batchTranslateDocument(
request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest,
Expand Down Expand Up @@ -1411,10 +1427,12 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const decodedOperation = await checkBatchTranslateDocumentProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* ```
*/
async checkBatchTranslateDocumentProgress(
name: string
Expand Down Expand Up @@ -1494,8 +1512,10 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const [operation] = await client.createGlossary(request);
* const [response] = await operation.promise();
* ```
*/
createGlossary(
request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest,
Expand Down Expand Up @@ -1555,10 +1575,12 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const decodedOperation = await checkCreateGlossaryProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* ```
*/
async checkCreateGlossaryProgress(
name: string
Expand Down Expand Up @@ -1637,8 +1659,10 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const [operation] = await client.deleteGlossary(request);
* const [response] = await operation.promise();
* ```
*/
deleteGlossary(
request?: protos.google.cloud.translation.v3.IDeleteGlossaryRequest,
Expand Down Expand Up @@ -1698,10 +1722,12 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
* for more details and examples.
* @example
* ```
* const decodedOperation = await checkDeleteGlossaryProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* ```
*/
async checkDeleteGlossaryProgress(
name: string
Expand Down Expand Up @@ -1955,10 +1981,12 @@ export class TranslationServiceClient {
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination| documentation}
* for more details and examples.
* @example
* ```
* const iterable = client.listGlossariesAsync(request);
* for await (const response of iterable) {
* // process response
* }
* ```
*/
listGlossariesAsync(
request?: protos.google.cloud.translation.v3.IListGlossariesRequest,
Expand Down
Loading

0 comments on commit 8307ad0

Please sign in to comment.