mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-28 06:47:25 +00:00
28 lines
642 B
TypeScript
28 lines
642 B
TypeScript
import type { ITeam, TEAM_TYPE } from '@rocket.chat/core-typings';
|
|
|
|
import { api, request } from './api-data';
|
|
|
|
export const createTeam = async (
|
|
credentials: Record<string, any>,
|
|
teamName: string,
|
|
type: TEAM_TYPE,
|
|
members?: string[],
|
|
): Promise<ITeam> => {
|
|
const response = await request
|
|
.post(api('teams.create'))
|
|
.set(credentials)
|
|
.send({
|
|
name: teamName,
|
|
type,
|
|
...(members && { members }),
|
|
});
|
|
|
|
return response.body.team;
|
|
};
|
|
|
|
export const deleteTeam = async (credentials: Record<string, any>, teamName: string): Promise<void> => {
|
|
await request.post(api('teams.delete')).set(credentials).send({
|
|
teamName,
|
|
});
|
|
};
|