import { UserId, ISODateString, ApplicationId, APIPayload } from '../../common/v2.js'; import { ApplicationLanguage } from './application.js'; import { APIDatabaseSummary } from './database.js'; import '../../utils.js'; import './status.js'; /** * Available RAM sizes (GB) for the `hobby` tier. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ type HobbyPlanSizes = 1 | 2; /** * Available RAM sizes (GB) for the `standard` tier. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ type StandardPlanSizes = 4 | 6 | 8; /** * Available RAM sizes (GB) for the `pro` tier. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ type ProPlanSizes = 12 | 16 | 24; /** * Available RAM sizes (GB) for the `enterprise` tier. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ type EnterprisePlanSizes = 24 | 32 | 48 | 64 | 96 | 128 | 160 | 192 | 224 | 256 | 288 | 320 | 384 | 448 | 512 | 640 | 768 | 1024; /** * Plan slug returned by `/v2/users/me`. Paid tiers are always suffixed with * their RAM size (GB); only `free` has no suffix. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ type UserPlanName = "free" | `hobby-${HobbyPlanSizes}` | `standard-${StandardPlanSizes}` | `pro-${ProPlanSizes}` | `enterprise-${EnterprisePlanSizes}`; declare const UserPlanName: { Free: string; Hobby: (size: HobbyPlanSizes) => "hobby-2" | "hobby-1"; Standard: (size: StandardPlanSizes) => "standard-4" | "standard-6" | "standard-8"; Pro: (size: ProPlanSizes) => "pro-12" | "pro-16" | "pro-24"; Enterprise: (size: EnterprisePlanSizes) => "enterprise-24" | "enterprise-32" | "enterprise-48" | "enterprise-64" | "enterprise-96" | "enterprise-128" | "enterprise-160" | "enterprise-192" | "enterprise-224" | "enterprise-256" | "enterprise-288" | "enterprise-320" | "enterprise-384" | "enterprise-448" | "enterprise-512" | "enterprise-640" | "enterprise-768" | "enterprise-1024"; }; /** * APIUserPlan#memory * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ interface APIUserPlanMemory { limit: number; available: number; used: number; } /** * APIUser#plan * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ interface APIUserPlan { name: UserPlanName; memory: APIUserPlanMemory; duration: number | null; } /** * APIUser * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ interface APIUser { id: UserId; name: string; email: string; /** * Preferred locale (e.g. `pt-BR`, `en-US`, `es-ES`, `zh-CN`, `ja-JP`, * `fr-FR`, `de-DE`, `it-IT`). */ locale: string; plan: APIUserPlan; created_at: ISODateString; } /** * APIUserApplication — compact application descriptor returned under * `response.applications` of `/v2/users/me`. * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ interface APIUserApplication { id: ApplicationId; name: string; desc?: string; ram: number; lang: ApplicationLanguage; cluster: string; domain: string | null; custom: string | null; created_at: ISODateString; } /** * @see https://docs.squarecloud.app/en/api-reference/endpoint/users/me */ interface APIUserInfo { user: APIUser; applications: APIUserApplication[]; databases: APIDatabaseSummary[]; } type APIUserInfoPayload = APIPayload; export { type APIUser, type APIUserApplication, type APIUserInfo, type APIUserInfoPayload, type APIUserPlan, type APIUserPlanMemory, type EnterprisePlanSizes, type HobbyPlanSizes, type ProPlanSizes, type StandardPlanSizes, UserPlanName };