Package Exports
- @vtex/api
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 IO API Client for Node
This client enables Node developers to quickly integrate with the VTEX IO APIs.
Getting started
The clients currently available in this library are:
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 methods of sending a file to VBase:
import {VBase} from '@vtex/api'
import {createReadStream} from 'fs'
const client = new VBase({
account: 'account',
workspace: 'workspace',
authToken: 'test',
userAgent: 'test send',
region: 'aws-us-east-1',
})
client.saveFile(
'bucket',
'test-send-stream-gzip.txt',
createReadStream('./test-send.txt'),
{gzip: true, gzipOptions: {level: 9}}
).then((res) => {
console.log('gz:', res)
})
client.saveFile(
'bucket',
'test-send-stream.txt',
createReadStream('./test-send.txt'),
{gzip: false}
).then((res) => {
console.log('stream:', res)
})
client.saveFile(
'bucket',
'test-send-file.txt',
'./test-send.txt'
).then((res) => {
console.log('file:', res)
})