Skip to content

Commit

Permalink
Add support for querying daily usages by year and monts
Browse files Browse the repository at this point in the history
  • Loading branch information
sistrall committed Mar 26, 2024
1 parent 817185f commit e809e54
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/dashboard-client/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@
"method": "GET",
"comment": "Retrieve daily usage info for either an account or an organization",
"optionalRequestBody": false,
"queryParamsType": "DailyUsageInstancesHrefSchema",
"queryParamsRequired": false,
"responseType": "DailyUsageInstancesTargetSchema",
"name": "list",
Expand Down
15 changes: 15 additions & 0 deletions packages/dashboard-client/src/generated/SchemaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,21 @@ export type DailyUsageType = 'daily_usage';
* via the `definition` "id".
*/
export type DailyUsageIdentity = string;
/**
* This interface was referenced by `DailyUsage`'s JSON-Schema
* via the `instances.hrefSchema` link.
*/
export type DailyUsageInstancesHrefSchema = {
/**
* Year of the daily usages to retrieve. Defaults to current year.
*/
year?: string;
/**
* Monthof the daily usages to retrieve. Defaults to current month.
*/
month?: string;
[k: string]: unknown;
};
/**
* This interface was referenced by `JobResult`'s JSON-Schema
* via the `definition` "type".
Expand Down
15 changes: 15 additions & 0 deletions packages/dashboard-client/src/generated/SimpleSchemaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,21 @@ export type DailyUsageType = 'daily_usage';
* via the `instances.targetSchema` link.
*/
export type DailyUsageInstancesTargetSchema = DailyUsage[];
/**
* This interface was referenced by `DailyUsage`'s JSON-Schema
* via the `instances.hrefSchema` link.
*/
export type DailyUsageInstancesHrefSchema = {
/**
* Year of the daily usages to retrieve. Defaults to current year.
*/
year?: string;
/**
* Monthof the daily usages to retrieve. Defaults to current month.
*/
month?: string;
[k: string]: unknown;
};
/**
* ID of job result
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export default class DailyUsage extends BaseResource {
* @throws {ApiError}
* @throws {TimeoutError}
*/
list() {
return this.rawList().then((body) =>
list(queryParams?: SimpleSchemaTypes.DailyUsageInstancesHrefSchema) {
return this.rawList(queryParams).then((body) =>
Utils.deserializeResponseBody<SimpleSchemaTypes.DailyUsageInstancesTargetSchema>(
body,
),
Expand All @@ -26,10 +26,13 @@ export default class DailyUsage extends BaseResource {
* @throws {ApiError}
* @throws {TimeoutError}
*/
rawList(): Promise<SchemaTypes.DailyUsageInstancesTargetSchema> {
rawList(
queryParams?: SchemaTypes.DailyUsageInstancesHrefSchema,
): Promise<SchemaTypes.DailyUsageInstancesTargetSchema> {
return this.client.request<SchemaTypes.DailyUsageInstancesTargetSchema>({
method: 'GET',
url: '/daily-site-usages',
queryParams,
});
}
}

0 comments on commit e809e54

Please sign in to comment.