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

Dev 30 #118

Merged
merged 31 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0fbc419
SDK update
Palabola Aug 14, 2024
185f210
/storages added
Palabola Aug 14, 2024
06cd0fb
Merge branch 'main' into DEV-299
Palabola Aug 22, 2024
1cdd4a1
SDK update
Palabola Aug 22, 2024
08d0643
/storages updates
Palabola Aug 22, 2024
1f4836b
Merge branch 'main' into DEV-299
Palabola Sep 2, 2024
c91bd9f
Merge branch 'main' into DEV-299
Palabola Sep 5, 2024
7aeae50
SDK update
Palabola Sep 5, 2024
60e0ea1
SDK update
Palabola Sep 5, 2024
8c3655f
Merge branch 'main' into DEV-299
Palabola Sep 9, 2024
3c34b25
SDK
Palabola Sep 9, 2024
a094510
added currency options to storages
Palabola Sep 9, 2024
612bb6f
Merge branch 'DEV-299' of https://github.com/SpareCores/sc-www into D…
Palabola Sep 9, 2024
11c7e33
typo
Palabola Sep 9, 2024
5228f56
lint
Palabola Sep 9, 2024
7e4b7f8
added /traffic_prices page
Palabola Sep 9, 2024
0341576
SDK
Palabola Sep 9, 2024
77ddbea
traffic-prices update
Palabola Sep 10, 2024
3f1114e
dynamic title, needs research before use
Palabola Sep 10, 2024
6455c53
missing filea
Palabola Sep 11, 2024
e2def96
storages ordering + fields
Palabola Sep 11, 2024
780db3e
cleanup
Palabola Sep 11, 2024
4d4ac54
review
Palabola Sep 11, 2024
a4e3579
review
Palabola Sep 11, 2024
a99cbaa
SDK update
Palabola Sep 13, 2024
9990ffc
update AI assistant logic, use schema default limits
Palabola Sep 13, 2024
8c1b735
Merge branch 'main' into DEV-349
Palabola Sep 13, 2024
500db4d
lint
Palabola Sep 13, 2024
243473b
Merge branch 'DEV-349' of https://github.com/SpareCores/sc-www into D…
Palabola Sep 13, 2024
7c5109c
default order
Palabola Sep 13, 2024
b2bbb54
query total count
Palabola Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sdk/Ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
AssistServerFiltersAiAssistServerFiltersGetParams,
AssistServerPriceFiltersAiAssistServerPriceFiltersGetData,
AssistServerPriceFiltersAiAssistServerPriceFiltersGetParams,
AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData,
AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetParams,
HTTPValidationError,
} from "./data-contracts";
import { HttpClient, RequestParams } from "./http-client";
Expand Down Expand Up @@ -63,4 +65,23 @@ export class Ai<SecurityDataType = unknown> {
format: "json",
...params,
});
/**
* @description Extract StoragePrice JSON filters from freetext.
*
* @tags AI
* @name AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet
* @summary Assist Storage Price Filters
* @request GET:/ai/assist_storage_price_filters
*/
assistStoragePriceFiltersAiAssistStoragePriceFiltersGet = (
query: AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetParams,
params: RequestParams = {},
) =>
this.http.request<AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData, HTTPValidationError>({
path: `/ai/assist_storage_price_filters`,
method: "GET",
query: query,
format: "json",
...params,
});
}
19 changes: 19 additions & 0 deletions sdk/AiRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import {
AssistServerFiltersAiAssistServerFiltersGetData,
AssistServerPriceFiltersAiAssistServerPriceFiltersGetData,
AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData,
} from "./data-contracts";

