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
2022-02-15 13:38:33 +01:00

35 lines
1.1 KiB
TypeScript

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);
}
}