1.0.2 • Published 4 months ago

apparatus-sdk v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

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-sdk

Getting 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): Contains keyword, 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

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Commit your changes (git commit -m "Add new feature")
  4. Push to the branch (git push origin feature-branch)
  5. Open a pull request

License

This SDK is licensed under the MIT License.


šŸš€ Start building with ApparatusAI today!

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago