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

303 lines
23 KiB
Markdown

# Port
(*port*)
## Overview
### Available Operations
* [create](#create)
* [get](#get)
* [delete](#delete)
* [update](#update)
## create
### Example Usage
<!-- UsageSnippet language="typescript" operationID="port-create" method="post" path="/port.create" -->
```typescript
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.port.create({
publishedPort: 9167.77,
targetPort: 2161.7,
applicationId: "<id>",
});
console.log(result);
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { DokployCore } from "dokploy/core.js";
import { portCreate } from "dokploy/funcs/portCreate.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 portCreate(dokploy, {
publishedPort: 9167.77,
targetPort: 2161.7,
applicationId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("portCreate failed:", res.error);
}
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request` | [operations.PortCreateRequest](../../models/operations/portcreaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[models.ErrorT](../../models/errort.md)\>**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------- | -------------------------- | -------------------------- |
| errors.DokployDefaultError | 4XX, 5XX | \*/\* |
## get
### Example Usage
<!-- UsageSnippet language="typescript" operationID="port-one" method="get" path="/port.one" -->
```typescript
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.port.get({
portId: "<id>",
});
console.log(result);
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { DokployCore } from "dokploy/core.js";
import { portGet } from "dokploy/funcs/portGet.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 portGet(dokploy, {
portId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("portGet failed:", res.error);
}
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request` | [operations.PortOneRequest](../../models/operations/portonerequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[models.ErrorT](../../models/errort.md)\>**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------- | -------------------------- | -------------------------- |
| errors.DokployDefaultError | 4XX, 5XX | \*/\* |
## delete
### Example Usage
<!-- UsageSnippet language="typescript" operationID="port-delete" method="post" path="/port.delete" -->
```typescript
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.port.delete({
portId: "<id>",
});
console.log(result);
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { DokployCore } from "dokploy/core.js";
import { portDelete } from "dokploy/funcs/portDelete.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 portDelete(dokploy, {
portId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("portDelete failed:", res.error);
}
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request` | [operations.PortDeleteRequest](../../models/operations/portdeleterequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[models.ErrorT](../../models/errort.md)\>**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------- | -------------------------- | -------------------------- |
| errors.DokployDefaultError | 4XX, 5XX | \*/\* |
## update
### Example Usage
<!-- UsageSnippet language="typescript" operationID="port-update" method="post" path="/port.update" -->
```typescript
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.port.update({
portId: "<id>",
publishedPort: 7240.07,
targetPort: 9496,
});
console.log(result);
}
run();
```
### Standalone function
The standalone function version of this method:
```typescript
import { DokployCore } from "dokploy/core.js";
import { portUpdate } from "dokploy/funcs/portUpdate.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 portUpdate(dokploy, {
portId: "<id>",
publishedPort: 7240.07,
targetPort: 9496,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("portUpdate failed:", res.error);
}
}
run();
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request` | [operations.PortUpdateRequest](../../models/operations/portupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
### Response
**Promise\<[models.ErrorT](../../models/errort.md)\>**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------- | -------------------------- | -------------------------- |
| errors.DokployDefaultError | 4XX, 5XX | \*/\* |