mirror of
https://github.com/LukeHagar/Dokploy-ts-sdk.git
synced 2025-12-06 04:19:37 +00:00
Server
(server)
Overview
Available Operations
create
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.create({
name: "<value>",
ipAddress: "8.12.175.213",
port: 9154.55,
username: "Asia_Parker82",
sshKeyId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverCreate } from "dokploy/funcs/serverCreate.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverCreate(dokploy, {
name: "<value>",
ipAddress: "8.12.175.213",
port: 9154.55,
username: "Asia_Parker82",
sshKeyId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverCreate failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ServerCreateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
all
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.all();
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverAll } from "dokploy/funcs/serverAll.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverAll(dokploy);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverAll failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
withSSHKey
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.withSSHKey();
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverWithSSHKey } from "dokploy/funcs/serverWithSSHKey.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverWithSSHKey(dokploy);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverWithSSHKey failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
setup
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.setup({
serverId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverSetup } from "dokploy/funcs/serverSetup.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverSetup(dokploy, {
serverId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverSetup failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ServerSetupRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
remove
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.remove({
serverId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverRemove } from "dokploy/funcs/serverRemove.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverRemove(dokploy, {
serverId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverRemove failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ServerRemoveRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
update
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.server.update({
name: "<value>",
serverId: "<id>",
ipAddress: "945d:4a06:ae40:dab4:6ecb:dbfc:8b3d:df1d",
port: 4322.18,
username: "Adelia.Casper",
sshKeyId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { serverUpdate } from "dokploy/funcs/serverUpdate.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await serverUpdate(dokploy, {
name: "<value>",
serverId: "<id>",
ipAddress: "945d:4a06:ae40:dab4:6ecb:dbfc:8b3d:df1d",
port: 4322.18,
username: "Adelia.Casper",
sshKeyId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("serverUpdate failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ServerUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |