Skip to content

Commit

Permalink
docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorniaky committed Nov 24, 2023
1 parent 30d745a commit fcff35b
Show file tree
Hide file tree
Showing 407 changed files with 3,958 additions and 3,012 deletions.
160 changes: 150 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@ yarn add discloud.app

## Examples usage

[Examples usage](#examples-usage)
[How to upload/commit your application](#how-to-uploadcommit-your-application)
[How to fetch your application](#how-to-fetch-your-application)
[How to start, stop, restart or delete your application](#how-to-start-stop-restart-or-delete-your-application)
[How to view app logs](#how-to-view-app-logs)
[How to backup apps](#how-to-backup-apps)
[How to see your app statuses](#how-to-see-your-app-statuses)
[How to change your app's name and/or avatar](#how-to-change-your-apps-name-andor-avatar)
[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)

```js
// index.js
// Get instanced discloud
const { discloud } = require("discloud.app");

// Set token
discloud.login("DISCLOUD_TOKEN");
await discloud.login("DISCLOUD_TOKEN");
```

```js
Expand All @@ -34,12 +46,10 @@ const { discloud } = require("discloud.app");

// ...

async function () {
await discloud.apps.fetch("ID"); // Promise<App>
}
await discloud.apps.fetch("ID"); // Promise<App>
```

## How to `upload`/`commit` your app
### How to `upload`/`commit` your application

Before continuing, make sure your [`zip`](https://docs.discloudbot.com/v/en/suport/faq/zip) contains the [`discloud.config`](https://docs.discloudbot.com/v/en/discloud.config) file.

Expand All @@ -48,7 +58,7 @@ Before continuing, make sure your [`zip`](https://docs.discloudbot.com/v/en/supo
```js
const { discloud } = require("discloud.app");

discloud.apps.create({
await discloud.apps.create({
file: "FILE_PATH/FILE_NAME.zip"
}); // Promise<RESTPostApiUploadResult>
```
Expand All @@ -58,7 +68,7 @@ discloud.apps.create({
```js
const { discloud } = require("discloud.app");

discloud.apps.create({
await discloud.apps.create({
file: {
data: readFileSync("FILE_PATH/FILE_NAME.zip"), // Blob | Buffer
name: "FILE_NAME.zip"
Expand All @@ -71,7 +81,7 @@ discloud.apps.create({
```js
const { discloud } = require("discloud.app");

discloud.apps.update("APP_ID", {
await discloud.apps.update("APP_ID", {
file: "FILE_PATH/FILE_NAME.zip"
}); // Promise<RESTPutApiAppCommitResult>
```
Expand All @@ -81,7 +91,7 @@ discloud.apps.update("APP_ID", {
```js
const { discloud } = require("discloud.app");

discloud.apps.update("APP_ID", {
await discloud.apps.update("APP_ID", {
file: {
data: readFileSync("FILE_PATH/FILE_NAME.zip"), // Blob | Buffer
name: "FILE_NAME.zip"
Expand All @@ -96,5 +106,135 @@ const { discloud, streamToFile } = require("discloud.app");

const file = await streamToFile(stream, "FILE_NAME.zip");

discloud.apps.create({ file }); // Promise<RESTPostApiUploadResult>
await discloud.apps.create({ file }); // Promise<RESTPostApiUploadResult>
```

### How to `fetch` your application

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

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

### How to `start`, `stop`, `restart` or `delete` your application

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

await discloud.apps.start("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.start(/* "all" | undefined */); // Promise<ApiAppManagerStartedAll>

await discloud.apps.stop("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.stop(/* "all" | undefined */); // Promise<ApiAppManagerStopedAll>

await discloud.apps.restart("APP_ID"); // Promise<RESTApiBaseResult>
await discloud.apps.restart(/* "all" | undefined */); // Promise<ApiAppManagerRestartedAll>

await discloud.apps.delete("APP_ID"); // Promise<RESTDeleteApiAppDeleteResult>
await discloud.apps.delete(/* "all" | undefined */); // Promise<ApiAppManagerRemovedAll>
```

### How to view app `logs`

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

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

### How to `backup` apps

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

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

### How to see your app `statuses`

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

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

### How to change your app's `name` and/or `avatar`

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

await discloud.apps.profile("APP_ID", {
avatarURL // Optional URL ending with GIF, JPG, JPEG or PNG
name // Optional text up to 30 characters
}); // Promise<RESTApiBaseResult>
```

### How to change the amount of `RAM` in the app

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

await discloud.apps.ram("APP_ID", 100 /* number greater than 100 */); // Promise<RESTPutApiAppRamResult>
// Remember that if your app type is site, the minimum is 512
```

### How to install or uninstall `APT`

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

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

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

### 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[]>

// Add a mod
await discloud.appTeam.create("APP_ID", "MOD_ID", [
"backup_app",
"commit_app",
"edit_ram",
"logs_app",
"restart_app",
"start_app",
"status_app",
"stop_app",
]); // Promise<ApiAppTeamManager>

// Edit mod permissions
await discloud.appTeam.edit("APP_ID", "MOD_ID", [
ModPermissions.backup_app,
ModPermissions.commit_app,
ModPermissions.edit_ram,
ModPermissions.logs_app,
ModPermissions.restart_app,
ModPermissions.start_app,
ModPermissions.status_app,
ModPermissions.stop_app,
]); // Promise<ApiAppTeamManager>

// Remove a mod
await discloud.appTeam.delete("APP_ID", "MOD_ID"); // Promise<RESTApiBaseResult>
```
8 changes: 4 additions & 4 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
--dark-hl-4: #569CD6;
--light-hl-5: #0070C1;
--dark-hl-5: #4FC1FF;
--light-hl-6: #001080;
--dark-hl-6: #9CDCFE;
--light-hl-7: #AF00DB;
--dark-hl-7: #C586C0;
--light-hl-6: #AF00DB;
--dark-hl-6: #C586C0;
--light-hl-7: #001080;
--dark-hl-7: #9CDCFE;
--light-hl-8: #098658;
--dark-hl-8: #B5CEA8;
--light-hl-9: #267F99;
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

Loading

0 comments on commit fcff35b

Please sign in to comment.