Chore: Migrate REST API - createChannel to Typescript (#3786)

* Chore: Migrate REST API - createChannel  to Typescript

* removed success

* iserverroomitem
This commit is contained in:
Reinaldo Neto 2022-03-02 16:40:27 -03:00 committed by GitHub
parent 0521c291f2
commit 79f585a361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { IRoom, IServerRoomItem } from '../../IRoom';
import type { IUser } from '../../IUser';
export type ChannelsEndpoints = {
@ -29,6 +29,20 @@ export type ChannelsEndpoints = {
messages: IMessageFromServer[];
};
};
'channels.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IServerRoomItem>;
};
};
'channels.convertToTeam': {
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
};

View File

@ -1,6 +1,6 @@
import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom';
import type { IRoom, IServerRoomItem } from '../../IRoom';
import type { IUser } from '../../IUser';
export type GroupsEndpoints = {
@ -23,6 +23,20 @@ export type GroupsEndpoints = {
messages: IMessageFromServer[];
};
};
'groups.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IServerRoomItem>;
};
};
'groups.convertToTeam': {
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
};

View File

@ -19,7 +19,7 @@ export const createChannel = ({
broadcast: boolean;
encrypted: boolean;
teamId: string;
}): any => {
}) => {
const params = {
name,
members: users,
@ -30,8 +30,6 @@ export const createChannel = ({
...(teamId && { teamId })
}
};
// TODO: missing definitions from server
// @ts-ignore
return sdk.post(type ? 'groups.create' : 'channels.create', params);
};