Skip to content

Commit 69f3f8d

Browse files
author
Benjamin E. Coe
authored
feat!: initial library generation (#1)
0 parents  commit 69f3f8d

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

media-translation/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2+
[//]: # "To regenerate it, use `python -m synthtool`."
3+
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
4+
5+
# [Cloud Media Translation: Node.js Samples](https://github.com/googleapis/nodejs-media-translation)
6+
7+
[![Open in Cloud Shell][shell_img]][shell_link]
8+
9+
10+
11+
## Table of Contents
12+
13+
* [Before you begin](#before-you-begin)
14+
* [Samples](#samples)
15+
* [Quickstart](#quickstart)
16+
17+
## Before you begin
18+
19+
Before running the samples, make sure you've followed the steps outlined in
20+
[Using the client library](https://github.com/googleapis/nodejs-media-translation#using-the-client-library).
21+
22+
`cd samples`
23+
24+
`npm install`
25+
26+
`cd ..`
27+
28+
## Samples
29+
30+
31+
32+
### Quickstart
33+
34+
View the [source code](https://github.com/googleapis/nodejs-media-translation/blob/master/samples/quickstart.js).
35+
36+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-media-translation&page=editor&open_in_editor=samples/quickstart.js,samples/README.md)
37+
38+
__Usage:__
39+
40+
41+
`node samples/quickstart.js`
42+
43+
44+
45+
46+
47+
48+
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
49+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-media-translation&page=editor&open_in_editor=samples/README.md
50+
[product-docs]: https://cloud.google.com/mediatranslation/docs/

media-translation/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "media-translation-samples",
3+
"private": true,
4+
"license": "Apache-2.0",
5+
"author": "Google LLC",
6+
"engines": {
7+
"node": ">=10"
8+
},
9+
"files": [
10+
"*.js"
11+
],
12+
"scripts": {
13+
"test": "c8 mocha --timeout 600000 test/*.js"
14+
},
15+
"dependencies": {
16+
"@google-cloud/media-translation": "^0.1.0"
17+
},
18+
"devDependencies": {
19+
"c8": "^7.0.0",
20+
"chai": "^4.2.0",
21+
"mocha": "^7.0.0"
22+
}
23+
}

media-translation/quickstart.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2020 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+
16+
'use strict';
17+
18+
async function quickstart() {
19+
// parent = 'projects/my-project' // Project to list dashboards for.
20+
// [START media_translation_quickstart]
21+
// Imports the Google Cloud client library
22+
const {
23+
SpeechTranslationServiceClient,
24+
} = require('@google-cloud/media-translation');
25+
26+
// Creates a client
27+
const translate = new SpeechTranslationServiceClient();
28+
29+
// parent = 'projects/my-project', // Project to list dashboards for.
30+
31+
// TODO: add an actual sample.
32+
console.info(translate);
33+
34+
// [END media_translation_quickstart]
35+
}
36+
37+
const args = process.argv.slice(2);
38+
quickstart(...args).catch(console.error);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2020 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+
16+
'use strict';
17+
18+
const path = require('path');
19+
const {assert} = require('chai');
20+
const cp = require('child_process');
21+
const {describe, it} = require('mocha');
22+
23+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
24+
25+
const cwd = path.join(__dirname, '..');
26+
27+
const PROJECT_ID = process.env.GCLOUD_PROJECT;
28+
29+
describe('Sample Integration Tests', () => {
30+
it('should run quickstart.js', async () => {
31+
const stdout = execSync(`node ./quickstart.js projects/${PROJECT_ID}`, {
32+
cwd,
33+
});
34+
assert(stdout);
35+
});
36+
});

0 commit comments

Comments
 (0)