@fern-api/stackone v0.0.23
StackOne Node Library
The StackOne Node.js library provides access to the StackOne API from JavaScript/TypeScript.
Documentation
API reference documentation is available here.
Usage
import { StackOneClient } from '@fern-api/stackone';
const stackOne = new StackOneClient({
username: 'YOUR_USERNAME_HERE',
password: 'YOUR_PASSWORD_HERE',
});
const account = await stackOne.crm.accounts.get('account-id');
console.log('Got account!', account);
Hierarchial SDK Structure
The SDK is hierarchically constructed and supports operations for HRIS, ATS, CRM and Marketing.
stackOne.hris. // Opertions within the HRIS category
stackOne.ats. // Opertions within the ATS category
Handling Errors
When the API returns a non-success status code (4xx or 5xx response), a subclass of StackOneError will be thrown:
import { StackOneClient, StackOneError } from "@fern-api/stackone";
try {
await stackOne.crm.accounts.get('account-id');
} catch (err) {
if (err instanceof StackOneError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
Request Options
The HTTP Client accepts a RequestOptions
class where you can specify
a customized timeout.
const transcript = await aai.transcript.get("transcript-id", {
timeoutInSeconds: 60 // increase timeout in seconds
});
Retries
The SDK is configured to retry requests up to 5 times with exponential backoff.
Checkout the relevant code sample here.
Beta status
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!