This repository has been archived on 2024-09-23. You can view files and clone it, but cannot push or open issues or pull requests.
rocketchat-scim/rc-sdk/RcSdkUser.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-02-15 12:38:33 +00:00
import { RcSdk } from "./RcSdk";
export class RcSdkUser {
private sdk: RcSdk;
constructor(sdk: RcSdk) {
this.sdk = sdk;
}
public async list(): Promise<any> {
const response = await this.sdk.get(
`users.list?query={"type":{"$eq":"user"}}&fields={"createdAt":1}`,
);
return this.sdk.parseResponse(response);
}
public async info(userId: string): Promise<any> {
const response = await this.sdk.get(`users.info?userId=${userId}`);
return this.sdk.parseResponse(response);
}
public async update(body: IUserUpdate): Promise<any> {
const response = await this.sdk.post(`users.update`, body);
return this.sdk.parseResponse(response);
}
public async delete(body: IUserDelete): Promise<any> {
const response = await this.sdk.post(`users.delete`);
return this.sdk.parseResponse(response);
}
public async create(body: IUserCreate): Promise<any> {
const response = await this.sdk.post(`users.create`, body);
return this.sdk.parseResponse(response);
}
}