0.1.4•Updated 6 months ago
declare namespace Supply {
interface Supply<EntityName extends string> {
readonly REST: import("@supply/mod.ts").SupplyRest<EntityName>
/**
* Add a new entry to the supply, and updates the balance.
*
* *Runs on a processor*
*/
AddItem(params: Supply.Item.Unentered): Promise<Supply.Item.Response>
/**
* Consume from positive past entries linked to a specific user
*
* *Runs on a processor*
*/
ArchiveEntry(params: Supply.Item.Unentered): Promise<Supply.Item.ArchiveResponse>
/**
* Fetch supply data for a particular user
*
* @param key The unique value referring to a user. Usually their `msisdn`
*/
UserData(key: string, count: number, page: number): Promise<Supply.User.Response>
/**
* Get the supply history for a user
*
* @param key The unique value referring to a user. Usually their `msisdn`
* @param limit How many entries should be retrieved?
*
* Default: 10
*/
AllotmentsFor(key: string, count: number, page: number): void
/**
* Get information regarding an entry, including consumption entries
*
* @param key The unique value referring to a user. Usually their `msisdn`
* @param limit How many entries should be retrieved?
*
* Default: 10
*/
EntryData(id: number): void
/**
* Get the total amount of items allotted to a user
*
* @param key The unique value referring to a user. Usually their `msisdn`
*/
CountFor(key: string): Promise<number | undefined>
/**
* Get the total number of users that have been tracked in this supply.
*
* A user is only tracked once an item has been added for them.
*/
UserCount(): Promise<number>
/**
* The name of the database table where this supply stores entries
*/
entries_table: string
/**
* The name of the database table where this supply stores user data
*/
user_table: string
/**
* The name of the database table where this supply records consumptions
*/
consumption_table: string
}
}