SDKs
SDKs for the Browser and NodeJS environment.
This documentation is actively being improved. You may encounter gaps or incomplete sections as we refine and expand the content. We appreciate your understanding and welcome any feedback to help us make this resource even better!
Fonoster SDKs provide you with control of a set of Fonoster resources. We currently offer SDKs for the Node.js and browser environment, and we plan to add more in the future.
Installation
Or using yarn:
Or in the browser:
Importing the library
For CommonJS projects:
For ES6 modules:
Directly in the browser:
Example
Create a new SDK instance to interact with the Fonoster API. The SDK requires a client object to handle communication with the API.
Creating a client object
In Node.js:
When connecting to Fonoster’s cloud services, you can omit the endpoint
parameter.
In the browser:
Note the only difference is the name of the constructor.
Login in and make requests
In addition to the login
method, the SDK provides a loginWithApiKey
and loginWithRefreshToken
methods. The loginWithRefreshToken
is helpful in browser environments where you want to keep the user logged in between sessions.
The SDK will automatically refresh the token when it expires.
See NPM for details
For full documentation, please visit NPM.