Files
Dokploy-ts-sdk/docs/sdks/admin/README.md
2025-09-26 02:33:10 +00:00

28 KiB
Raw Permalink Blame History

Admin

(admin)

Overview

Available Operations

getOne

Example Usage

import { Dokploy } from "dokploy";

const dokploy = new Dokploy({
  authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});

async function run() {
  const result = await dokploy.admin.getOne();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DokployCore } from "dokploy/core.js";
import { adminGetOne } from "dokploy/funcs/adminGetOne.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 adminGetOne(dokploy);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("adminGetOne 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 */*

createUserInvitation

Example Usage

import { Dokploy } from "dokploy";

const dokploy = new Dokploy({
  authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});

async function run() {
  const result = await dokploy.admin.createUserInvitation({
    email: "Melody5@gmail.com",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DokployCore } from "dokploy/core.js";
import { adminCreateUserInvitation } from "dokploy/funcs/adminCreateUserInvitation.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 adminCreateUserInvitation(dokploy, {
    email: "Melody5@gmail.com",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("adminCreateUserInvitation failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AdminCreateUserInvitationRequest ✔️ 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 */*

removeUser

Example Usage

import { Dokploy } from "dokploy";

const dokploy = new Dokploy({
  authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});

async function run() {
  const result = await dokploy.admin.removeUser({
    authId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DokployCore } from "dokploy/core.js";
import { adminRemoveUser } from "dokploy/funcs/adminRemoveUser.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 adminRemoveUser(dokploy, {
    authId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("adminRemoveUser failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AdminRemoveUserRequest ✔️ 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 */*

getUserByToken

Example Usage

import { Dokploy } from "dokploy";

const dokploy = new Dokploy({
  authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});

async function run() {
  const result = await dokploy.admin.getUserByToken({
    token: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DokployCore } from "dokploy/core.js";
import { adminGetUserByToken } from "dokploy/funcs/adminGetUserByToken.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 adminGetUserByToken(dokploy, {
    token: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("adminGetUserByToken failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AdminGetUserByTokenRequest ✔️ 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 */*

assignPermissions

Example Usage

import { Dokploy } from "dokploy";

const dokploy = new Dokploy({
  authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});

async function run() {
  const result = await dokploy.admin.assignPermissions({
    userId: "<id>",
    canCreateProjects: false,
    canCreateServices: false,
    canDeleteProjects: false,
    canDeleteServices: false,
    accesedProjects: [
      "<value 1>",
    ],
    accesedServices: [
      "<value 1>",
    ],
    canAccessToTraefikFiles: false,
    canAccessToDocker: true,
    canAccessToAPI: false,
    canAccessToSSHKeys: true,
    canAccessToGitProviders: false,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DokployCore } from "dokploy/core.js";
import { adminAssignPermissions } from "dokploy/funcs/adminAssignPermissions.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 adminAssignPermissions(dokploy, {
    userId: "<id>",
    canCreateProjects: false,
    canCreateServices: false,
    canDeleteProjects: false,
    canDeleteServices: false,
    accesedProjects: [
      "<value 1>",
    ],
    accesedServices: [
      "<value 1>",
    ],
    canAccessToTraefikFiles: false,
    canAccessToDocker: true,
    canAccessToAPI: false,
    canAccessToSSHKeys: true,
    canAccessToGitProviders: false,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("adminAssignPermissions failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AdminAssignPermissionsRequest ✔️ 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 */*