Skip to main content
Application is a small helper that binds an application to the client, so you do not have to repeat its ID. You get one from getApplication or createApplication.
The class is also exported by the package (import { Application } from "@camposcloud/sdk" in TypeScript), mainly to be used as a type.

data

The application exactly as the API returned it when the instance was created. See ApplicationResponseData.
data is a snapshot. It is not refreshed by start(), stop(), restart() or update(). Use the value returned by those methods, or call getApplication again, to read the current state.

Methods

Every method calls the matching method of the client with appId set to data._id, so the same behaviour, errors and limits apply.

start

Throws when the application is already running (the API answers with 500).

stop

Throws when the application is already stopped (the API answers with 500).

restart

Throws when the application is not running and has no pending settings (the API answers with 500).

delete

Deletes the application. This cannot be undone, and the instance must not be used afterwards.

update

Takes the same fields as updateApplication, without appId. appName, memoryMB and runtimeEnvironment are always required.

uploadFile

The method takes one object, not two positional arguments: app.uploadFile(zip, "/") does not work. file must be a zip, and path must always be passed, otherwise the zip is extracted into a folder called undefined. See uploadFile.

downloadFile

The argument is optional. The result is always a zip archive.