/** * Platform API Services * * Typed API methods for interacting with platform resources. * * These call the BFF (the app's /api/* routes on app.apso.cloud), which wraps * the internal backend and enforces auth + workspace scoping. Workspace-scoped * routes read the active workspace from the X-Workspace-Id header that the API * client injects from the linked project (see client.ts). Responses are the * backend's snake_case / nestjsx-crud shapes and are adapted to the CLI types * below. */ import { UserProfile, Workspace, Service, ServiceSchema, GitHubRepo, GitHubConnection, BuildStatus, PaginatedResponse, TokenExchangeResponse } from "./types"; type Raw = Record; /** * Authentication API */ export declare const authApi: { exchangeCode(code: string): Promise; getProfile(): Promise; /** * The BFF has no CLI logout route; logout is local (the logout command * clears stored credentials). Best-effort, never throws. */ logout(): Promise; }; /** * Workspaces API */ export declare const workspacesApi: { list(): Promise; getById(id: string): Promise; /** BFF is id-based; resolve a slug against the user's workspace list. */ get(slug: string): Promise; }; /** * Services API */ export declare const servicesApi: { list(workspaceId?: string | number, options?: { status?: string; page?: number; pageSize?: number; }): Promise>; getById(id: string): Promise; /** Resolve (workspaceId, serviceSlug) to a service via the workspace-scoped list. */ get(workspaceId: string, serviceSlug: string): Promise; create(workspaceId: string, data: { name: string; slug?: string; description?: string; githubRepo?: string; githubBranch?: string; }): Promise; update(_workspaceSlug: string, serviceSlugOrId: string, data: Partial<{ name: string; description: string; githubRepo: string; githubBranch: string; }>): Promise; delete(_workspaceSlug: string, serviceSlugOrId: string): Promise; }; /** * Schema API — the schema lives on the service as its `apsorc` field, and * versioned rows exist under /api/ServiceSchemas. */ export declare const schemaApi: { getByServiceId(serviceId: string): Promise; get(_workspaceSlug: string, serviceSlug: string): Promise; update(_workspaceSlug: string, serviceSlugOrId: string, schema: Omit): Promise; validate(_workspaceSlug?: string, _serviceSlug?: string, _schema?: unknown): Promise<{ valid: boolean; errors: string[]; }>; diff(_workspaceSlug?: string, _serviceSlug?: string, _localSchema?: unknown): Promise<{ hasChanges: boolean; added: string[]; removed: string[]; modified: string[]; }>; }; /** * Build / Deploy API */ export declare const buildApi: { /** Trigger a deploy for the linked service (POST /api/services/:id/deploy). */ trigger(_workspaceSlug: string, serviceSlugOrId: string): Promise; /** No dedicated builds resource; derive status from the service record. */ getStatus(serviceId: string): Promise; getLatest(_workspaceSlug: string, serviceSlugOrId: string): Promise; waitForCompletion(serviceId: string, options?: { maxWait?: number | undefined; pollInterval?: number | undefined; onProgress?: ((status: BuildStatus) => void) | undefined; } | undefined): Promise; }; /** * GitHub API */ export declare const githubApi: { getConnection(_workspaceSlug?: string): Promise; listRepos(_workspaceSlug: string, options?: { page?: number; pageSize?: number; search?: string; connectionId?: string; }): Promise>; getConnectUrl(_workspaceSlug: string): Promise<{ url: string; }>; /** * Create a new GitHub repo for a service via the user's connection (no local * git or gh required). autoInit=false leaves it empty so the deploy's first * push becomes the initial commit. */ createRepo(connectionId: string, serviceName: string, options?: { private?: boolean; autoInit?: boolean; }): Promise; /** Link an existing GitHub repo to a service. */ connectRepo(serviceId: string, connectionId: string, repoFullName: string): Promise; /** Push the service's saved (S3) code to its connected GitHub repo. */ push(serviceId: string, connectionId: string, options?: { branch?: string; message?: string; }): Promise; }; /** * Service code API — used for the server-side deploy (upload the project zip to * S3; the backend then pushes it to the repo, so no local git is required). */ export declare const codeApi: { /** Presigned S3 PUT URL to upload the service's code zip. */ getUploadUrl(serviceId: string): Promise<{ url: string; bucket?: string; key?: string; }>; /** * Record S3 metadata after the presigned PUT completes. Without this the * service row's s3_code_key stays null and a server-side push fails with * "No S3 code found". Mirrors the browser upload flow (upload-url -> PUT -> * finalize). */ finalize(serviceId: string): Promise<{ success: boolean; version?: string; size?: number; }>; }; export {};