JavaScript/Node library for interacting with the Bild External API.
This repo is currently intended to be used directly from source (not published to npm yet).
git clone https://github.com/AJFrio/Bild-Javascript.git
cd Bild-Javascript
npm installexport BILD_API_KEY="YOUR_JWT_TOKEN"Or pass token directly in code.
const { BildClient } = require('./src');
const client = new BildClient(); // uses BILD_API_KEY from env
// or: const client = new BildClient({ token: 'YOUR_JWT_TOKEN' });
(async () => {
const projects = await client.api.projects.list();
console.log(projects);
})();const { BildClient } = require('./src');
const client = new BildClient();
(async () => {
const users = await client.api.users.list();
const projects = await client.api.projects.list();
console.log('Users:', users);
console.log('Projects:', projects);
})();await client.api.users.add({
emails: ['person@example.com'],
role: 'Member',
projects: [{ id: 'project-id', projectAccess: 'Editor' }]
});const files = await client.api.files.list('project-id');
console.log(files);const result = await client.api.files.universalFormat(
'project-id',
null, // auto-resolves main/default branch
'file-id',
{
fileVersion: null, // auto-resolves latest file version
outputFormat: 'step'
}
);
console.log(result);const links = await client.api.sharedLinks.list('project-id');
console.log(links);
const newLink = await client.api.sharedLinks.create('project-id', {
name: 'Review Link',
fileIds: ['file-id']
});
console.log(newLink);const search = await client.api.search.query({ query: 'bolt' });
console.log(search);client.api.usersclient.api.projectsclient.api.projectUsersclient.api.branchesCommitsclient.api.filesclient.api.fileUploadclient.api.fileCheckinCheckoutclient.api.sharedLinksclient.api.filesMoveDeleteclient.api.filesMetadataclient.api.feedbackItemsclient.api.packagesclient.api.revisionsclient.api.approvalsclient.api.bomsclient.api.search
const client = new BildClient({
token: process.env.BILD_API_KEY,
baseUrl: 'https://api.portle.io/api'
});const raw = await client.get('projects');
console.log(raw);