Skip to content

Commit

Permalink
feat: update to track latest spec changes
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed May 7, 2024
2 parents af58bdb + 0261fb1 commit 6f5ed39
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 0 deletions.
6 changes: 6 additions & 0 deletions generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export type { ConnectionParameters } from './models/ConnectionParameters';
export type { ConnectionURIResponse } from './models/ConnectionURIResponse';
export type { ConnectionURIsOptionalResponse } from './models/ConnectionURIsOptionalResponse';
export type { ConnectionURIsResponse } from './models/ConnectionURIsResponse';
export type { ConsumptionHistoryGranularity } from './models/ConsumptionHistoryGranularity';
export type { ConsumptionHistoryPerAccountResponse } from './models/ConsumptionHistoryPerAccountResponse';
export type { ConsumptionHistoryPerPeriod } from './models/ConsumptionHistoryPerPeriod';
export type { ConsumptionHistoryPerProject } from './models/ConsumptionHistoryPerProject';
export type { ConsumptionHistoryPerProjectResponse } from './models/ConsumptionHistoryPerProjectResponse';
export type { ConsumptionHistoryPerTimeframe } from './models/ConsumptionHistoryPerTimeframe';
export type { CurrentUserAuthAccount } from './models/CurrentUserAuthAccount';
export type { CurrentUserInfoAuthResponse } from './models/CurrentUserInfoAuthResponse';
export type { CurrentUserInfoResponse } from './models/CurrentUserInfoResponse';
Expand Down
5 changes: 5 additions & 0 deletions generated/models/ConsumptionHistoryGranularity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ConsumptionHistoryGranularity = 'hourly' | 'daily' | 'monthly';
9 changes: 9 additions & 0 deletions generated/models/ConsumptionHistoryPerAccountResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConsumptionHistoryPerPeriod } from './ConsumptionHistoryPerPeriod';
export type ConsumptionHistoryPerAccountResponse = {
periods: Array<ConsumptionHistoryPerPeriod>;
};

10 changes: 10 additions & 0 deletions generated/models/ConsumptionHistoryPerPeriod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConsumptionHistoryPerTimeframe } from './ConsumptionHistoryPerTimeframe';
export type ConsumptionHistoryPerPeriod = {
period_id: string;
consumption: Array<ConsumptionHistoryPerTimeframe>;
};

10 changes: 10 additions & 0 deletions generated/models/ConsumptionHistoryPerProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConsumptionHistoryPerPeriod } from './ConsumptionHistoryPerPeriod';
export type ConsumptionHistoryPerProject = {
project_id: string;
periods: Array<ConsumptionHistoryPerPeriod>;
};

9 changes: 9 additions & 0 deletions generated/models/ConsumptionHistoryPerProjectResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConsumptionHistoryPerProject } from './ConsumptionHistoryPerProject';
export type ConsumptionHistoryPerProjectResponse = {
projects: Array<ConsumptionHistoryPerProject>;
};

13 changes: 13 additions & 0 deletions generated/models/ConsumptionHistoryPerTimeframe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ConsumptionHistoryPerTimeframe = {
timeframe_start: string;
timeframe_end: string;
active_time_seconds: number;
compute_time_seconds: number;
written_data_bytes: number;
synthetic_storage_size_bytes: number;
};

