Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
519 changes: 519 additions & 0 deletions MIGRATION_v1_TO_v2.md

Large diffs are not rendered by default.

117 changes: 101 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Discloud.app

## Instalation
A powerful and flexible SDK for interacting with the Discloud API. Deploy, manage, and monitor your applications hosted on Discloud with ease.

## Installation

```sh
npm i discloud.app
Expand All @@ -10,10 +12,14 @@ yarn add discloud.app
## Links

[Documentation](https://discloud.github.io/discloud.app)
[Github](https://github.com/discloud/discloud.app)
[GitHub](https://github.com/discloud/discloud.app)
[NPM](https://www.npmjs.com/package/discloud.app)
[Discloud Server](https://discord.discloudbot.com)

## Migrations

[Migration Guide - v1 to v2](./MIGRATION_v1_TO_v2.md)

## Examples usage

[Examples usage](#examples-usage)
Expand All @@ -28,6 +34,9 @@ yarn add discloud.app
[How to change the amount of RAM in the app](#how-to-change-the-amount-of-ram-in-the-app)
[How to install or uninstall APT](#how-to-install-or-uninstall-apt)
[How to fetch/add/edit/remove moderators for your application](#how-to-fetchaddeditremove-moderators-for-your-application)
[How to manage custom domains](#how-to-manage-custom-domains)
[How to manage subdomains](#how-to-manage-subdomains)
[How to manage shared/team applications](#how-to-manage-sharedteam-applications)

```js
// index.js
Expand All @@ -43,9 +52,8 @@ await discloud.login("DISCLOUD_TOKEN");
// Get instanced discloud
const { discloud } = require("discloud.app");

// ...

await discloud.apps.fetch("ID"); // Promise<App>
// Use discloud instance to manage apps
await discloud.apps.fetch("APP_ID"); // Promise<App>
```

### How to `upload`/`commit` your application
Expand Down Expand Up @@ -166,8 +174,8 @@ await discloud.apps.backup(/* "all" | undefined */); // Promise<Map<string, AppB
```js
const { discloud } = require("discloud.app");

await discloud.apps.status("APP_ID"); // Promise<AppStatus>
await discloud.apps.status(/* "all" | undefined */); // Promise<Map<string, AppStatus>>
await discloud.apps.status.fetch("APP_ID"); // Promise<AppStatus>
await discloud.apps.status.fetch("all"); // Promise<Map<string, AppStatus>>
```

### How to change your app's `name` and/or `avatar`
Expand Down Expand Up @@ -196,30 +204,32 @@ await discloud.apps.ram("APP_ID", 100 /* number greater than 100 */); // Promise
const { discloud } = require("discloud.app");

// Install APTs
await discloud.appApt.install("APP_ID", [
await discloud.apps.apts.install("APP_ID", [
"canvas",
"ffmpeg",
"java",
"libgl",
"openssl",
"puppeteer",
"tools",
]); // Promise<RESTPutApiAppAptResult>
]); // Promise<void>

// Uninstall APTs
await discloud.appApt.uninstall("APP_ID", ["canvas", "ffmpeg"]); // Promise<RESTDeleteApiAppAptResult>
await discloud.apps.apts.uninstall("APP_ID", ["canvas", "ffmpeg"]); // Promise<void>
```

> **Note:** In v1.x, use `discloud.appApt` instead of `discloud.apps.apts`. See the [Migration Guide](./MIGRATION.md) for more details.

### How to `fetch`/`add`/`edit`/`remove` moderators for your application

```js
const { discloud, ModPermissions } = require("discloud.app");

// Fetch mods and permissions
await discloud.appTeam.fetch("APP_ID"); // Promise<ApiAppTeam[]>
await discloud.apps.moderators.fetch("APP_ID"); // Promise<Map<string, AppModerator>>

// Add a mod
await discloud.appTeam.create("APP_ID", "MOD_ID", [
await discloud.apps.moderators.create("APP_ID", "MOD_ID", [
"backup_app",
"commit_app",
"edit_ram",
Expand All @@ -228,10 +238,10 @@ await discloud.appTeam.create("APP_ID", "MOD_ID", [
"start_app",
"status_app",
"stop_app",
]); // Promise<ApiAppTeamManager>
]); // Promise<AppModerator>

// Edit mod permissions
await discloud.appTeam.edit("APP_ID", "MOD_ID", [
await discloud.apps.moderators.edit("APP_ID", "MOD_ID", [
ModPermissions.backup_app,
ModPermissions.commit_app,
ModPermissions.edit_ram,
Expand All @@ -240,8 +250,83 @@ await discloud.appTeam.edit("APP_ID", "MOD_ID", [
ModPermissions.start_app,
ModPermissions.status_app,
ModPermissions.stop_app,
]); // Promise<ApiAppTeamManager>
]); // Promise<AppModerator>

// Remove a mod
await discloud.appTeam.delete("APP_ID", "MOD_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.moderators.delete("APP_ID", "MOD_ID"); // Promise<void>
```

