quala-node
Version:
client library for quala
83 lines (82 loc) • 2.15 kB
TypeScript
import { AxiosError } from 'axios';
interface ObjectLiteral {
[key: string]: any;
}
interface Options {
timeout?: boolean;
flushInterval?: number;
flushAt?: number;
enable?: boolean;
retryCount?: number;
host?: string;
}
export declare enum MessageType {
'IDENTIFY' = "IDENTIFY",
'IDENTIFY_COMPANY' = "IDENTIFY_COMPANY",
'TRACK' = "TRACK"
}
export declare class Message {
timestamp?: Date;
userId: string;
}
export declare class BatchMessage extends Message {
type: MessageType;
}
export declare class CompanyTraits {
name?: string;
industry?: string;
plan?: string;
renewalDate?: Date;
accountCreatedDate?: Date;
arr?: number;
}
export declare class UserTraits {
avatar?: string;
email?: string;
description?: string;
firstName?: string;
lastName?: string;
name?: string;
phone?: string;
title?: string;
username?: string;
website?: string;
}
export declare class IndentifyMessage extends Message {
companyId: string;
traits?: UserTraits & ObjectLiteral;
companyTraits?: CompanyTraits & ObjectLiteral;
}
declare class IndentifyCompanyMessage extends Message {
companyId: string;
companyTraits: CompanyTraits & ObjectLiteral;
}
declare class Properties {
value?: number;
currency?: string;
revenue?: number;
}
export declare class TrackMessage extends Message {
signal: string;
properties?: Properties & ObjectLiteral;
}
export default class Beacon {
private queue;
private writeKey;
private host;
private timeout;
private flushAt;
private flushInterval;
private flushed;
private enable;
private timer;
constructor(writeKey: string, options?: Options);
static _validate(object: Object): void;
identify(message: IndentifyMessage, callback?: any): this;
identifyCompany(message: IndentifyCompanyMessage, callback?: any): this;
track(message: TrackMessage, callback?: any): this;
enqueue(type: MessageType, message: Message, callback: any): any;
flush(callback?: any): any;
_isErrorRetryable(error: AxiosError): boolean;
}
export {};