12 changes: 12 additions & 0 deletions generated/models/OuterbaseProjectResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ export type OuterbaseProjectResponse = {
* The current repository associated with the GitHub App
*/
current_workspace_id?: string;
/**
* ID of "base" entity
*/
base_id?: string;
/**
* ID of "connection" entity
*/
connection_id?: string;
/**
* ID of "source" entity
*/
source_id?: string;
/**
* The neon database role
*/
Expand Down
120 changes: 120 additions & 0 deletions generated/services/ConsumptionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,133 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConsumptionHistoryGranularity } from '../models/ConsumptionHistoryGranularity';
import type { ConsumptionHistoryPerAccountResponse } from '../models/ConsumptionHistoryPerAccountResponse';
import type { ConsumptionHistoryPerProjectResponse } from '../models/ConsumptionHistoryPerProjectResponse';
import type { GeneralError } from '../models/GeneralError';
import type { PaginationResponse } from '../models/PaginationResponse';
import type { ProjectsConsumptionResponse } from '../models/ProjectsConsumptionResponse';
import type { CancelablePromise } from '../core/CancelablePromise';
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
export class ConsumptionService {
constructor(public readonly httpRequest: BaseHttpRequest) {}
/**
* Get account consumption metrics
* Retrieves consumption metrics for Scale plan accounts. History begins at the time of upgrade.
* Available for Scale plan users only.
*
* @param from Specify the start `date-time` for the consumption period.
* The `date-time` value is rounded according to the specified `granularity`.
* For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`.
* The specified `date-time` value must respect the specified granularity:
* - For `hourly`, consumption metrics are limited to the last 168 hours.
* - For `daily`, consumption metrics are limited to the last 60 days.
* - For `monthly`, consumption metrics are limited to the past year.
*
* The consumption history is available starting from `March 1, 2024, at 00:00:00 UTC`.
*
* @param to Specify the end `date-time` for the consumption period.
* The `date-time` value is rounded according to the specified granularity.
* For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`.
* The specified `date-time` value must respect the specified granularity:
* - For `hourly`, consumption metrics are limited to the last 168 hours.
* - For `daily`, consumption metrics are limited to the last 60 days.
* - For `monthly`, consumption metrics are limited to the past year.
*
* @param granularity Specify the granularity of consumption metrics.
* Hourly, daily, and monthly metrics are available for the last 168 hours, 60 days,
* and 1 year, respectively.
*
* @returns ConsumptionHistoryPerAccountResponse Returned consumption metrics for the Neon account
* @returns GeneralError General Error
* @throws ApiError
*/
public getConsumptionHistoryPerAccount(
from: string,
to: string,
granularity: ConsumptionHistoryGranularity,
): CancelablePromise<ConsumptionHistoryPerAccountResponse | GeneralError> {
return this.httpRequest.request({
method: 'GET',
url: '/consumption_history/account',
query: {
'from': from,
'to': to,
'granularity': granularity,
},
errors: {
403: `This endpoint is not available. It is only supported with Scale plan accounts.`,
406: `The specified \`date-time\` range is outside the boundaries of the specified \`granularity\`.
Adjust your \`from\` and \`to\` values or select a different \`granularity\`.
`,
429: `Too many requests`,
},
});
}
/**
* Get consumption metrics for each project
* Retrieves consumption metrics for Scale plan projects. History begins at the time of upgrade.
* Available for Scale plan users only.
*
* @param from Specify the start `date-time` for the consumption period.
* The `date-time` value is rounded according to the specified `granularity`.
* For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`.
* The specified `date-time` value must respect the specified `granularity`:
* - For `hourly`, consumption metrics are limited to the last 168 hours.
* - For `daily`, consumption metrics are limited to the last 60 days.
* - For `monthly`, consumption metrics are limited to the last year.
*
* The consumption history is available starting from `March 1, 2024, at 00:00:00 UTC`.
*
* @param to Specify the end `date-time` for the consumption period.
* The `date-time` value is rounded according to the specified granularity.
* For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`.
* The specified `date-time` value must respect the specified `granularity`:
* - For `hourly`, consumption metrics are limited to the last 168 hours.
* - For `daily`, consumption metrics are limited to the last 60 days.
* - For `monthly`, consumption metrics are limited to the last year.
*
* @param granularity Specify the granularity of consumption metrics.
* Hourly, daily, and monthly metrics are available for the last 168 hours, 60 days,
* and 1 year, respectively.
*
* @param cursor Specify the cursor value from the previous response to get the next batch of projects.
* @param limit Specify a value from 1 to 100 to limit number of projects in the response.
* @param projectIds Specify a list of project IDs to filter the response.
* If omitted, the response will contain all projects.
*
* @returns any Returned project consumption metrics for the Neon account
* @returns GeneralError General Error
* @throws ApiError
*/
public getConsumptionHistoryPerProject(
from: string,
to: string,
granularity: ConsumptionHistoryGranularity,
cursor?: string,
limit: number = 10,
projectIds?: Array<string>,
): CancelablePromise<(ConsumptionHistoryPerProjectResponse & PaginationResponse) | GeneralError> {
return this.httpRequest.request({
method: 'GET',
url: '/consumption_history/projects',
query: {
'cursor': cursor,
'limit': limit,
'project_ids': projectIds,
'from': from,
'to': to,
'granularity': granularity,
},
errors: {
403: `This endpoint is not available. It is only supported with Scale plan accounts.`,
406: `The specified \`date-time\` range is outside the boundaries of the specified \`granularity\`.
Adjust your \`from\` and \`to\` values or select a different \`granularity\`.
`,
429: `Too many requests`,
},
});
}
/**
* Get project consumption metrics
* Retrieves consumption metrics for each project for the current billing period.
Expand Down

0 comments on commit 6f5ed39

Please sign in to comment.