1.0.2 ⢠Published 9 months ago
apparatus-sdk v1.0.2
ApparatusAI JavaScript SDK
The ApparatusAI SDK provides an easy-to-use interface to interact with the ApparatusAI API. This SDK enables developers to fetch user information, run business forecasts, and analyze social trends using ApparatusAI's powerful machine learning models.
Features
- š Secure API Token Authentication
- š Business Forecasting
- š Social Trend Analysis
- ā” Easy Integration with JavaScript & Node.js
Installation
To install the SDK, run:
npm install apparatus-sdkGetting Started
1. Import the SDK
const ApparatusAI = require("apparatus-sdk");2. Initialize the SDK with your API Token
const ai = new ApparatusAI("apai_your_api_token_here");ā ļø Note: Ensure your API token starts with
apai_, or an error will be thrown.
3. Fetch User Info
(async () => {
try {
const userInfo = await ai.getUserInfo();
console.log("User Info:", userInfo);
} catch (error) {
console.error("Error fetching user info:", error.message);
}
})();4. Perform Business Forecasting
(async () => {
try {
const forecastData = await ai.forecast({ revenue: [10000, 12000, 15000] });
console.log("Forecast Result:", forecastData);
} catch (error) {
console.error("Forecasting Error:", error.message);
}
})();5. Analyze Social Trends
(async () => {
try {
const socialTrends = await ai.analyzeSocialTrends({ keyword: "AI Trends" });
console.log("Social Trends Analysis:", socialTrends);
} catch (error) {
console.error("Social Analysis Error:", error.message);
}
})();API Reference
new ApparatusAI(apiToken)
Creates an instance of the SDK.
.getUserInfo() ā Promise<Object>
Fetches the authenticated user's information.
.forecast(data: Object) ā Promise<Object>
Submits business data for forecasting.
Parameters:
data(Object): An object containing business metrics like revenue, expenses, etc.
Example:
await ai.forecast({ revenue: [10000, 12000, 15000] });.analyzeSocialTrends(params: Object) ā Promise<Object>
Analyzes social trends based on the given parameters.
Parameters:
params(Object): Containskeyword,dateRange, and other optional filters.
Example:
await ai.analyzeSocialTrends({ keyword: "Artificial Intelligence" });Error Handling
If the API request fails, the SDK throws an error with details:
try {
await ai.getUserInfo();
} catch (error) {
console.error("API Error:", error.message);
}Contributing
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Commit your changes (
git commit -m "Add new feature") - Push to the branch (
git push origin feature-branch) - Open a pull request
License
This SDK is licensed under the MIT License.
š Start building with ApparatusAI today!