2.8.0: toObject, fromObject, use your ApiClient
This release, in addition to upgrading our Twurple to 7.x, brings three new features:
- `Emote.toObject()` (#31 - @Tzahi12345): You can export the data of an emote for caching or offline use.
```js
const emote = emoteFetcher.emotes.get('Kappa').toObject();
/*
{
id: '25',
type: 'twitch',
code: 'Kappa',
animated: false,
channel_id: null,
set: undefined
}
*/
```
- `Fetcher.fromObject()` (#31 - @Tzahi12345): You can import an array of emotes directly into the fetcher.
```js
emoteFetcher.fromObject([emote]);
```
- The `EmoteFetcher` now accepts an object as a third parameter for options. (#33)
The only option for now is `apiClient` and it allows you to use your own `@twurple/api`'s `ApiClient` object, in case you already have one or want to manage authentification without app tokens.
Note that the first two parameters of `EmoteFetcher` will be unused in this case and can be left as `null`.
```js
const { ApiClient } = require('@twurple/api');
const { StaticAuthProvider } = require('@twurple/auth');
const authProvider = new StaticAuthProvider('<your client id>', '<your token>');
const apiClient = new ApiClient({ authProvider });
const fetcher = new EmoteFetcher(null, null, { apiClient });
```