Skip to content

Commit

Permalink
feat!: initial release of @google-cloud/video-transcoder (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and irataxy committed Jan 18, 2023
1 parent 02c2ff4 commit 9cccb9f
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
22 changes: 22 additions & 0 deletions media/transcoder/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "nodejs-video-transcoder-samples",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=10"
},
"files": [
"*.js"
],
"scripts": {
"test": "c8 mocha --timeout 600000 test/*.js"
},
"dependencies": {
"@google-cloud/video-transcoder": "^0.1.0"
},
"devDependencies": {
"c8": "^7.3.0",
"mocha": "^8.1.1"
}
}
43 changes: 43 additions & 0 deletions media/transcoder/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

async function main(projectId, location) {
// [START video_transcoder_quickstart]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my-project';
// const location = 'us-central1';
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const client = new TranscoderServiceClient();
async function listJobs() {
const [jobs] = await client.listJobs({
parent: client.locationPath(projectId, location),
});
console.info('jobs:');
for (const job of jobs) {
console.info(job);
}
}
listJobs();
// [END video_transcoder_quickstart]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
35 changes: 35 additions & 0 deletions media/transcoder/test/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

const path = require('path');
const assert = require('assert');
const cp = require('child_process');
const {describe, it} = require('mocha');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const cwd = path.join(__dirname, '..');

const project = process.env.GCLOUD_PROJECT;

describe('Quickstart', () => {
it('should run quickstart', async () => {
const output = execSync(`node ./quickstart.js ${project} us-west1`, {
cwd,
});
assert(output.match(/jobs:/));
});
});

0 comments on commit 9cccb9f

Please sign in to comment.