Skip to content

Commit

Permalink
feat: add initial samples (#2)
Browse files Browse the repository at this point in the history
Release-As: v0.1.0
  • Loading branch information
sofisl authored Jun 9, 2022
1 parent a3f31c3 commit b8c82d9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 30 deletions.
76 changes: 52 additions & 24 deletions media/video-stitcher/quickstart.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2022 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
Expand All @@ -10,41 +12,67 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

async function main() {

// [START nodejs_video_stitcher_quickstart]
// Imports the Google Cloud client library
function main(parent) {
// [START videostitcher_v1_generated_VideoStitcherService_ListCdnKeys_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project that contains the list of CDN keys, in the form of
* `projects/{project_number}/locations/{location}`.
*/
// const parent = 'abc123'
/**
* Requested page size. Server may return fewer items than requested.
* If unspecified, server will pick an appropriate default.
*/
// const pageSize = 1234
/**
* A token identifying a page of results the server should return.
*/
// const pageToken = 'abc123'
/**
* Filtering results
*/
// const filter = 'abc123'
/**
* Hint for how to order the results
*/
// const orderBy = 'abc123'

// remove this line after package is released
// eslint-disable-next-line node/no-missing-require
const {VideoStitcherServiceClient} = require('@google-cloud/video-stitcher');
// Imports the Stitcher library
const {VideoStitcherServiceClient} =
require('@google-cloud/video-stitcher').v1;

// TODO(developer): replace with your prefered project ID.
// const projectId = 'my-project'
// Instantiates a client
const stitcherClient = new VideoStitcherServiceClient();

// Creates a client
// eslint-disable-next-line no-unused-vars
const client = new {VideoStitcherServiceClient}();
async function callListCdnKeys() {
// Construct request
const request = {
parent,
};

//TODO(library generator): write the actual function you will be testing
async function doSomething() {
console.log('DPE! Change this code so that it shows how to use the library! See comments below on structure.')
// const [thing] = await client.methodName({
// });
// console.info(thing);
// Run request
const iterable = await stitcherClient.listCdnKeysAsync(request);
for await (const response of iterable) {
console.log(response);
}
console.log(iterable);
}
doSomething();
// [END nodejs_video_stitcher_quickstart]

callListCdnKeys();
// [END videostitcher_v1_generated_VideoStitcherService_ListCdnKeys_async]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
9 changes: 3 additions & 6 deletions media/video-stitcher/test/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

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

const client = new {VideoStitcherServiceClient}();
const client = new VideoStitcherServiceClient();

describe('Quickstart', () => {
//TODO: remove this if not using the projectId
// eslint-disable-next-line no-unused-vars
let projectId;

Expand All @@ -42,12 +41,10 @@ describe('Quickstart', () => {
});

it('should run quickstart', async () => {
//TODO: remove this line
// eslint-disable-next-line no-unused-vars
const stdout = execSync(
`node ./quickstart.js`,
`node ./quickstart.js projects/${projectId}/locations/us-central1`,
{cwd}
);
//assert(stdout, stdout !== null);
assert(stdout, stdout !== null);
});
});

0 comments on commit b8c82d9

Please sign in to comment.