> **Note:** In v1.x, use `discloud.appTeam` instead of `discloud.apps.moderators`. See the [Migration Guide](./MIGRATION.md) for more details.

### How to manage `custom domains`

```js
const { discloud } = require("discloud.app");

// Create a custom domain
await discloud.customdomains.create("APP_ID", "example.com"); // Promise<Customdomain>

// Fetch all custom domains
await discloud.customdomains.fetch(); // Promise<Map<string, Customdomain>>

// Fetch a specific custom domain
await discloud.customdomains.fetch("example.com"); // Promise<Customdomain>

// Verify a custom domain (check DNS records)
await discloud.customdomains.verify("example.com"); // Promise<Customdomain>

// Edit a custom domain (change associated app)
await discloud.customdomains.edit("example.com", "NEW_APP_ID"); // Promise<void>

// Delete a custom domain
await discloud.customdomains.delete("example.com"); // Promise<void>
```

### How to manage `subdomains`

```js
const { discloud } = require("discloud.app");

// Create a subdomain
await discloud.subdomains.create("myapp"); // Promise<Subdomain>

// Fetch all subdomains
await discloud.subdomains.fetch(); // Promise<Map<string, Subdomain>>

// Fetch a specific subdomain
await discloud.subdomains.fetch("myapp"); // Promise<Subdomain>

// Delete a subdomain
await discloud.subdomains.delete("myapp"); // Promise<void>
```

### How to manage `shared`/`team` applications

Shared applications are applications that your team has access to manage.

```js
const { discloud } = require("discloud.app");

// Fetch all shared applications
await discloud.sharedApps.fetch(); // Promise<Map<string, SharedApp>>

// Get logs for a shared application
await discloud.sharedApps.terminal("APP_ID"); // Promise<ApiTerminal>

// Set RAM for a shared application
await discloud.sharedApps.ram("APP_ID", 100); // Promise<void>

// Restart a shared application
await discloud.sharedApps.restart("APP_ID"); // Promise<void>

// Start a shared application
await discloud.sharedApps.start("APP_ID"); // Promise<void>

// Stop a shared application
await discloud.sharedApps.stop("APP_ID"); // Promise<void>

// Get status of a shared application
const status = await discloud.sharedApps.status.fetch("APP_ID"); // Promise<SharedAppStatus>
```

> **Note:** In v1.x, use `discloud.teamApps` instead of `discloud.sharedApps`. See the [Migration Guide](./MIGRATION.md) for more details.
17 changes: 16 additions & 1 deletion docs/@discloudapp/api-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@
- [ApiAppTeamManager](interfaces/ApiAppTeamManager.md)
- [ApiConsoleApp](interfaces/ApiConsoleApp.md)
- [ApiConsoleAppShell](interfaces/ApiConsoleAppShell.md)
- [ApiDomain](interfaces/ApiDomain.md)
- [ApiDomainApp](interfaces/ApiDomainApp.md)
- [ApiDomainInstruction](interfaces/ApiDomainInstruction.md)
- [ApiNetIO](interfaces/ApiNetIO.md)
- [ApiStatusApp](interfaces/ApiStatusApp.md)
- [ApiSubdomain](interfaces/ApiSubdomain.md)
- [ApiTeamApp](interfaces/ApiTeamApp.md)
- [ApiTeamAppOwner](interfaces/ApiTeamAppOwner.md)
- [ApiTeamApps](interfaces/ApiTeamApps.md)
- [~~ApiTeamApps~~](interfaces/ApiTeamApps.md)
- [ApiTerminal](interfaces/ApiTerminal.md)
- [ApiUploadApp](interfaces/ApiUploadApp.md)
- [ApiUser](interfaces/ApiUser.md)
Expand All @@ -47,6 +52,10 @@
- [RESTGetApiAppResult](interfaces/RESTGetApiAppResult.md)
- [RESTGetApiAppStatusResult](interfaces/RESTGetApiAppStatusResult.md)
- [RESTGetApiAppTeamResult](interfaces/RESTGetApiAppTeamResult.md)
- [RESTGetApiCustomdomainListResult](interfaces/RESTGetApiCustomdomainListResult.md)
- [RESTGetApiCustomdomainResult](interfaces/RESTGetApiCustomdomainResult.md)
- [RESTGetApiSubdomainListResult](interfaces/RESTGetApiSubdomainListResult.md)
- [RESTGetApiSubdomainResult](interfaces/RESTGetApiSubdomainResult.md)
- [RESTGetApiTeamResult](interfaces/RESTGetApiTeamResult.md)
- [RESTGetApiUserResult](interfaces/RESTGetApiUserResult.md)
- [RESTPostApiAppTeamResult](interfaces/RESTPostApiAppTeamResult.md)
Expand All @@ -71,10 +80,16 @@
- [DiscloudConfigType](type-aliases/DiscloudConfigType.md)
- [RESTDeleteApiAppDeleteResult](type-aliases/RESTDeleteApiAppDeleteResult.md)
- [RESTDeleteApiAppTeamResult](type-aliases/RESTDeleteApiAppTeamResult.md)
- [RESTDeleteApiCustomdomainResult](type-aliases/RESTDeleteApiCustomdomainResult.md)
- [RESTDeleteApiSubdomainResult](type-aliases/RESTDeleteApiSubdomainResult.md)
- [RESTGetApiCustomdomainVerifyResult](type-aliases/RESTGetApiCustomdomainVerifyResult.md)
- [RESTPostApiCustomdomainCreateResult](type-aliases/RESTPostApiCustomdomainCreateResult.md)
- [RESTPostApiSubdomainResult](type-aliases/RESTPostApiSubdomainResult.md)
- [RESTPostApiUploadResult](type-aliases/RESTPostApiUploadResult.md)
- [RESTPutApiAppRestartResult](type-aliases/RESTPutApiAppRestartResult.md)
- [RESTPutApiAppStartResult](type-aliases/RESTPutApiAppStartResult.md)
- [RESTPutApiAppStopResult](type-aliases/RESTPutApiAppStopResult.md)
- [RESTPutApiCustomdomainEditResult](type-aliases/RESTPutApiCustomdomainEditResult.md)
- [Routes](type-aliases/Routes.md)

