@allthings/sdk
Version:
Allthings Node/Javascript SDK
106 lines (105 loc) • 3.79 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { IAllthingsRestClient } from '../types';
import { IMessage } from './conversation';
import { IFile } from './file';
import { IUser } from './user';
export declare enum ETicketStatus {
CLOSED = "closed",
WAITING_FOR_AGENT = "waiting-for-agent",
WAITING_FOR_CUSTOMER = "waiting-for-customer",
WAITING_FOR_EXTERNAL = "waiting-for-external"
}
export declare enum ETrafficLightColor {
GREEN = "green",
RED = "red",
YELLOW = "yellow"
}
export interface ITicketLabel {
readonly id: string;
readonly key: string;
readonly name: IMessage;
}
export interface ICustomSettingsItem {
readonly key: string;
readonly type: string;
readonly value: string;
}
export interface ITicketCreatePayload {
readonly category: string;
readonly channel?: string;
readonly createdByCommunicationMethod?: {
readonly type: string;
readonly value: string;
};
readonly customSettings?: readonly ICustomSettingsItem[];
readonly description: string;
readonly files?: readonly {
readonly content: Buffer;
readonly filename: string;
}[];
readonly inputChannel: string;
readonly phoneNumber?: string;
readonly title: string;
}
interface ITicketParticipant extends IUser {
readonly roles: readonly string[];
}
export interface ITicket {
readonly _embedded: {
readonly assignedTo: IUser;
readonly category: {
readonly id: string;
readonly name: IMessage;
};
readonly conversations: readonly {
readonly _embedded: {
readonly participants: readonly ITicketParticipant[];
};
readonly id: string;
}[];
readonly createdBy: IUser;
readonly files: readonly IFile[];
readonly group: {
readonly address: object;
};
readonly labels: readonly ITicketLabel[];
readonly property: {
readonly id: string;
readonly name: string;
};
readonly unit: {
readonly name: string;
};
};
readonly category: string;
readonly channels: readonly string[];
readonly commentCount: number;
readonly createdAt: string;
readonly customSettings?: readonly ICustomSettingsItem[];
readonly customerWaitingSinceIndicator: ETrafficLightColor;
readonly description: string;
readonly files: readonly string[];
readonly id: string;
readonly incrementID: string;
readonly labels: readonly string[];
readonly lastStatusUpdate: string;
readonly phoneNumber: string;
readonly read: boolean;
readonly sortHash: string;
readonly status: ETicketStatus;
readonly tags: readonly string[];
readonly title: string;
readonly token?: string;
readonly unreadAdminMessages: number;
readonly unreadUserMessages: number;
readonly updatedAt: string;
}
export type TicketResult = Promise<ITicket>;
export type MethodTicketGetById = (ticketId: string) => TicketResult;
export declare function ticketGetById(client: IAllthingsRestClient, ticketId: string): TicketResult;
export type MethodTicketCreateOnUser = (userId: string, utilisationPeriodId: string, payload: ITicketCreatePayload) => TicketResult;
export declare function ticketCreateOnUser(client: IAllthingsRestClient, userId: string, utilisationPeriodId: string, payload: ITicketCreatePayload): TicketResult;
export type MethodTicketCreateOnServiceProvider = (serviceProviderId: string, payload: ITicketCreatePayload) => TicketResult;
export declare function ticketCreateOnServiceProvider(client: IAllthingsRestClient, serviceProviderId: string, payload: ITicketCreatePayload): TicketResult;
export {};