Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use serverV2 in server details to speed up page load #98

Merged
merged 14 commits into from
Sep 2, 2024
2 changes: 1 addition & 1 deletion sdk/Healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Healthcheck<SecurityDataType = unknown> {
}

/**
* @description Return database hash and last udpated timestamp.
* @description Return database hash and last updated timestamp.
*
* @tags Administrative endpoints
* @name HealthcheckHealthcheckGet
Expand Down
2 changes: 1 addition & 1 deletion sdk/HealthcheckRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { HealthcheckHealthcheckGetData } from "./data-contracts";

export namespace Healthcheck {
/**
* @description Return database hash and last udpated timestamp.
* @description Return database hash and last updated timestamp.
* @tags Administrative endpoints
* @name HealthcheckHealthcheckGet
* @summary Healthcheck
Expand Down
49 changes: 43 additions & 6 deletions sdk/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
*/

import {
GetServerBenchmarksServerVendorServerBenchmarksGetData,
GetServerPricesServerVendorServerPricesGetData,
GetServerPricesServerVendorServerPricesGetParams,
GetServerServerVendorServerGetData,
GetServerServerVendorServerGetParams,
GetSimilarServersServerVendorServerSimilarServersByNGetData,
GetSimilarServersServerVendorServerSimilarServersByNGetParams,
HTTPValidationError,
} from "./data-contracts";
import { HttpClient, RequestParams } from "./http-client";
Expand All @@ -27,10 +31,11 @@ export class Server<SecurityDataType = unknown> {
/**
* @description Query a single server by its vendor id and either the server or, or its API reference. Return dictionary includes all server fields, along with the current prices per zone, and the available benchmark scores.
*
* @tags Query Resources
* @tags Server Details
* @name GetServerServerVendorServerGet
* @summary Get Server
* @request GET:/server/{vendor}/{server}
* @deprecated
*/
getServerServerVendorServerGet = (
{ vendor, server, ...query }: GetServerServerVendorServerGetParams,
Expand All @@ -46,21 +51,53 @@ export class Server<SecurityDataType = unknown> {
/**
* @description Search similar servers to the provided one. The "family" method returns all servers from the same family of the same vendor. The "specs" approach will prioritize the number of GPUs, then CPUs, lastly the amount of memory. The "score" method will find the servers with the closest performance using the multi-core SCore.
*
* @tags Query Resources
* @tags Server Details
* @name GetSimilarServersServerVendorServerSimilarServersByNGet
* @summary Get Similar Servers
* @request GET:/server/{vendor}/{server}/similar_servers/{by}/{n}
*/
getSimilarServersServerVendorServerSimilarServersByNGet = (
vendor: string,
server: string,
by: "family" | "specs" | "score",
n: number,
{ vendor, server, by, n, ...query }: GetSimilarServersServerVendorServerSimilarServersByNGetParams,
params: RequestParams = {},
) =>
this.http.request<GetSimilarServersServerVendorServerSimilarServersByNGetData, HTTPValidationError>({
path: `/server/${vendor}/${server}/similar_servers/${by}/${n}`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* @description Query the current prices of a single server by its vendor id and server id.
*
* @tags Server Details
* @name GetServerPricesServerVendorServerPricesGet
* @summary Get Server Prices
* @request GET:/server/{vendor}/{server}/prices
*/
getServerPricesServerVendorServerPricesGet = (
{ vendor, server, ...query }: GetServerPricesServerVendorServerPricesGetParams,
params: RequestParams = {},
) =>
this.http.request<GetServerPricesServerVendorServerPricesGetData, HTTPValidationError>({
path: `/server/${vendor}/${server}/prices`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* @description Query the current benchmark scores of a single server.
*
* @tags Server Details
* @name GetServerBenchmarksServerVendorServerBenchmarksGet
* @summary Get Server Benchmarks
* @request GET:/server/{vendor}/{server}/benchmarks
*/
getServerBenchmarksServerVendorServerBenchmarksGet = (vendor: string, server: string, params: RequestParams = {}) =>
this.http.request<GetServerBenchmarksServerVendorServerBenchmarksGetData, HTTPValidationError>({
path: `/server/${vendor}/${server}/benchmarks`,
method: "GET",
format: "json",
...params,
});
Expand Down
6 changes: 4 additions & 2 deletions sdk/ServerPricesRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export namespace ServerPrices {
* Minimum number of virtual CPUs.
* @min 1
* @max 256
* @default 1
*/
vcpus_min?: number;
/**
Expand Down Expand Up @@ -76,7 +77,7 @@ export namespace ServerPrices {
*/
vendor?: "aws" | "azure" | "gcp" | "hcloud";
/**
* region id
* Region id
* Identifier of the region.
*/
regions?:
Expand Down Expand Up @@ -192,6 +193,7 @@ export namespace ServerPrices {
| "southafricanorth"
| "southafricawest"
| "southcentralus"
| "southcentralusstg"
| "southeastasia"
| "southindia"
| "spaincentral"
Expand Down Expand Up @@ -219,7 +221,7 @@ export namespace ServerPrices {
compliance_framework?: "hipaa" | "iso27001" | "soc2t2";
/**
* Storage Size
* Minimum amount of storage (GBs) attached to the server.
* Minimum amount of storage (GBs).
*/
storage_size?: number | null;
/**
Expand Down
80 changes: 77 additions & 3 deletions sdk/ServerRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
*/

import {
GetServerBenchmarksServerVendorServerBenchmarksGetData,
GetServerPricesServerVendorServerPricesGetData,
GetServerServerVendorServerGetData,
GetSimilarServersServerVendorServerSimilarServersByNGetData,
} from "./data-contracts";

export namespace Server {
/**
* @description Query a single server by its vendor id and either the server or, or its API reference. Return dictionary includes all server fields, along with the current prices per zone, and the available benchmark scores.
* @tags Query Resources
* @tags Server Details
* @name GetServerServerVendorServerGet
* @summary Get Server
* @request GET:/server/{vendor}/{server}
* @deprecated
*/
export namespace GetServerServerVendorServerGet {
export type RequestParams = {
Expand Down Expand Up @@ -49,7 +52,7 @@ export namespace Server {

/**
* @description Search similar servers to the provided one. The "family" method returns all servers from the same family of the same vendor. The "specs" approach will prioritize the number of GPUs, then CPUs, lastly the amount of memory. The "score" method will find the servers with the closest performance using the multi-core SCore.
* @tags Query Resources
* @tags Server Details
* @name GetSimilarServersServerVendorServerSimilarServersByNGet
* @summary Get Similar Servers
* @request GET:/server/{vendor}/{server}/similar_servers/{by}/{n}
Expand Down Expand Up @@ -78,9 +81,80 @@ export namespace Server {
*/
n: number;
};
export type RequestQuery = {};
export type RequestQuery = {
/**
* Benchmark Id
* Benchmark id to use as the main score for the server.
* @default "stress_ng:cpu_all"
*/
benchmark_id?: string;
/**
* Benchmark Config
* Benchmark id to use as the main score for the server.
* @default ""
*/
benchmark_config?: string;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;

Committable suggestion was skipped due to low confidence.

export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = GetSimilarServersServerVendorServerSimilarServersByNGetData;
}

/**
* @description Query the current prices of a single server by its vendor id and server id.
* @tags Server Details
* @name GetServerPricesServerVendorServerPricesGet
* @summary Get Server Prices
* @request GET:/server/{vendor}/{server}/prices
*/
export namespace GetServerPricesServerVendorServerPricesGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {
/**
* Currency
* Currency used for prices.
*/
currency?: string | null;
};
export type RequestBody = never;
export type RequestHeaders = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export type RequestHeaders = {};
export type RequestHeaders = Record<string, string>;
Tools
Biome

[error] 125-125: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

export type ResponseBody = GetServerPricesServerVendorServerPricesGetData;
}
Comment on lines +103 to +133
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* @description Query the current prices of a single server by its vendor id and server id.
* @tags Server Details
* @name GetServerPricesServerVendorServerPricesGet
* @summary Get Server Prices
* @request GET:/server/{vendor}/{server}/prices
*/
export namespace GetServerPricesServerVendorServerPricesGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {
/**
* Currency
* Currency used for prices.
*/
currency?: string | null;
};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = GetServerPricesServerVendorServerPricesGetData;
}
/**
* @description Query the current prices of a single server by its vendor id and server id.
* @tags Server Details
* @name GetServerPricesServerVendorServerPricesGet
* @summary Get Server Prices
* @request GET:/server/{vendor}/{server}/prices
*/
export namespace GetServerPricesServerVendorServerPricesGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {
/**
* Currency
* Currency used for prices.
*/
currency?: string | null;
};
export type RequestBody = never;
export type RequestHeaders = Record<string, string>;
export type ResponseBody = GetServerPricesServerVendorServerPricesGetData;
}
Tools
Biome

[error] 131-131: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


/**
* @description Query the current benchmark scores of a single server.
* @tags Server Details
* @name GetServerBenchmarksServerVendorServerBenchmarksGet
* @summary Get Server Benchmarks
* @request GET:/server/{vendor}/{server}/benchmarks
*/
export namespace GetServerBenchmarksServerVendorServerBenchmarksGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export type RequestHeaders = {};
export type RequestHeaders = Record<string, string>;
Tools
Biome

[error] 151-151: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

export type ResponseBody = GetServerBenchmarksServerVendorServerBenchmarksGetData;
}
Comment on lines +135 to +159
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestQuery = {};
+    export type RequestQuery = Record<string, never>;

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* @description Query the current benchmark scores of a single server.
* @tags Server Details
* @name GetServerBenchmarksServerVendorServerBenchmarksGet
* @summary Get Server Benchmarks
* @request GET:/server/{vendor}/{server}/benchmarks
*/
export namespace GetServerBenchmarksServerVendorServerBenchmarksGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = GetServerBenchmarksServerVendorServerBenchmarksGetData;
}
/**
* @description Query the current benchmark scores of a single server.
* @tags Server Details
* @name GetServerBenchmarksServerVendorServerBenchmarksGet
* @summary Get Server Benchmarks
* @request GET:/server/{vendor}/{server}/benchmarks
*/
export namespace GetServerBenchmarksServerVendorServerBenchmarksGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = Record<string, never>;
export type RequestBody = never;
export type RequestHeaders = Record<string, string>;
export type ResponseBody = GetServerBenchmarksServerVendorServerBenchmarksGetData;
}
Tools
Biome

[error] 155-155: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 157-157: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

}
2 changes: 1 addition & 1 deletion sdk/ServersRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export namespace Servers {
compliance_framework?: "hipaa" | "iso27001" | "soc2t2";
/**
* Storage Size
* Minimum amount of storage (GBs) attached to the server.
* Minimum amount of storage (GBs).
*/
storage_size?: number | null;
/**
Expand Down
37 changes: 37 additions & 0 deletions sdk/V2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/

import { GetServerWithoutRelationsV2ServerVendorServerGetData, HTTPValidationError } from "./data-contracts";
import { HttpClient, RequestParams } from "./http-client";

export class V2<SecurityDataType = unknown> {
http: HttpClient<SecurityDataType>;

constructor(http: HttpClient<SecurityDataType>) {
this.http = http;
}

/**
* @description Query a single server by its vendor id and either the server id or its API reference.
*
* @tags Server Details
* @name GetServerWithoutRelationsV2ServerVendorServerGet
* @summary Get Server Without Relations
* @request GET:/v2/server/{vendor}/{server}
*/
getServerWithoutRelationsV2ServerVendorServerGet = (vendor: string, server: string, params: RequestParams = {}) =>
this.http.request<GetServerWithoutRelationsV2ServerVendorServerGetData, HTTPValidationError>({
path: `/v2/server/${vendor}/${server}`,
method: "GET",
format: "json",
...params,
});
}
40 changes: 40 additions & 0 deletions sdk/V2Route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/

import { GetServerWithoutRelationsV2ServerVendorServerGetData } from "./data-contracts";

export namespace V2 {
/**
* @description Query a single server by its vendor id and either the server id or its API reference.
* @tags Server Details
* @name GetServerWithoutRelationsV2ServerVendorServerGet
* @summary Get Server Without Relations
* @request GET:/v2/server/{vendor}/{server}
*/
export namespace GetServerWithoutRelationsV2ServerVendorServerGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = GetServerWithoutRelationsV2ServerVendorServerGetData;
}
Comment on lines +14 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace {} with a more explicit type definition.

The use of {} as a type should be replaced with a more explicit type definition to avoid ambiguity.

Apply this diff to replace {} with a more explicit type definition:

-    export type RequestQuery = {};
+    export type RequestQuery = Record<string, never>;

-    export type RequestHeaders = {};
+    export type RequestHeaders = Record<string, string>;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export namespace V2 {
/**
* @description Query a single server by its vendor id and either the server id or its API reference.
* @tags Server Details
* @name GetServerWithoutRelationsV2ServerVendorServerGet
* @summary Get Server Without Relations
* @request GET:/v2/server/{vendor}/{server}
*/
export namespace GetServerWithoutRelationsV2ServerVendorServerGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = GetServerWithoutRelationsV2ServerVendorServerGetData;
}
export namespace V2 {
/**
* @description Query a single server by its vendor id and either the server id or its API reference.
* @tags Server Details
* @name GetServerWithoutRelationsV2ServerVendorServerGet
* @summary Get Server Without Relations
* @request GET:/v2/server/{vendor}/{server}
*/
export namespace GetServerWithoutRelationsV2ServerVendorServerGet {
export type RequestParams = {
/**
* Vendor
* A Vendor's ID.
*/
vendor: string;
/**
* Server
* A Server's ID or API reference.
*/
server: string;
};
export type RequestQuery = Record<string, never>;
export type RequestBody = never;
export type RequestHeaders = Record<string, string>;
export type ResponseBody = GetServerWithoutRelationsV2ServerVendorServerGetData;
}
Tools
Biome

[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 37-37: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

}
Loading