UsageQueries: the mechanism UsageService implements.
API
@Interface()
export abstract class UsageQueries {
abstract query(projectId: string, q: UsageQuery): Promise<UsageResponse>;
abstract queryErrors(projectId: string, q: UsageErrorsQuery): UsageErrorsPage;
abstract clearErrors(projectId: string, q: UsageErrorsClearQuery): number;
abstract modelTotals(projectId: string): UsageModelTotals;
abstract costBySession(
projectId: string,
sessionIds: readonly string[],
fromTs: string,
toTs: string,
): Promise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>;
abstract dailyCostForSessions(
projectId: string,
sessionIds: readonly string[],
fromTs: string,
toTs: string,
): Promise<Array<{ date: string; cost: number }>>;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (6)
query
query(projectId: string, q: UsageQuery): Promise<UsageResponse>@paramprojectId
string@paramq
UsageQuery@returns
Promise<UsageResponse>queryErrors
queryErrors(projectId: string, q: UsageErrorsQuery): UsageErrorsPage@paramprojectId
string@paramq
UsageErrorsQuery@returns
UsageErrorsPageclearErrors
clearErrors(projectId: string, q: UsageErrorsClearQuery): number@paramprojectId
string@paramq
UsageErrorsClearQuery@returns
numbermodelTotals
modelTotals(projectId: string): UsageModelTotals@paramprojectId
string@returns
UsageModelTotalscostBySession
costBySession(projectId: string, sessionIds: readonly string[], fromTs: string, toTs: string): Promise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>@paramprojectId
string@paramsessionIds
readonly string[]@paramfromTs
string@paramtoTs
string@returns
Promise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>dailyCostForSessions
dailyCostForSessions(projectId: string, sessionIds: readonly string[], fromTs: string, toTs: string): Promise<Array<{ date: string; cost: number }>>@paramprojectId
string@paramsessionIds
readonly string[]@paramfromTs
string@paramtoTs
string@returns
Promise<Array<{ date: string; cost: number }>>