## Variables
Expand Down
28 changes: 14 additions & 14 deletions docs/@discloudapp/api-types/enumerations/DiscloudConfigScopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,108 +6,108 @@

# Enumeration: DiscloudConfigScopes

Defined in: [payload/v2/DiscloudConfig.ts:59](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L59)
Defined in: [payload/v2/DiscloudConfig.ts:59](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L59)

## Enumeration Members

### APT

> **APT**: `"APT"`

Defined in: [payload/v2/DiscloudConfig.ts:60](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L60)
Defined in: [payload/v2/DiscloudConfig.ts:60](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L60)

***

### AUTORESTART

> **AUTORESTART**: `"AUTORESTART"`

Defined in: [payload/v2/DiscloudConfig.ts:61](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L61)
Defined in: [payload/v2/DiscloudConfig.ts:61](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L61)

***

### AVATAR

> **AVATAR**: `"AVATAR"`

Defined in: [payload/v2/DiscloudConfig.ts:62](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L62)
Defined in: [payload/v2/DiscloudConfig.ts:62](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L62)

***

### HOSTNAME

> **HOSTNAME**: `"HOSTNAME"`

Defined in: [payload/v2/DiscloudConfig.ts:63](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L63)
Defined in: [payload/v2/DiscloudConfig.ts:63](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L63)

***

### ID

> **ID**: `"ID"`

Defined in: [payload/v2/DiscloudConfig.ts:64](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L64)
Defined in: [payload/v2/DiscloudConfig.ts:64](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L64)

***

### MAIN

> **MAIN**: `"MAIN"`

Defined in: [payload/v2/DiscloudConfig.ts:65](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L65)
Defined in: [payload/v2/DiscloudConfig.ts:65](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L65)

***

### NAME

> **NAME**: `"NAME"`

Defined in: [payload/v2/DiscloudConfig.ts:66](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L66)
Defined in: [payload/v2/DiscloudConfig.ts:66](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L66)

***

### RAM

> **RAM**: `"RAM"`

Defined in: [payload/v2/DiscloudConfig.ts:67](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L67)
Defined in: [payload/v2/DiscloudConfig.ts:67](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L67)

***

### START

> **START**: `"START"`

Defined in: [payload/v2/DiscloudConfig.ts:68](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L68)
Defined in: [payload/v2/DiscloudConfig.ts:68](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L68)

***

### STORAGE

> **STORAGE**: `"STORAGE"`

Defined in: [payload/v2/DiscloudConfig.ts:69](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L69)
Defined in: [payload/v2/DiscloudConfig.ts:69](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L69)

***

### TYPE

> **TYPE**: `"TYPE"`

Defined in: [payload/v2/DiscloudConfig.ts:70](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L70)
Defined in: [payload/v2/DiscloudConfig.ts:70](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L70)

***

### VERSION

> **VERSION**: `"VERSION"`

Defined in: [payload/v2/DiscloudConfig.ts:71](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L71)
Defined in: [payload/v2/DiscloudConfig.ts:71](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L71)

***

### VLAN

> **VLAN**: `"VLAN"`

Defined in: [payload/v2/DiscloudConfig.ts:72](https://github.com/discloud/discloud.app/blob/5849f1b1f34ceb1cb07b41e95e2ec257b46b9f4b/packages/api-types/payload/v2/DiscloudConfig.ts#L72)
Defined in: [payload/v2/DiscloudConfig.ts:72](https://github.com/discloud/discloud.app/blob/c4016c90540db229b9170cffe6882c41b0b114cb/packages/api-types/payload/v2/DiscloudConfig.ts#L72)
Loading
Loading