boosty-ai-api
v0.0.33
Published
Node.js AI generated client for Boosty API
Downloads
4
Readme
boosty-api
Node.js client for Boosty API. This library provides a simple way to interact with the Boosty platform programmatically.
Installation
npm install boosty-apiIf you plan to use the interactive login feature, you'll also need to install Playwright:
npm install playwright
npx playwright install chromiumUsage
Authentication
There are two ways to authenticate with the Boosty API:
1. Interactive Login (Browser-based)
This method opens a browser window for you to log in to Boosty:
const { API, interactiveLogin, Auth } = require('boosty-api');
async function main() {
// Interactive login (opens a browser window)
const authResolver = await interactiveLogin();
// Create API client with authentication
const api = new API({ auth: new Auth(authResolver) });
// Now you can make authenticated requests
const post = await api.getPost('blogName', 'postId');
console.log(post.title);
}
main().catch(console.error);2. Using Saved Authentication Data
If you already have authentication data (from a previous login), you can use it directly:
const { API, Auth, FileAuthDataResolver } = require('boosty-api');
const path = require('path');
async function main() {
// Load authentication data from a file
const authResolver = new FileAuthDataResolver(path.join(__dirname, 'auth.json'));
// Create API client with authentication
const api = new API({ auth: new Auth(authResolver) });
// Now you can make authenticated requests
const post = await api.getPost('blogName', 'postId');
console.log(post.title);
}
main().catch(console.error);Public Content
For public content, you don't need authentication:
const { API } = require('boosty-api');
async function main() {
// Create API client without authentication
const api = new API();
// Get a public post
const post = await api.getPost('boosty', 'c9fb8a19-c45e-4602-9942-087c3af28c1b');
// Print post title and URL
console.log(post.title);
console.log(post.url);
}
main().catch(console.error);API Reference
API Class
The main class for interacting with the Boosty API.
Constructor
new API(options)options.httpClient(optional): Custom HTTP clientoptions.auth(optional): Authentication manager
Methods
Posts
createPost(blogName, newPost): Create a new postgetPosts(blogName, options): Get posts from a bloggetPost(blogName, postId, options): Get a specific postupdatePost(blogName, postId, editedPost): Update a postdeletePost(blogName, postId): Delete a post
Comments
getPostComments(blogName, postId, options): Get comments for a post
Deferred Access
getPostDeferredAccess(blogName, postId): Get deferred access for a postupdatePostDeferredAccess(blogName, postId, editedDeferredAccess): Update deferred access for a post
Blacklist
getBlacklistedUsers(blogName): Get blacklisted users for a blog
File Downloads
downloadFile(url, params): Download a file as a stream
Auth Class
Manages authentication with the Boosty API.
Constructor
new Auth(resolver)resolver: Authentication data resolver
Authentication Resolvers
FileAuthDataResolver
Loads authentication data from a file.
new FileAuthDataResolver(filePath)filePath: Path to the authentication data file
interactiveLogin
Opens a browser window for interactive login.
await interactiveLogin(options)options.headless(optional): Run browser in headless mode (default: true)options.timeout(optional): Login timeout in milliseconds (default: 60000)
License
MIT
