Installation
Install the package with npm:
npm install infr
Usage First, import the InfrDisplayer class from the package:
import { InfrDisplayer } from 'infr';
Next, create an instance of InfrDisplayer with your public API key:
const infr = new InfrDisplayer('your-public-key');
You can then call the getAd method to retrieve an ad:
const ad = await infr.getAd('A test backdrop');
The getAd method returns a Promise that resolves to the ad data.
Development Mode
If you want to use the package in development mode (which will use the test environment and test API key), pass development
as the third argument when creating an instance of InfrDisplayer
:
// Use the test environment and test API key
// Using `test` will also suffice
const infr = new InfrDisplayer('test', null, 'development');
Testing
To run the package's tests, use the npm test command:
npm test
Issues
If you have any issues with the package, please file an issue on GitHub (opens in a new tab)