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 { ITeam } from '../../ITeam';
|
||||||
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
||||||
import type { IRoom } from '../../IRoom';
|
import type { IRoom, IServerRoomItem } from '../../IRoom';
|
||||||
import type { IUser } from '../../IUser';
|
import type { IUser } from '../../IUser';
|
||||||
|
|
||||||
export type ChannelsEndpoints = {
|
export type ChannelsEndpoints = {
|
||||||
|
@ -29,6 +29,20 @@ export type ChannelsEndpoints = {
|
||||||
messages: IMessageFromServer[];
|
messages: IMessageFromServer[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
'channels.create': {
|
||||||
|
POST: (params: {
|
||||||
|
name: string;
|
||||||
|
members: string[];
|
||||||
|
readOnly: boolean;
|
||||||
|
extraData: {
|
||||||
|
broadcast: boolean;
|
||||||
|
encrypted: boolean;
|
||||||
|
teamId?: string;
|
||||||
|
};
|
||||||
|
}) => {
|
||||||
|
group: Partial<IServerRoomItem>;
|
||||||
|
};
|
||||||
|
};
|
||||||
'channels.convertToTeam': {
|
'channels.convertToTeam': {
|
||||||
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ITeam } from '../../ITeam';
|
import { ITeam } from '../../ITeam';
|
||||||
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
||||||
import type { IRoom } from '../../IRoom';
|
import type { IRoom, IServerRoomItem } from '../../IRoom';
|
||||||
import type { IUser } from '../../IUser';
|
import type { IUser } from '../../IUser';
|
||||||
|
|
||||||
export type GroupsEndpoints = {
|
export type GroupsEndpoints = {
|
||||||
|
@ -23,6 +23,20 @@ export type GroupsEndpoints = {
|
||||||
messages: IMessageFromServer[];
|
messages: IMessageFromServer[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
'groups.create': {
|
||||||
|
POST: (params: {
|
||||||
|
name: string;
|
||||||
|
members: string[];
|
||||||
|
readOnly: boolean;
|
||||||
|
extraData: {
|
||||||
|
broadcast: boolean;
|
||||||
|
encrypted: boolean;
|
||||||
|
teamId?: string;
|
||||||
|
};
|
||||||
|
}) => {
|
||||||
|
group: Partial<IServerRoomItem>;
|
||||||
|
};
|
||||||
|
};
|
||||||
'groups.convertToTeam': {
|
'groups.convertToTeam': {
|
||||||
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
|
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const createChannel = ({
|
||||||
broadcast: boolean;
|
broadcast: boolean;
|
||||||
encrypted: boolean;
|
encrypted: boolean;
|
||||||
teamId: string;
|
teamId: string;
|
||||||
}): any => {
|
}) => {
|
||||||
const params = {
|
const params = {
|
||||||
name,
|
name,
|
||||||
members: users,
|
members: users,
|
||||||
|
@ -30,8 +30,6 @@ export const createChannel = ({
|
||||||
...(teamId && { teamId })
|
...(teamId && { teamId })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// TODO: missing definitions from server
|
|
||||||
// @ts-ignore
|
|
||||||
return sdk.post(type ? 'groups.create' : 'channels.create', params);
|
return sdk.post(type ? 'groups.create' : 'channels.create', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue