Package Exports
- @vtex/api
- @vtex/api/lib/AppEngineClient
- @vtex/api/lib/AppRegistryClient
- @vtex/api/lib/RouterClient
- @vtex/api/lib/VTEXIDClient
- @vtex/api/lib/WorkspacesClient
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vtex/api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
VTEX I/O API Client for Node
This client enables Node developers to quickly integrate with the VTEX I/O API.
Getting started
The three clients in this library are:
- AppsClient
- RegistryClient
- VBaseClient
- VTEXIDClient
Usage:
import { AppsClient } from '@vtex/api';
const client = new AppsClient({
authToken: yourAuthToken,
userAgent: myUserAgent
});Development
Install the dependencies (npm install) and run npm run build.
Using VBaseClient.sendFile
An example usage of the three supported method of sending a file to VBase:
import {VBaseClient} from '@vtex/api'
import {createReadStream} from 'fs'
const client = new VBaseClient({
authToken: 'test',
userAgent: 'test send',
endpointUrl: 'BETA',
})
client.saveFile(
'account',
'workspace',
'bucket',
'test-send-stream-gzip.txt',
createReadStream('./test-send.txt'),
{gzip: true, gzipOptions: {level: 9}}
).then((res) => {
console.log('gz:', res)
})
client.saveFile(
'account',
'workspace',
'bucket',
'test-send-stream.txt',
createReadStream('./test-send.txt'),
{gzip: false}
).then((res) => {
console.log('stream:', res)
})
client.saveFile(
'account',
'workspace',
'bucket',
'test-send-file.txt',
'./test-send.txt'
).then((res) => {
console.log('file:', res)
})