From a9c09f6c1212da0d08bec53072075e9c5783a67d Mon Sep 17 00:00:00 2001 From: hanzydev <77491112+hanzydev@users.noreply.github.com> Date: Tue, 13 Oct 2026 11:46:35 +0000 Subject: [PATCH] feat(api): sync Nodesty OpenAPI schema --- openapi/openapi.json | 418 +++++++++++++++++++++++++++++++++++- src/generated/facade.gen.ts | 110 ++++++++++ src/generated/sdk.gen.ts | 228 +++++++++++++++++++- src/generated/types.gen.ts | 316 ++++++++++++++++++++++++++- 4 files changed, 1057 insertions(+), 15 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index a0214ea..75d5334 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -906,6 +906,11 @@ "example": 449455557, "type": "integer" }, + "peakPps": { + "description": "Peak packets per second, where the protection reports it", + "example": 20419, + "type": "integer" + }, "startedAt": { "description": "Timestamp when the attack started", "example": 1700000000000, @@ -982,6 +987,11 @@ "description": "Whether email notifications are enabled for attack alerts", "example": true, "type": "boolean" + }, + "inAppNotification": { + "description": "Whether attacks appear in the dashboard notification center", + "example": true, + "type": "boolean" } }, "type": "object" @@ -1040,6 +1050,11 @@ "description": "Whether email notifications are enabled", "example": true, "type": "boolean" + }, + "inAppNotification": { + "description": "Whether attacks appear in the dashboard notification center", + "example": true, + "type": "boolean" } }, "required": [], @@ -1064,6 +1079,11 @@ "description": "Whether email notifications are enabled", "example": true, "type": "boolean" + }, + "inAppNotification": { + "description": "Whether attacks appear in the dashboard notification center", + "example": true, + "type": "boolean" } }, "type": "object" @@ -1089,6 +1109,66 @@ "tags": ["Firewall"] } }, + "/api/services/{id}/firewall/{ip}/metrics": { + "get": { + "description": "Get the current allowed and blocked traffic for an IP address protected by the advanced firewall on a Virtual or Dedicated Server", + "operationId": "firewallGetLiveTraffic", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + }, + { + "description": "IP Address", + "in": "path", + "name": "ip", + "required": true, + "schema": { "example": "82.25.42.10", "type": "string" } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "dropBps": { + "description": "Blocked traffic in bits per second", + "type": "number" + }, + "dropPps": { + "description": "Blocked packets per second", + "type": "number" + }, + "passBps": { + "description": "Allowed traffic in bits per second", + "type": "number" + }, + "passPps": { + "description": "Allowed packets per second", + "type": "number" + }, + "timestamp": { "example": 1700000000000, "type": "integer" } + }, + "type": "object" + } + } + }, + "description": "Current traffic counters" + }, + "404": { + "description": "Service or IP not found, or the IP is not on the advanced firewall" + } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Get Live Traffic", + "tags": ["Firewall"] + }, + "parameters": [] + }, "/api/services/{id}/firewall/{ip}/rdns": { "delete": { "description": "Reset reverse DNS (rDNS) for a specific IP address on a Virtual or Dedicated Server", @@ -1372,7 +1452,7 @@ }, "/api/services/{id}/firewall/{ip}/stats": { "get": { - "description": "Get nShield statistics for a specific IP address on a Virtual or Dedicated Server", + "description": "Get the firewall traffic history for a specific IP address on a Virtual or Dedicated Server", "operationId": "firewallGetStatistics", "parameters": [ { @@ -1388,6 +1468,17 @@ "name": "ip", "required": true, "schema": { "example": "77.90.14.1", "type": "string" } + }, + { + "description": "Time window, for addresses on the advanced firewall only. Other addresses always return the last 7 days", + "in": "query", + "name": "range", + "required": false, + "schema": { + "default": "7d", + "enum": ["1h", "6h", "24h", "7d"], + "type": "string" + } } ], "responses": { @@ -1404,14 +1495,14 @@ "type": "integer" }, "totalDropTraffic": { - "description": "Total traffic that was dropped by the nShield", - "example": "2048576", - "type": "string" + "description": "Traffic that was dropped by the firewall, in bytes per second. Null where no data was recorded", + "example": 2048576, + "type": ["number", "null"] }, "totalPassTraffic": { - "description": "Total traffic that passed through the nShield", - "example": "10248576", - "type": "string" + "description": "Traffic that passed through the firewall, in bytes per second. Null where no data was recorded", + "example": 10248576, + "type": ["number", "null"] } }, "type": "object" @@ -1420,7 +1511,7 @@ } } }, - "description": "nShield statistics for the specified IP address" + "description": "Traffic history for the specified IP address, oldest first" }, "404": { "content": { @@ -2080,6 +2171,11 @@ "example": 10737418240, "type": "integer" }, + "hasPendingChanges": { + "description": "Indicates if there are pending changes for the VPS. If true, the VPS may require a restart to apply changes.", + "example": false, + "type": "boolean" + }, "hostname": { "description": "Hostname of the VPS", "example": "vps.example.com", @@ -2288,6 +2384,185 @@ "tags": ["Virtual Server"] } }, + "/api/services/{id}/vps/schedules": { + "get": { + "description": "List the scheduled power actions of a Virtual Server and its last 20 runs", + "operationId": "virtualServerGetPowerSchedules", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + } + ], + "responses": { + "200": { "description": "Schedules and recent runs" }, + "404": { "description": "VPS not found" } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Get Power Schedules", + "tags": ["Virtual Server"] + }, + "parameters": [], + "post": { + "description": "Schedule a power action (START, SHUTDOWN, REBOOT or STOP) on a Virtual Server. mode WEEKLY takes days (1 = Monday) and minute after midnight, INTERVAL takes intervalHours and minute past the hour, ONCE takes runAt, CRON takes a five-field cron expression. Power actions on one server, across all its enabled schedules, must be at least 15 minutes apart.", + "operationId": "virtualServerCreatePowerSchedule", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "action": { + "enum": ["START", "SHUTDOWN", "REBOOT", "STOP"], + "type": "string" + }, + "cron": { "example": "0 4 * * 1-5", "type": "string" }, + "days": { + "items": { "maximum": 7, "minimum": 1, "type": "integer" }, + "type": "array" + }, + "enabled": { "default": true, "type": "boolean" }, + "forceAfterMinutes": { + "enum": [5, 10, 15, 30], + "type": "integer" + }, + "intervalHours": { + "enum": [1, 2, 3, 4, 6, 8, 12], + "type": "integer" + }, + "minute": { "maximum": 1439, "minimum": 0, "type": "integer" }, + "mode": { + "enum": ["WEEKLY", "INTERVAL", "ONCE", "CRON"], + "type": "string" + }, + "name": { + "description": "Optional label, up to 60 characters", + "type": "string" + }, + "runAt": { "format": "date-time", "type": "string" }, + "timezone": { "example": "Europe/Istanbul", "type": "string" } + }, + "required": ["action", "mode", "timezone"], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { "description": "The created schedule" }, + "400": { + "description": "Invalid rule, runs too close together or the limit of 10 schedules reached" + }, + "404": { "description": "VPS not found" } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Create Power Schedule", + "tags": ["Virtual Server"] + } + }, + "/api/services/{id}/vps/schedules/{scheduleId}": { + "delete": { + "description": "Delete a power schedule; its past runs stay in the history", + "operationId": "virtualServerDeletePowerSchedule", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + }, + { + "description": "Schedule ID", + "in": "path", + "name": "scheduleId", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "204": { "description": "Deleted" }, + "404": { "description": "VPS or schedule not found" } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Delete Power Schedule", + "tags": ["Virtual Server"] + }, + "parameters": [], + "patch": { + "description": "Replace a power schedule with a new rule (same body as creating one) or send only { enabled }", + "operationId": "virtualServerUpdatePowerSchedule", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + }, + { + "description": "Schedule ID", + "in": "path", + "name": "scheduleId", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { "description": "The updated schedule" }, + "400": { "description": "Invalid rule" }, + "404": { "description": "VPS or schedule not found" } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Update Power Schedule", + "tags": ["Virtual Server"] + } + }, + "/api/services/{id}/vps/schedules/{scheduleId}/run": { + "parameters": [], + "post": { + "description": "Run a power schedule once right away. Skipped when the server is already in the target state or busy. At most 3 runs per minute per service.", + "operationId": "virtualServerRunPowerScheduleNow", + "parameters": [ + { + "description": "Service ID", + "in": "path", + "name": "id", + "required": true, + "schema": { "example": "1", "type": "string" } + }, + { + "description": "Schedule ID", + "in": "path", + "name": "scheduleId", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "The run result: { status: SUCCESS | SKIPPED | FAILED, reason? }" + }, + "404": { "description": "VPS or schedule not found" }, + "429": { "description": "Too many manual runs" } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Run Power Schedule Now", + "tags": ["Virtual Server"] + } + }, "/api/services/{id}/vps/tasks": { "get": { "description": "Get VPS tasks", @@ -3001,6 +3276,133 @@ "tags": ["Billing"] } }, + "/api/users/@me/invoices/bulk/balance": { + "parameters": [], + "post": { + "description": "Pay several invoices from the account balance. expectedTotal must equal the total returned by the preview.", + "operationId": "billingBulkPayWithBalance", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "expectedTotal": { "example": 40, "type": "number" }, + "invoiceIds": { + "example": [1, 2, 3], + "items": { "type": "integer" }, + "type": "array" + } + }, + "required": ["invoiceIds", "expectedTotal"], + "type": "object" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "results": { + "items": { + "properties": { + "amount": { "example": 40, "type": "number" }, + "invoiceId": { + "example": 1, + "type": "integer" + }, + "status": { + "enum": ["paid", "failed"], + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "Result per invoice" + } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Bulk Pay With Balance", + "tags": ["Billing"] + } + }, + "/api/users/@me/invoices/bulk/preview": { + "parameters": [], + "post": { + "description": "Get what is still due on several invoices before paying them together", + "operationId": "billingPreviewBulkPayment", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "invoiceIds": { + "example": [1, 2, 3], + "items": { "type": "integer" }, + "type": "array" + } + }, + "required": ["invoiceIds"], + "type": "object" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "balance": { "example": 100, "type": "number" }, + "invoices": { + "items": { + "properties": { + "amount": { "example": 40, "type": "number" }, + "dueDate": { + "example": "2026-10-20", + "type": "string" + }, + "id": { "example": 1, "type": "integer" }, + "isAddFunds": { + "example": false, + "type": "boolean" + }, + "total": { "example": 50, "type": "number" } + }, + "type": "object" + }, + "type": "array" + }, + "total": { "example": 40, "type": "number" }, + "unavailable": { + "items": { "type": "integer" }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "Payable invoices with the amount still due, invoices that cannot be paid, and the balance" + } + }, + "security": [{ "personalAccessToken": [] }], + "summary": "Preview Bulk Payment", + "tags": ["Billing"] + } + }, "/api/users/@me/referral": { "get": { "description": "Get the current user referral code", diff --git a/src/generated/facade.gen.ts b/src/generated/facade.gen.ts index 1a1615a..7d5aec0 100644 --- a/src/generated/facade.gen.ts +++ b/src/generated/facade.gen.ts @@ -16,6 +16,7 @@ import { firewallGetAttackLogs, firewallGetAttackNotificationSettings, firewallUpdateAttackNotificationSettings, + firewallGetLiveTraffic, firewallResetReverseDns, firewallGetReverseDns, firewallUpsertReverseDns, @@ -33,6 +34,11 @@ import { virtualServerGetInformation, virtualServerGetOsTemplates, virtualServerReinstall, + virtualServerGetPowerSchedules, + virtualServerCreatePowerSchedule, + virtualServerDeletePowerSchedule, + virtualServerUpdatePowerSchedule, + virtualServerRunPowerScheduleNow, virtualServerGetTasks, billingGetProductsByGroupId, billingAddOrder, @@ -41,6 +47,8 @@ import { userGetInvoices, userGetInvoice, billingMakePayment, + billingBulkPayWithBalance, + billingPreviewBulkPayment, userGetReferralCode, userGetSessions, billingGetPaymentMethods, @@ -59,6 +67,7 @@ import type { FirewallGetAttackLogsData, FirewallGetAttackNotificationSettingsData, FirewallUpdateAttackNotificationSettingsData, + FirewallGetLiveTrafficData, FirewallResetReverseDnsData, FirewallGetReverseDnsData, FirewallUpsertReverseDnsData, @@ -76,6 +85,11 @@ import type { VirtualServerGetInformationData, VirtualServerGetOsTemplatesData, VirtualServerReinstallData, + VirtualServerGetPowerSchedulesData, + VirtualServerCreatePowerScheduleData, + VirtualServerDeletePowerScheduleData, + VirtualServerUpdatePowerScheduleData, + VirtualServerRunPowerScheduleNowData, VirtualServerGetTasksData, BillingGetProductsByGroupIdData, BillingAddOrderData, @@ -84,6 +98,8 @@ import type { UserGetInvoicesData, UserGetInvoiceData, BillingMakePaymentData, + BillingBulkPayWithBalanceData, + BillingPreviewBulkPaymentData, UserGetReferralCodeData, UserGetSessionsData, BillingGetPaymentMethodsData, @@ -301,6 +317,18 @@ export class FirewallClient { }); } + public getLiveTraffic( + id: FirewallGetLiveTrafficData['path']['id'], + ip: FirewallGetLiveTrafficData['path']['ip'], + options?: FacadeOptions, + ): ReturnType> { + return firewallGetLiveTraffic({ + ...options, + client: this.client, + path: { id, ip }, + }); + } + public resetReverseDns( id: FirewallResetReverseDnsData['path']['id'], ip: FirewallResetReverseDnsData['path']['ip'], @@ -514,6 +542,66 @@ export class VirtualServerClient { }); } + public getPowerSchedules( + id: VirtualServerGetPowerSchedulesData['path']['id'], + options?: FacadeOptions, + ): ReturnType> { + return virtualServerGetPowerSchedules({ + ...options, + client: this.client, + path: { id }, + }); + } + + public createPowerSchedule( + id: VirtualServerCreatePowerScheduleData['path']['id'], + data: NonNullable, + options?: FacadeOptions, + ): ReturnType> { + return virtualServerCreatePowerSchedule({ + ...options, + client: this.client, + path: { id }, + body: data, + }); + } + + public deletePowerSchedule( + id: VirtualServerDeletePowerScheduleData['path']['id'], + scheduleId: VirtualServerDeletePowerScheduleData['path']['scheduleId'], + options?: FacadeOptions, + ): ReturnType> { + return virtualServerDeletePowerSchedule({ + ...options, + client: this.client, + path: { id, scheduleId }, + }); + } + + public updatePowerSchedule( + id: VirtualServerUpdatePowerScheduleData['path']['id'], + scheduleId: VirtualServerUpdatePowerScheduleData['path']['scheduleId'], + options?: FacadeOptions, + ): ReturnType> { + return virtualServerUpdatePowerSchedule({ + ...options, + client: this.client, + path: { id, scheduleId }, + }); + } + + public runPowerScheduleNow( + id: VirtualServerRunPowerScheduleNowData['path']['id'], + scheduleId: VirtualServerRunPowerScheduleNowData['path']['scheduleId'], + options?: FacadeOptions, + ): ReturnType> { + return virtualServerRunPowerScheduleNow({ + ...options, + client: this.client, + path: { id, scheduleId }, + }); + } + public getTasks( id: VirtualServerGetTasksData['path']['id'], options?: FacadeOptions, @@ -576,6 +664,28 @@ export class BillingClient { }); } + public bulkPayWithBalance( + data?: NonNullable, + options?: FacadeOptions, + ): ReturnType> { + return billingBulkPayWithBalance({ + ...options, + client: this.client, + body: data, + }); + } + + public previewBulkPayment( + data?: NonNullable, + options?: FacadeOptions, + ): ReturnType> { + return billingPreviewBulkPayment({ + ...options, + client: this.client, + body: data, + }); + } + public getPaymentMethods( options?: FacadeOptions, ): ReturnType> { diff --git a/src/generated/sdk.gen.ts b/src/generated/sdk.gen.ts index 26a4a35..79fab46 100644 --- a/src/generated/sdk.gen.ts +++ b/src/generated/sdk.gen.ts @@ -38,6 +38,9 @@ import type { FirewallUpdateAttackNotificationSettingsData, FirewallUpdateAttackNotificationSettingsResponses, FirewallUpdateAttackNotificationSettingsErrors, + FirewallGetLiveTrafficData, + FirewallGetLiveTrafficResponses, + FirewallGetLiveTrafficErrors, FirewallResetReverseDnsData, FirewallResetReverseDnsResponses, FirewallResetReverseDnsErrors, @@ -89,6 +92,21 @@ import type { VirtualServerReinstallData, VirtualServerReinstallResponses, VirtualServerReinstallErrors, + VirtualServerGetPowerSchedulesData, + VirtualServerGetPowerSchedulesResponses, + VirtualServerGetPowerSchedulesErrors, + VirtualServerCreatePowerScheduleData, + VirtualServerCreatePowerScheduleResponses, + VirtualServerCreatePowerScheduleErrors, + VirtualServerDeletePowerScheduleData, + VirtualServerDeletePowerScheduleResponses, + VirtualServerDeletePowerScheduleErrors, + VirtualServerUpdatePowerScheduleData, + VirtualServerUpdatePowerScheduleResponses, + VirtualServerUpdatePowerScheduleErrors, + VirtualServerRunPowerScheduleNowData, + VirtualServerRunPowerScheduleNowResponses, + VirtualServerRunPowerScheduleNowErrors, VirtualServerGetTasksData, VirtualServerGetTasksResponses, VirtualServerGetTasksErrors, @@ -107,6 +125,10 @@ import type { BillingMakePaymentData, BillingMakePaymentResponses, BillingMakePaymentErrors, + BillingBulkPayWithBalanceData, + BillingBulkPayWithBalanceResponses, + BillingPreviewBulkPaymentData, + BillingPreviewBulkPaymentResponses, UserGetReferralCodeData, UserGetReferralCodeResponses, UserGetSessionsData, @@ -453,6 +475,30 @@ export const firewallUpdateAttackNotificationSettings = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + FirewallGetLiveTrafficResponses, + FirewallGetLiveTrafficErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/firewall/{ip}/metrics', + ...options, + responseStyle: 'fields', + }); +}; + /** * Reset Reverse DNS * Reset reverse DNS (rDNS) for a specific IP address on a Virtual or Dedicated Server @@ -579,7 +625,7 @@ export const firewallDeleteRule = ( /** * Get Statistics - * Get nShield statistics for a specific IP address on a Virtual or Dedicated Server + * Get the firewall traffic history for a specific IP address on a Virtual or Dedicated Server */ export const firewallGetStatistics = ( options: Options, @@ -881,6 +927,130 @@ export const virtualServerReinstall = ( }); }; +/** + * Get Power Schedules + * List the scheduled power actions of a Virtual Server and its last 20 runs + */ +export const virtualServerGetPowerSchedules = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + VirtualServerGetPowerSchedulesResponses, + VirtualServerGetPowerSchedulesErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/vps/schedules', + ...options, + responseStyle: 'fields', + }); +}; + +/** + * Create Power Schedule + * Schedule a power action (START, SHUTDOWN, REBOOT or STOP) on a Virtual Server. mode WEEKLY takes days (1 = Monday) and minute after midnight, INTERVAL takes intervalHours and minute past the hour, ONCE takes runAt, CRON takes a five-field cron expression. Power actions on one server, across all its enabled schedules, must be at least 15 minutes apart. + */ +export const virtualServerCreatePowerSchedule = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).post< + VirtualServerCreatePowerScheduleResponses, + VirtualServerCreatePowerScheduleErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/vps/schedules', + ...options, + responseStyle: 'fields', + headers: { + 'Content-Type': 'application/json', + ...options.headers, + }, + }); +}; + +/** + * Delete Power Schedule + * Delete a power schedule; its past runs stay in the history + */ +export const virtualServerDeletePowerSchedule = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).delete< + VirtualServerDeletePowerScheduleResponses, + VirtualServerDeletePowerScheduleErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/vps/schedules/{scheduleId}', + ...options, + responseStyle: 'fields', + }); +}; + +/** + * Update Power Schedule + * Replace a power schedule with a new rule (same body as creating one) or send only { enabled } + */ +export const virtualServerUpdatePowerSchedule = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).patch< + VirtualServerUpdatePowerScheduleResponses, + VirtualServerUpdatePowerScheduleErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/vps/schedules/{scheduleId}', + ...options, + responseStyle: 'fields', + }); +}; + +/** + * Run Power Schedule Now + * Run a power schedule once right away. Skipped when the server is already in the target state or busy. At most 3 runs per minute per service. + */ +export const virtualServerRunPowerScheduleNow = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).post< + VirtualServerRunPowerScheduleNowResponses, + VirtualServerRunPowerScheduleNowErrors, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/services/{id}/vps/schedules/{scheduleId}/run', + ...options, + responseStyle: 'fields', + }); +}; + /** * Get Tasks * Get VPS tasks @@ -1063,6 +1233,62 @@ export const billingMakePayment = ( }); }; +/** + * Bulk Pay With Balance + * Pay several invoices from the account balance. expectedTotal must equal the total returned by the preview. + */ +export const billingBulkPayWithBalance = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + BillingBulkPayWithBalanceResponses, + unknown, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/users/@me/invoices/bulk/balance', + ...options, + responseStyle: 'fields', + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + }, + }); +}; + +/** + * Preview Bulk Payment + * Get what is still due on several invoices before paying them together + */ +export const billingPreviewBulkPayment = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + BillingPreviewBulkPaymentResponses, + unknown, + ThrowOnError + >({ + security: [ + { + name: 'Authorization', + type: 'apiKey', + }, + ], + url: '/api/users/@me/invoices/bulk/preview', + ...options, + responseStyle: 'fields', + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + }, + }); +}; + /** * Get Referral Code * Get the current user referral code diff --git a/src/generated/types.gen.ts b/src/generated/types.gen.ts index 76061b0..62a7219 100644 --- a/src/generated/types.gen.ts +++ b/src/generated/types.gen.ts @@ -677,6 +677,10 @@ export type FirewallGetAttackLogsResponses = { * Peak traffic during the attack */ peak?: number; + /** + * Peak packets per second, where the protection reports it + */ + peakPps?: number; /** * Timestamp when the attack started */ @@ -732,6 +736,10 @@ export type FirewallGetAttackNotificationSettingsResponses = { * Whether email notifications are enabled for attack alerts */ emailNotification?: boolean; + /** + * Whether attacks appear in the dashboard notification center + */ + inAppNotification?: boolean; }; }; @@ -751,6 +759,10 @@ export type FirewallUpdateAttackNotificationSettingsData = { * Whether email notifications are enabled */ emailNotification?: boolean; + /** + * Whether attacks appear in the dashboard notification center + */ + inAppNotification?: boolean; }; path: { /** @@ -791,12 +803,67 @@ export type FirewallUpdateAttackNotificationSettingsResponses = { * Whether email notifications are enabled */ emailNotification?: boolean; + /** + * Whether attacks appear in the dashboard notification center + */ + inAppNotification?: boolean; }; }; export type FirewallUpdateAttackNotificationSettingsResponse = FirewallUpdateAttackNotificationSettingsResponses[keyof FirewallUpdateAttackNotificationSettingsResponses]; +export type FirewallGetLiveTrafficData = { + body?: never; + path: { + /** + * Service ID + */ + id: string; + /** + * IP Address + */ + ip: string; + }; + query?: never; + url: '/api/services/{id}/firewall/{ip}/metrics'; +}; + +export type FirewallGetLiveTrafficErrors = { + /** + * Service or IP not found, or the IP is not on the advanced firewall + */ + 404: unknown; +}; + +export type FirewallGetLiveTrafficResponses = { + /** + * Current traffic counters + */ + 200: { + /** + * Blocked traffic in bits per second + */ + dropBps?: number; + /** + * Blocked packets per second + */ + dropPps?: number; + /** + * Allowed traffic in bits per second + */ + passBps?: number; + /** + * Allowed packets per second + */ + passPps?: number; + timestamp?: number; + }; +}; + +export type FirewallGetLiveTrafficResponse = + FirewallGetLiveTrafficResponses[keyof FirewallGetLiveTrafficResponses]; + export type FirewallResetReverseDnsData = { body?: never; path: { @@ -1036,7 +1103,12 @@ export type FirewallGetStatisticsData = { */ ip: string; }; - query?: never; + query?: { + /** + * Time window, for addresses on the advanced firewall only. Other addresses always return the last 7 days + */ + range?: '1h' | '6h' | '24h' | '7d'; + }; url: '/api/services/{id}/firewall/{ip}/stats'; }; @@ -1054,7 +1126,7 @@ export type FirewallGetStatisticsError = export type FirewallGetStatisticsResponses = { /** - * nShield statistics for the specified IP address + * Traffic history for the specified IP address, oldest first */ 200: Array<{ /** @@ -1062,13 +1134,13 @@ export type FirewallGetStatisticsResponses = { */ timestamp?: number; /** - * Total traffic that was dropped by the nShield + * Traffic that was dropped by the firewall, in bytes per second. Null where no data was recorded */ - totalDropTraffic?: string; + totalDropTraffic?: number | null; /** - * Total traffic that passed through the nShield + * Traffic that passed through the firewall, in bytes per second. Null where no data was recorded */ - totalPassTraffic?: string; + totalPassTraffic?: number | null; }>; }; @@ -1583,6 +1655,10 @@ export type VirtualServerGetInformationResponses = { * Total disk space in bytes */ disk?: number; + /** + * Indicates if there are pending changes for the VPS. If true, the VPS may require a restart to apply changes. + */ + hasPendingChanges?: boolean; /** * Hostname of the VPS */ @@ -1723,6 +1799,178 @@ export type VirtualServerReinstallResponses = { export type VirtualServerReinstallResponse = VirtualServerReinstallResponses[keyof VirtualServerReinstallResponses]; +export type VirtualServerGetPowerSchedulesData = { + body?: never; + path: { + /** + * Service ID + */ + id: string; + }; + query?: never; + url: '/api/services/{id}/vps/schedules'; +}; + +export type VirtualServerGetPowerSchedulesErrors = { + /** + * VPS not found + */ + 404: unknown; +}; + +export type VirtualServerGetPowerSchedulesResponses = { + /** + * Schedules and recent runs + */ + 200: unknown; +}; + +export type VirtualServerCreatePowerScheduleData = { + body: { + action: 'START' | 'SHUTDOWN' | 'REBOOT' | 'STOP'; + cron?: string; + days?: Array; + enabled?: boolean; + forceAfterMinutes?: 5 | 10 | 15 | 30; + intervalHours?: 1 | 2 | 3 | 4 | 6 | 8 | 12; + minute?: number; + mode: 'WEEKLY' | 'INTERVAL' | 'ONCE' | 'CRON'; + /** + * Optional label, up to 60 characters + */ + name?: string; + runAt?: string; + timezone: string; + }; + path: { + /** + * Service ID + */ + id: string; + }; + query?: never; + url: '/api/services/{id}/vps/schedules'; +}; + +export type VirtualServerCreatePowerScheduleErrors = { + /** + * Invalid rule, runs too close together or the limit of 10 schedules reached + */ + 400: unknown; + /** + * VPS not found + */ + 404: unknown; +}; + +export type VirtualServerCreatePowerScheduleResponses = { + /** + * The created schedule + */ + 200: unknown; +}; + +export type VirtualServerDeletePowerScheduleData = { + body?: never; + path: { + /** + * Service ID + */ + id: string; + /** + * Schedule ID + */ + scheduleId: string; + }; + query?: never; + url: '/api/services/{id}/vps/schedules/{scheduleId}'; +}; + +export type VirtualServerDeletePowerScheduleErrors = { + /** + * VPS or schedule not found + */ + 404: unknown; +}; + +export type VirtualServerDeletePowerScheduleResponses = { + /** + * Deleted + */ + 204: void; +}; + +export type VirtualServerDeletePowerScheduleResponse = + VirtualServerDeletePowerScheduleResponses[keyof VirtualServerDeletePowerScheduleResponses]; + +export type VirtualServerUpdatePowerScheduleData = { + body?: never; + path: { + /** + * Service ID + */ + id: string; + /** + * Schedule ID + */ + scheduleId: string; + }; + query?: never; + url: '/api/services/{id}/vps/schedules/{scheduleId}'; +}; + +export type VirtualServerUpdatePowerScheduleErrors = { + /** + * Invalid rule + */ + 400: unknown; + /** + * VPS or schedule not found + */ + 404: unknown; +}; + +export type VirtualServerUpdatePowerScheduleResponses = { + /** + * The updated schedule + */ + 200: unknown; +}; + +export type VirtualServerRunPowerScheduleNowData = { + body?: never; + path: { + /** + * Service ID + */ + id: string; + /** + * Schedule ID + */ + scheduleId: string; + }; + query?: never; + url: '/api/services/{id}/vps/schedules/{scheduleId}/run'; +}; + +export type VirtualServerRunPowerScheduleNowErrors = { + /** + * VPS or schedule not found + */ + 404: unknown; + /** + * Too many manual runs + */ + 429: unknown; +}; + +export type VirtualServerRunPowerScheduleNowResponses = { + /** + * The run result: { status: SUCCESS | SKIPPED | FAILED, reason? } + */ + 200: unknown; +}; + export type VirtualServerGetTasksData = { body?: never; path: { @@ -2237,6 +2485,62 @@ export type BillingMakePaymentResponses = { export type BillingMakePaymentResponse = BillingMakePaymentResponses[keyof BillingMakePaymentResponses]; +export type BillingBulkPayWithBalanceData = { + body?: { + expectedTotal: number; + invoiceIds: Array; + }; + path?: never; + query?: never; + url: '/api/users/@me/invoices/bulk/balance'; +}; + +export type BillingBulkPayWithBalanceResponses = { + /** + * Result per invoice + */ + 200: { + results?: Array<{ + amount?: number; + invoiceId?: number; + status?: 'paid' | 'failed'; + }>; + }; +}; + +export type BillingBulkPayWithBalanceResponse = + BillingBulkPayWithBalanceResponses[keyof BillingBulkPayWithBalanceResponses]; + +export type BillingPreviewBulkPaymentData = { + body?: { + invoiceIds: Array; + }; + path?: never; + query?: never; + url: '/api/users/@me/invoices/bulk/preview'; +}; + +export type BillingPreviewBulkPaymentResponses = { + /** + * Payable invoices with the amount still due, invoices that cannot be paid, and the balance + */ + 200: { + balance?: number; + invoices?: Array<{ + amount?: number; + dueDate?: string; + id?: number; + isAddFunds?: boolean; + total?: number; + }>; + total?: number; + unavailable?: Array; + }; +}; + +export type BillingPreviewBulkPaymentResponse = + BillingPreviewBulkPaymentResponses[keyof BillingPreviewBulkPaymentResponses]; + export type UserGetReferralCodeData = { body?: never; path?: never;