UNPKG

1.4 kBTypeScriptView Raw
1import type { DefaultElements, MakeRequest, MetaLinkProps, MetaSysProps, QueryOptions } from '../common-types';
2export type UsageMetricEnum = 'cda' | 'cma' | 'cpa' | 'gql';
3export interface UsageQuery extends QueryOptions {
4 'metric[in]'?: string;
5 'dateRange.startAt'?: string;
6 'dateRange.endAt'?: string;
7}
8export type UsageProps = {
9 /**
10 * System metadata
11 */
12 sys: MetaSysProps & {
13 organization?: {
14 sys: MetaLinkProps;
15 };
16 };
17 /**
18 * Type of usage
19 */
20 metric: UsageMetricEnum;
21 /**
22 * Unit of usage metric
23 */
24 unitOfMeasure: string;
25 /**
26 * Range of usage
27 */
28 dateRange: {
29 startAt: string;
30 endAt: string;
31 };
32 /**
33 * Value of the usage
34 */
35 usage: number;
36 /**
37 * Usage per day
38 */
39 usagePerDay: {
40 [key: string]: number;
41 };
42};
43export interface Usage extends UsageProps, DefaultElements<UsageProps> {
44}
45/**
46 * @private
47 * @param makeRequest - function to make requests via an adapter
48 * @param data - Raw data
49 * @return Normalized usage
50 */
51export declare function wrapUsage(_makeRequest: MakeRequest, data: UsageProps): Usage;
52/**
53 * @private
54 */
55export declare const wrapUsageCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<UsageProps>) => import("../common-types").Collection<Usage, UsageProps>;