export namespace Ai {
Expand Down Expand Up @@ -50,4 +51,22 @@ export namespace Ai {
export type RequestHeaders = {};
export type ResponseBody = AssistServerPriceFiltersAiAssistServerPriceFiltersGetData;
}

/**
* @description Extract StoragePrice JSON filters from freetext.
* @tags AI
* @name AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet
* @summary Assist Storage Price Filters
* @request GET:/ai/assist_storage_price_filters
*/
export namespace AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet {
export type RequestParams = {};
export type RequestQuery = {
/** Text */
text: string;
};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData;
}
Comment on lines +56 to +72
Copy link
Contributor

Choose a reason for hiding this comment

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

Well-documented namespace, but consider refining type definitions.

The namespace AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet is well-documented and structured. However, the use of '{}' for RequestParams and RequestHeaders should be replaced with more explicit types to avoid ambiguity and comply with static analysis recommendations.

Consider defining explicit types or interfaces for RequestParams and RequestHeaders:

- export type RequestParams = {};
- export type RequestHeaders = {};
+ export interface RequestParams {
+   // Define specific parameters here if any, otherwise use 'Record<string, never>' for empty objects
+ }
+ export interface RequestHeaders {
+   // Define specific headers here if any, otherwise use 'Record<string, never>' for empty objects
+ }
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 Extract StoragePrice JSON filters from freetext.
* @tags AI
* @name AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet
* @summary Assist Storage Price Filters
* @request GET:/ai/assist_storage_price_filters
*/
export namespace AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet {
export type RequestParams = {};
export type RequestQuery = {
/** Text */
text: string;
};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData;
}
/**
* @description Extract StoragePrice JSON filters from freetext.
* @tags AI
* @name AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet
* @summary Assist Storage Price Filters
* @request GET:/ai/assist_storage_price_filters
*/
export namespace AssistStoragePriceFiltersAiAssistStoragePriceFiltersGet {
export interface RequestParams {
// Define specific parameters here if any, otherwise use 'Record<string, never>' for empty objects
}
export type RequestQuery = {
/** Text */
text: string;
};
export type RequestBody = never;
export interface RequestHeaders {
// Define specific headers here if any, otherwise use 'Record<string, never>' for empty objects
}
export type ResponseBody = AssistStoragePriceFiltersAiAssistStoragePriceFiltersGetData;
}
Tools
Biome

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

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

(lint/complexity/noBannedTypes)


[error] 69-69: 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/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 updated timestamp.
* @description Quickly return package and database version information.
*
* @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 updated timestamp.
* @description Quickly return package and database version information.
* @tags Administrative endpoints
* @name HealthcheckHealthcheckGet
* @summary Healthcheck
Expand Down
2 changes: 1 addition & 1 deletion sdk/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Server<SecurityDataType = unknown> {
params: RequestParams = {},
) =>
this.http.request<GetSimilarServersServerVendorServerSimilarServersByNGetData, HTTPValidationError>({
path: `/server/${vendor}/${server}/similar_servers/${by}/${n}`,
path: `/server/${vendor}/${server}/similar_servers/${by}/{n}`,
method: "GET",
query: query,
format: "json",
Expand Down
16 changes: 10 additions & 6 deletions sdk/StoragePrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import {
HTTPValidationError,
TableStoragePricesStoragePricesGetData,
TableStoragePricesStoragePricesGetParams,
SearchStoragePricesStoragePricesGetData,
SearchStoragePricesStoragePricesGetParams,
} from "./data-contracts";
import { HttpClient, RequestParams } from "./http-client";

Expand All @@ -26,12 +26,16 @@ export class StoragePrices<SecurityDataType = unknown> {
/**
* No description
*
* @name TableStoragePricesStoragePricesGet
* @summary Table Storage Prices
* @tags Query Resources
* @name SearchStoragePricesStoragePricesGet
* @summary Search Storage Prices
* @request GET:/storage_prices
*/
tableStoragePricesStoragePricesGet = (query: TableStoragePricesStoragePricesGetParams, params: RequestParams = {}) =>
this.http.request<TableStoragePricesStoragePricesGetData, HTTPValidationError>({
searchStoragePricesStoragePricesGet = (
query: SearchStoragePricesStoragePricesGetParams,
params: RequestParams = {},
) =>
this.http.request<SearchStoragePricesStoragePricesGetData, HTTPValidationError>({
path: `/storage_prices`,
method: "GET",
query: query,
Expand Down
238 changes: 229 additions & 9 deletions sdk/StoragePricesRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,251 @@
* ---------------------------------------------------------------
*/

import { TableStoragePricesStoragePricesGetData } from "./data-contracts";
import { OrderDir, SearchStoragePricesStoragePricesGetData } from "./data-contracts";

export namespace StoragePrices {
/**
* No description
* @name TableStoragePricesStoragePricesGet
* @summary Table Storage Prices
* @tags Query Resources
* @name SearchStoragePricesStoragePricesGet
* @summary Search Storage Prices
* @request GET:/storage_prices
*/
export namespace TableStoragePricesStoragePricesGet {
export namespace SearchStoragePricesStoragePricesGet {
export type RequestParams = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Define the object shape explicitly for RequestParams.

The static analysis tool suggests avoiding the usage of {} as a type since it means "any non-nullable value". Instead, explicitly define the object shape for better type safety and code clarity.

If RequestParams is intended to be an empty object, consider defining it as follows:

export type RequestParams = Record<string, never>;

Alternatively, if there are no request parameters, you can remove the RequestParams type altogether.

Tools
Biome

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

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

(lint/complexity/noBannedTypes)

export type RequestQuery = {
/**
* Vendor id
* Identifier of the cloud provider vendor.
*/
vendor: "aws" | "gcp" | "hcloud";
vendor?: "aws" | "azure" | "gcp" | "hcloud";
/**
* Storage id
* Identifier of the storage type.
* Green energy
* Filter for regions with kow CO2 emission only.
*/
storage_type: "30001" | "30002" | "30007" | "block" | "gp2" | "gp3" | "sc1" | "st1" | "standard";
green_energy?: boolean | null;
/**
* Storage Size
* Minimum amount of storage (GBs).
*/
storage_min?: number | null;
/**
* Storage Type
* Type of the storage attached to the server.
*/
storage_type?: "hdd" | "ssd" | "nvme ssd" | "network";
/**
* Compliance Framework id
* Compliance framework implemented at the vendor.
*/
compliance_framework?: "hipaa" | "iso27001" | "soc2t2";
/**
* Region id
* Identifier of the region.
*/
regions?:
| "1000"
| "1100"
| "1210"
| "1220"
| "1230"
| "1250"
| "1260"
| "1270"
| "1280"
| "1290"
| "1300"
| "1310"
| "1320"
| "1330"
| "1340"
| "1350"
| "1360"
| "1370"
| "1380"
| "1390"
| "1410"
| "1420"
| "1430"
| "1440"
| "1450"
| "1460"
| "1470"
| "1480"
| "1490"
| "1510"
| "1520"
| "1530"
| "1540"
| "1550"
| "1560"
| "1570"
| "1580"
| "1590"
| "1600"
| "1610"
| "2"
| "3"
| "4"
| "5"
| "6"
| "7"
| "af-south-1"
| "ap-east-1"
| "ap-northeast-1"
| "ap-northeast-2"
| "ap-northeast-3"
| "ap-south-1"
| "ap-south-2"
| "ap-southeast-1"
| "ap-southeast-2"
| "ap-southeast-3"
| "ap-southeast-4"
| "australiacentral"
| "australiacentral2"
| "australiaeast"
| "australiasoutheast"
| "brazilsouth"
| "brazilsoutheast"
| "brazilus"
| "ca-central-1"
| "canadacentral"
| "canadaeast"
| "ca-west-1"
| "centralindia"
| "centralus"
| "centraluseuap"
| "cn-north-1"
| "cn-northwest-1"
| "eastasia"
| "eastus"
| "eastus2"
| "eastus2euap"
| "eastusstg"
| "eu-central-1"
| "eu-central-2"
| "eu-north-1"
| "eu-south-1"
| "eu-south-2"
| "eu-west-1"
| "eu-west-2"
| "eu-west-3"
| "francecentral"
| "francesouth"
| "germanynorth"
| "germanywestcentral"
| "il-central-1"
| "israelcentral"
| "italynorth"
| "japaneast"
| "japanwest"
| "jioindiacentral"
| "jioindiawest"
| "koreacentral"
| "koreasouth"
| "me-central-1"
| "me-south-1"
| "mexicocentral"
| "northcentralus"
| "northeurope"
| "norwayeast"
| "norwaywest"
| "polandcentral"
| "qatarcentral"
| "sa-east-1"
| "southafricanorth"
| "southafricawest"
| "southcentralus"
| "southcentralusstg"
| "southeastasia"
| "southindia"
| "spaincentral"
| "swedencentral"
| "switzerlandnorth"
| "switzerlandwest"
| "uaecentral"
| "uaenorth"
| "uksouth"
| "ukwest"
| "us-east-1"
| "us-east-2"
| "us-west-1"
| "us-west-2"
| "westcentralus"
| "westeurope"
| "westindia"
| "westus"
| "westus2"
| "westus3";
/**
* Countries
* Filter for regions in the provided list of countries.
*/
countries?:
| "AE"
| "AU"
| "BE"
| "BH"
| "BR"
| "CA"
| "CH"
| "CL"
| "CN"
| "DE"
| "ES"
| "FI"
| "FR"
| "GB"
| "HK"
| "ID"
| "IE"
| "IL"
| "IN"
| "IT"
| "JP"
| "KR"
| "NL"
| "NO"
| "PL"
| "QA"
| "SA"
| "SE"
| "SG"
| "TW"
| "US"
| "ZA";
/**
* Limit
* Maximum number of results. Set to -1 for unlimited.
* @default 50
*/
limit?: number;
/**
* Page
* Page number.
*/
page?: number | null;
/**
* Order By
* Order by column.
* @default "price"
*/
order_by?: string;
/**
* Order Dir
* Order direction.
* @default "asc"
*/
order_dir?: OrderDir;
/**
* Currency
* Currency used for prices.
* @default "USD"
*/
currency?: string | null;
};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = TableStoragePricesStoragePricesGetData;
export type ResponseBody = SearchStoragePricesStoragePricesGetData;
}
}
Loading