Chore: Migrate REST API - convertChannelToTeam to TS (#3792)

* migrate channels.convertToTeam and groups.convertToTeam to ts

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Gerzon Z 2022-03-02 13:44:42 -04:00 committed by GitHub
parent 71b184d38a
commit c5023eaeea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { IUser } from '../../IUser';
@ -28,4 +29,7 @@ export type ChannelsEndpoints = {
messages: IMessageFromServer[];
};
};
'channels.convertToTeam': {
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
};
};

View File

@ -1,3 +1,4 @@
import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { IUser } from '../../IUser';
@ -22,4 +23,7 @@ export type GroupsEndpoints = {
messages: IMessageFromServer[];
};
};
'groups.convertToTeam': {
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
};
};

View File

@ -220,7 +220,7 @@ export const teamListRoomsOfUser = ({ teamId, userId }: { teamId: string; userId
// @ts-ignore
sdk.get('teams.listRoomsOfUser', { teamId, userId });
export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: string; type: 'c' | 'p' }): any => {
export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: string; type: 'c' | 'p' }) => {
const params = {
...(type === 'c'
? {
@ -232,8 +232,6 @@ export const convertChannelToTeam = ({ rid, name, type }: { rid: string; name: s
roomName: name
})
};
// TODO: missing definitions from server
// @ts-ignore
return sdk.post(type === 'c' ? 'channels.convertToTeam' : 'groups.convertToTeam', params);
};