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 bb318fb commit 4f02d2a
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-video-stitcher/.repo-metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "videostitcher",
"name_pretty": "Video Stitcher API",
"product_documentation": "cloud.google.com/video-stitcher/",
"product_documentation": "https://cloud.google.com/video-stitcher/",
"client_documentation": "https://googleapis.dev/nodejs/videostitcher/latest/",
"issue_tracker": "https://github.com/googleapis/nodejs-video-stitcher/issues",
"release_level": "beta",
Expand Down
8 changes: 4 additions & 4 deletions packages/google-cloud-video-stitcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stitcher client for Node.js


A comprehensive list of changes in each version may be found in
[the CHANGELOG](https://github.com/googleapis/nodejs-video-stitcher/blob/master/CHANGELOG.md).
[the CHANGELOG](https://github.com/googleapis/nodejs-video-stitcher/blob/main/CHANGELOG.md).

* [Video Stitcher API Node.js Client API Reference][client-docs]
* [Video Stitcher API Documentation][product-docs]
Expand Down Expand Up @@ -103,7 +103,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages]

## Contributing

Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-video-stitcher/blob/master/CONTRIBUTING.md).
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-video-stitcher/blob/main/CONTRIBUTING.md).

Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
Expand All @@ -115,10 +115,10 @@ to its templates in

Apache Version 2.0

See [LICENSE](https://github.com/googleapis/nodejs-video-stitcher/blob/master/LICENSE)
See [LICENSE](https://github.com/googleapis/nodejs-video-stitcher/blob/main/LICENSE)

[client-docs]: https://googleapis.dev/nodejs/videostitcher/latest/
[product-docs]: cloud.google.com/video-stitcher/
[product-docs]: https://cloud.google.com/video-stitcher/
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":5,"retry":true,"retryErrors":true,"retryErrorsCount":5,"retryErrorsJitter":3000}
{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io", "https://googleapis.dev/nodejs/videostitcher/latest/", "https://github.com/googleapis/nodejs-video-stitcher/blob/master/CHANGELOG.md", "https://github.com/googleapis/nodejs-video-stitcher/blob/addInitialSamples/CHANGELOG.md"],"silent":true,"concurrency":5,"retry":true,"retryErrors":true,"retryErrorsCount":5,"retryErrorsJitter":3000}
67 changes: 66 additions & 1 deletion packages/google-cloud-video-stitcher/package.json
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
{"name":"@google-cloud/video-stitcher","version":"0.1.0","description":"stitcher client for Node.js","repository":"googleapis/nodejs-video-stitcher","license":"Apache-2.0","author":"Google LLC","main":"build/src/index.js","files":["build/src","build/protos"],"keywords":["google apis client","google api client","google apis","google api","google","google cloud platform","google cloud","cloud","google stitcher","stitcher","stitcher service"],"scripts":{"clean":"gts clean","compile":"tsc -p . && cp -r protos build/","compile-protos":"compileProtos src","docs":"jsdoc -c .jsdoc.js","predocs-test":"npm run docs","docs-test":"linkinator docs","fix":"gts fix","lint":"gts check","prepare":"npm run compile-protos && npm run compile","system-test":"c8 mocha build/system-test","test":"c8 mocha build/test","samples-test":"cd samples/ && npm link ../ && npm test","prelint":"cd samples; npm link ../; npm i"},"dependencies":{"google-gax":"^2.12.0"},"devDependencies":{"@types/mocha":"^8.2.2","@types/node":"^14.14.44","@types/sinon":"^10.0.0","c8":"^7.7.2","gts":"^3.1.0","jsdoc":"^3.6.6","jsdoc-fresh":"^1.0.2","jsdoc-region-tag":"^1.0.6","linkinator":"^2.13.6","mocha":"^8.4.0","null-loader":"^4.0.1","pack-n-play":"^1.0.0-2","sinon":"^10.0.0","ts-loader":"^9.1.2","typescript":"^4.2.4","webpack":"^5.36.2","webpack-cli":"^4.7.0"},"engines":{"node":">=v10.0.0"}}
{
"name": "@google-cloud/video-stitcher",
"version": "0.1.0",
"description": "stitcher client for Node.js",
"repository": "googleapis/nodejs-video-stitcher",
"license": "Apache-2.0",
"author": "Google LLC",
"main": "build/src/index.js",
"files": [
"build/src",
"build/protos"
],
"keywords": [
"google apis client",
"google api client",
"google apis",
"google api",
"google",
"google cloud platform",
"google cloud",
"cloud",
"google stitcher",
"stitcher",
"stitcher service"
],
"scripts": {
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"docs": "jsdoc -c .jsdoc.js",
"predocs-test": "npm run docs",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"prepare": "npm run compile-protos && npm run compile",
"system-test": "c8 mocha build/system-test",
"test": "c8 mocha build/test",
"samples-test": "cd samples/ && npm link ../ && npm test",
"prelint": "cd samples; npm link ../; npm i"
},
"dependencies": {
"google-gax": "^2.12.0"
},
"devDependencies": {
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.44",
"@types/sinon": "^10.0.0",
"c8": "^7.7.2",
"gts": "^3.1.0",
"jsdoc": "^3.6.6",
"jsdoc-fresh": "^1.0.2",
"jsdoc-region-tag": "^1.0.6",
"linkinator": "^2.13.6",
"mocha": "^8.4.0",
"null-loader": "^4.0.1",
"pack-n-play": "^1.0.0-2",
"sinon": "^10.0.0",
"ts-loader": "^9.1.2",
"typescript": "^4.2.4",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0"
},
"engines": {
"node": ">=v12.0.0"
}
}
76 changes: 52 additions & 24 deletions packages/google-cloud-video-stitcher/samples/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));
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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// ** All changes to this file may be overwritten. **

/* eslint-disable node/no-missing-require, no-unused-vars */
const stitcher = require('@google-cloud/stitcher');
const stitcher = require('@google-cloud/video-stitcher');

function main() {
const videoStitcherServiceClient = new stitcher.VideoStitcherServiceClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

import {VideoStitcherServiceClient} from '@google-cloud/stitcher';
import {VideoStitcherServiceClient} from '@google-cloud/video-stitcher';

// check that the client class type name can be used
function doStuffWithVideoStitcherServiceClient(
Expand Down

0 comments on commit 4f02d2a

Please sign in to comment.