Vertex API Client for Node.js
If you're ready to integrate Vertex into your application, this is the place! For more background on the Vertex platform, start with our Developer Portal.
The Vertex REST API client for Node.js is generated using openapi-generator
, so it's always up-to-date. On top of the generated code, we've added a higher-level client and helpers in the ./client
directory.
Usage
If you're not an existing Vertex customer, sign up for a free account.
Install the client and export your credentials.
# Install client
npm install --save @vertexvis/api-client-node
# Export your Vertex REST API client ID and secret
export VERTEX_CLIENT_ID=[YOUR_CLIENT_ID]
export VERTEX_CLIENT_SECRET=[YOUR_CLIENT_SECRET]
Then, create a client and start using the Vertex API.
import { logError, prettyJson, VertexClient } from '@vertexvis/api-client-node';
const main = async () => {
try {
// Shown with default values
const client = await VertexClient.build({
basePath: 'https://platform.vertexvis.com',
client: {
id: process.env.VERTEX_CLIENT_ID,
secret: process.env.VERTEX_CLIENT_SECRET,
},
});
const getFilesRes = await client.files.getFiles({ pageSize: 1 });
console.log(prettyJson(getFilesRes.data));
} catch (error) {
logError(error, console.error);
}
};
main();
Local Development
# Install dependencies
yarn
# Transpile TypeScript to JavaScript
yarn build
# Format code
yarn format
Publishing
# Generate latest
yarn generate
# Generate using latest OpenAPI spec, version, and open GitHub PR
yarn push:version [patch|minor|major (default: patch)]