import { gracely } from "gracely" import { http } from "cloudly-http" import { Organization } from "../../Organization" import { Fx } from "./Fx" import { Groups } from "./Groups" import { Risk } from "./Risk" import { Rules } from "./Rules" export class Organizations { readonly risk: Risk readonly Rules: Rules readonly groups: Groups readonly fx: Fx constructor(private readonly client: http.Client) { this.risk = new Risk(this.client) this.Rules = new Rules(this.client) this.groups = new Groups(this.client) this.fx = new Fx(this.client) } async list(options?: { limit?: string cursor?: string }): Promise<(Organization[] & { cursor?: string | undefined }) | gracely.Error> { return this.client.get(`/organization`, options) } async create(organization: Organization.Creatable): Promise { return this.client.post(`/organization`, organization) } async update(id: string, changeable: Organization.Changeable): Promise { return this.client.patch(`/organization/${id}`, changeable) } async inactivate(organization: string): Promise { return this.client.delete(`/organization/${organization}`, { organization }) } }