Skip to content
Snippets Groups Projects
Unverified Commit 7aae1112 authored by Gerzon Z's avatar Gerzon Z Committed by GitHub
Browse files

Chore: add some missing REST definitions (#24925)

parent ff563e5d
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,16 @@ export interface IRole {
_id: string;
}
export interface IGetRoomRoles {
_id: string;
rid: string;
u: {
_id: string;
username: string;
};
roles: string[];
}
export interface IUser extends IRocketChatRecord {
_id: string;
createdAt: Date;
......
......@@ -9,6 +9,7 @@ import type { CloudEndpoints } from './v1/cloud';
import type { CustomUserStatusEndpoints } from './v1/customUserStatus';
import type { DmEndpoints } from './v1/dm';
import type { DnsEndpoints } from './v1/dns';
import { E2eEndpoints } from './v1/e2e';
import type { EmojiCustomEndpoints } from './v1/emojiCustom';
import type { GroupsEndpoints } from './v1/groups';
import type { ImEndpoints } from './v1/im';
......@@ -51,7 +52,8 @@ type CommunityEndpoints = BannersEndpoints &
PermissionsEndpoints &
InstancesEndpoints &
VoipEndpoints &
InvitesEndpoints;
InvitesEndpoints &
E2eEndpoints;
type Endpoints = CommunityEndpoints & EnterpriseEndpoints;
......
import type { IMessage } from '../../IMessage/IMessage';
import type { IRoom } from '../../IRoom';
import type { IUser } from '../../IUser';
import type { ITeam } from '../../ITeam';
import type { IGetRoomRoles, IUser } from '../../IUser';
export type ChannelsEndpoints = {
'channels.files': {
......@@ -17,4 +18,92 @@ export type ChannelsEndpoints = {
total: number;
};
};
'channels.history': {
GET: (params: { roomId: string; count: number; latest?: string }) => {
messages: IMessage[];
};
};
'channels.archive': {
POST: (params: { roomId: string }) => void;
};
'channels.unarchive': {
POST: (params: { roomId: string }) => void;
};
'channels.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IRoom>;
};
};
'channels.convertToTeam': {
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
};
'channels.info': {
GET: (params: { roomId: string }) => { channel: IRoom };
};
'channels.counters': {
GET: (params: { roomId: string }) => {
joined: boolean;
members: number;
unreads: number;
unreadsFrom: Date;
msgs: number;
latest: Date;
userMentions: number;
};
};
'channels.join': {
POST: (params: { roomId: string; joinCode: string | null }) => { channel: IRoom };
};
'channels.close': {
POST: (params: { roomId: string }) => {};
};
'channels.kick': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.delete': {
POST: (params: { roomId: string }) => {};
};
'channels.leave': {
POST: (params: { roomId: string }) => {};
};
'channels.addModerator': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.removeModerator': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.addOwner': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.removeOwner': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.addLeader': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.removeLeader': {
POST: (params: { roomId: string; userId: string }) => {};
};
'channels.roles': {
GET: (params: { roomId: string }) => { roles: IGetRoomRoles[] };
};
'channels.messages': {
GET: (params: {
roomId: IRoom['_id'];
query: { 'mentions._id': { $in: string[] } } | { 'starred._id': { $in: string[] } } | { pinned: boolean };
offset: number;
sort: { ts: number };
}) => {
messages: IMessage[];
};
};
};
import type { IMessage } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { ReadReceipt } from '../../ReadReceipt';
export type ChatEndpoints = {
'chat.getMessage': {
......@@ -13,6 +14,21 @@ export type ChatEndpoints = {
'chat.unfollowMessage': {
POST: (params: { mid: IMessage['_id'] }) => void;
};
'chat.starMessage': {
POST: (params: { messageId: IMessage['_id'] }) => void;
};
'chat.unStarMessage': {
POST: (params: { messageId: IMessage['_id'] }) => void;
};
'chat.pinMessage': {
POST: (params: { messageId: IMessage['_id'] }) => void;
};
'chat.unPinMessage': {
POST: (params: { messageId: IMessage['_id'] }) => void;
};
'chat.reportMessage': {
POST: (params: { messageId: IMessage['_id']; description: string }) => void;
};
'chat.getDiscussions': {
GET: (params: { roomId: IRoom['_id']; text?: string; offset: number; count: number }) => {
messages: IMessage[];
......@@ -25,4 +41,38 @@ export type ChatEndpoints = {
total: number;
};
};
'chat.syncThreadsList': {
GET: (params: { rid: IRoom['_id']; updatedSince: string }) => {
threads: {
update: IMessage[];
remove: IMessage[];
};
};
};
'chat.delete': {
POST: (params: { msgId: string; roomId: string }) => {
_id: string;
ts: string;
message: Pick<IMessage, '_id' | 'rid' | 'u'>;
};
};
'chat.react': {
POST: (params: { emoji: string; messageId: string }) => void;
};
'chat.ignoreUser': {
GET: (params: { rid: string; userId: string; ignore: boolean }) => {};
};
'chat.search': {
GET: (params: { roomId: IRoom['_id']; searchText: string; count: number; offset: number }) => {
messages: IMessage[];
};
};
'chat.update': {
POST: (params: { roomId: IRoom['_id']; msgId: string; text: string }) => {
messages: IMessage;
};
};
'chat.getMessageReadReceipts': {
GET: (params: { messageId: string }) => { receipts: ReadReceipt[] };
};
};
import { IRoom } from '../../IRoom';
import { PaginatedResult } from '../helpers/PaginatedResult';
export type DirectoryEndpoint = {
directory: {
GET: (params: {
query: { [key: string]: string };
count: number;
offset: number;
sort: { [key: string]: number };
}) => PaginatedResult<{ result: IRoom[] }>;
};
};
import { IUser } from '../../IUser';
export type E2eEndpoints = {
'e2e.setUserPublicAndPrivateKeys': {
POST: (params: { public_key: string; private_key: string }) => void;
};
'e2e.getUsersOfRoomWithoutKey': {
GET: (params: { rid: string }) => {
users: Pick<IUser, '_id' | 'e2e'>[];
};
};
'e2e.updateGroupKey': {
POST: (params: { uid: string; rid: string; key: string }) => {};
};
'e2e.setRoomKeyID': {
POST: (params: { rid: string; keyID: string }) => {};
};
'e2e.fetchMyKeys': {
GET: () => { public_key: string; private_key: string };
};
};
import type { IMessage } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { IUser } from '../../IUser';
import { ITeam } from '../../ITeam';
import type { IGetRoomRoles, IUser } from '../../IUser';
export type GroupsEndpoints = {
'groups.files': {
......@@ -17,4 +18,68 @@ export type GroupsEndpoints = {
total: number;
};
};
'groups.history': {
GET: (params: { roomId: string; count: number; latest?: string }) => {
messages: IMessage[];
};
};
'groups.archive': {
POST: (params: { roomId: string }) => void;
};
'groups.unarchive': {
POST: (params: { roomId: string }) => void;
};
'groups.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IRoom>;
};
};
'groups.convertToTeam': {
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
};
'groups.counters': {
GET: (params: { roomId: string }) => {
joined: boolean;
members: number;
unreads: number;
unreadsFrom: Date;
msgs: number;
latest: Date;
userMentions: number;
};
};
'groups.close': {
POST: (params: { roomId: string }) => {};
};
'groups.kick': {
POST: (params: { roomId: string; userId: string }) => {};
};
'groups.delete': {
POST: (params: { roomId: string }) => {};
};
'groups.leave': {
POST: (params: { roomId: string }) => {};
};
'groups.roles': {
GET: (params: { roomId: string }) => { roles: IGetRoomRoles[] };
};
'groups.messages': {
GET: (params: {
roomId: IRoom['_id'];
query: { 'mentions._id': { $in: string[] } } | { 'starred._id': { $in: string[] } } | { pinned: boolean };
offset: number;
sort: { ts: number };
}) => {
messages: IMessage[];
};
};
};
......@@ -33,4 +33,31 @@ export type ImEndpoints = {
total: number;
};
};
'im.history': {
GET: (params: { roomId: string; count: number; latest?: string }) => {
messages: IMessage[];
};
};
'im.close': {
POST: (params: { roomId: string }) => {};
};
'im.kick': {
POST: (params: { roomId: string; userId: string }) => {};
};
'im.delete': {
POST: (params: { roomId: string }) => {};
};
'im.leave': {
POST: (params: { roomId: string }) => {};
};
'im.messages': {
GET: (params: {
roomId: IRoom['_id'];
query: { 'mentions._id': { $in: string[] } } | { 'starred._id': { $in: string[] } } | { pinned: boolean };
offset: number;
sort: { ts: number };
}) => {
messages: IMessage[];
};
};
};
import { IOmnichannelCannedResponse } from '../../../ee/client/omnichannel/cannedResponses/IOmnichannelCannedResponse';
import { ILivechatAgent } from '../../ILivechatAgent';
import { ILivechatDepartment } from '../../ILivechatDepartment';
import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents';
......@@ -194,4 +195,13 @@ export type OmnichannelEndpoints = {
total: number;
};
};
'livechat/agents/:uid/departments?enabledDepartmentsOnly=true': {
GET: () => { departments: ILivechatDepartment[] };
};
'canned-responses': {
GET: (params: PaginatedRequest<{ scope?: string; departmentId?: string; text?: string }>) => PaginatedResult<{
cannedResponses: IOmnichannelCannedResponse[];
}>;
};
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment