finesse-toolkit
Version:
useful tools for finesse phone system
56 lines (55 loc) • 1.52 kB
TypeScript
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
export declare type ParsedXML = any;
export interface IUserReason {
code: string;
label: string;
}
export interface IUserPayload {
reason: IUserReason | null;
agentState: string;
lastChange: string;
pendingState: string;
}
export interface IDialogInformation {
dialogId: string;
fromAddress: string;
toAddress: string;
type: string;
start: string;
lastChange: string;
dialogState: string;
participants: string[];
}
export interface IDialogPayload {
dialog: boolean;
dialogs?: IDialogInformation;
}
export interface IReasonPayload {
category: string;
code: string;
label: string;
}
export default class XmlHelper {
private _parsed;
constructor(xml: any);
isUser(): boolean;
isDialog(): boolean;
userJson(): IUserPayload | null;
reasonsJson(): Promise<IReasonPayload[]>;
dialogJson(extension: string): IDialogPayload;
_filterParticipants(participants: string[]): Promise<any[]>;
_promisedFind(xpath: string, root: ParsedXML): Promise<any>;
promisedDialogJson(extension: any): Promise<IDialogPayload>;
static _safelyGet(xpath: string, opts: {
xml: ParsedXML;
callback?: (x: string | null) => string;
}): string | null;
static _promisedSafelyGet(xpath: string, opts: {
xml: ParsedXML;
}): Promise<any>;
static objToXml(obj: {
root: string;
properties: Object;
}): string;
}