Chore: Migrate REST API - createChannel to Typescript (#3786)
* Chore: Migrate REST API - createChannel to Typescript * removed success * iserverroomitem
This commit is contained in:
parent
0521c291f2
commit
79f585a361
|
@ -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 };
|
||||
};
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue