verdnatura-chat/app/definitions/rest/v1/omnichannel.ts

207 lines
5.7 KiB
TypeScript
Raw Permalink Normal View History

import { ICannedResponse } from '../../ICannedResponse';
import { ILivechatAgent } from '../../ILivechatAgent';
import { ILivechatDepartment } from '../../ILivechatDepartment';
import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents';
import { ILivechatMonitor } from '../../ILivechatMonitor';
import { ILivechatTag } from '../../ILivechatTag';
import { ILivechatVisitor, ILivechatVisitorDTO } from '../../ILivechatVisitor';
import { IMessage } from '../../IMessage';
import { IOmnichannelRoom, IServerRoom } from '../../IRoom';
import { ISetting } from '../../ISetting';
import { PaginatedRequest } from '../helpers/PaginatedRequest';
import { PaginatedResult } from '../helpers/PaginatedResult';
type booleanString = 'true' | 'false';
export type OmnichannelEndpoints = {
'livechat/appearance': {
GET: () => {
appearance: ISetting[];
};
};
'livechat/visitors.info': {
GET: (params: { visitorId: string }) => {
visitor: ILivechatVisitor;
};
};
'livechat/room.onHold': {
POST: (params: { roomId: IServerRoom['_id'] }) => void;
};
'livechat/monitors.list': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
monitors: ILivechatMonitor[];
}>;
};
'livechat/tags.list': {
GET: (params: PaginatedRequest<{ text: string }, 'name'>) => PaginatedResult<{
tags: ILivechatTag[];
}>;
};
'livechat/department': {
GET: (
params: PaginatedRequest<{
text: string;
onlyMyDepartments?: booleanString;
enabled?: boolean;
excludeDepartmentId?: string;
}>
) => PaginatedResult<{
departments: ILivechatDepartment[];
}>;
POST: (params: { department: Partial<ILivechatDepartment>; agents: string[] }) => {
department: ILivechatDepartment;
agents: any[];
};
};
'livechat/department/:_id': {
GET: (params: { onlyMyDepartments?: booleanString; includeAgents?: booleanString }) => {
department: ILivechatDepartment | null;
agents?: any[];
};
PUT: (params: { department: Partial<ILivechatDepartment>[]; agents: any[] }) => {
department: ILivechatDepartment;
agents: any[];
};
DELETE: () => void;
};
'livechat/department.autocomplete': {
GET: (params: { selector: string; onlyMyDepartments: booleanString }) => {
items: ILivechatDepartment[];
};
};
'livechat/department/:departmentId/agents': {
GET: (params: { sort: string }) => PaginatedResult<{ agents: ILivechatDepartmentAgents[] }>;
POST: (params: { upsert: string[]; remove: string[] }) => void;
};
'livechat/department/:departmentId/?includeAgents=false': {
GET: () => PaginatedResult<{ department: ILivechatDepartment }>;
};
'livechat/departments.available-by-unit/:id': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
departments: ILivechatDepartment[];
}>;
};
'livechat/departments.by-unit/': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
departments: ILivechatDepartment[];
}>;
};
'livechat/departments.by-unit/:id': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
departments: ILivechatDepartment[];
}>;
};
'livechat/department.listByIds': {
GET: (params: { ids: string[]; fields?: Record<string, unknown> }) => { departments: ILivechatDepartment[] };
};
'livechat/custom-fields': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
customFields: [
{
_id: string;
label: string;
visibility?: string;
scope?: string;
}
];
}>;
};
'livechat/rooms': {
GET: (params: {
guest: string;
fname: string;
servedBy: string[];
status: string;
department: string;
from: string;
to: string;
customFields: any;
current: number;
itemsPerPage: number;
tags: string[];
}) => PaginatedResult<{
rooms: IOmnichannelRoom[];
}>;
};
'livechat/:rid/messages': {
GET: (params: PaginatedRequest<{ query: string }>) => PaginatedResult<{
messages: IMessage[];
}>;
};
'livechat/users/agent': {
GET: (params: PaginatedRequest<{ text?: string }>) => PaginatedResult<{
users: {
_id: string;
emails: {
address: string;
verified: boolean;
}[];
status: string;
name: string;
username: string;
statusLivechat: string;
livechat: {
maxNumberSimultaneousChat: number;
};
}[];
}>;
};
'livechat/visitor': {
POST: (params: { visitor: ILivechatVisitorDTO }) => { visitor: ILivechatVisitor };
};
'livechat/visitor/:token': {
GET: (params: { token: string }) => { visitor: ILivechatVisitor };
DELETE: (params: { token: string }) => { visitor: { _id: string; ts: string } };
};
'livechat/visitor/:token/room': {
GET: (params: { token: string }) => { rooms: IOmnichannelRoom[] };
};
'livechat/visitor.callStatus': {
POST: (params: { token: string; callStatus: string; rid: string; callId: string }) => {
token: string;
callStatus: string;
};
};
'livechat/visitor.status': {
POST: (params: { token: string; status: string }) => { token: string; status: string };
};
'livechat/queue': {
GET: (params: {
agentId?: ILivechatAgent['_id'];
includeOfflineAgents?: boolean;
departmentId?: ILivechatAgent['_id'];
offset: number;
count: number;
sort: string | { uploadedAt: number };
}) => {
queue: {
chats: number;
department: { _id: string; name: string };
user: { _id: string; username: string; status: string };
}[];
count: number;
offset: number;
total: number;
};
};
'livechat/agents/:uid/departments?enabledDepartmentsOnly=true': {
GET: () => { departments: ILivechatDepartment[] };
};
'canned-responses': {
GET: (params: PaginatedRequest<{ scope?: string; departmentId?: string; text?: string }>) => PaginatedResult<{
cannedResponses: ICannedResponse[];
}>;
};
};