import { ConfigOptions, JWT } from '../types';
type TrackOptions = {
jwt?: JWT;
};
interface UserEventInput {
userId: string;
accountId: string;
idempotencyKey?: string;
events: UserEventDataInput[];
}
interface UserEventDataInput {
key: string;
id?: string;
fields?: object;
dateTriggered?: number;
}
/**
*
* The EventsApi class is a wrapper around the open endpoints of the SaaSquatch REST API.
*
*/
export default class EventsApi {
tenantAlias: string;
domain: string;
/**
* Initialize a new {@link EventsApi} instance.
*
* @param {ConfigOptions} config Config details
*
* @example
Browser example
* var squatchApi = new squatch.EventsApi({tenantAlias:'test_12b5bo1b25125'});
*
* @example Browserify/Webpack example
* var EventsApi = require('@saasquatch/squatch-js').EventsApi;
* var squatchApi = new EventsApi({tenantAlias:'test_12b5bo1b25125'});
*
* @example Babel+Browserify/Webpack example
* import {EventsApi} from '@saasquatch/squatch-js';
* let squatchApi = new EventsApi({tenantAlias:'test_12b5bo1b25125'});
*/
constructor(config: ConfigOptions);
/**
* Track an event for a user
*
* @param params Parameters for request
* @param options.jwt the JSON Web Token (JWT) that is used to authenticate the user
*
* @return An ID to confirm the event has been accepted for asynchronous processing
*/
track(params: UserEventInput, options?: TrackOptions): Promise;
}
export {};