import { gracely } from "gracely" import { isoly } from "isoly" import { http } from "cloudly-http" import { Treasury as TreasuryModel } from "../Treasury" export class Treasury { constructor(private readonly client: http.Client) {} async fetch(hour?: isoly.DateTime): Promise { return this.client.get( `/treasury/v2/snapshot${hour ? `/${isoly.DateTime.truncate(hour, "hours")}` : ""}` ) } async listTransactions(accountId: string): Promise { return this.client.get(`/treasury/account/${accountId}/transaction`) } async listAccounts(): Promise { return this.client.get(`/treasury/account`) } async report(start: isoly.Date, end: isoly.Date, supplier: string): Promise { return this.client.get(`/treasury/${supplier}/report?start=${start}&end=${end}`) } }