Skip to content

Commit

Permalink
refactor: drop dependency on lodash.merge and update links (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed May 28, 2019
1 parent 2afef38 commit 405f248
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 88 deletions.
3 changes: 0 additions & 3 deletions packages/google-cloud-translate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ npm install @google-cloud/translate
### Using the client library

```javascript
async function main(
projectId = 'YOUR_PROJECT_ID' // Your GCP Project Id
) {
// Imports the Google Cloud client library
const {Translate} = require('@google-cloud/translate');

Expand Down
58 changes: 1 addition & 57 deletions packages/google-cloud-translate/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,6 @@ API is part of the larger Cloud Machine Learning API family. Samples
Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/nodejs-translate#using-the-client-library).

### Translate V3 Beta Samples

#### Install Dependencies

From the [root directory](https://github.com/googleapis/nodejs-translate) of the client library install the dependencies:

```
npm install
```

Change to the samples directory, link the google-cloud/translate library from the parent, and install its dependencies:

```
cd samples/
npm link ../
npm install
```

#### Run the Tests

To run the tests for the entire sample, run

```
npm test
```

To run the tests for only the translate v3 samples, run

```
npm run test-v3
```

To run the tests for a single translate v3 sample, run this command, substituting FILE_NAME with the name of a valid test file.

```
./node_modules/.bin/mocha test/v3beta1/FILE_NAME
```

For example, to test the `translate_list_language_names_beta` sample, the command would be

```
./node_modules/.bin/mocha test/v3beta1/translate_list_language_names_beta.test.js
```

To run a sample directly, call the file with the `node` command and any required CLI arguments:

```
node v3beta1/FILE_NAME <CLI argument 0> <CLI argument 1>
```

For example, to run the `translate_list_codes_beta` sample, you would run the following command, substituting your project ID in place of "your_project_id"

```
node v3beta1/translate_list_codes_beta.js "your_project_id"
```

## Samples


Expand Down Expand Up @@ -120,4 +64,4 @@ __Usage:__

[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/translate/docs/
[product-docs]: https://cloud.google.com/translate/docs/
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

const gapicConfig = require('./translation_service_client_config.json');
const gax = require('google-gax');
const merge = require('lodash.merge');
const path = require('path');
const protobuf = require('protobufjs');

Expand Down Expand Up @@ -89,12 +88,9 @@ class TranslationServiceClient {
}

// Load the applicable protos.
const protos = merge(
{},
gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
'google/cloud/translate/v3beta1/translation_service.proto'
)
const protos = gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
['google/cloud/translate/v3beta1/translation_service.proto']
);

// This API contains "path templates"; forward-slash-separated
Expand Down Expand Up @@ -316,7 +312,7 @@ class TranslationServiceClient {
* This object should have the same structure as [TranslateTextGlossaryConfig]{@link google.cloud.translation.v3beta1.TranslateTextGlossaryConfig}
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
Expand Down Expand Up @@ -388,7 +384,7 @@ class TranslationServiceClient {
* "text/plain". If left blank, the MIME type is assumed to be "text/html".
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
Expand Down Expand Up @@ -460,7 +456,7 @@ class TranslationServiceClient {
* If missing, we get supported languages of Google general NMT model.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
Expand Down Expand Up @@ -562,13 +558,13 @@ class TranslationServiceClient {
* It's keyed by target language code.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
Expand Down Expand Up @@ -691,13 +687,13 @@ class TranslationServiceClient {
* This object should have the same structure as [Glossary]{@link google.cloud.translation.v3beta1.Glossary}
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
Expand Down Expand Up @@ -814,7 +810,7 @@ class TranslationServiceClient {
* If missing, no filtering is performed.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
Expand Down Expand Up @@ -925,7 +921,7 @@ class TranslationServiceClient {
* If missing, no filtering is performed.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @returns {Stream}
* An object stream which emits an object representing [Glossary]{@link google.cloud.translation.v3beta1.Glossary} on 'data' event.
*
Expand Down Expand Up @@ -965,7 +961,7 @@ class TranslationServiceClient {
* Required. The name of the glossary to retrieve.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
Expand Down Expand Up @@ -1020,13 +1016,13 @@ class TranslationServiceClient {
* Required. The name of the glossary to delete.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object.
* The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
Expand Down
12 changes: 6 additions & 6 deletions packages/google-cloud-translate/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"updateTime": "2019-05-17T22:13:39.352938Z",
"updateTime": "2019-05-21T11:28:08.403550Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.19.0",
"dockerImage": "googleapis/artman@sha256:d3df563538225ac6caac45d8ad86499500211d1bcb2536955a6dbda15e1b368e"
"version": "0.20.0",
"dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "99efb1441b7c2aeb75c69f8baf9b61d4221bb744",
"internalRef": "248724297"
"sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160",
"internalRef": "249058354"
}
},
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.4.10"
"version": "2019.5.2"
}
}
],
Expand Down

0 comments on commit 405f248

Please sign in to comment.