import { APIPayloadStatusOnly, WorkspaceId, ApplicationId, APIPayload } from '../../common/v2.js'; import { ApplicationLanguage } from '../../payloads/v2/application.js'; import '../../utils.js'; /** * Query for `GET /v2/apps/status` — optionally limit the listing to * applications shared in a workspace. * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/status-all */ interface RESTGetAPIApplicationStatusAllQuery { workspaceId?: WorkspaceId; } /** * Query for `GET /v2/apps/{appId}/status` (and the database equivalent) — * pass `rawData=true` to receive raw numbers instead of formatted strings * (type the response with `APIApplicationStatus`). * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/status */ interface RESTGetAPIApplicationStatusQuery { rawData?: "true" | "false"; } /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/start */ type RESTPostAPIApplicationStartResultPayload = APIPayloadStatusOnly; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/restart */ type RESTPostAPIApplicationRestartResultPayload = APIPayloadStatusOnly; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/stop */ type RESTPostAPIApplicationStopResultPayload = APIPayloadStatusOnly; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/commit */ interface RESTPostAPIApplicationCommitFormDataBody { file: unknown; } /** * Query for `POST /v2/apps/{appId}/commit` — optional destination directory * inside the application (no traversal, no shell metacharacters). * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/commit */ interface RESTPostAPIApplicationCommitQuery { path?: string; } type RESTPostAPIApplicationCommitResultPayload = APIPayloadStatusOnly; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/delete */ type RESTDeleteAPIApplicationDeleteResultPayload = APIPayloadStatusOnly; /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/upload */ interface RESTPostAPIApplicationUploadFormDataBody { file: unknown; } /** * Runtime detected for an uploaded application. * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/upload */ interface RESTPostAPIApplicationUploadLanguage { name: ApplicationLanguage; /** Detected runtime version (e.g. `22`, `3.12`). */ version: string; } /** * Response of `POST /v2/apps`. `description` and `subdomain` are present only * when set in `squarecloud.config`. Client-side upload aborts surface as the * `UPLOAD_ABORTED` error code. * @see https://docs.squarecloud.app/en/api-reference/endpoint/apps/upload */ interface RESTPostAPIApplicationUploadResult { id: ApplicationId; name: string; /** Optional description (from `DESCRIPTION` in `squarecloud.config`). Omitted when unset. */ description?: string; /** Optional `.squareweb.app` host (from `SUBDOMAIN` in `squarecloud.config`). Omitted for non-web apps. */ subdomain?: string; /** Allocated memory in MB. */ ram: number; /** Allocated CPU shares. */ cpu: number; /** Detected runtime. */ language: RESTPostAPIApplicationUploadLanguage; } type RESTPostAPIApplicationUploadResultPayload = APIPayload; export type { RESTDeleteAPIApplicationDeleteResultPayload, RESTGetAPIApplicationStatusAllQuery, RESTGetAPIApplicationStatusQuery, RESTPostAPIApplicationCommitFormDataBody, RESTPostAPIApplicationCommitQuery, RESTPostAPIApplicationCommitResultPayload, RESTPostAPIApplicationRestartResultPayload, RESTPostAPIApplicationStartResultPayload, RESTPostAPIApplicationStopResultPayload, RESTPostAPIApplicationUploadFormDataBody, RESTPostAPIApplicationUploadLanguage, RESTPostAPIApplicationUploadResult, RESTPostAPIApplicationUploadResultPayload };