Skip to content

Commit

Permalink
Merge branch 'main' into gp/open-ts-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed May 7, 2024
2 parents 4706718 + 3097955 commit c029032
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# [1.21.0](https://github.com/paambaati/neon-js-sdk/compare/v1.20.0...v1.21.0) (2024-05-07)


### Features

* update to track latest spec changes ([6f5ed39](https://github.com/paambaati/neon-js-sdk/commit/6f5ed395bafd64eb352290275664e5cd51804b71))
* update to track latest spec changes ([0261fb1](https://github.com/paambaati/neon-js-sdk/commit/0261fb1af41e63d1e393ab818776fc8555a2f4d4))

# [1.20.0](https://github.com/paambaati/neon-js-sdk/compare/v1.19.0...v1.20.0) (2024-04-29)


### Features

* update to track latest spec changes ([b32e4ac](https://github.com/paambaati/neon-js-sdk/commit/b32e4ac7eee52e70f8abed8ce1169fb6465bb7e4))
* update to track latest spec changes ([e98ef04](https://github.com/paambaati/neon-js-sdk/commit/e98ef04dcc99be1e0d0b37ea24920c5291119628))

# [1.19.0](https://github.com/paambaati/neon-js-sdk/compare/v1.18.0...v1.19.0) (2024-04-18)


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;
};

2 changes: 1 addition & 1 deletion generated/models/OperationStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
/**
* The status of the operation
*/
export type OperationStatus = 'running' | 'finished' | 'failed' | 'scheduling';
export type OperationStatus = 'scheduling' | 'running' | 'finished' | 'failed' | 'error' | 'cancelling' | 'cancelled' | 'skipped';
40 changes: 40 additions & 0 deletions generated/models/OuterbaseProjectResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { OuterbaseWorkspace } from './OuterbaseWorkspace';
export type OuterbaseProjectResponse = {
/**
* The ID of the project
*/
project_id?: string;
/**
* The list of workspaces associated with the Outerbase integrations
*/
workspaces?: Array<OuterbaseWorkspace>;
/**
* 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
*/
role?: string;
/**
* The neon database name
*/
db?: string;
};

15 changes: 15 additions & 0 deletions generated/models/OuterbaseWorkspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type OuterbaseWorkspace = {
/**
* The ID of the Outerbase workspace
*/
id?: string;
/**
* The name of the Outerbase workspace
*/
name?: string;
};

11 changes: 11 additions & 0 deletions generated/models/OuterbaseWorkspaceUpdateRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type OuterbaseWorkspaceUpdateRequest = {
/**
* The ID of the Outerbase workspace
*/
workspace_id: string;
};

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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neon-sdk",
"version": "1.19.0",
"version": "1.21.0",
"description": "TypeScript SDK for managing your Neon Serverless PostgreSQL projects",
"keywords": [
"neon",
Expand Down

0 comments on commit c029032

Please sign in to comment.