Skip to content

Commit

Permalink
feat!: initial generation of library (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored and pattishin committed Nov 22, 2022
1 parent c5118dd commit 871de78
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ai-platform/snippets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "nodejs-aiplatform-samples",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=10"
},
"files": [
"*.js"
],
"scripts": {
"test": "mocha --timeout 600000 test/*.js"
},
"dependencies": {
"@google-cloud/aiplatform": "^0.1.0"
},
"devDependencies": {
"mocha": "^8.0.0"
}
}
34 changes: 34 additions & 0 deletions ai-platform/snippets/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2019 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';

/**
* TODO: add an actual quickstart example.
*/
async function main() {
// [START aiplatform_quickstart]
const {DatasetServiceClient} = require('@google-cloud/aiplatform');
const client = new DatasetServiceClient();

// Do something with DatasetServiceClient.
console.info(client);

// [END aiplatform_quickstart]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err);
process.exitCode = 1;
});
29 changes: 29 additions & 0 deletions ai-platform/snippets/test/quickstart.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2017, Google, Inc.
* 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 {describe, it} = require('mocha');
const assert = require('assert');
const cp = require('child_process');

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

describe('quickstart', () => {
it('should have functional quickstart', async () => {
const stdout = execSync('node quickstart');
assert(stdout.match(/DatasetServiceClient/));
});
});

0 comments on commit 871de78

Please sign in to comment.