35 lines
1.1 KiB
TypeScript
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);
|
|
}
|
|
}
|