refactor: nx setup; local pipeline for package publishing (#2063)

Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
This commit is contained in:
Mirko Džaja
2025-07-03 12:58:21 +02:00
committed by GitHub
parent b5684b77d4
commit de792baddc
175 changed files with 16117 additions and 7354 deletions
+7 -7
View File
@@ -10,7 +10,7 @@
"remoteEnv": {
"NX_DAEMON": "true",
"NODE_ENV": "development",
"PYTHONPATH": "${containerWorkspaceFolder}/libs/sdk-python/src:${containerWorkspaceFolder}/libs/api-client-python:${containerWorkspaceFolder}/libs/api-client-python-async:${containerEnv:PYTHONPATH}"
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
},
"customizations": {
// Configure properties specific to VS Code.
@@ -30,7 +30,10 @@
"bradlc.vscode-tailwindcss"
],
"settings": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true
}
}
},
@@ -55,11 +58,8 @@
"version": "22.14.0",
"installYarnUsingApt": false
},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.10"
},
"./tools-feature": {
"pipPackages": ["build", "twine"],
"pipPackages": ["poetry==2.1.3"],
"goTools": ["github.com/swaggo/swag/cmd/swag@v1.16.4", "github.com/mitranim/gow@latest"]
}
},
@@ -67,7 +67,7 @@
// "install-deps": "git config --global --add safe.directory ${containerWorkspaceFolder} && yarn",
"env": "test -f .env.local || touch .env.local"
},
"postStartCommand": "yarn && yarn --cwd libs/sdk-typescript install && pip install --upgrade pip && pip install -e ./libs/sdk-python[dev]",
"postStartCommand": "yarn && poetry lock && poetry install",
"postAttachCommand": "",
"forwardPorts": [5556, "pgadmin:80", "registry-ui:5100", "maildev:1080", "minio:9000", "minio:9001", "jaeger:16686"],
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+7 -1
View File
@@ -1 +1,7 @@
NX_PACKAGE_PUBLISH_VERSION=0.0.0-dev
DEFAULT_PACKAGE_VERSION=0.0.0-dev
PYPI_PKG_VERSION=
NPM_PKG_VERSION=
NPM_TAG=
PYPI_TOKEN=
NPM_TOKEN=
+6 -6
View File
@@ -1,7 +1,7 @@
libs/api-client linguist-generated=true
libs/api-client-go linguist-generated=true
libs/api-client-python linguist-generated=true
libs/api-client-python-async linguist-generated=true
libs/runner-api-client linguist-generated=true
apps/runner/pkg/api/docs linguist-generated=true
libs/api-client/** linguist-generated=true
libs/api-client-go/** linguist-generated=true
libs/api-client-python/** linguist-generated=true
libs/api-client-python-async/** linguist-generated=true
libs/runner-api-client/** linguist-generated=true
apps/runner/pkg/api/docs/** linguist-generated=true
+4 -3
View File
@@ -57,18 +57,19 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install "isort>=5.10.0,<6.0.0" "black[jupyter]>=23.1.0,<24.0.0" "nbqa>=1.9.1,<2.0.0 " "pylint>=3.3.4,<4.0.0" "unasync>=0.6.0,<0.7.0"
pip install "isort>=5.10.0,<6.0.0" "black[jupyter]>=23.1.0,<24.0.0" "nbqa>=1.9.1,<2.0.0 " "pylint>=3.3.4,<4.0.0" "unasync>=0.6.0,<0.7.0" "poetry==2.1.3"
- run: corepack enable
- name: generate-api-clients
run: |
go install github.com/swaggo/swag/cmd/swag@v1.16.4
echo -e 'NX_PACKAGE_PUBLISH_VERSION=0.0.0-dev' > .env
echo -e 'DEFAULT_PACKAGE_VERSION=0.0.0-dev\n\nPYPI_PKG_VERSION=\nNPM_PKG_VERSION=\nNPM_TAG=\nPYPI_TOKEN=\nNPM_TOKEN=' > .env
yarn
mkdir -p dist/apps/api
yarn generate:openapi && yarn nx run-many --target=generate:api-client --all --parallel=false
yarn sdk-python:generate-sync
yarn lint:fix
yarn format
poetry lock
git diff --exit-code || (echo "Code not formatted or linting errors! Hint: 'yarn generate:api-client', 'yarn sdk-python:generate-sync', 'yarn lint:fix' and commit" && exit 1)
build:
@@ -88,7 +89,7 @@ jobs:
python-version: '3.12'
- name: Build all
run: |
python3 -m pip install build twine
python3 -m pip install poetry==2.1.3
yarn
yarn build
+5 -1
View File
@@ -65,4 +65,8 @@ vitest.config.*.timestamp*
*.pyc
__pycache__/
examples/**/*.png
examples/**/*.png
**/.venv
**/poetry.lock
!/poetry.lock
@@ -0,0 +1,174 @@
---
title: 'AsyncSnapshot'
hideTitleOnPage: true
---
## Snapshot
```python
class Snapshot(SnapshotDto)
```
Represents a Daytona Snapshot which is a pre-configured sandbox.
**Attributes**:
- `id` _StrictStr_ - Unique identifier for the Snapshot.
- `organization_id` _Optional[StrictStr]_ - Organization ID of the Snapshot.
- `general` _Optional[bool]_ - Whether the Snapshot is general.
- `name` _StrictStr_ - Name of the Snapshot.
- `image_name` _StrictStr_ - Name of the Image of the Snapshot.
- `enabled` _StrictBool_ - Whether the Snapshot is enabled.
- `state` _StrictStr_ - State of the Snapshot.
- `size` _Optional[Union[StrictFloat, StrictInt]]_ - Size of the Snapshot.
- `entrypoint` _Optional[List[str]]_ - Entrypoint of the Snapshot.
- `cpu` _Union[StrictFloat, StrictInt]_ - CPU of the Snapshot.
- `gpu` _Union[StrictFloat, StrictInt]_ - GPU of the Snapshot.
- `mem` _Union[StrictFloat, StrictInt]_ - Memory of the Snapshot in GiB.
- `disk` _Union[StrictFloat, StrictInt]_ - Disk of the Snapshot in GiB.
- `error_reason` _Optional[StrictStr]_ - Error reason of the Snapshot.
- `created_at` _StrictStr_ - Timestamp when the Snapshot was created.
- `updated_at` _StrictStr_ - Timestamp when the Snapshot was last updated.
- `last_used_at` _StrictStr_ - Timestamp when the Snapshot was last used.
## AsyncSnapshotService
```python
class AsyncSnapshotService()
```
Service for managing Daytona Snapshots. Can be used to list, get, create and delete Snapshots.
#### AsyncSnapshotService.list
```python
@intercept_errors(message_prefix="Failed to list snapshots: ")
async def list() -> List[Snapshot]
```
List all Snapshots.
**Returns**:
- `List[Snapshot]` - List of all Snapshots.
**Example**:
```python
async with AsyncDaytona() as daytona:
snapshots = await daytona.snapshot.list()
for snapshot in snapshots:
print(f"{snapshot.name} ({snapshot.image_name})")
```
#### AsyncSnapshotService.delete
```python
@intercept_errors(message_prefix="Failed to delete snapshot: ")
async def delete(snapshot: Snapshot) -> None
```
Delete a Snapshot.
**Arguments**:
- `snapshot` _Snapshot_ - Snapshot to delete.
**Example**:
```python
async with AsyncDaytona() as daytona:
snapshot = await daytona.snapshot.get("test-snapshot")
await daytona.snapshot.delete(snapshot)
print("Snapshot deleted")
```
#### AsyncSnapshotService.get
```python
@intercept_errors(message_prefix="Failed to get snapshot: ")
async def get(name: str) -> Snapshot
```
Get a Snapshot by name.
**Arguments**:
- `name` _str_ - Name of the Snapshot to get.
**Returns**:
- `Snapshot` - The Snapshot object.
**Example**:
```python
async with AsyncDaytona() as daytona:
snapshot = await daytona.snapshot.get("test-snapshot-name")
print(f"{snapshot.name} ({snapshot.image_name})")
```
#### AsyncSnapshotService.create
```python
@intercept_errors(message_prefix="Failed to create snapshot: ")
@with_timeout(error_message=lambda self, timeout: (
f"Failed to create snapshot within {timeout} seconds timeout period."))
async def create(params: CreateSnapshotParams,
*,
on_logs: Callable[[str], None] = None,
timeout: Optional[float] = 0) -> Snapshot
```
Creates and registers a new snapshot from the given Image definition.
**Arguments**:
- `params` _CreateSnapshotParams_ - Parameters for snapshot creation.
- `on_logs` _Callable[[str], None]_ - This callback function handles snapshot creation logs.
- `timeout` _Optional[float]_ - Default is no timeout. Timeout in seconds (0 means no timeout).
**Example**:
```python
image = Image.debianSlim('3.12').pipInstall('numpy')
daytona.snapshot.create(
CreateSnapshotParams(name='my-snapshot', image=image),
on_logs=lambda chunk: print(chunk, end=""),
)
```
#### AsyncSnapshotService.process_image_context
```python
@staticmethod
async def process_image_context(object_storage_api: ObjectStorageApi,
image: Image) -> List[str]
```
Processes the image context by uploading it to object storage.
**Arguments**:
- `image` _Image_ - The Image instance.
**Returns**:
- `List[str]` - List of context hashes stored in object storage.
## CreateSnapshotParams
```python
class CreateSnapshotParams(BaseModel)
```
Parameters for creating a new snapshot.
**Attributes**:
- `name` _Optional[str]_ - Name of the snapshot.
- `image` _Union[str, Image]_ - Image of the snapshot. If a string is provided,
it should be available on some registry. If an Image instance is provided,
it will be used to create a new image in Daytona.
- `resources` _Optional[Resources]_ - Resources of the snapshot.
- `entrypoint` _Optional[List[str]]_ - Entrypoint of the snapshot.
@@ -0,0 +1,174 @@
---
title: 'Snapshot'
hideTitleOnPage: true
---
## Snapshot
```python
class Snapshot(SnapshotDto)
```
Represents a Daytona Snapshot which is a pre-configured sandbox.
**Attributes**:
- `id` _StrictStr_ - Unique identifier for the Snapshot.
- `organization_id` _Optional[StrictStr]_ - Organization ID of the Snapshot.
- `general` _Optional[bool]_ - Whether the Snapshot is general.
- `name` _StrictStr_ - Name of the Snapshot.
- `image_name` _StrictStr_ - Name of the Image of the Snapshot.
- `enabled` _StrictBool_ - Whether the Snapshot is enabled.
- `state` _StrictStr_ - State of the Snapshot.
- `size` _Optional[Union[StrictFloat, StrictInt]]_ - Size of the Snapshot.
- `entrypoint` _Optional[List[str]]_ - Entrypoint of the Snapshot.
- `cpu` _Union[StrictFloat, StrictInt]_ - CPU of the Snapshot.
- `gpu` _Union[StrictFloat, StrictInt]_ - GPU of the Snapshot.
- `mem` _Union[StrictFloat, StrictInt]_ - Memory of the Snapshot in GiB.
- `disk` _Union[StrictFloat, StrictInt]_ - Disk of the Snapshot in GiB.
- `error_reason` _Optional[StrictStr]_ - Error reason of the Snapshot.
- `created_at` _StrictStr_ - Timestamp when the Snapshot was created.
- `updated_at` _StrictStr_ - Timestamp when the Snapshot was last updated.
- `last_used_at` _StrictStr_ - Timestamp when the Snapshot was last used.
## SnapshotService
```python
class SnapshotService()
```
Service for managing Daytona Snapshots. Can be used to list, get, create and delete Snapshots.
#### SnapshotService.list
```python
@intercept_errors(message_prefix="Failed to list snapshots: ")
def list() -> List[Snapshot]
```
List all Snapshots.
**Returns**:
- `List[Snapshot]` - List of all Snapshots.
**Example**:
```python
daytona = Daytona()
snapshots = daytona.snapshot.list()
for snapshot in snapshots:
print(f"{snapshot.name} ({snapshot.image_name})")
```
#### SnapshotService.delete
```python
@intercept_errors(message_prefix="Failed to delete snapshot: ")
def delete(snapshot: Snapshot) -> None
```
Delete a Snapshot.
**Arguments**:
- `snapshot` _Snapshot_ - Snapshot to delete.
**Example**:
```python
daytona = Daytona()
snapshot = daytona.snapshot.get("test-snapshot")
daytona.snapshot.delete(snapshot)
print("Snapshot deleted")
```
#### SnapshotService.get
```python
@intercept_errors(message_prefix="Failed to get snapshot: ")
def get(name: str) -> Snapshot
```
Get a Snapshot by name.
**Arguments**:
- `name` _str_ - Name of the Snapshot to get.
**Returns**:
- `Snapshot` - The Snapshot object.
**Example**:
```python
daytona = Daytona()
snapshot = daytona.snapshot.get("test-snapshot-name")
print(f"{snapshot.name} ({snapshot.image_name})")
```
#### SnapshotService.create
```python
@intercept_errors(message_prefix="Failed to create snapshot: ")
@with_timeout(error_message=lambda self, timeout: (
f"Failed to create snapshot within {timeout} seconds timeout period."))
def create(params: CreateSnapshotParams,
*,
on_logs: Callable[[str], None] = None,
timeout: Optional[float] = 0) -> Snapshot
```
Creates and registers a new snapshot from the given Image definition.
**Arguments**:
- `params` _CreateSnapshotParams_ - Parameters for snapshot creation.
- `on_logs` _Callable[[str], None]_ - This callback function handles snapshot creation logs.
- `timeout` _Optional[float]_ - Default is no timeout. Timeout in seconds (0 means no timeout).
**Example**:
```python
image = Image.debianSlim('3.12').pipInstall('numpy')
daytona.snapshot.create(
CreateSnapshotParams(name='my-snapshot', image=image),
on_logs=lambda chunk: print(chunk, end=""),
)
```
#### SnapshotService.process_image_context
```python
@staticmethod
def process_image_context(object_storage_api: ObjectStorageApi,
image: Image) -> List[str]
```
Processes the image context by uploading it to object storage.
**Arguments**:
- `image` _Image_ - The Image instance.
**Returns**:
- `List[str]` - List of context hashes stored in object storage.
## CreateSnapshotParams
```python
class CreateSnapshotParams(BaseModel)
```
Parameters for creating a new snapshot.
**Attributes**:
- `name` _Optional[str]_ - Name of the snapshot.
- `image` _Union[str, Image]_ - Image of the snapshot. If a string is provided,
it should be available on some registry. If an Image instance is provided,
it will be used to create a new image in Daytona.
- `resources` _Optional[Resources]_ - Resources of the snapshot.
- `entrypoint` _Optional[List[str]]_ - Entrypoint of the snapshot.
+1 -1
View File
@@ -391,7 +391,7 @@ Represents a context file to be added to the image.
**Properties**:
- `archivePath?` _string_ - The path inside the archive file in object storage.
- `archivePath` _string_ - The path inside the archive file in object storage.
- `sourcePath` _string_ - The path to the source file or directory.
## PipInstallOptions
@@ -29,31 +29,13 @@ new ObjectStorage(config: ObjectStorageConfig): ObjectStorage
### Methods
#### computeArchiveBasePath()
```ts
static computeArchiveBasePath(pathStr: string): string
```
Compute the base path for an archive. Returns normalized path without the root (drive letter or leading slash).
**Parameters**:
- `pathStr` _string_ - The path to compute the base path for.
**Returns**:
- `string` - The base path for the archive.
---
#### upload()
```ts
upload(
path: string,
organizationId: string,
archiveBasePath?: string): Promise<string>
archiveBasePath: string): Promise<string>
```
Upload a file or directory to object storage.
@@ -62,7 +44,7 @@ Upload a file or directory to object storage.
- `path` _string_ - The path to the file or directory to upload.
- `organizationId` _string_ - The organization ID to use for the upload.
- `archiveBasePath?` _string_ - The base path to use for the archive.
- `archiveBasePath` _string_ - The base path to use for the archive.
**Returns**:
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
-9
View File
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
-20
View File
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
-9
View File
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
-20
View File
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
-9
View File
@@ -1,9 +0,0 @@
{
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@daytonaio/sdk": "*"
}
}
-20
View File
@@ -1,20 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"declaration": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
+1 -1
View File
@@ -21,7 +21,7 @@
"generate:api-client": {
"executor": "nx:run-commands",
"options": {
"command": "yarn run openapi-generator-cli generate --git-repo-id=daytona --git-user-id=daytonaio -i dist/apps/api/openapi.json -g go --additional-properties=packageName=daytonaapiclient,moduleVersion=$NX_PACKAGE_PUBLISH_VERSION,generateInterfaces=true,enumClassPrefix=true,structPrefix=true -o libs/api-client-go"
"command": "yarn run openapi-generator-cli generate --git-repo-id=daytona --git-user-id=daytonaio -i dist/apps/api/openapi.json -g go --additional-properties=packageName=daytonaapiclient,moduleVersion=$DEFAULT_PACKAGE_VERSION,generateInterfaces=true,enumClassPrefix=true,structPrefix=true -o libs/api-client-go"
}
},
"tidy": {
+2 -1
View File
@@ -30,4 +30,5 @@ test/*
.gitlab-ci.yml
.github/**
docs/*
README.md
README.md
setup.cfg
-1
View File
@@ -112,7 +112,6 @@ daytona_api_client_async/py.typed
daytona_api_client_async/rest.py
pyproject.toml
requirements.txt
setup.cfg
setup.py
test-requirements.txt
tox.ini
+37 -3
View File
@@ -4,17 +4,51 @@
"sourceRoot": "libs/api-client-python-async/src",
"projectType": "library",
"targets": {
"generate:api-client": {
"executor": "nx:run-commands",
"options": {
"commands": [
"yarn run openapi-generator-cli generate --git-repo-id=daytona --git-user-id=daytonaio -i dist/apps/api/openapi.json -g python --additional-properties=packageName=daytona_api_client_async,projectName=daytona_api_client_async,packageVersion=$DEFAULT_PACKAGE_VERSION,pythonPackageName=daytona_api_client_async,disallowAdditionalPropertiesIfNotPresent=false,library=asyncio -o {projectRoot}",
"sed -i 's/^license = \".*\"/license = \"Apache-2.0\"/' {projectRoot}/pyproject.toml"
],
"parallel": false
},
"dependsOn": [
{
"target": "openapi",
"projects": "api"
}
]
},
"build": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "python3 -m build"
"commands": [
"rm -rf dist",
"if [ -n \"$PYPI_PKG_VERSION\" ] || [ -n \"$DEFAULT_PACKAGE_VERSION\" ]; then VER=${PYPI_PKG_VERSION:-$DEFAULT_PACKAGE_VERSION}; sed -i \"s/^VERSION = \\\".*\\\"$/VERSION = \\\"$VER\\\"/\" setup.py && poetry version \"$VER\"; fi && poetry build"
],
"parallel": false,
"dependsOn": ["deps-check"]
}
},
"generate:api-client": {
"publish": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "{projectRoot}",
"commands": [
"poetry publish --username __token__ --password $PYPI_TOKEN --no-interaction",
"for i in $(seq 1 20); do if pip download daytona_api_client_async==${PYPI_PKG_VERSION} -q -d /tmp; then echo \"daytona_api_client_async==${PYPI_PKG_VERSION} is now downloadable from PyPI\" && sleep 5 && exit 0; else printf '.\n' && sleep 5; fi; done; echo \"Timeout waiting for daytona_api_client_async==${PYPI_PKG_VERSION} on PyPI\" >&2; exit 1"
],
"parallel": false
}
},
"deps-check": {
"executor": "nx:run-commands",
"options": {
"command": "yarn run openapi-generator-cli generate --git-repo-id=daytona --git-user-id=daytonaio -i dist/apps/api/openapi.json -g python --additional-properties=packageName=daytona_api_client_async,projectName=daytona_api_client_async,packageVersion=$NX_PACKAGE_PUBLISH_VERSION,pythonPackageName=daytona_api_client_async,disallowAdditionalPropertiesIfNotPresent=false,library=asyncio -o libs/api-client-python-async"
"cwd": "{projectRoot}",
"commands": ["poetry run deptry .", "poetry lock --regenerate"]
}
}
},
+1 -1
View File
@@ -3,7 +3,7 @@ name = "daytona_api_client_async"
version = "0.0.0-dev"
description = "Daytona"
authors = ["Daytona Platforms Inc. <support@daytona.com>"]
license = "NoLicense"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/daytonaio/daytona"
keywords = ["OpenAPI", "OpenAPI-Generator", "Daytona"]
+4
View File
@@ -1,2 +1,6 @@
[flake8]
max-line-length=99
[options]
package_dir =
= .
+1
View File
@@ -31,3 +31,4 @@ test/*
.github/**
docs/*
README.md
setup.cfg
-1
View File
@@ -112,7 +112,6 @@ daytona_api_client/py.typed
daytona_api_client/rest.py
pyproject.toml
requirements.txt
setup.cfg
setup.py
test-requirements.txt
tox.ini
View File
@@ -13,3 +13,4 @@ from daytona_api_client.api.toolbox_api import ToolboxApi
from daytona_api_client.api.users_api import UsersApi
from daytona_api_client.api.volumes_api import VolumesApi
from daytona_api_client.api.workspace_api import WorkspaceApi
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -39,16 +39,18 @@ class ObjectStorageApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def get_push_access(
self,
x_daytona_organization_id: Annotated[
Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")
] = None,
x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -80,36 +82,41 @@ class ObjectStorageApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_push_access_serialize(
x_daytona_organization_id=x_daytona_organization_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "StorageAccessDto",
'200': "StorageAccessDto",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_push_access_with_http_info(
self,
x_daytona_organization_id: Annotated[
Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")
] = None,
x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -141,36 +148,41 @@ class ObjectStorageApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_push_access_serialize(
x_daytona_organization_id=x_daytona_organization_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "StorageAccessDto",
'200': "StorageAccessDto",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_push_access_without_preload_content(
self,
x_daytona_organization_id: Annotated[
Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")
] = None,
x_daytona_organization_id: Annotated[Optional[StrictStr], Field(description="Use with JWT to specify the organization ID")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -202,22 +214,26 @@ class ObjectStorageApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_push_access_serialize(
x_daytona_organization_id=x_daytona_organization_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "StorageAccessDto",
'200': "StorageAccessDto",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_push_access_serialize(
self,
x_daytona_organization_id,
@@ -226,35 +242,47 @@ class ObjectStorageApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
if x_daytona_organization_id is not None:
_header_params["X-Daytona-Organization-ID"] = x_daytona_organization_id
_header_params['X-Daytona-Organization-ID'] = x_daytona_organization_id
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = ["oauth2"]
_auth_settings: List[str] = [
'oauth2'
]
return self.api_client.param_serialize(
method="GET",
resource_path="/object-storage/push-access",
method='GET',
resource_path='/object-storage/push-access',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -264,5 +292,7 @@ class ObjectStorageApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
File diff suppressed because it is too large Load Diff
+175 -71
View File
@@ -37,6 +37,7 @@ class PreviewApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def has_sandbox_access(
self,
@@ -44,7 +45,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -76,26 +80,30 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._has_sandbox_access_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def has_sandbox_access_with_http_info(
self,
@@ -103,7 +111,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -135,26 +146,30 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._has_sandbox_access_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def has_sandbox_access_without_preload_content(
self,
@@ -162,7 +177,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -194,22 +212,26 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._has_sandbox_access_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _has_sandbox_access_serialize(
self,
sandbox_id,
@@ -218,31 +240,41 @@ class PreviewApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if sandbox_id is not None:
_path_params["sandboxId"] = sandbox_id
_path_params['sandboxId'] = sandbox_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="GET",
resource_path="/preview/{sandboxId}/access",
method='GET',
resource_path='/preview/{sandboxId}/access',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -252,9 +284,12 @@ class PreviewApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def is_sandbox_public(
self,
@@ -262,7 +297,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -294,26 +332,30 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_sandbox_public_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def is_sandbox_public_with_http_info(
self,
@@ -321,7 +363,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -353,26 +398,30 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_sandbox_public_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def is_sandbox_public_without_preload_content(
self,
@@ -380,7 +429,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -412,22 +464,26 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_sandbox_public_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _is_sandbox_public_serialize(
self,
sandbox_id,
@@ -436,35 +492,46 @@ class PreviewApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if sandbox_id is not None:
_path_params["sandboxId"] = sandbox_id
_path_params['sandboxId'] = sandbox_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = []
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method="GET",
resource_path="/preview/{sandboxId}/public",
method='GET',
resource_path='/preview/{sandboxId}/public',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -474,9 +541,12 @@ class PreviewApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def is_valid_auth_token(
self,
@@ -485,7 +555,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -519,7 +592,7 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_valid_auth_token_serialize(
sandbox_id=sandbox_id,
@@ -527,19 +600,23 @@ class PreviewApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def is_valid_auth_token_with_http_info(
self,
@@ -548,7 +625,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -582,7 +662,7 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_valid_auth_token_serialize(
sandbox_id=sandbox_id,
@@ -590,19 +670,23 @@ class PreviewApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def is_valid_auth_token_without_preload_content(
self,
@@ -611,7 +695,10 @@ class PreviewApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -645,7 +732,7 @@ class PreviewApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._is_valid_auth_token_serialize(
sandbox_id=sandbox_id,
@@ -653,15 +740,19 @@ class PreviewApi:
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "bool",
'200': "bool",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _is_valid_auth_token_serialize(
self,
sandbox_id,
@@ -671,37 +762,48 @@ class PreviewApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if sandbox_id is not None:
_path_params["sandboxId"] = sandbox_id
_path_params['sandboxId'] = sandbox_id
if auth_token is not None:
_path_params["authToken"] = auth_token
_path_params['authToken'] = auth_token
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = []
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method="GET",
resource_path="/preview/{sandboxId}/validate/{authToken}",
method='GET',
resource_path='/preview/{sandboxId}/validate/{authToken}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -711,5 +813,7 @@ class PreviewApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
+319 -116
View File
@@ -41,6 +41,7 @@ class RunnersApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def create_runner(
self,
@@ -48,7 +49,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -80,26 +84,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._create_runner_serialize(
create_runner=create_runner,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"201": None,
'201': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def create_runner_with_http_info(
self,
@@ -107,7 +115,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -139,26 +150,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._create_runner_serialize(
create_runner=create_runner,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"201": None,
'201': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def create_runner_without_preload_content(
self,
@@ -166,7 +181,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -198,22 +216,26 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._create_runner_serialize(
create_runner=create_runner,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"201": None,
'201': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _create_runner_serialize(
self,
create_runner,
@@ -222,15 +244,19 @@ class RunnersApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@@ -241,20 +267,31 @@ class RunnersApi:
if create_runner is not None:
_body_params = create_runner
# set the HTTP header `Content-Type`
if _content_type:
_header_params["Content-Type"] = _content_type
_header_params['Content-Type'] = _content_type
else:
_default_content_type = self.api_client.select_header_content_type(["application/json"])
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params["Content-Type"] = _default_content_type
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="POST",
resource_path="/runners",
method='POST',
resource_path='/runners',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -264,9 +301,12 @@ class RunnersApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def get_runner_by_sandbox_id(
self,
@@ -274,7 +314,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -306,26 +349,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runner_by_sandbox_id_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "Runner",
'200': "Runner",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_runner_by_sandbox_id_with_http_info(
self,
@@ -333,7 +380,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -365,26 +415,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runner_by_sandbox_id_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "Runner",
'200': "Runner",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_runner_by_sandbox_id_without_preload_content(
self,
@@ -392,7 +446,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -424,22 +481,26 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runner_by_sandbox_id_serialize(
sandbox_id=sandbox_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "Runner",
'200': "Runner",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_runner_by_sandbox_id_serialize(
self,
sandbox_id,
@@ -448,35 +509,48 @@ class RunnersApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if sandbox_id is not None:
_path_params["sandboxId"] = sandbox_id
_path_params['sandboxId'] = sandbox_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="GET",
resource_path="/runners/by-sandbox/{sandboxId}",
method='GET',
resource_path='/runners/by-sandbox/{sandboxId}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -486,9 +560,12 @@ class RunnersApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def get_runners_by_snapshot_internal_name(
self,
@@ -496,7 +573,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -528,26 +608,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runners_by_snapshot_internal_name_serialize(
internal_name=internal_name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "List[RunnerSnapshotDto]",
'200': "List[RunnerSnapshotDto]",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def get_runners_by_snapshot_internal_name_with_http_info(
self,
@@ -555,7 +639,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -587,26 +674,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runners_by_snapshot_internal_name_serialize(
internal_name=internal_name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "List[RunnerSnapshotDto]",
'200': "List[RunnerSnapshotDto]",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def get_runners_by_snapshot_internal_name_without_preload_content(
self,
@@ -614,7 +705,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -646,22 +740,26 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._get_runners_by_snapshot_internal_name_serialize(
internal_name=internal_name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "List[RunnerSnapshotDto]",
'200': "List[RunnerSnapshotDto]",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _get_runners_by_snapshot_internal_name_serialize(
self,
internal_name,
@@ -670,36 +768,50 @@ class RunnersApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if internal_name is not None:
_query_params.append(("internalName", internal_name))
_query_params.append(('internalName', internal_name))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="GET",
resource_path="/runners/by-snapshot",
method='GET',
resource_path='/runners/by-snapshot',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -709,16 +821,22 @@ class RunnersApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def list_runners(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -748,29 +866,39 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._list_runners_serialize(
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def list_runners_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -800,29 +928,39 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._list_runners_serialize(
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def list_runners_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -852,18 +990,25 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._list_runners_serialize(
_request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _list_runners_serialize(
self,
_request_auth,
@@ -871,15 +1016,19 @@ class RunnersApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@@ -888,12 +1037,18 @@ class RunnersApi:
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="GET",
resource_path="/runners",
method='GET',
resource_path='/runners',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -903,9 +1058,12 @@ class RunnersApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
@validate_call
def update_runner_scheduling(
self,
@@ -913,7 +1071,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -945,22 +1106,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._update_runner_scheduling_serialize(
id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def update_runner_scheduling_with_http_info(
self,
@@ -968,7 +1137,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -1000,22 +1172,30 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._update_runner_scheduling_serialize(
id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def update_runner_scheduling_without_preload_content(
self,
@@ -1023,7 +1203,10 @@ class RunnersApi:
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -1055,18 +1238,26 @@ class RunnersApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._update_runner_scheduling_serialize(
id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
"200": None,
'200': None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _update_runner_scheduling_serialize(
self,
id,
@@ -1075,31 +1266,41 @@ class RunnersApi:
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if id is not None:
_path_params["id"] = id
_path_params['id'] = id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = ["bearer", "oauth2"]
_auth_settings: List[str] = [
'bearer',
'oauth2'
]
return self.api_client.param_serialize(
method="PATCH",
resource_path="/runners/{id}/scheduling",
method='PATCH',
resource_path='/runners/{id}/scheduling',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -1109,5 +1310,7 @@ class RunnersApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
_request_auth=_request_auth
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+191 -89
View File
@@ -38,12 +38,11 @@ from daytona_api_client.exceptions import (
UnauthorizedException,
ForbiddenException,
NotFoundException,
ServiceException,
ServiceException
)
RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
class ApiClient:
"""Generic API client for OpenAPI client library builds.
@@ -62,19 +61,25 @@ class ApiClient:
PRIMITIVE_TYPES = (float, bool, bytes, str, int)
NATIVE_TYPES_MAPPING = {
"int": int,
"long": int, # TODO remove as only py3 is supported?
"float": float,
"str": str,
"bool": bool,
"date": datetime.date,
"datetime": datetime.datetime,
"decimal": decimal.Decimal,
"object": object,
'int': int,
'long': int, # TODO remove as only py3 is supported?
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'decimal': decimal.Decimal,
'object': object,
}
_pool = None
def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None) -> None:
def __init__(
self,
configuration=None,
header_name=None,
header_value=None,
cookie=None
) -> None:
# use default configuration if none is provided
if configuration is None:
configuration = Configuration.get_default()
@@ -86,7 +91,7 @@ class ApiClient:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = "OpenAPI-Generator/0.0.0-dev/python"
self.user_agent = 'OpenAPI-Generator/0.0.0-dev/python'
self.client_side_validation = configuration.client_side_validation
def __enter__(self):
@@ -98,15 +103,16 @@ class ApiClient:
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers["User-Agent"]
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers["User-Agent"] = value
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
_default = None
@classmethod
@@ -142,12 +148,12 @@ class ApiClient:
header_params=None,
body=None,
post_params=None,
files=None,
auth_settings=None,
files=None, auth_settings=None,
collection_formats=None,
_host=None,
_request_auth=None,
_request_auth=None
) -> RequestSerialized:
"""Builds the HTTP request params needed by the request.
:param method: Method to call.
:param resource_path: Path to method endpoint.
@@ -176,30 +182,47 @@ class ApiClient:
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params["Cookie"] = self.cookie
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params, collection_formats))
header_params = dict(
self.parameters_to_tuples(header_params,collection_formats)
)
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params, collection_formats)
path_params = self.parameters_to_tuples(
path_params,
collection_formats
)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param))
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# post parameters
if post_params or files:
post_params = post_params if post_params else []
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params, collection_formats)
post_params = self.parameters_to_tuples(
post_params,
collection_formats
)
if files:
post_params.extend(self.files_parameters(files))
# auth setting
self.update_params_for_auth(
header_params, query_params, auth_settings, resource_path, method, body, request_auth=_request_auth
header_params,
query_params,
auth_settings,
resource_path,
method,
body,
request_auth=_request_auth
)
# body
@@ -216,13 +239,23 @@ class ApiClient:
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
url_query = self.parameters_to_url_query(query_params, collection_formats)
url_query = self.parameters_to_url_query(
query_params,
collection_formats
)
url += "?" + url_query
return method, url, header_params, body, post_params
def call_api(
self, method, url, header_params=None, body=None, post_params=None, _request_timeout=None
self,
method,
url,
header_params=None,
body=None,
post_params=None,
_request_timeout=None
) -> rest.RESTResponse:
"""Makes the HTTP request (synchronous)
:param method: Method to call.
@@ -239,12 +272,10 @@ class ApiClient:
try:
# perform request and return response
response_data = self.rest_client.request(
method,
url,
method, url,
headers=header_params,
body=body,
post_params=post_params,
_request_timeout=_request_timeout,
body=body, post_params=post_params,
_request_timeout=_request_timeout
)
except ApiException as e:
@@ -253,7 +284,9 @@ class ApiClient:
return response_data
def response_deserialize(
self, response_data: rest.RESTResponse, response_types_map: Optional[Dict[str, ApiResponseT]] = None
self,
response_data: rest.RESTResponse,
response_types_map: Optional[Dict[str, ApiResponseT]]=None
) -> ApiResponse[ApiResponseT]:
"""Deserializes response into an object.
:param response_data: RESTResponse object to be deserialized.
@@ -279,7 +312,7 @@ class ApiClient:
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader("content-type")
content_type = response_data.getheader('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
@@ -294,10 +327,10 @@ class ApiClient:
)
return ApiResponse(
status_code=response_data.status,
data=return_data,
headers=response_data.getheaders(),
raw_data=response_data.data,
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
raw_data = response_data.data
)
def sanitize_for_serialization(self, obj):
@@ -325,9 +358,13 @@ class ApiClient:
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
return [
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
return tuple(
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
elif isinstance(obj, decimal.Decimal):
@@ -341,12 +378,15 @@ class ApiClient:
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")):
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
obj_dict = obj.to_dict()
else:
obj_dict = obj.__dict__
return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
return {
key: self.sanitize_for_serialization(val)
for key, val in obj_dict.items()
}
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
"""Deserializes response into an object.
@@ -365,15 +405,18 @@ class ApiClient:
data = json.loads(response_text)
except ValueError:
data = response_text
elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
if response_text == "":
data = ""
else:
data = json.loads(response_text)
elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
data = response_text
else:
raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type))
raise ApiException(
status=0,
reason="Unsupported content type: {0}".format(content_type)
)
return self.__deserialize(data, response_type)
@@ -389,17 +432,19 @@ class ApiClient:
return None
if isinstance(klass, str):
if klass.startswith("List["):
m = re.match(r"List\[(.*)]", klass)
if klass.startswith('List['):
m = re.match(r'List\[(.*)]', klass)
assert m is not None, "Malformed List type definition"
sub_kls = m.group(1)
return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith("Dict["):
m = re.match(r"Dict\[([^,]*), (.*)]", klass)
if klass.startswith('Dict['):
m = re.match(r'Dict\[([^,]*), (.*)]', klass)
assert m is not None, "Malformed Dict type definition"
sub_kls = m.group(2)
return {k: self.__deserialize(v, sub_kls) for k, v in data.items()}
return {k: self.__deserialize(v, sub_kls)
for k, v in data.items()}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
@@ -435,18 +480,19 @@ class ApiClient:
for k, v in params.items() if isinstance(params, dict) else params:
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == "multi":
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == "ssv":
delimiter = " "
elif collection_format == "tsv":
delimiter = "\t"
elif collection_format == "pipes":
delimiter = "|"
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ","
new_params.append((k, delimiter.join(str(value) for value in v)))
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
@@ -471,18 +517,20 @@ class ApiClient:
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == "multi":
if collection_format == 'multi':
new_params.extend((k, quote(str(value))) for value in v)
else:
if collection_format == "ssv":
delimiter = " "
elif collection_format == "tsv":
delimiter = "\t"
elif collection_format == "pipes":
delimiter = "|"
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ","
new_params.append((k, delimiter.join(quote(str(value)) for value in v)))
delimiter = ','
new_params.append(
(k, delimiter.join(quote(str(value)) for value in v))
)
else:
new_params.append((k, quote(str(v))))
@@ -500,7 +548,7 @@ class ApiClient:
params = []
for k, v in files.items():
if isinstance(v, str):
with open(v, "rb") as f:
with open(v, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
elif isinstance(v, bytes):
@@ -514,8 +562,13 @@ class ApiClient:
continue
else:
raise ValueError("Unsupported file value")
mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"
params.append(tuple([k, tuple([filename, filedata, mimetype])]))
mimetype = (
mimetypes.guess_type(filename)[0]
or 'application/octet-stream'
)
params.append(
tuple([k, tuple([filename, filedata, mimetype])])
)
return params
def select_header_accept(self, accepts: List[str]) -> Optional[str]:
@@ -528,7 +581,7 @@ class ApiClient:
return None
for accept in accepts:
if re.search("json", accept, re.IGNORECASE):
if re.search('json', accept, re.IGNORECASE):
return accept
return accepts[0]
@@ -543,13 +596,20 @@ class ApiClient:
return None
for content_type in content_types:
if re.search("json", content_type, re.IGNORECASE):
if re.search('json', content_type, re.IGNORECASE):
return content_type
return content_types[0]
def update_params_for_auth(
self, headers, queries, auth_settings, resource_path, method, body, request_auth=None
self,
headers,
queries,
auth_settings,
resource_path,
method,
body,
request_auth=None
) -> None:
"""Updates header and query params based on authentication setting.
@@ -567,14 +627,36 @@ class ApiClient:
return
if request_auth:
self._apply_auth_params(headers, queries, resource_path, method, body, request_auth)
self._apply_auth_params(
headers,
queries,
resource_path,
method,
body,
request_auth
)
else:
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting)
self._apply_auth_params(
headers,
queries,
resource_path,
method,
body,
auth_setting
)
def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting) -> None:
def _apply_auth_params(
self,
headers,
queries,
resource_path,
method,
body,
auth_setting
) -> None:
"""Updates the request parameters based on a single auth_setting
:param headers: Header parameters dict to be updated.
@@ -585,15 +667,17 @@ class ApiClient:
The object type is the return value of sanitize_for_serialization().
:param auth_setting: auth settings for the endpoint
"""
if auth_setting["in"] == "cookie":
headers["Cookie"] = auth_setting["value"]
elif auth_setting["in"] == "header":
if auth_setting["type"] != "http-signature":
headers[auth_setting["key"]] = auth_setting["value"]
elif auth_setting["in"] == "query":
queries.append((auth_setting["key"], auth_setting["value"]))
if auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
if auth_setting['type'] != 'http-signature':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
queries.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError("Authentication token must be in `query` or `header`")
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""Deserializes body to file
@@ -613,7 +697,10 @@ class ApiClient:
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
path = os.path.join(os.path.dirname(path), filename)
@@ -656,7 +743,10 @@ class ApiClient:
except ImportError:
return string
except ValueError:
raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string))
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
def __deserialize_datetime(self, string):
"""Deserializes string to datetime.
@@ -671,7 +761,13 @@ class ApiClient:
except ImportError:
return string
except ValueError:
raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as datetime object".format(string)))
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __deserialize_enum(self, data, klass):
"""Deserializes primitive type to enum.
@@ -683,7 +779,13 @@ class ApiClient:
try:
return klass(data)
except ValueError:
raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as `{1}`".format(data, klass)))
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as `{1}`"
.format(data, klass)
)
)
def __deserialize_model(self, data, klass):
"""Deserializes list or dict to model.
+3 -2
View File
@@ -6,7 +6,6 @@ from pydantic import Field, StrictInt, StrictBytes, BaseModel
T = TypeVar("T")
class ApiResponse(BaseModel, Generic[T]):
"""
API response object
@@ -17,4 +16,6 @@ class ApiResponse(BaseModel, Generic[T]):
data: T = Field(description="Deserialized data given the data type")
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
model_config = {"arbitrary_types_allowed": True}
model_config = {
"arbitrary_types_allowed": True
}
+52 -55
View File
@@ -26,16 +26,9 @@ import urllib3
JSON_SCHEMA_VALIDATION_KEYWORDS = {
"multipleOf",
"maximum",
"exclusiveMaximum",
"minimum",
"exclusiveMinimum",
"maxLength",
"minLength",
"pattern",
"maxItems",
"minItems",
'multipleOf', 'maximum', 'exclusiveMaximum',
'minimum', 'exclusiveMinimum', 'maxLength',
'minLength', 'pattern', 'maxItems', 'minItems'
}
ServerVariablesT = Dict[str, str]
@@ -179,24 +172,25 @@ class Configuration:
def __init__(
self,
host: Optional[str] = None,
api_key: Optional[Dict[str, str]] = None,
api_key_prefix: Optional[Dict[str, str]] = None,
username: Optional[str] = None,
password: Optional[str] = None,
access_token: Optional[str] = None,
server_index: Optional[int] = None,
server_variables: Optional[ServerVariablesT] = None,
server_operation_index: Optional[Dict[int, int]] = None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None,
ignore_operation_servers: bool = False,
ssl_ca_cert: Optional[str] = None,
host: Optional[str]=None,
api_key: Optional[Dict[str, str]]=None,
api_key_prefix: Optional[Dict[str, str]]=None,
username: Optional[str]=None,
password: Optional[str]=None,
access_token: Optional[str]=None,
server_index: Optional[int]=None,
server_variables: Optional[ServerVariablesT]=None,
server_operation_index: Optional[Dict[int, int]]=None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
*,
debug: Optional[bool] = None,
) -> None:
"""Constructor"""
"""Constructor
"""
self._base_path = "http://localhost:3000" if host is None else host
"""Default Base url
"""
@@ -242,7 +236,7 @@ class Configuration:
"""
self.logger["package_logger"] = logging.getLogger("daytona_api_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
self.logger_format = "%(asctime)s %(levelname)s %(message)s"
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
"""Log format
"""
self.logger_stream_handler = None
@@ -301,7 +295,7 @@ class Configuration:
self.proxy_headers = None
"""Proxy headers
"""
self.safe_chars_for_path_param = ""
self.safe_chars_for_path_param = ''
"""Safe chars for path_param
"""
self.retries = retries
@@ -322,12 +316,12 @@ class Configuration:
"""date format
"""
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
for k, v in self.__dict__.items():
if k not in ("logger", "logger_file_handler"):
if k not in ('logger', 'logger_file_handler'):
setattr(result, k, copy.deepcopy(v, memo))
# shallow copy of loggers
result.logger = copy.copy(self.logger)
@@ -459,7 +453,7 @@ class Configuration:
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str] = None) -> Optional[str]:
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
@@ -489,21 +483,23 @@ class Configuration:
password = ""
if self.password is not None:
password = self.password
return urllib3.util.make_headers(basic_auth=username + ":" + password).get("authorization")
return urllib3.util.make_headers(
basic_auth=username + ':' + password
).get('authorization')
def auth_settings(self) -> AuthSettings:
def auth_settings(self)-> AuthSettings:
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth: AuthSettings = {}
if self.access_token is not None:
auth["bearer"] = {
"type": "bearer",
"in": "header",
"format": "JWT",
"key": "Authorization",
"value": "Bearer " + self.access_token,
auth['bearer'] = {
'type': 'bearer',
'in': 'header',
'format': 'JWT',
'key': 'Authorization',
'value': 'Bearer ' + self.access_token
}
return auth
@@ -512,13 +508,12 @@ class Configuration:
:return: The report for debugging.
"""
return (
"Python SDK Debug Report:\n"
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 1.0\n"
"SDK Package Version: 0.0.0-dev".format(env=sys.platform, pyversion=sys.version)
)
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.0\n"\
"SDK Package Version: 0.0.0-dev".\
format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self) -> List[HostSetting]:
"""Gets an array of host settings
@@ -527,16 +522,16 @@ class Configuration:
"""
return [
{
"url": "http://localhost:3000",
"description": "No description provided",
'url': "http://localhost:3000",
'description': "No description provided",
}
]
def get_host_from_settings(
self,
index: Optional[int],
variables: Optional[ServerVariablesT] = None,
servers: Optional[List[HostSetting]] = None,
variables: Optional[ServerVariablesT]=None,
servers: Optional[List[HostSetting]]=None,
) -> str:
"""Gets host URL based on the index and variables
:param index: array index of the host settings
@@ -555,20 +550,22 @@ class Configuration:
except IndexError:
raise ValueError(
"Invalid index {0} when selecting the host settings. "
"Must be less than {1}".format(index, len(servers))
)
"Must be less than {1}".format(index, len(servers)))
url = server["url"]
url = server['url']
# go through variables and replace placeholders
for variable_name, variable in server.get("variables", {}).items():
used_value = variables.get(variable_name, variable["default_value"])
for variable_name, variable in server.get('variables', {}).items():
used_value = variables.get(
variable_name, variable['default_value'])
if "enum_values" in variable and used_value not in variable["enum_values"]:
if 'enum_values' in variable \
and used_value not in variable['enum_values']:
raise ValueError(
"The variable `{0}` in the host URL has invalid value "
"{1}. Must be {2}.".format(variable_name, variables[variable_name], variable["enum_values"])
)
"{1}. Must be {2}.".format(
variable_name, variables[variable_name],
variable['enum_values']))
url = url.replace("{" + variable_name + "}", used_value)
+16 -15
View File
@@ -15,14 +15,14 @@
from typing import Any, Optional
from typing_extensions import Self
class OpenApiException(Exception):
"""The base exception class for all OpenAPIExceptions"""
class ApiTypeError(OpenApiException, TypeError):
def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
"""Raises an exception for TypeErrors
def __init__(self, msg, path_to_item=None, valid_classes=None,
key_type=None) -> None:
""" Raises an exception for TypeErrors
Args:
msg (str): the exception message
@@ -103,10 +103,11 @@ class ApiKeyError(OpenApiException, KeyError):
class ApiException(OpenApiException):
def __init__(
self,
status=None,
reason=None,
self,
status=None,
reason=None,
http_resp=None,
*,
body: Optional[str] = None,
@@ -125,17 +126,17 @@ class ApiException(OpenApiException):
self.reason = http_resp.reason
if self.body is None:
try:
self.body = http_resp.data.decode("utf-8")
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
@classmethod
def from_response(
cls,
*,
http_resp,
body: Optional[str],
cls,
*,
http_resp,
body: Optional[str],
data: Optional[Any],
) -> Self:
if http_resp.status == 400:
@@ -163,9 +164,11 @@ class ApiException(OpenApiException):
def __str__(self):
"""Custom error messages for exception"""
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
error_message = "({0})\n"\
"Reason: {1}\n".format(self.status, self.reason)
if self.headers:
error_message += "HTTP response headers: {0}\n".format(self.headers)
error_message += "HTTP response headers: {0}\n".format(
self.headers)
if self.data or self.body:
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
@@ -195,13 +198,11 @@ class ServiceException(ApiException):
class ConflictException(ApiException):
"""Exception for HTTP 409 Conflict."""
pass
class UnprocessableEntityException(ApiException):
"""Exception for HTTP 422 Unprocessable Entity."""
pass
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class AccountProvider(BaseModel):
"""
AccountProvider
""" # noqa: E501
""" # noqa: E501
name: StrictStr
display_name: StrictStr = Field(alias="displayName")
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class AccountProvider(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class AccountProvider(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class AccountProvider(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"name": obj.get("name"), "displayName": obj.get("displayName")})
_obj = cls.model_validate({
"name": obj.get("name"),
"displayName": obj.get("displayName")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,43 +24,25 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class ApiKeyList(BaseModel):
"""
ApiKeyList
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of the API key")
value: StrictStr = Field(description="The masked API key value")
created_at: datetime = Field(description="When the API key was created", alias="createdAt")
permissions: List[StrictStr] = Field(
description="The list of organization resource permissions assigned to the API key"
)
permissions: List[StrictStr] = Field(description="The list of organization resource permissions assigned to the API key")
last_used_at: Optional[datetime] = Field(description="When the API key was last used", alias="lastUsedAt")
expires_at: Optional[datetime] = Field(description="When the API key expires", alias="expiresAt")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name", "value", "createdAt", "permissions", "lastUsedAt", "expiresAt"]
@field_validator("permissions")
@field_validator('permissions')
def permissions_validate_enum(cls, value):
"""Validates the enum"""
for i in value:
if i not in set(
[
"write:registries",
"delete:registries",
"write:snapshots",
"delete:snapshots",
"write:sandboxes",
"delete:sandboxes",
"read:volumes",
"write:volumes",
"delete:volumes",
]
):
raise ValueError(
"each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')"
)
if i not in set(['write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes']):
raise ValueError("each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')")
return value
model_config = ConfigDict(
@@ -69,6 +51,7 @@ class ApiKeyList(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -94,11 +77,9 @@ class ApiKeyList(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -113,12 +94,12 @@ class ApiKeyList(BaseModel):
# set to None if last_used_at (nullable) is None
# and model_fields_set contains the field
if self.last_used_at is None and "last_used_at" in self.model_fields_set:
_dict["lastUsedAt"] = None
_dict['lastUsedAt'] = None
# set to None if expires_at (nullable) is None
# and model_fields_set contains the field
if self.expires_at is None and "expires_at" in self.model_fields_set:
_dict["expiresAt"] = None
_dict['expiresAt'] = None
return _dict
@@ -131,19 +112,19 @@ class ApiKeyList(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"value": obj.get("value"),
"createdAt": obj.get("createdAt"),
"permissions": obj.get("permissions"),
"lastUsedAt": obj.get("lastUsedAt"),
"expiresAt": obj.get("expiresAt"),
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"value": obj.get("value"),
"createdAt": obj.get("createdAt"),
"permissions": obj.get("permissions"),
"lastUsedAt": obj.get("lastUsedAt"),
"expiresAt": obj.get("expiresAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,42 +24,24 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class ApiKeyResponse(BaseModel):
"""
ApiKeyResponse
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of the API key")
value: StrictStr = Field(description="The API key value")
created_at: datetime = Field(description="When the API key was created", alias="createdAt")
permissions: List[StrictStr] = Field(
description="The list of organization resource permissions assigned to the API key"
)
permissions: List[StrictStr] = Field(description="The list of organization resource permissions assigned to the API key")
expires_at: Optional[datetime] = Field(description="When the API key expires", alias="expiresAt")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name", "value", "createdAt", "permissions", "expiresAt"]
@field_validator("permissions")
@field_validator('permissions')
def permissions_validate_enum(cls, value):
"""Validates the enum"""
for i in value:
if i not in set(
[
"write:registries",
"delete:registries",
"write:snapshots",
"delete:snapshots",
"write:sandboxes",
"delete:sandboxes",
"read:volumes",
"write:volumes",
"delete:volumes",
]
):
raise ValueError(
"each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')"
)
if i not in set(['write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes']):
raise ValueError("each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')")
return value
model_config = ConfigDict(
@@ -68,6 +50,7 @@ class ApiKeyResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -93,11 +76,9 @@ class ApiKeyResponse(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -112,7 +93,7 @@ class ApiKeyResponse(BaseModel):
# set to None if expires_at (nullable) is None
# and model_fields_set contains the field
if self.expires_at is None and "expires_at" in self.model_fields_set:
_dict["expiresAt"] = None
_dict['expiresAt'] = None
return _dict
@@ -125,18 +106,18 @@ class ApiKeyResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"value": obj.get("value"),
"createdAt": obj.get("createdAt"),
"permissions": obj.get("permissions"),
"expiresAt": obj.get("expiresAt"),
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"value": obj.get("value"),
"createdAt": obj.get("createdAt"),
"permissions": obj.get("permissions"),
"expiresAt": obj.get("expiresAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
+15 -22
View File
@@ -24,18 +24,12 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class BuildInfo(BaseModel):
"""
BuildInfo
""" # noqa: E501
dockerfile_content: Optional[StrictStr] = Field(
default=None, description="The Dockerfile content used for the build", alias="dockerfileContent"
)
context_hashes: Optional[List[StrictStr]] = Field(
default=None, description="The context hashes used for the build", alias="contextHashes"
)
""" # noqa: E501
dockerfile_content: Optional[StrictStr] = Field(default=None, description="The Dockerfile content used for the build", alias="dockerfileContent")
context_hashes: Optional[List[StrictStr]] = Field(default=None, description="The context hashes used for the build", alias="contextHashes")
created_at: datetime = Field(description="The creation timestamp", alias="createdAt")
updated_at: datetime = Field(description="The last update timestamp", alias="updatedAt")
additional_properties: Dict[str, Any] = {}
@@ -47,6 +41,7 @@ class BuildInfo(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -72,11 +67,9 @@ class BuildInfo(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -99,17 +92,17 @@ class BuildInfo(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"dockerfileContent": obj.get("dockerfileContent"),
"contextHashes": obj.get("contextHashes"),
"createdAt": obj.get("createdAt"),
"updatedAt": obj.get("updatedAt"),
}
)
_obj = cls.model_validate({
"dockerfileContent": obj.get("dockerfileContent"),
"contextHashes": obj.get("contextHashes"),
"createdAt": obj.get("createdAt"),
"updatedAt": obj.get("updatedAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
+13 -12
View File
@@ -23,17 +23,13 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class Command(BaseModel):
"""
Command
""" # noqa: E501
""" # noqa: E501
id: StrictStr = Field(description="The ID of the command")
command: StrictStr = Field(description="The command that was executed")
exit_code: Optional[Union[StrictFloat, StrictInt]] = Field(
default=None, description="The exit code of the command", alias="exitCode"
)
exit_code: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The exit code of the command", alias="exitCode")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["id", "command", "exitCode"]
@@ -43,6 +39,7 @@ class Command(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -68,11 +65,9 @@ class Command(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -95,10 +90,16 @@ class Command(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"id": obj.get("id"), "command": obj.get("command"), "exitCode": obj.get("exitCode")})
_obj = cls.model_validate({
"id": obj.get("id"),
"command": obj.get("command"),
"exitCode": obj.get("exitCode")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class CompletionContext(BaseModel):
"""
CompletionContext
""" # noqa: E501
""" # noqa: E501
trigger_kind: Union[StrictFloat, StrictInt] = Field(alias="triggerKind")
trigger_character: Optional[StrictStr] = Field(default=None, alias="triggerCharacter")
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class CompletionContext(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class CompletionContext(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,12 +89,15 @@ class CompletionContext(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"triggerKind": obj.get("triggerKind"), "triggerCharacter": obj.get("triggerCharacter")}
)
_obj = cls.model_validate({
"triggerKind": obj.get("triggerKind"),
"triggerCharacter": obj.get("triggerCharacter")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class CompletionItem(BaseModel):
"""
CompletionItem
""" # noqa: E501
""" # noqa: E501
label: StrictStr
kind: Optional[Union[StrictFloat, StrictInt]] = None
detail: Optional[StrictStr] = None
@@ -37,15 +35,7 @@ class CompletionItem(BaseModel):
filter_text: Optional[StrictStr] = Field(default=None, alias="filterText")
insert_text: Optional[StrictStr] = Field(default=None, alias="insertText")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"label",
"kind",
"detail",
"documentation",
"sortText",
"filterText",
"insertText",
]
__properties: ClassVar[List[str]] = ["label", "kind", "detail", "documentation", "sortText", "filterText", "insertText"]
model_config = ConfigDict(
populate_by_name=True,
@@ -53,6 +43,7 @@ class CompletionItem(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -78,11 +69,9 @@ class CompletionItem(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -105,20 +94,20 @@ class CompletionItem(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"label": obj.get("label"),
"kind": obj.get("kind"),
"detail": obj.get("detail"),
"documentation": obj.get("documentation"),
"sortText": obj.get("sortText"),
"filterText": obj.get("filterText"),
"insertText": obj.get("insertText"),
}
)
_obj = cls.model_validate({
"label": obj.get("label"),
"kind": obj.get("kind"),
"detail": obj.get("detail"),
"documentation": obj.get("documentation"),
"sortText": obj.get("sortText"),
"filterText": obj.get("filterText"),
"insertText": obj.get("insertText")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,12 +24,10 @@ from daytona_api_client.models.completion_item import CompletionItem
from typing import Optional, Set
from typing_extensions import Self
class CompletionList(BaseModel):
"""
CompletionList
""" # noqa: E501
""" # noqa: E501
is_incomplete: StrictBool = Field(alias="isIncomplete")
items: List[CompletionItem]
additional_properties: Dict[str, Any] = {}
@@ -41,6 +39,7 @@ class CompletionList(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -66,11 +65,9 @@ class CompletionList(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -83,7 +80,7 @@ class CompletionList(BaseModel):
for _item_items in self.items:
if _item_items:
_items.append(_item_items.to_dict())
_dict["items"] = _items
_dict['items'] = _items
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -100,17 +97,15 @@ class CompletionList(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"isIncomplete": obj.get("isIncomplete"),
"items": [CompletionItem.from_dict(_item) for _item in obj["items"]]
if obj.get("items") is not None
else None,
}
)
_obj = cls.model_validate({
"isIncomplete": obj.get("isIncomplete"),
"items": [CompletionItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,40 +24,22 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class CreateApiKey(BaseModel):
"""
CreateApiKey
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of the API key")
permissions: List[StrictStr] = Field(
description="The list of organization resource permissions assigned to the API key"
)
permissions: List[StrictStr] = Field(description="The list of organization resource permissions assigned to the API key")
expires_at: Optional[datetime] = Field(default=None, description="When the API key expires", alias="expiresAt")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name", "permissions", "expiresAt"]
@field_validator("permissions")
@field_validator('permissions')
def permissions_validate_enum(cls, value):
"""Validates the enum"""
for i in value:
if i not in set(
[
"write:registries",
"delete:registries",
"write:snapshots",
"delete:snapshots",
"write:sandboxes",
"delete:sandboxes",
"read:volumes",
"write:volumes",
"delete:volumes",
]
):
raise ValueError(
"each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')"
)
if i not in set(['write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes']):
raise ValueError("each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')")
return value
model_config = ConfigDict(
@@ -66,6 +48,7 @@ class CreateApiKey(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -91,11 +74,9 @@ class CreateApiKey(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -110,7 +91,7 @@ class CreateApiKey(BaseModel):
# set to None if expires_at (nullable) is None
# and model_fields_set contains the field
if self.expires_at is None and "expires_at" in self.model_fields_set:
_dict["expiresAt"] = None
_dict['expiresAt'] = None
return _dict
@@ -123,12 +104,16 @@ class CreateApiKey(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"name": obj.get("name"), "permissions": obj.get("permissions"), "expiresAt": obj.get("expiresAt")}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"permissions": obj.get("permissions"),
"expiresAt": obj.get("expiresAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,18 +23,12 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class CreateBuildInfo(BaseModel):
"""
CreateBuildInfo
""" # noqa: E501
dockerfile_content: StrictStr = Field(
description="The Dockerfile content used for the build", alias="dockerfileContent"
)
context_hashes: Optional[List[StrictStr]] = Field(
default=None, description="The context hashes used for the build", alias="contextHashes"
)
""" # noqa: E501
dockerfile_content: StrictStr = Field(description="The Dockerfile content used for the build", alias="dockerfileContent")
context_hashes: Optional[List[StrictStr]] = Field(default=None, description="The context hashes used for the build", alias="contextHashes")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["dockerfileContent", "contextHashes"]
@@ -44,6 +38,7 @@ class CreateBuildInfo(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -69,11 +64,9 @@ class CreateBuildInfo(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -96,12 +89,15 @@ class CreateBuildInfo(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"dockerfileContent": obj.get("dockerfileContent"), "contextHashes": obj.get("contextHashes")}
)
_obj = cls.model_validate({
"dockerfileContent": obj.get("dockerfileContent"),
"contextHashes": obj.get("contextHashes")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateDockerRegistry(BaseModel):
"""
CreateDockerRegistry
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="Registry name")
url: StrictStr = Field(description="Registry URL")
username: StrictStr = Field(description="Registry username")
@@ -39,10 +37,10 @@ class CreateDockerRegistry(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name", "url", "username", "password", "project", "registryType", "isDefault"]
@field_validator("registry_type")
@field_validator('registry_type')
def registry_type_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["internal", "organization", "public", "transient"]):
if value not in set(['internal', 'organization', 'public', 'transient']):
raise ValueError("must be one of enum values ('internal', 'organization', 'public', 'transient')")
return value
@@ -52,6 +50,7 @@ class CreateDockerRegistry(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -77,11 +76,9 @@ class CreateDockerRegistry(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -104,20 +101,20 @@ class CreateDockerRegistry(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"url": obj.get("url"),
"username": obj.get("username"),
"password": obj.get("password"),
"project": obj.get("project"),
"registryType": obj.get("registryType") if obj.get("registryType") is not None else "internal",
"isDefault": obj.get("isDefault") if obj.get("isDefault") is not None else False,
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"url": obj.get("url"),
"username": obj.get("username"),
"password": obj.get("password"),
"project": obj.get("project"),
"registryType": obj.get("registryType") if obj.get("registryType") is not None else 'internal',
"isDefault": obj.get("isDefault") if obj.get("isDefault") is not None else False
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateLinkedAccount(BaseModel):
"""
CreateLinkedAccount
""" # noqa: E501
""" # noqa: E501
provider: StrictStr = Field(description="The authentication provider of the secondary account")
user_id: StrictStr = Field(description="The user ID of the secondary account", alias="userId")
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class CreateLinkedAccount(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class CreateLinkedAccount(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class CreateLinkedAccount(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"provider": obj.get("provider"), "userId": obj.get("userId")})
_obj = cls.model_validate({
"provider": obj.get("provider"),
"userId": obj.get("userId")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateOrganization(BaseModel):
"""
CreateOrganization
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of organization")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name"]
@@ -39,6 +37,7 @@ class CreateOrganization(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -64,11 +63,9 @@ class CreateOrganization(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -91,10 +88,14 @@ class CreateOrganization(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"name": obj.get("name")})
_obj = cls.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,27 +24,21 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class CreateOrganizationInvitation(BaseModel):
"""
CreateOrganizationInvitation
""" # noqa: E501
""" # noqa: E501
email: StrictStr = Field(description="Email address of the invitee")
role: StrictStr = Field(description="Organization member role for the invitee")
assigned_role_ids: List[StrictStr] = Field(
description="Array of assigned role IDs for the invitee", alias="assignedRoleIds"
)
expires_at: Optional[datetime] = Field(
default=None, description="Expiration date of the invitation", alias="expiresAt"
)
assigned_role_ids: List[StrictStr] = Field(description="Array of assigned role IDs for the invitee", alias="assignedRoleIds")
expires_at: Optional[datetime] = Field(default=None, description="Expiration date of the invitation", alias="expiresAt")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["email", "role", "assignedRoleIds", "expiresAt"]
@field_validator("role")
@field_validator('role')
def role_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["owner", "member"]):
if value not in set(['owner', 'member']):
raise ValueError("must be one of enum values ('owner', 'member')")
return value
@@ -54,6 +48,7 @@ class CreateOrganizationInvitation(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -79,11 +74,9 @@ class CreateOrganizationInvitation(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -106,17 +99,17 @@ class CreateOrganizationInvitation(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"email": obj.get("email"),
"role": obj.get("role") if obj.get("role") is not None else "member",
"assignedRoleIds": obj.get("assignedRoleIds"),
"expiresAt": obj.get("expiresAt"),
}
)
_obj = cls.model_validate({
"email": obj.get("email"),
"role": obj.get("role") if obj.get("role") is not None else 'member',
"assignedRoleIds": obj.get("assignedRoleIds"),
"expiresAt": obj.get("expiresAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class CreateOrganizationQuota(BaseModel):
"""
CreateOrganizationQuota
""" # noqa: E501
""" # noqa: E501
total_cpu_quota: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalCpuQuota")
total_memory_quota: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalMemoryQuota")
total_disk_quota: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalDiskQuota")
@@ -39,17 +37,7 @@ class CreateOrganizationQuota(BaseModel):
max_snapshot_size: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="maxSnapshotSize")
volume_quota: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="volumeQuota")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"totalCpuQuota",
"totalMemoryQuota",
"totalDiskQuota",
"maxCpuPerSandbox",
"maxMemoryPerSandbox",
"maxDiskPerSandbox",
"snapshotQuota",
"maxSnapshotSize",
"volumeQuota",
]
__properties: ClassVar[List[str]] = ["totalCpuQuota", "totalMemoryQuota", "totalDiskQuota", "maxCpuPerSandbox", "maxMemoryPerSandbox", "maxDiskPerSandbox", "snapshotQuota", "maxSnapshotSize", "volumeQuota"]
model_config = ConfigDict(
populate_by_name=True,
@@ -57,6 +45,7 @@ class CreateOrganizationQuota(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -82,11 +71,9 @@ class CreateOrganizationQuota(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -109,22 +96,22 @@ class CreateOrganizationQuota(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"totalCpuQuota": obj.get("totalCpuQuota"),
"totalMemoryQuota": obj.get("totalMemoryQuota"),
"totalDiskQuota": obj.get("totalDiskQuota"),
"maxCpuPerSandbox": obj.get("maxCpuPerSandbox"),
"maxMemoryPerSandbox": obj.get("maxMemoryPerSandbox"),
"maxDiskPerSandbox": obj.get("maxDiskPerSandbox"),
"snapshotQuota": obj.get("snapshotQuota"),
"maxSnapshotSize": obj.get("maxSnapshotSize"),
"volumeQuota": obj.get("volumeQuota"),
}
)
_obj = cls.model_validate({
"totalCpuQuota": obj.get("totalCpuQuota"),
"totalMemoryQuota": obj.get("totalMemoryQuota"),
"totalDiskQuota": obj.get("totalDiskQuota"),
"maxCpuPerSandbox": obj.get("maxCpuPerSandbox"),
"maxMemoryPerSandbox": obj.get("maxMemoryPerSandbox"),
"maxDiskPerSandbox": obj.get("maxDiskPerSandbox"),
"snapshotQuota": obj.get("snapshotQuota"),
"maxSnapshotSize": obj.get("maxSnapshotSize"),
"volumeQuota": obj.get("volumeQuota")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,38 +23,22 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateOrganizationRole(BaseModel):
"""
CreateOrganizationRole
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of the role")
description: StrictStr = Field(description="The description of the role")
permissions: List[StrictStr] = Field(description="The list of permissions assigned to the role")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name", "description", "permissions"]
@field_validator("permissions")
@field_validator('permissions')
def permissions_validate_enum(cls, value):
"""Validates the enum"""
for i in value:
if i not in set(
[
"write:registries",
"delete:registries",
"write:snapshots",
"delete:snapshots",
"write:sandboxes",
"delete:sandboxes",
"read:volumes",
"write:volumes",
"delete:volumes",
]
):
raise ValueError(
"each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')"
)
if i not in set(['write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes']):
raise ValueError("each list item must be one of ('write:registries', 'delete:registries', 'write:snapshots', 'delete:snapshots', 'write:sandboxes', 'delete:sandboxes', 'read:volumes', 'write:volumes', 'delete:volumes')")
return value
model_config = ConfigDict(
@@ -63,6 +47,7 @@ class CreateOrganizationRole(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -88,11 +73,9 @@ class CreateOrganizationRole(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -115,12 +98,16 @@ class CreateOrganizationRole(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"name": obj.get("name"), "description": obj.get("description"), "permissions": obj.get("permissions")}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"description": obj.get("description"),
"permissions": obj.get("permissions")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Union
from typing import Optional, Set
from typing_extensions import Self
class CreateRunner(BaseModel):
"""
CreateRunner
""" # noqa: E501
""" # noqa: E501
domain: StrictStr
api_url: StrictStr = Field(alias="apiUrl")
api_key: StrictStr = Field(alias="apiKey")
@@ -41,31 +39,19 @@ class CreateRunner(BaseModel):
capacity: Union[StrictFloat, StrictInt]
region: StrictStr
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"domain",
"apiUrl",
"apiKey",
"cpu",
"memory",
"disk",
"gpu",
"gpuType",
"class",
"capacity",
"region",
]
__properties: ClassVar[List[str]] = ["domain", "apiUrl", "apiKey", "cpu", "memory", "disk", "gpu", "gpuType", "class", "capacity", "region"]
@field_validator("var_class")
@field_validator('var_class')
def var_class_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["small", "medium", "large"]):
if value not in set(['small', 'medium', 'large']):
raise ValueError("must be one of enum values ('small', 'medium', 'large')")
return value
@field_validator("region")
@field_validator('region')
def region_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["eu", "us", "asia"]):
if value not in set(['eu', 'us', 'asia']):
raise ValueError("must be one of enum values ('eu', 'us', 'asia')")
return value
@@ -75,6 +61,7 @@ class CreateRunner(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -100,11 +87,9 @@ class CreateRunner(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -127,24 +112,24 @@ class CreateRunner(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"domain": obj.get("domain"),
"apiUrl": obj.get("apiUrl"),
"apiKey": obj.get("apiKey"),
"cpu": obj.get("cpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"gpu": obj.get("gpu"),
"gpuType": obj.get("gpuType"),
"class": obj.get("class"),
"capacity": obj.get("capacity"),
"region": obj.get("region"),
}
)
_obj = cls.model_validate({
"domain": obj.get("domain"),
"apiUrl": obj.get("apiUrl"),
"apiKey": obj.get("apiKey"),
"cpu": obj.get("cpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"gpu": obj.get("gpu"),
"gpuType": obj.get("gpuType"),
"class": obj.get("class"),
"capacity": obj.get("capacity"),
"region": obj.get("region")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -25,79 +25,45 @@ from daytona_api_client.models.sandbox_volume import SandboxVolume
from typing import Optional, Set
from typing_extensions import Self
class CreateSandbox(BaseModel):
"""
CreateSandbox
""" # noqa: E501
snapshot: Optional[StrictStr] = Field(
default=None, description="The ID or name of the snapshot used for the sandbox"
)
""" # noqa: E501
snapshot: Optional[StrictStr] = Field(default=None, description="The ID or name of the snapshot used for the sandbox")
user: Optional[StrictStr] = Field(default=None, description="The user associated with the project")
env: Optional[Dict[str, StrictStr]] = Field(default=None, description="Environment variables for the sandbox")
labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels for the sandbox")
public: Optional[StrictBool] = Field(
default=None, description="Whether the sandbox http preview is publicly accessible"
)
public: Optional[StrictBool] = Field(default=None, description="Whether the sandbox http preview is publicly accessible")
var_class: Optional[StrictStr] = Field(default=None, description="The sandbox class type", alias="class")
target: Optional[StrictStr] = Field(
default=None, description="The target (region) where the sandbox will be created"
)
target: Optional[StrictStr] = Field(default=None, description="The target (region) where the sandbox will be created")
cpu: Optional[StrictInt] = Field(default=None, description="CPU cores allocated to the sandbox")
gpu: Optional[StrictInt] = Field(default=None, description="GPU units allocated to the sandbox")
memory: Optional[StrictInt] = Field(default=None, description="Memory allocated to the sandbox in GB")
disk: Optional[StrictInt] = Field(default=None, description="Disk space allocated to the sandbox in GB")
auto_stop_interval: Optional[StrictInt] = Field(
default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval"
)
auto_archive_interval: Optional[StrictInt] = Field(
default=None,
description="Auto-archive interval in minutes (0 means the maximum interval will be used)",
alias="autoArchiveInterval",
)
volumes: Optional[List[SandboxVolume]] = Field(
default=None, description="Array of volumes to attach to the sandbox"
)
build_info: Optional[CreateBuildInfo] = Field(
default=None, description="Build information for the sandbox", alias="buildInfo"
)
auto_stop_interval: Optional[StrictInt] = Field(default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval")
auto_archive_interval: Optional[StrictInt] = Field(default=None, description="Auto-archive interval in minutes (0 means the maximum interval will be used)", alias="autoArchiveInterval")
volumes: Optional[List[SandboxVolume]] = Field(default=None, description="Array of volumes to attach to the sandbox")
build_info: Optional[CreateBuildInfo] = Field(default=None, description="Build information for the sandbox", alias="buildInfo")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"snapshot",
"user",
"env",
"labels",
"public",
"class",
"target",
"cpu",
"gpu",
"memory",
"disk",
"autoStopInterval",
"autoArchiveInterval",
"volumes",
"buildInfo",
]
__properties: ClassVar[List[str]] = ["snapshot", "user", "env", "labels", "public", "class", "target", "cpu", "gpu", "memory", "disk", "autoStopInterval", "autoArchiveInterval", "volumes", "buildInfo"]
@field_validator("var_class")
@field_validator('var_class')
def var_class_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(["small", "medium", "large"]):
if value not in set(['small', 'medium', 'large']):
raise ValueError("must be one of enum values ('small', 'medium', 'large')")
return value
@field_validator("target")
@field_validator('target')
def target_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(["eu", "us", "asia"]):
if value not in set(['eu', 'us', 'asia']):
raise ValueError("must be one of enum values ('eu', 'us', 'asia')")
return value
@@ -107,6 +73,7 @@ class CreateSandbox(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -132,11 +99,9 @@ class CreateSandbox(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -149,10 +114,10 @@ class CreateSandbox(BaseModel):
for _item_volumes in self.volumes:
if _item_volumes:
_items.append(_item_volumes.to_dict())
_dict["volumes"] = _items
_dict['volumes'] = _items
# override the default output from pydantic by calling `to_dict()` of build_info
if self.build_info:
_dict["buildInfo"] = self.build_info.to_dict()
_dict['buildInfo'] = self.build_info.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -169,30 +134,28 @@ class CreateSandbox(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"snapshot": obj.get("snapshot"),
"user": obj.get("user"),
"env": obj.get("env"),
"labels": obj.get("labels"),
"public": obj.get("public"),
"class": obj.get("class"),
"target": obj.get("target"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"autoStopInterval": obj.get("autoStopInterval"),
"autoArchiveInterval": obj.get("autoArchiveInterval"),
"volumes": [SandboxVolume.from_dict(_item) for _item in obj["volumes"]]
if obj.get("volumes") is not None
else None,
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None,
}
)
_obj = cls.model_validate({
"snapshot": obj.get("snapshot"),
"user": obj.get("user"),
"env": obj.get("env"),
"labels": obj.get("labels"),
"public": obj.get("public"),
"class": obj.get("class"),
"target": obj.get("target"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"autoStopInterval": obj.get("autoStopInterval"),
"autoArchiveInterval": obj.get("autoArchiveInterval"),
"volumes": [SandboxVolume.from_dict(_item) for _item in obj["volumes"]] if obj.get("volumes") is not None else None,
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateSessionRequest(BaseModel):
"""
CreateSessionRequest
""" # noqa: E501
""" # noqa: E501
session_id: StrictStr = Field(description="The ID of the session", alias="sessionId")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["sessionId"]
@@ -39,6 +37,7 @@ class CreateSessionRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -64,11 +63,9 @@ class CreateSessionRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -91,10 +88,14 @@ class CreateSessionRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"sessionId": obj.get("sessionId")})
_obj = cls.model_validate({
"sessionId": obj.get("sessionId")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,37 +24,21 @@ from daytona_api_client.models.create_build_info import CreateBuildInfo
from typing import Optional, Set
from typing_extensions import Self
class CreateSnapshot(BaseModel):
"""
CreateSnapshot
""" # noqa: E501
""" # noqa: E501
name: StrictStr = Field(description="The name of the snapshot")
image_name: Optional[StrictStr] = Field(
default=None, description="The image name of the snapshot", alias="imageName"
)
image_name: Optional[StrictStr] = Field(default=None, description="The image name of the snapshot", alias="imageName")
entrypoint: Optional[List[StrictStr]] = Field(default=None, description="The entrypoint command for the snapshot")
general: Optional[StrictBool] = Field(default=None, description="Whether the snapshot is general")
cpu: Optional[StrictInt] = Field(default=None, description="CPU cores allocated to the resulting sandbox")
gpu: Optional[StrictInt] = Field(default=None, description="GPU units allocated to the resulting sandbox")
memory: Optional[StrictInt] = Field(default=None, description="Memory allocated to the resulting sandbox in GB")
disk: Optional[StrictInt] = Field(default=None, description="Disk space allocated to the sandbox in GB")
build_info: Optional[CreateBuildInfo] = Field(
default=None, description="Build information for the snapshot", alias="buildInfo"
)
build_info: Optional[CreateBuildInfo] = Field(default=None, description="Build information for the snapshot", alias="buildInfo")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"name",
"imageName",
"entrypoint",
"general",
"cpu",
"gpu",
"memory",
"disk",
"buildInfo",
]
__properties: ClassVar[List[str]] = ["name", "imageName", "entrypoint", "general", "cpu", "gpu", "memory", "disk", "buildInfo"]
model_config = ConfigDict(
populate_by_name=True,
@@ -62,6 +46,7 @@ class CreateSnapshot(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -87,11 +72,9 @@ class CreateSnapshot(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -100,7 +83,7 @@ class CreateSnapshot(BaseModel):
)
# override the default output from pydantic by calling `to_dict()` of build_info
if self.build_info:
_dict["buildInfo"] = self.build_info.to_dict()
_dict['buildInfo'] = self.build_info.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -117,22 +100,22 @@ class CreateSnapshot(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"imageName": obj.get("imageName"),
"entrypoint": obj.get("entrypoint"),
"general": obj.get("general"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None,
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"imageName": obj.get("imageName"),
"entrypoint": obj.get("entrypoint"),
"general": obj.get("general"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,30 +24,26 @@ from daytona_api_client.models.create_organization_quota import CreateOrganizati
from typing import Optional, Set
from typing_extensions import Self
class CreateUser(BaseModel):
"""
CreateUser
""" # noqa: E501
""" # noqa: E501
id: StrictStr
name: StrictStr
email: Optional[StrictStr] = None
personal_organization_quota: Optional[CreateOrganizationQuota] = Field(
default=None, alias="personalOrganizationQuota"
)
personal_organization_quota: Optional[CreateOrganizationQuota] = Field(default=None, alias="personalOrganizationQuota")
role: Optional[StrictStr] = None
email_verified: Optional[StrictBool] = Field(default=None, alias="emailVerified")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["id", "name", "email", "personalOrganizationQuota", "role", "emailVerified"]
@field_validator("role")
@field_validator('role')
def role_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(["admin", "user"]):
if value not in set(['admin', 'user']):
raise ValueError("must be one of enum values ('admin', 'user')")
return value
@@ -57,6 +53,7 @@ class CreateUser(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -82,11 +79,9 @@ class CreateUser(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -95,7 +90,7 @@ class CreateUser(BaseModel):
)
# override the default output from pydantic by calling `to_dict()` of personal_organization_quota
if self.personal_organization_quota:
_dict["personalOrganizationQuota"] = self.personal_organization_quota.to_dict()
_dict['personalOrganizationQuota'] = self.personal_organization_quota.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -112,21 +107,19 @@ class CreateUser(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"id": obj.get("id"),
"name": obj.get("name"),
"email": obj.get("email"),
"personalOrganizationQuota": CreateOrganizationQuota.from_dict(obj["personalOrganizationQuota"])
if obj.get("personalOrganizationQuota") is not None
else None,
"role": obj.get("role"),
"emailVerified": obj.get("emailVerified"),
}
)
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"email": obj.get("email"),
"personalOrganizationQuota": CreateOrganizationQuota.from_dict(obj["personalOrganizationQuota"]) if obj.get("personalOrganizationQuota") is not None else None,
"role": obj.get("role"),
"emailVerified": obj.get("emailVerified")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class CreateVolume(BaseModel):
"""
CreateVolume
""" # noqa: E501
""" # noqa: E501
name: StrictStr
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["name"]
@@ -39,6 +37,7 @@ class CreateVolume(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -64,11 +63,9 @@ class CreateVolume(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -91,10 +88,14 @@ class CreateVolume(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"name": obj.get("name")})
_obj = cls.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -25,77 +25,45 @@ from daytona_api_client.models.sandbox_volume import SandboxVolume
from typing import Optional, Set
from typing_extensions import Self
class CreateWorkspace(BaseModel):
"""
CreateWorkspace
""" # noqa: E501
""" # noqa: E501
image: Optional[StrictStr] = Field(default=None, description="The image used for the workspace")
user: Optional[StrictStr] = Field(default=None, description="The user associated with the project")
env: Optional[Dict[str, StrictStr]] = Field(default=None, description="Environment variables for the workspace")
labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels for the workspace")
public: Optional[StrictBool] = Field(
default=None, description="Whether the workspace http preview is publicly accessible"
)
public: Optional[StrictBool] = Field(default=None, description="Whether the workspace http preview is publicly accessible")
var_class: Optional[StrictStr] = Field(default=None, description="The workspace class type", alias="class")
target: Optional[StrictStr] = Field(
default=None, description="The target (region) where the workspace will be created"
)
target: Optional[StrictStr] = Field(default=None, description="The target (region) where the workspace will be created")
cpu: Optional[StrictInt] = Field(default=None, description="CPU cores allocated to the workspace")
gpu: Optional[StrictInt] = Field(default=None, description="GPU units allocated to the workspace")
memory: Optional[StrictInt] = Field(default=None, description="Memory allocated to the workspace in GB")
disk: Optional[StrictInt] = Field(default=None, description="Disk space allocated to the workspace in GB")
auto_stop_interval: Optional[StrictInt] = Field(
default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval"
)
auto_archive_interval: Optional[StrictInt] = Field(
default=None,
description="Auto-archive interval in minutes (0 means the maximum interval will be used)",
alias="autoArchiveInterval",
)
volumes: Optional[List[SandboxVolume]] = Field(
default=None, description="Array of volumes to attach to the workspace"
)
build_info: Optional[CreateBuildInfo] = Field(
default=None, description="Build information for the workspace", alias="buildInfo"
)
auto_stop_interval: Optional[StrictInt] = Field(default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval")
auto_archive_interval: Optional[StrictInt] = Field(default=None, description="Auto-archive interval in minutes (0 means the maximum interval will be used)", alias="autoArchiveInterval")
volumes: Optional[List[SandboxVolume]] = Field(default=None, description="Array of volumes to attach to the workspace")
build_info: Optional[CreateBuildInfo] = Field(default=None, description="Build information for the workspace", alias="buildInfo")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"image",
"user",
"env",
"labels",
"public",
"class",
"target",
"cpu",
"gpu",
"memory",
"disk",
"autoStopInterval",
"autoArchiveInterval",
"volumes",
"buildInfo",
]
__properties: ClassVar[List[str]] = ["image", "user", "env", "labels", "public", "class", "target", "cpu", "gpu", "memory", "disk", "autoStopInterval", "autoArchiveInterval", "volumes", "buildInfo"]
@field_validator("var_class")
@field_validator('var_class')
def var_class_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(["small", "medium", "large"]):
if value not in set(['small', 'medium', 'large']):
raise ValueError("must be one of enum values ('small', 'medium', 'large')")
return value
@field_validator("target")
@field_validator('target')
def target_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(["eu", "us", "asia"]):
if value not in set(['eu', 'us', 'asia']):
raise ValueError("must be one of enum values ('eu', 'us', 'asia')")
return value
@@ -105,6 +73,7 @@ class CreateWorkspace(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -130,11 +99,9 @@ class CreateWorkspace(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -147,10 +114,10 @@ class CreateWorkspace(BaseModel):
for _item_volumes in self.volumes:
if _item_volumes:
_items.append(_item_volumes.to_dict())
_dict["volumes"] = _items
_dict['volumes'] = _items
# override the default output from pydantic by calling `to_dict()` of build_info
if self.build_info:
_dict["buildInfo"] = self.build_info.to_dict()
_dict['buildInfo'] = self.build_info.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -167,30 +134,28 @@ class CreateWorkspace(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"image": obj.get("image"),
"user": obj.get("user"),
"env": obj.get("env"),
"labels": obj.get("labels"),
"public": obj.get("public"),
"class": obj.get("class"),
"target": obj.get("target"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"autoStopInterval": obj.get("autoStopInterval"),
"autoArchiveInterval": obj.get("autoArchiveInterval"),
"volumes": [SandboxVolume.from_dict(_item) for _item in obj["volumes"]]
if obj.get("volumes") is not None
else None,
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None,
}
)
_obj = cls.model_validate({
"image": obj.get("image"),
"user": obj.get("user"),
"env": obj.get("env"),
"labels": obj.get("labels"),
"public": obj.get("public"),
"class": obj.get("class"),
"target": obj.get("target"),
"cpu": obj.get("cpu"),
"gpu": obj.get("gpu"),
"memory": obj.get("memory"),
"disk": obj.get("disk"),
"autoStopInterval": obj.get("autoStopInterval"),
"autoArchiveInterval": obj.get("autoArchiveInterval"),
"volumes": [SandboxVolume.from_dict(_item) for _item in obj["volumes"]] if obj.get("volumes") is not None else None,
"buildInfo": CreateBuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -24,12 +24,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class DockerRegistry(BaseModel):
"""
DockerRegistry
""" # noqa: E501
""" # noqa: E501
id: StrictStr = Field(description="Registry ID")
name: StrictStr = Field(description="Registry name")
url: StrictStr = Field(description="Registry URL")
@@ -39,21 +37,12 @@ class DockerRegistry(BaseModel):
created_at: datetime = Field(description="Creation timestamp", alias="createdAt")
updated_at: datetime = Field(description="Last update timestamp", alias="updatedAt")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = [
"id",
"name",
"url",
"username",
"project",
"registryType",
"createdAt",
"updatedAt",
]
__properties: ClassVar[List[str]] = ["id", "name", "url", "username", "project", "registryType", "createdAt", "updatedAt"]
@field_validator("registry_type")
@field_validator('registry_type')
def registry_type_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["internal", "organization", "public", "transient"]):
if value not in set(['internal', 'organization', 'public', 'transient']):
raise ValueError("must be one of enum values ('internal', 'organization', 'public', 'transient')")
return value
@@ -63,6 +52,7 @@ class DockerRegistry(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -88,11 +78,9 @@ class DockerRegistry(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -115,21 +103,21 @@ class DockerRegistry(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"id": obj.get("id"),
"name": obj.get("name"),
"url": obj.get("url"),
"username": obj.get("username"),
"project": obj.get("project"),
"registryType": obj.get("registryType"),
"createdAt": obj.get("createdAt"),
"updatedAt": obj.get("updatedAt"),
}
)
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"url": obj.get("url"),
"username": obj.get("username"),
"project": obj.get("project"),
"registryType": obj.get("registryType"),
"createdAt": obj.get("createdAt"),
"updatedAt": obj.get("updatedAt")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,17 +23,13 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class ExecuteRequest(BaseModel):
"""
ExecuteRequest
""" # noqa: E501
""" # noqa: E501
command: StrictStr
cwd: Optional[StrictStr] = Field(default=None, description="Current working directory")
timeout: Optional[Union[StrictFloat, StrictInt]] = Field(
default=None, description="Timeout in seconds, defaults to 10 seconds"
)
timeout: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Timeout in seconds, defaults to 10 seconds")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["command", "cwd", "timeout"]
@@ -43,6 +39,7 @@ class ExecuteRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -68,11 +65,9 @@ class ExecuteRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -95,10 +90,16 @@ class ExecuteRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"command": obj.get("command"), "cwd": obj.get("cwd"), "timeout": obj.get("timeout")})
_obj = cls.model_validate({
"command": obj.get("command"),
"cwd": obj.get("cwd"),
"timeout": obj.get("timeout")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Union
from typing import Optional, Set
from typing_extensions import Self
class ExecuteResponse(BaseModel):
"""
ExecuteResponse
""" # noqa: E501
""" # noqa: E501
exit_code: Union[StrictFloat, StrictInt] = Field(description="Exit code", alias="exitCode")
result: StrictStr = Field(description="Command output")
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class ExecuteResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class ExecuteResponse(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class ExecuteResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"exitCode": obj.get("exitCode"), "result": obj.get("result")})
_obj = cls.model_validate({
"exitCode": obj.get("exitCode"),
"result": obj.get("result")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
+17 -20
View File
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Union
from typing import Optional, Set
from typing_extensions import Self
class FileInfo(BaseModel):
"""
FileInfo
""" # noqa: E501
""" # noqa: E501
name: StrictStr
is_dir: StrictBool = Field(alias="isDir")
size: Union[StrictFloat, StrictInt]
@@ -46,6 +44,7 @@ class FileInfo(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -71,11 +70,9 @@ class FileInfo(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -98,21 +95,21 @@ class FileInfo(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"isDir": obj.get("isDir"),
"size": obj.get("size"),
"modTime": obj.get("modTime"),
"mode": obj.get("mode"),
"permissions": obj.get("permissions"),
"owner": obj.get("owner"),
"group": obj.get("group"),
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"isDir": obj.get("isDir"),
"size": obj.get("size"),
"modTime": obj.get("modTime"),
"mode": obj.get("mode"),
"permissions": obj.get("permissions"),
"owner": obj.get("owner"),
"group": obj.get("group")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class FileStatus(BaseModel):
"""
FileStatus
""" # noqa: E501
""" # noqa: E501
name: StrictStr
staging: StrictStr
worktree: StrictStr
@@ -42,6 +40,7 @@ class FileStatus(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -67,11 +66,9 @@ class FileStatus(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -94,17 +91,17 @@ class FileStatus(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"name": obj.get("name"),
"staging": obj.get("staging"),
"worktree": obj.get("worktree"),
"extra": obj.get("extra"),
}
)
_obj = cls.model_validate({
"name": obj.get("name"),
"staging": obj.get("staging"),
"worktree": obj.get("worktree"),
"extra": obj.get("extra")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitAddRequest(BaseModel):
"""
GitAddRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
files: List[StrictStr] = Field(description="files to add (use . for all files)")
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class GitAddRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class GitAddRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class GitAddRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"path": obj.get("path"), "files": obj.get("files")})
_obj = cls.model_validate({
"path": obj.get("path"),
"files": obj.get("files")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitBranchRequest(BaseModel):
"""
GitBranchRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
name: StrictStr
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class GitBranchRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class GitBranchRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class GitBranchRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"path": obj.get("path"), "name": obj.get("name")})
_obj = cls.model_validate({
"path": obj.get("path"),
"name": obj.get("name")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitCheckoutRequest(BaseModel):
"""
GitCheckoutRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
branch: StrictStr
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class GitCheckoutRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class GitCheckoutRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class GitCheckoutRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"path": obj.get("path"), "branch": obj.get("branch")})
_obj = cls.model_validate({
"path": obj.get("path"),
"branch": obj.get("branch")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class GitCloneRequest(BaseModel):
"""
GitCloneRequest
""" # noqa: E501
""" # noqa: E501
url: StrictStr
path: StrictStr
username: Optional[StrictStr] = None
@@ -44,6 +42,7 @@ class GitCloneRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -69,11 +68,9 @@ class GitCloneRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -96,19 +93,19 @@ class GitCloneRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"url": obj.get("url"),
"path": obj.get("path"),
"username": obj.get("username"),
"password": obj.get("password"),
"branch": obj.get("branch"),
"commit_id": obj.get("commit_id"),
}
)
_obj = cls.model_validate({
"url": obj.get("url"),
"path": obj.get("path"),
"username": obj.get("username"),
"password": obj.get("password"),
"branch": obj.get("branch"),
"commit_id": obj.get("commit_id")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitCommitInfo(BaseModel):
"""
GitCommitInfo
""" # noqa: E501
""" # noqa: E501
hash: StrictStr
message: StrictStr
author: StrictStr
@@ -43,6 +41,7 @@ class GitCommitInfo(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -68,11 +67,9 @@ class GitCommitInfo(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -95,18 +92,18 @@ class GitCommitInfo(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"hash": obj.get("hash"),
"message": obj.get("message"),
"author": obj.get("author"),
"email": obj.get("email"),
"timestamp": obj.get("timestamp"),
}
)
_obj = cls.model_validate({
"hash": obj.get("hash"),
"message": obj.get("message"),
"author": obj.get("author"),
"email": obj.get("email"),
"timestamp": obj.get("timestamp")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitCommitRequest(BaseModel):
"""
GitCommitRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
message: StrictStr
author: StrictStr
@@ -42,6 +40,7 @@ class GitCommitRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -67,11 +66,9 @@ class GitCommitRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -94,17 +91,17 @@ class GitCommitRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"path": obj.get("path"),
"message": obj.get("message"),
"author": obj.get("author"),
"email": obj.get("email"),
}
)
_obj = cls.model_validate({
"path": obj.get("path"),
"message": obj.get("message"),
"author": obj.get("author"),
"email": obj.get("email")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitCommitResponse(BaseModel):
"""
GitCommitResponse
""" # noqa: E501
""" # noqa: E501
hash: StrictStr
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["hash"]
@@ -39,6 +37,7 @@ class GitCommitResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -64,11 +63,9 @@ class GitCommitResponse(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -91,10 +88,14 @@ class GitCommitResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"hash": obj.get("hash")})
_obj = cls.model_validate({
"hash": obj.get("hash")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class GitDeleteBranchRequest(BaseModel):
"""
GitDeleteBranchRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
name: StrictStr
additional_properties: Dict[str, Any] = {}
@@ -40,6 +38,7 @@ class GitDeleteBranchRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -65,11 +64,9 @@ class GitDeleteBranchRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -92,10 +89,15 @@ class GitDeleteBranchRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"path": obj.get("path"), "name": obj.get("name")})
_obj = cls.model_validate({
"path": obj.get("path"),
"name": obj.get("name")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class GitRepoRequest(BaseModel):
"""
GitRepoRequest
""" # noqa: E501
""" # noqa: E501
path: StrictStr
username: Optional[StrictStr] = None
password: Optional[StrictStr] = None
@@ -41,6 +39,7 @@ class GitRepoRequest(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -66,11 +65,9 @@ class GitRepoRequest(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -93,12 +90,16 @@ class GitRepoRequest(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"path": obj.get("path"), "username": obj.get("username"), "password": obj.get("password")}
)
_obj = cls.model_validate({
"path": obj.get("path"),
"username": obj.get("username"),
"password": obj.get("password")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
+15 -20
View File
@@ -24,12 +24,10 @@ from daytona_api_client.models.file_status import FileStatus
from typing import Optional, Set
from typing_extensions import Self
class GitStatus(BaseModel):
"""
GitStatus
""" # noqa: E501
""" # noqa: E501
current_branch: StrictStr = Field(alias="currentBranch")
file_status: List[FileStatus] = Field(alias="fileStatus")
ahead: Optional[Union[StrictFloat, StrictInt]] = None
@@ -44,6 +42,7 @@ class GitStatus(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -69,11 +68,9 @@ class GitStatus(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -86,7 +83,7 @@ class GitStatus(BaseModel):
for _item_file_status in self.file_status:
if _item_file_status:
_items.append(_item_file_status.to_dict())
_dict["fileStatus"] = _items
_dict['fileStatus'] = _items
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -103,20 +100,18 @@ class GitStatus(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"currentBranch": obj.get("currentBranch"),
"fileStatus": [FileStatus.from_dict(_item) for _item in obj["fileStatus"]]
if obj.get("fileStatus") is not None
else None,
"ahead": obj.get("ahead"),
"behind": obj.get("behind"),
"branchPublished": obj.get("branchPublished"),
}
)
_obj = cls.model_validate({
"currentBranch": obj.get("currentBranch"),
"fileStatus": [FileStatus.from_dict(_item) for _item in obj["fileStatus"]] if obj.get("fileStatus") is not None else None,
"ahead": obj.get("ahead"),
"behind": obj.get("behind"),
"branchPublished": obj.get("branchPublished")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -23,12 +23,10 @@ from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self
class ListBranchResponse(BaseModel):
"""
ListBranchResponse
""" # noqa: E501
""" # noqa: E501
branches: List[StrictStr]
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["branches"]
@@ -39,6 +37,7 @@ class ListBranchResponse(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -64,11 +63,9 @@ class ListBranchResponse(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -91,10 +88,14 @@ class ListBranchResponse(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({"branches": obj.get("branches")})
_obj = cls.model_validate({
"branches": obj.get("branches")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj
@@ -25,12 +25,10 @@ from daytona_api_client.models.position import Position
from typing import Optional, Set
from typing_extensions import Self
class LspCompletionParams(BaseModel):
"""
LspCompletionParams
""" # noqa: E501
""" # noqa: E501
language_id: StrictStr = Field(description="Language identifier", alias="languageId")
path_to_project: StrictStr = Field(description="Path to the project", alias="pathToProject")
uri: StrictStr = Field(description="Document URI")
@@ -45,6 +43,7 @@ class LspCompletionParams(BaseModel):
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
@@ -70,11 +69,9 @@ class LspCompletionParams(BaseModel):
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set(
[
"additional_properties",
]
)
excluded_fields: Set[str] = set([
"additional_properties",
])
_dict = self.model_dump(
by_alias=True,
@@ -83,10 +80,10 @@ class LspCompletionParams(BaseModel):
)
# override the default output from pydantic by calling `to_dict()` of position
if self.position:
_dict["position"] = self.position.to_dict()
_dict['position'] = self.position.to_dict()
# override the default output from pydantic by calling `to_dict()` of context
if self.context:
_dict["context"] = self.context.to_dict()
_dict['context'] = self.context.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
@@ -103,18 +100,18 @@ class LspCompletionParams(BaseModel):
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"languageId": obj.get("languageId"),
"pathToProject": obj.get("pathToProject"),
"uri": obj.get("uri"),
"position": Position.from_dict(obj["position"]) if obj.get("position") is not None else None,
"context": CompletionContext.from_dict(obj["context"]) if obj.get("context") is not None else None,
}
)
_obj = cls.model_validate({
"languageId": obj.get("languageId"),
"pathToProject": obj.get("pathToProject"),
"uri": obj.get("uri"),
"position": Position.from_dict(obj["position"]) if obj.get("position") is not None else None,
"context": CompletionContext.from_dict(obj["context"]) if obj.get("context") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj

Some files were not shown because too many files have changed in this diff Show More