import { Resource, FedaPayObject } from '.'; import { arrayToFedaPayObject } from './Util'; /** * Class Event * * @property int $id * @property string $type * @property string $entity * @property int $object_id * @property int $account_id * @property string $object * @property string $created_at * @property string $updated_at */ export class Event extends Resource { protected static ressourceName = 'event'; /** * @param {string|number} id The event id * @param {Object|null} params * @param {Object|null} headers * @returns {Promise} */ static retrieve(id: string|number, params = {}, headers = {}): Promise { return >this._retrieve(id, params, headers); } /** * @param {Object|null} params * @param {Object|null} headers * * @returns {Promise} */ static all(params = {}, headers = {}): Promise { return >this._all(params, headers); } /** * Subscribe to events flow * @param {Object} params * @param {Object} headers * * @returns {Promise} */ static async subscribe(params = {}, headers = {}) : Promise { const url = this.classPath() + '/subscribe'; return this._staticRequest('post', url, params, headers) .then(({ data, options }) => { let object = arrayToFedaPayObject(data, options); return object; }); } }