diff --git a/app/definitions/rest/v1/directory.ts b/app/definitions/rest/v1/directory.ts new file mode 100644 index 00000000..dfb2c9e0 --- /dev/null +++ b/app/definitions/rest/v1/directory.ts @@ -0,0 +1,13 @@ +import { IServerRoom } 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: IServerRoom[] }>; + }; +}; diff --git a/app/definitions/rest/v1/index.ts b/app/definitions/rest/v1/index.ts index dc1cdcd0..a594a966 100644 --- a/app/definitions/rest/v1/index.ts +++ b/app/definitions/rest/v1/index.ts @@ -17,6 +17,7 @@ import { E2eEndpoints } from './e2e'; import { SubscriptionsEndpoints } from './subscriptions'; import { VideoConferenceEndpoints } from './videoConference'; import { CommandsEndpoints } from './commands'; +import { DirectoryEndpoint } from './directory'; export type Endpoints = ChannelsEndpoints & ChatEndpoints & @@ -36,4 +37,5 @@ export type Endpoints = ChannelsEndpoints & E2eEndpoints & SubscriptionsEndpoints & VideoConferenceEndpoints & - CommandsEndpoints; + CommandsEndpoints & + DirectoryEndpoint; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 721d2f29..0f80f9c3 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -713,10 +713,18 @@ export const executeCommandPreview = ( tmid }); -export const getDirectory = ({ query, count, offset, sort }: { query: any; count: number; offset: number; sort: any }): any => +export const getDirectory = ({ + query, + count, + offset, + sort +}: { + query: { [key: string]: string }; + count: number; + offset: number; + sort: { [key: string]: number }; +}) => // RC 1.0 - // TODO: missing definitions from server - // @ts-ignore sdk.get('directory', { query, count,