Chore: Migrate REST API - getTeamListRoom to TS (#3840)

* add: `teams.listRooms` types

* add: `PaginatedResult<T>` to `teams.ts`
This commit is contained in:
Gerzon Z 2022-03-08 13:59:17 -04:00 committed by GitHub
parent b2bd71e83e
commit 15f573a703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View File

@ -1,17 +1,13 @@
import { IServerRoom } from '../../IRoom';
import { IServerTeamUpdateRoom, ITeam, TEAM_TYPE } from '../../ITeam';
import { PaginatedResult } from '../helpers/PaginatedResult';
export type TeamsEndpoints = {
'teams.removeRoom': {
POST: (params: { roomId: string; teamId: string }) => { room: IServerRoom };
};
'teams.listRoomsOfUser': {
GET: (params: { teamId: string; userId: string }) => {
rooms: IServerRoom[];
total: number;
count: number;
offset: number;
};
GET: (params: { teamId: string; userId: string }) => PaginatedResult<{ rooms: IServerRoom[] }>;
};
'teams.updateRoom': {
POST: (params: { roomId: string; isDefault: boolean }) => { room: IServerTeamUpdateRoom };
@ -33,4 +29,13 @@ export type TeamsEndpoints = {
room: { readOnly: boolean; extraData: { broadcast: boolean; encrypted: boolean } };
}) => { team: ITeam };
};
'teams.listRooms': {
GET: (params: {
teamId: string;
count: number;
offset: number;
type: string;
filter?: any;
}) => PaginatedResult<{ rooms: IServerTeamUpdateRoom[] }>;
};
};

View File

@ -319,7 +319,7 @@ export const getTeamListRoom = ({
offset: number;
type: string;
filter: any;
}): any => {
}) => {
const params: any = {
teamId,
count,
@ -331,8 +331,6 @@ export const getTeamListRoom = ({
params.filter = filter;
}
// RC 3.13.0
// TODO: missing definitions from server
// @ts-ignore
return sdk.get('teams.listRooms', params);
};

View File

@ -187,8 +187,10 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
} as ITeamChannelsViewState;
if (isSearching) {
// @ts-ignore
newState.search = [...search, ...result.rooms];
} else {
// @ts-ignore
newState.data = [...data, ...result.rooms];
}