chore(format): added pre-commit hooks and formatted files (#294)

Co-authored-by: steebchen <contact@luca-steeb.com>
This commit is contained in:
Abhiuday Gupta
2024-04-16 23:49:21 +05:30
committed by GitHub
parent 76cca3f666
commit c8a79aabf3
210 changed files with 6871 additions and 5993 deletions

View File

@@ -7,7 +7,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
@@ -29,7 +29,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false

View File

@@ -7,7 +7,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
@@ -29,7 +29,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false

View File

@@ -14,7 +14,7 @@ jobs:
with:
go-version: "1.21"
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
@@ -29,9 +29,9 @@ jobs:
run: go run github.com/steebchen/prisma-client-go generate
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v4
with:
version: v1.55.0
version: v1.57.1
args: --config .golangci.yml --timeout 5m --max-issues-per-linter 0 --max-same-issues 0
only-new-issues: true
skip-cache: true

View File

@@ -14,7 +14,7 @@ jobs:
env:
GITHUB_TAG: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GHCR
id: login-ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
@@ -38,7 +38,7 @@ jobs:
env:
GITHUB_TAG: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GHCR
id: login-ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
@@ -62,7 +62,7 @@ jobs:
env:
GITHUB_TAG: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GHCR
id: login-ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
@@ -86,7 +86,7 @@ jobs:
env:
GITHUB_TAG: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GHCR
id: login-ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
@@ -108,7 +108,7 @@ jobs:
env:
GITHUB_TAG: ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Login to GHCR
id: login-ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

View File

@@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: "3.x"

View File

@@ -10,12 +10,12 @@ jobs:
- uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@v2
uses: arduino/setup-protoc@v3
with:
version: "25.2"
- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2
- name: Setup Go
uses: actions/setup-go@v5
@@ -23,7 +23,7 @@ jobs:
go-version: "1.21"
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
@@ -54,7 +54,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@v2
uses: arduino/setup-protoc@v3
with:
version: "25.1"
@@ -81,12 +81,12 @@ jobs:
- uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@v2
uses: arduino/setup-protoc@v3
with:
version: "25.1"
- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2
- name: Setup Go
uses: actions/setup-go@v5
@@ -94,7 +94,7 @@ jobs:
go-version: "1.21"
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
@@ -134,10 +134,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2
- name: Install Protoc
uses: arduino/setup-protoc@v2
uses: arduino/setup-protoc@v3
with:
version: "25.1"
@@ -147,7 +147,7 @@ jobs:
go-version: "1.21"
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
@@ -223,10 +223,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2
- name: Install Protoc
uses: arduino/setup-protoc@v2
uses: arduino/setup-protoc@v3
with:
version: "25.1"
@@ -236,7 +236,7 @@ jobs:
go-version: "1.21"
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false

View File

@@ -1,7 +1,33 @@
repos:
- repo: https://github.com/gitguardian/ggshield
rev: v1.23.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: ggshield
language_version: python3
stages: [commit]
- id: no-commit-to-branch
args: ["--branch=main"]
- id: check-merge-conflict
- id: mixed-line-ending
args: ["--fix=lf"]
- id: end-of-file-fixer
exclude: \.sql
- id: check-yaml
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: ["isort[pyproject]"]
exclude: _pb2(_grpc)?\.py
types:
- python
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
args: ["--config=python-sdk/pyproject.toml"]
exclude: _pb2(_grpc)?\.py
types:
- python
- repo: https://github.com/golangci/golangci-lint
rev: v1.57.1
hooks:
- id: golangci-lint
args: ["--config=.golangci.yml"]

View File

@@ -110,4 +110,4 @@ export HATCHET_CLIENT_TOKEN="$(go run ./cmd/hatchet-admin token create --tenant-
2. Create or modify the required SQL queries in `./internal/repository/prisma/dbsqlc`
3. Add new queries files to `./internal/repository/prisma/dbsqlc/sqlc.yaml`
4. Create a new migration file with `task prisma-migrate`
5. Generate Go with `task generate-all`
5. Generate Go with `task generate-all`

View File

@@ -14,4 +14,4 @@ grpc.dev.hatchet-tools.com {
tls internal
reverse_proxy h2c://127.0.0.1:7070
}
}

View File

@@ -3,16 +3,15 @@ version: "3"
tasks:
setup:
cmds:
- |
task install-dependencies &&
task generate-certs &&
task set-env-db &&
task prisma-migrate &&
task generate-all &&
task generate-local-encryption-keys &&
task set-env-all &&
task seed-dev &&
task copy-ca-to-sdks
- task: install-dependencies
- task: generate-certs
- task: set-env-db
- task: prisma-migrate
- task: generate-all
- task: generate-local-encryption-key
- task: set-env-all
- task: seed-dev
- task: copy-ca-to-sdks
set-env-db:
cmds:
- |
@@ -88,6 +87,7 @@ tasks:
- task: generate-go
- task: generate-proto
- task: generate-sqlc
- task: pre-commit-run
install-dependencies:
cmds:
- go mod download
@@ -157,3 +157,12 @@ tasks:
copy-ca-to-sdks:
cmds:
- mkdir -p ./python-sdk/certs/ && cp ./hack/dev/certs/ca.cert ./python-sdk/certs/
pre-commit-install:
cmds:
- pip install pre-commit
- pre-commit install
pre-commit-run:
deps:
- pre-commit-install
cmds:
- pre-commit run --all-files || pre-commit run --all-files

View File

@@ -232,4 +232,4 @@ output-options:
}
return nil
}
{{end}}
{{end}}

View File

@@ -13,4 +13,4 @@ http {
try_files $uri /index.html;
}
}
}
}

View File

@@ -13,4 +13,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}

View File

@@ -235,4 +235,4 @@ body {
.rjsf textarea{
@apply flex h-20 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50;
}
/* END rjsf JSON Schema Form style hack */
/* END rjsf JSON Schema Form style hack */

View File

@@ -136,4 +136,4 @@ module.exports = {
},
},
plugins: [require("tailwindcss-animate")],
}
}

View File

@@ -25,4 +25,4 @@
"display": "hidden",
"type": "page"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,4 +3,4 @@
"title": "An unfair advantage: multi-tenant queues in Postgres",
"display": "hidden"
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -2,4 +2,4 @@
"index": "Contributing",
"github-app-setup": "GitHub App Setup",
"sdks": "SDKs"
}
}

View File

@@ -2,4 +2,4 @@
"overview": "Overview",
"cancel-in-progress": "Cancel In Progress",
"round-robin": "Round Robin"
}
}

View File

@@ -1,4 +1,4 @@
{
"installation": "Installation & Setup",
"first-workflow": "Running your first Step"
}
}

View File

@@ -11,4 +11,4 @@
"title": "April 12th - v0.20 Release",
"display": "hidden"
}
}
}

View File

@@ -9,4 +9,4 @@
"python-sdk": "Python SDK",
"typescript-sdk": "TypeScript SDK",
"go-sdk": "Go SDK"
}
}

View File

@@ -28,5 +28,3 @@ api_error_dict = api_error_instance.to_dict()
api_error_form_dict = api_error.from_dict(api_error_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,5 +25,3 @@ api_errors_dict = api_errors_instance.to_dict()
api_errors_form_dict = api_errors.from_dict(api_errors_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,5 +25,3 @@ api_meta_dict = api_meta_instance.to_dict()
api_meta_form_dict = api_meta.from_dict(api_meta_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,5 +25,3 @@ api_meta_auth_dict = api_meta_auth_instance.to_dict()
api_meta_auth_form_dict = api_meta_auth.from_dict(api_meta_auth_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -26,5 +26,3 @@ api_meta_integration_dict = api_meta_integration_instance.to_dict()
api_meta_integration_form_dict = api_meta_integration.from_dict(api_meta_integration_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,5 +27,3 @@ api_resource_meta_dict = api_resource_meta_instance.to_dict()
api_resource_meta_form_dict = api_resource_meta.from_dict(api_resource_meta_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,5 +27,3 @@ pagination_response_dict = pagination_response_instance.to_dict()
pagination_response_form_dict = pagination_response.from_dict(pagination_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -32,5 +32,3 @@ workflow_dict = workflow_instance.to_dict()
workflow_form_dict = workflow.from_dict(workflow_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -914,4 +914,3 @@ Name | Type | Description | Notes
**404** | Not found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -30,5 +30,3 @@ workflow_deployment_config_dict = workflow_deployment_config_instance.to_dict()
workflow_deployment_config_form_dict = workflow_deployment_config.from_dict(workflow_deployment_config_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,5 +27,3 @@ workflow_list_dict = workflow_list_instance.to_dict()
workflow_list_form_dict = workflow_list.from_dict(workflow_list_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -36,5 +36,3 @@ workflow_run_dict = workflow_run_instance.to_dict()
workflow_run_form_dict = workflow_run.from_dict(workflow_run_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -99,4 +99,3 @@ Name | Type | Description | Notes
**404** | Not found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -26,5 +26,3 @@ workflow_run_list_dict = workflow_run_list_instance.to_dict()
workflow_run_list_form_dict = workflow_run_list.from_dict(workflow_run_list_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -7,5 +7,3 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -30,5 +30,3 @@ workflow_run_triggered_by_dict = workflow_run_triggered_by_instance.to_dict()
workflow_run_triggered_by_form_dict = workflow_run_triggered_by.from_dict(workflow_run_triggered_by_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -26,5 +26,3 @@ workflow_tag_dict = workflow_tag_instance.to_dict()
workflow_tag_form_dict = workflow_tag.from_dict(workflow_tag_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -26,5 +26,3 @@ workflow_trigger_cron_ref_dict = workflow_trigger_cron_ref_instance.to_dict()
workflow_trigger_cron_ref_form_dict = workflow_trigger_cron_ref.from_dict(workflow_trigger_cron_ref_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -26,5 +26,3 @@ workflow_trigger_event_ref_dict = workflow_trigger_event_ref_instance.to_dict()
workflow_trigger_event_ref_form_dict = workflow_trigger_event_ref.from_dict(workflow_trigger_event_ref_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -29,5 +29,3 @@ workflow_triggers_dict = workflow_triggers_instance.to_dict()
workflow_triggers_form_dict = workflow_triggers.from_dict(workflow_triggers_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -31,5 +31,3 @@ workflow_version_dict = workflow_version_instance.to_dict()
workflow_version_form_dict = workflow_version.from_dict(workflow_version_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,5 +25,3 @@ workflow_version_definition_dict = workflow_version_definition_instance.to_dict(
workflow_version_definition_form_dict = workflow_version_definition.from_dict(workflow_version_definition_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -29,5 +29,3 @@ workflow_version_meta_dict = workflow_version_meta_instance.to_dict()
workflow_version_meta_form_dict = workflow_version_meta.from_dict(workflow_version_meta_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,4 +4,4 @@
"creating-a-worker": "Creating a Worker",
"pushing-events": "Pushing Events",
"api": "API"
}
}

View File

@@ -4,4 +4,4 @@
"creating-a-worker": "Creating a Worker",
"pushing-events": "Pushing Events",
"api": "API"
}
}

View File

@@ -1,3 +1,3 @@
{
"admin-client": "Admin"
}
}

View File

@@ -12,4 +12,4 @@
},
"configuration-options": "Configuration Options",
"github-app-setup": "GitHub App Setup"
}
}

View File

@@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
}

View File

@@ -160,4 +160,4 @@ nav {
:is(html[class~="dark"]) .nextra-nav-container-blur.nx-pointer-events-none {
background-color: var(--background) !important;
}
}

View File

@@ -12,4 +12,4 @@ module.exports = {
extend: {},
},
plugins: [],
};
};

View File

@@ -7,4 +7,4 @@ set -a
. .env
set +a
go run ./cmd/hatchet-admin token create --name "local" --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52
go run ./cmd/hatchet-admin token create --name "local" --tenant-id 707d0855-80ab-4e1f-a156-f1c4546cbf52

View File

@@ -14,4 +14,3 @@ mkdir -p $ENCRYPTION_KEYS_DIR
# Generate a master encryption key
go run ./cmd/hatchet-admin keyset create-local-keys --key-dir $ENCRYPTION_KEYS_DIR

View File

@@ -49,4 +49,4 @@ cp $tmp_dir/hatchet_sdk/clients/rest/models/__init__.py $dst_dir/models/__init__
cp $tmp_dir/hatchet_sdk/clients/rest/api/__init__.py $dst_dir/api/__init__.py
# remove tmp folder
rm -rf $tmp_dir
rm -rf $tmp_dir

View File

@@ -10,4 +10,4 @@
"go.mod",
"go.sum"
]
}
}

View File

@@ -9,4 +9,4 @@
"go.mod",
"go.sum"
]
}
}

View File

@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
provider = "postgresql"

View File

@@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/

View File

@@ -1,11 +1,12 @@
from hatchet_sdk import Hatchet, WorkflowList
from dotenv import load_dotenv
from hatchet_sdk import Hatchet, WorkflowList
load_dotenv()
hatchet = Hatchet(debug=True)
list : WorkflowList = hatchet.client.rest().workflow_list()
list: WorkflowList = hatchet.client.rest().workflow_list()
for workflow in list.rows:
print(workflow.name)

View File

@@ -1,13 +1,9 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
client.event.push(
"user:create",
{
"test": "test"
}
)
client.event.push("user:create", {"test": "test"})

View File

@@ -1,36 +1,40 @@
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
import asyncio
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["user:create"])
class AsyncWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step(timeout='5s')
@hatchet.step(timeout="5s")
def step1(self, context: Context):
async def async_step1():
print("started step1")
await asyncio.sleep(2)
print("finished step1")
return 'result'
return "result"
res = asyncio.run(async_step1())
print(res)
return {'test': 'test'}
return {"test": "test"}
@hatchet.step(parents=["step1"],timeout='4s')
@hatchet.step(parents=["step1"], timeout="4s")
async def step2(self, context):
print("started async step2")
await asyncio.sleep(2)
print("finished step2")
workflow = AsyncWorkflow()
worker = hatchet.worker('test-worker', max_runs=4)
worker = hatchet.worker("test-worker", max_runs=4)
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,16 +1,20 @@
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
import asyncio
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["user:create"])
class CancelWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step(timeout='10s', retries=1)
@hatchet.step(timeout="10s", retries=1)
async def step1(self, context: Context):
i = 0
while not context.exit_flag.is_set() and i < 20:
@@ -23,7 +27,7 @@ class CancelWorkflow:
workflow = CancelWorkflow()
worker = hatchet.worker('test-worker', max_runs=4)
worker = hatchet.worker("test-worker", max_runs=4)
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,6 +1,7 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
@@ -11,9 +12,4 @@ for i in range(200):
if i % 2 == 0:
group = "1"
client.event.push(
"concurrency-test",
{
"group": group
}
)
client.event.push("concurrency-test", {"group": group})

View File

@@ -1,19 +1,23 @@
from hatchet_sdk import Hatchet, ConcurrencyLimitStrategy, Context
from dotenv import load_dotenv
from hatchet_sdk import ConcurrencyLimitStrategy, Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["concurrency-test"],schedule_timeout="10m")
@hatchet.workflow(on_events=["concurrency-test"], schedule_timeout="10m")
class ConcurrencyDemoWorkflowRR:
@hatchet.concurrency(max_runs=1, limit_strategy=ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN)
def concurrency(self, context : Context) -> str:
@hatchet.concurrency(
max_runs=1, limit_strategy=ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN
)
def concurrency(self, context: Context) -> str:
input = context.workflow_input()
print(input)
return input.get('group')
return input.get("group")
@hatchet.step()
def step1(self, context):
@@ -22,8 +26,9 @@ class ConcurrencyDemoWorkflowRR:
print("finished step1")
pass
workflow = ConcurrencyDemoWorkflowRR()
worker = hatchet.worker('concurrency-demo-worker-rr', max_runs=10)
worker = hatchet.worker("concurrency-demo-worker-rr", max_runs=10)
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,13 +1,9 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
client.event.push(
"concurrency-test",
{
"test": "test"
}
)
client.event.push("concurrency-test", {"test": "test"})

View File

@@ -1,10 +1,12 @@
from hatchet_sdk import Hatchet
from dotenv import load_dotenv
from hatchet_sdk import Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["concurrency-test"])
class ConcurrencyDemoWorkflow:
def __init__(self):
@@ -19,14 +21,15 @@ class ConcurrencyDemoWorkflow:
print("executed step1")
pass
@hatchet.step(parents=["step1"],timeout='4s')
@hatchet.step(parents=["step1"], timeout="4s")
def step2(self, context):
print("started step2")
context.sleep(1)
print("finished step2")
workflow = ConcurrencyDemoWorkflow()
worker = hatchet.worker('concurrency-demo-worker', max_runs=4)
worker = hatchet.worker("concurrency-demo-worker", max_runs=4)
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,15 +1,10 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
for i in range(10):
client.event.push(
"user:create",
{
"test": "test"
}
)
client.event.push("user:create", {"test": "test"})

View File

@@ -1,19 +1,26 @@
import time
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["user:create"],schedule_timeout="10m")
@hatchet.workflow(on_events=["user:create"], schedule_timeout="10m")
class MyWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step()
def step1(self, context : Context):
print("starting step1", time.strftime("%H:%M:%S", time.localtime()), context.workflow_input())
def step1(self, context: Context):
print(
"starting step1",
time.strftime("%H:%M:%S", time.localtime()),
context.workflow_input(),
)
overrideValue = context.playground("prompt", "You are an AI assistant...")
time.sleep(5)
# pretty-print time
@@ -23,8 +30,12 @@ class MyWorkflow:
}
@hatchet.step()
def step2(self, context : Context):
print("starting step2", time.strftime("%H:%M:%S", time.localtime()), context.workflow_input())
def step2(self, context: Context):
print(
"starting step2",
time.strftime("%H:%M:%S", time.localtime()),
context.workflow_input(),
)
time.sleep(5)
print("executed step2", time.strftime("%H:%M:%S", time.localtime()))
return {
@@ -32,21 +43,34 @@ class MyWorkflow:
}
@hatchet.step(parents=["step1", "step2"])
def step3(self, context : Context):
print("executed step3", time.strftime("%H:%M:%S", time.localtime()), context.workflow_input(), context.step_output("step1"), context.step_output("step2"))
def step3(self, context: Context):
print(
"executed step3",
time.strftime("%H:%M:%S", time.localtime()),
context.workflow_input(),
context.step_output("step1"),
context.step_output("step2"),
)
return {
"step3": "step3",
}
@hatchet.step(parents=["step1", "step3"])
def step4(self, context : Context):
print("executed step4", time.strftime("%H:%M:%S", time.localtime()), context.workflow_input(), context.step_output("step1"), context.step_output("step3"))
def step4(self, context: Context):
print(
"executed step4",
time.strftime("%H:%M:%S", time.localtime()),
context.workflow_input(),
context.step_output("step1"),
context.step_output("step3"),
)
return {
"step4": "step4",
}
workflow = MyWorkflow()
worker = hatchet.worker('test-worker')
worker = hatchet.worker("test-worker")
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,13 +1,9 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
client.event.push(
"printer:schedule",
{
"message": "test"
}
)
client.event.push("printer:schedule", {"message": "test"})

View File

@@ -1,36 +1,39 @@
from datetime import datetime, timedelta
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["printer:schedule"])
class PrintSchedule:
@hatchet.step()
def schedule(self, context:Context):
def schedule(self, context: Context):
now = datetime.now()
print(f"the time is \t {now.strftime("%H:%M:%S")}")
print(f"the time is \t {now.strftime('%H:%M:%S')}")
future_time = now + timedelta(seconds=15)
print(f"scheduling for \t {future_time.strftime("%H:%M:%S")}")
print(f"scheduling for \t {future_time.strftime('%H:%M:%S')}")
hatchet.client.admin.schedule_workflow(
'PrintPrinter',
[future_time],
context.workflow_input()
"PrintPrinter", [future_time], context.workflow_input()
)
@hatchet.workflow()
class PrintPrinter:
@hatchet.step()
def step1(self, context: Context):
now = datetime.now()
print(f"printed at \t {now.strftime("%H:%M:%S")}")
print(f"printed at \t {now.strftime('%H:%M:%S')}")
print(f"message \t {context.workflow_input()['message']}")
worker = hatchet.worker('test-worker', max_runs=4)
worker = hatchet.worker("test-worker", max_runs=4)
worker.register_workflow(PrintSchedule())
worker.register_workflow(PrintPrinter())
worker.start()
worker.start()

View File

@@ -1,17 +1,20 @@
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["parent:create"])
class Parent:
@hatchet.step(timeout='10s')
@hatchet.step(timeout="10s")
async def spawn(self, context: Context):
print("spawning child")
child = await context.spawn_workflow("Child", key="child").result()
print(f'results {child}')
print(f"results {child}")
@hatchet.workflow(on_events=["child:create"])
class Child:
@@ -21,8 +24,8 @@ class Child:
return {"status": "success"}
worker = hatchet.worker('fanout-worker', max_runs=4)
worker = hatchet.worker("fanout-worker", max_runs=4)
worker.register_workflow(Parent())
worker.register_workflow(Child())
worker.start()
worker.start()

View File

@@ -1,25 +1,29 @@
import time
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet()
@hatchet.workflow(on_events=["user:create"],schedule_timeout="10m")
@hatchet.workflow(on_events=["user:create"], schedule_timeout="10m")
class LoggingWorkflow:
@hatchet.step()
def logger(self, context : Context):
def logger(self, context: Context):
for i in range(1000):
context.log(f"Logging message {i}")
return {
"step1": "completed",
}
workflow = LoggingWorkflow()
worker = hatchet.worker('logging-worker-py')
worker = hatchet.worker("logging-worker-py")
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,15 +1,20 @@
import os
from hatchet_sdk import new_client
from dotenv import load_dotenv
import json
import asyncio
from hatchet_sdk.clients.listener import StepRunEventType
import base64
import json
import os
from dotenv import load_dotenv
from hatchet_sdk import new_client
from hatchet_sdk.clients.listener import StepRunEventType
async def main():
load_dotenv()
hatchet = new_client()
workflowRunId = hatchet.admin.run_workflow("ManualTriggerWorkflow", {"test": "test"})
workflowRunId = hatchet.admin.run_workflow(
"ManualTriggerWorkflow", {"test": "test"}
)
listener = hatchet.listener.stream(workflowRunId)
# Get the directory of the current script
@@ -30,11 +35,9 @@ async def main():
with open(payload_path, "wb") as f:
f.write(decoded_payload)
data = json.dumps({
"type": event.type,
"messageId": workflowRunId
})
data = json.dumps({"type": event.type, "messageId": workflowRunId})
print("data: " + data + "\n\n")
if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())

View File

@@ -1,8 +1,10 @@
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
import base64
import os
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@@ -12,39 +14,40 @@ hatchet = Hatchet(debug=True)
class ManualTriggerWorkflow:
@hatchet.step()
def step1(self, context: Context):
res = context.playground('res', "HELLO")
res = context.playground("res", "HELLO")
# Get the directory of the current script
script_dir = os.path.dirname(os.path.abspath(__file__))
# Construct the path to the image file relative to the script's directory
image_path = os.path.join(script_dir, "image.jpeg")
# Load the image file
with open(image_path, "rb") as image_file:
image_data = image_file.read()
print(len(image_data))
# Encode the image data as base64
base64_image = base64.b64encode(image_data).decode('utf-8')
base64_image = base64.b64encode(image_data).decode("utf-8")
# Stream the base64-encoded image data
context.put_stream(base64_image)
context.sleep(3)
print("executed step1")
return {"step1": "data1 "+res}
return {"step1": "data1 " + res}
@hatchet.step(parents=["step1"], timeout='4s')
@hatchet.step(parents=["step1"], timeout="4s")
def step2(self, context):
print("started step2")
context.sleep(1)
print("finished step2")
return {"step2": "data2"}
workflow = ManualTriggerWorkflow()
worker = hatchet.worker('manual-worker', max_runs=4)
worker = hatchet.worker("manual-worker", max_runs=4)
worker.register_workflow(workflow)
worker.start()

View File

@@ -1,25 +1,11 @@
from dotenv import load_dotenv
from hatchet_sdk.hatchet import Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
hatchet.client.event.push(
"rate_limit:create",
{
"test": "1"
}
)
hatchet.client.event.push(
"rate_limit:create",
{
"test": "2"
}
)
hatchet.client.event.push(
"rate_limit:create",
{
"test": "3"
}
)
hatchet.client.event.push("rate_limit:create", {"test": "1"})
hatchet.client.event.push("rate_limit:create", {"test": "2"})
hatchet.client.event.push("rate_limit:create", {"test": "3"})

View File

@@ -1,24 +1,27 @@
from hatchet_sdk import Hatchet, Context
from dotenv import load_dotenv
from hatchet_sdk import Context, Hatchet
from hatchet_sdk.rate_limit import RateLimit, RateLimitDuration
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["rate_limit:create"])
class RateLimitWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step(rate_limits = [RateLimit(key='test-limit', units=1)])
@hatchet.step(rate_limits=[RateLimit(key="test-limit", units=1)])
def step1(self, context: Context):
print("executed step1")
pass
hatchet.client.admin.put_rate_limit('test-limit', 2, RateLimitDuration.MINUTE)
worker = hatchet.worker('test-worker', max_runs=4)
hatchet.client.admin.put_rate_limit("test-limit", 2, RateLimitDuration.MINUTE)
worker = hatchet.worker("test-worker", max_runs=4)
worker.register_workflow(RateLimitWorkflow())
worker.start()
worker.start()

View File

@@ -1,13 +1,9 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
client.event.push(
"user:create",
{
"test": "test"
}
)
client.event.push("user:create", {"test": "test"})

View File

@@ -1,11 +1,14 @@
import json
from hatchet_sdk import Hatchet, Context, CreateWorkflowVersionOpts
from dotenv import load_dotenv
from hatchet_sdk import Context, CreateWorkflowVersionOpts, Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["user:create"])
class MyWorkflow:
def __init__(self):
@@ -23,19 +26,20 @@ class MyWorkflow:
print("executed step1")
pass
@hatchet.step(parents=["step1"],timeout='4s')
@hatchet.step(parents=["step1"], timeout="4s")
def step2(self, context):
print("started step2")
context.sleep(1)
print("finished step2")
workflow = MyWorkflow()
worker = hatchet.worker('test-worker', max_runs=4)
worker = hatchet.worker("test-worker", max_runs=4)
worker.register_workflow(workflow)
# workflow1 = hatchet.client.admin.put_workflow(
# "workflow-copy-2",
# MyWorkflow(),
# MyWorkflow(),
# overrides=CreateWorkflowVersionOpts(
# cron_triggers=["* * * * *"],
# cron_input=json.dumps({"test": "test"}),
@@ -44,4 +48,4 @@ worker.register_workflow(workflow)
# print(workflow1)
worker.start()
worker.start()

View File

@@ -1,13 +1,9 @@
from hatchet_sdk import new_client
from dotenv import load_dotenv
from hatchet_sdk import new_client
load_dotenv()
client = new_client()
client.event.push(
"user:create",
{
"test": "test"
}
)
client.event.push("user:create", {"test": "test"})

View File

@@ -1,16 +1,18 @@
from hatchet_sdk import Hatchet
from dotenv import load_dotenv
from hatchet_sdk import Hatchet
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["user:create"])
class TimeoutWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step(timeout='4s')
@hatchet.step(timeout="4s")
def timeout(self, context):
try:
print("started step2")
@@ -20,8 +22,9 @@ class TimeoutWorkflow:
print("caught an exception: " + str(e))
raise e
workflow = TimeoutWorkflow()
worker = hatchet.worker('timeout-worker', max_runs=4)
worker = hatchet.worker("timeout-worker", max_runs=4)
worker.register_workflow(workflow)
worker.start()
worker.start()

View File

@@ -1,9 +1,4 @@
from .hatchet import Hatchet
from .clients.listener import StepRunEventType
from .worker import Worker
from .client import new_client
from .context import Context
from .workflows_pb2 import ConcurrencyLimitStrategy, CreateWorkflowVersionOpts, RateLimitDuration
from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRequest
# import models into sdk package
from hatchet_sdk.clients.rest.models.api_error import APIError
@@ -13,34 +8,59 @@ from hatchet_sdk.clients.rest.models.api_meta_auth import APIMetaAuth
from hatchet_sdk.clients.rest.models.api_meta_integration import APIMetaIntegration
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
from hatchet_sdk.clients.rest.models.api_token import APIToken
from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRequest
from hatchet_sdk.clients.rest.models.create_api_token_request import CreateAPITokenRequest
from hatchet_sdk.clients.rest.models.create_api_token_response import CreateAPITokenResponse
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import CreatePullRequestFromStepRun
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import CreateTenantInviteRequest
from hatchet_sdk.clients.rest.models.create_api_token_request import (
CreateAPITokenRequest,
)
from hatchet_sdk.clients.rest.models.create_api_token_response import (
CreateAPITokenResponse,
)
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import (
CreatePullRequestFromStepRun,
)
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import (
CreateTenantInviteRequest,
)
from hatchet_sdk.clients.rest.models.create_tenant_request import CreateTenantRequest
from hatchet_sdk.clients.rest.models.event import Event
from hatchet_sdk.clients.rest.models.event_data import EventData
from hatchet_sdk.clients.rest.models.event_key_list import EventKeyList
from hatchet_sdk.clients.rest.models.event_list import EventList
from hatchet_sdk.clients.rest.models.event_order_by_direction import EventOrderByDirection
from hatchet_sdk.clients.rest.models.event_order_by_direction import (
EventOrderByDirection,
)
from hatchet_sdk.clients.rest.models.event_order_by_field import EventOrderByField
from hatchet_sdk.clients.rest.models.event_workflow_run_summary import EventWorkflowRunSummary
from hatchet_sdk.clients.rest.models.get_step_run_diff_response import GetStepRunDiffResponse
from hatchet_sdk.clients.rest.models.github_app_installation import GithubAppInstallation
from hatchet_sdk.clients.rest.models.event_workflow_run_summary import (
EventWorkflowRunSummary,
)
from hatchet_sdk.clients.rest.models.get_step_run_diff_response import (
GetStepRunDiffResponse,
)
from hatchet_sdk.clients.rest.models.github_app_installation import (
GithubAppInstallation,
)
from hatchet_sdk.clients.rest.models.github_branch import GithubBranch
from hatchet_sdk.clients.rest.models.github_repo import GithubRepo
from hatchet_sdk.clients.rest.models.job import Job
from hatchet_sdk.clients.rest.models.job_run import JobRun
from hatchet_sdk.clients.rest.models.job_run_status import JobRunStatus
from hatchet_sdk.clients.rest.models.link_github_repository_request import LinkGithubRepositoryRequest
from hatchet_sdk.clients.rest.models.list_api_tokens_response import ListAPITokensResponse
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import ListGithubAppInstallationsResponse
from hatchet_sdk.clients.rest.models.list_pull_requests_response import ListPullRequestsResponse
from hatchet_sdk.clients.rest.models.link_github_repository_request import (
LinkGithubRepositoryRequest,
)
from hatchet_sdk.clients.rest.models.list_api_tokens_response import (
ListAPITokensResponse,
)
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import (
ListGithubAppInstallationsResponse,
)
from hatchet_sdk.clients.rest.models.list_pull_requests_response import (
ListPullRequestsResponse,
)
from hatchet_sdk.clients.rest.models.log_line import LogLine
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import LogLineOrderByDirection
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import (
LogLineOrderByDirection,
)
from hatchet_sdk.clients.rest.models.log_line_order_by_field import LogLineOrderByField
from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
from hatchet_sdk.clients.rest.models.pull_request import PullRequest
@@ -59,26 +79,53 @@ from hatchet_sdk.clients.rest.models.tenant_list import TenantList
from hatchet_sdk.clients.rest.models.tenant_member import TenantMember
from hatchet_sdk.clients.rest.models.tenant_member_list import TenantMemberList
from hatchet_sdk.clients.rest.models.tenant_member_role import TenantMemberRole
from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import TriggerWorkflowRunRequest
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import UpdateTenantInviteRequest
from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import (
TriggerWorkflowRunRequest,
)
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import (
UpdateTenantInviteRequest,
)
from hatchet_sdk.clients.rest.models.user import User
from hatchet_sdk.clients.rest.models.user_login_request import UserLoginRequest
from hatchet_sdk.clients.rest.models.user_register_request import UserRegisterRequest
from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import UserTenantMembershipsList
from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import (
UserTenantMembershipsList,
)
from hatchet_sdk.clients.rest.models.user_tenant_public import UserTenantPublic
from hatchet_sdk.clients.rest.models.worker import Worker
from hatchet_sdk.clients.rest.models.worker_list import WorkerList
from hatchet_sdk.clients.rest.models.workflow import Workflow
from hatchet_sdk.clients.rest.models.workflow_deployment_config import WorkflowDeploymentConfig
from hatchet_sdk.clients.rest.models.workflow_deployment_config import (
WorkflowDeploymentConfig,
)
from hatchet_sdk.clients.rest.models.workflow_list import WorkflowList
from hatchet_sdk.clients.rest.models.workflow_run import WorkflowRun
from hatchet_sdk.clients.rest.models.workflow_run_list import WorkflowRunList
from hatchet_sdk.clients.rest.models.workflow_run_status import WorkflowRunStatus
from hatchet_sdk.clients.rest.models.workflow_run_triggered_by import WorkflowRunTriggeredBy
from hatchet_sdk.clients.rest.models.workflow_run_triggered_by import (
WorkflowRunTriggeredBy,
)
from hatchet_sdk.clients.rest.models.workflow_tag import WorkflowTag
from hatchet_sdk.clients.rest.models.workflow_trigger_cron_ref import WorkflowTriggerCronRef
from hatchet_sdk.clients.rest.models.workflow_trigger_event_ref import WorkflowTriggerEventRef
from hatchet_sdk.clients.rest.models.workflow_trigger_cron_ref import (
WorkflowTriggerCronRef,
)
from hatchet_sdk.clients.rest.models.workflow_trigger_event_ref import (
WorkflowTriggerEventRef,
)
from hatchet_sdk.clients.rest.models.workflow_triggers import WorkflowTriggers
from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion
from hatchet_sdk.clients.rest.models.workflow_version_definition import WorkflowVersionDefinition
from hatchet_sdk.clients.rest.models.workflow_version_definition import (
WorkflowVersionDefinition,
)
from hatchet_sdk.clients.rest.models.workflow_version_meta import WorkflowVersionMeta
from .client import new_client
from .clients.listener import StepRunEventType
from .context import Context
from .hatchet import Hatchet
from .worker import Worker
from .workflows_pb2 import (
ConcurrencyLimitStrategy,
CreateWorkflowVersionOpts,
RateLimitDuration,
)

View File

@@ -2,20 +2,21 @@
import os
from typing import Any
from hatchet_sdk.connection import new_conn
from .clients.admin import AdminClientImpl, new_admin
from .clients.events import EventClientImpl, new_event
from .clients.dispatcher import DispatcherClientImpl, new_dispatcher
from .clients.listener import ListenerClientImpl, new_listener
from .loader import ConfigLoader, ClientConfig
import grpc
from .clients.rest.api_client import ApiClient
from hatchet_sdk.connection import new_conn
from .clients.admin import AdminClientImpl, new_admin
from .clients.dispatcher import DispatcherClientImpl, new_dispatcher
from .clients.events import EventClientImpl, new_event
from .clients.listener import ListenerClientImpl, new_listener
from .clients.rest.api.workflow_api import WorkflowApi
from .clients.rest.api.workflow_run_api import WorkflowRunApi
from .clients.rest.api_client import ApiClient
from .clients.rest.configuration import Configuration
from .clients.rest_client import RestApi
from .loader import ClientConfig, ConfigLoader
class Client:
admin: AdminClientImpl
@@ -27,14 +28,14 @@ class Client:
class ClientImpl(Client):
def __init__(
self,
event_client: EventClientImpl,
admin_client: AdminClientImpl,
dispatcher_client: DispatcherClientImpl,
listener_client: ListenerClientImpl,
rest_client: RestApi,
config: ClientConfig
):
self,
event_client: EventClientImpl,
admin_client: AdminClientImpl,
dispatcher_client: DispatcherClientImpl,
listener_client: ListenerClientImpl,
rest_client: RestApi,
config: ClientConfig,
):
self.admin = admin_client
self.dispatcher = dispatcher_client
self.event = event_client
@@ -42,6 +43,7 @@ class ClientImpl(Client):
self.rest = rest_client
self.config = config
def with_host_port(host: str, port: int):
def with_host_port_impl(config: ClientConfig):
config.host = host
@@ -62,7 +64,7 @@ def new_client(*opts_functions):
if config.host_port is None:
raise ValueError("Host and port are required")
conn : grpc.Channel = new_conn(config)
conn: grpc.Channel = new_conn(config)
# Instantiate client implementations
event_client = new_event(conn, config)
@@ -71,4 +73,11 @@ def new_client(*opts_functions):
listener_client = new_listener(conn, config)
rest_client = RestApi(config.server_url, config.token, config.tenant_id)
return ClientImpl(event_client, admin_client, dispatcher_client, listener_client, rest_client, config)
return ClientImpl(
event_client,
admin_client,
dispatcher_client,
listener_client,
rest_client,
config,
)

View File

@@ -1,14 +1,25 @@
import json
from datetime import datetime
from typing import List, Union
from typing import List, Optional, TypedDict, Union
import grpc
from google.protobuf import timestamp_pb2
from ..workflows_pb2_grpc import WorkflowServiceStub
from ..workflows_pb2 import CreateWorkflowVersionOpts, PutRateLimitRequest, RateLimitDuration, ScheduleWorkflowRequest, TriggerWorkflowRequest, PutWorkflowRequest, TriggerWorkflowResponse, WorkflowVersion
from ..loader import ClientConfig
from ..metadata import get_metadata
import json
from typing import TypedDict, Optional
from ..workflow import WorkflowMeta
from ..workflows_pb2 import (
CreateWorkflowVersionOpts,
PutRateLimitRequest,
PutWorkflowRequest,
RateLimitDuration,
ScheduleWorkflowRequest,
TriggerWorkflowRequest,
TriggerWorkflowResponse,
WorkflowVersion,
)
from ..workflows_pb2_grpc import WorkflowServiceStub
def new_admin(conn, config: ClientConfig):
return AdminClientImpl(
@@ -16,20 +27,27 @@ def new_admin(conn, config: ClientConfig):
token=config.token,
)
class TriggerWorkflowParentOptions(TypedDict):
parent_id: Optional[str]
parent_step_run_id: Optional[str]
child_index: Optional[int]
child_key: Optional[str]
class AdminClientImpl:
def __init__(self, client: WorkflowServiceStub, token):
self.client = client
self.token = token
def put_workflow(self, name: str, workflow: CreateWorkflowVersionOpts | WorkflowMeta, overrides: CreateWorkflowVersionOpts | None = None) -> WorkflowVersion:
def put_workflow(
self,
name: str,
workflow: CreateWorkflowVersionOpts | WorkflowMeta,
overrides: CreateWorkflowVersionOpts | None = None,
) -> WorkflowVersion:
try:
opts : CreateWorkflowVersionOpts
opts: CreateWorkflowVersionOpts
if isinstance(workflow, CreateWorkflowVersionOpts):
opts = workflow
@@ -49,8 +67,13 @@ class AdminClientImpl:
)
except grpc.RpcError as e:
raise ValueError(f"Could not put workflow: {e}")
def put_rate_limit(self, key: str, limit: int, duration: RateLimitDuration = RateLimitDuration.SECOND):
def put_rate_limit(
self,
key: str,
limit: int,
duration: RateLimitDuration = RateLimitDuration.SECOND,
):
try:
self.client.PutRateLimit(
PutRateLimitRequest(
@@ -63,7 +86,13 @@ class AdminClientImpl:
except grpc.RpcError as e:
raise ValueError(f"Could not put rate limit: {e}")
def schedule_workflow(self, name: str, schedules: List[Union[datetime, timestamp_pb2.Timestamp]], input={}, options: TriggerWorkflowParentOptions = None):
def schedule_workflow(
self,
name: str,
schedules: List[Union[datetime, timestamp_pb2.Timestamp]],
input={},
options: TriggerWorkflowParentOptions = None,
):
timestamp_schedules = []
for schedule in schedules:
if isinstance(schedule, datetime):
@@ -75,28 +104,39 @@ class AdminClientImpl:
elif isinstance(schedule, timestamp_pb2.Timestamp):
timestamp_schedules.append(schedule)
else:
raise ValueError("Invalid schedule type. Must be datetime or timestamp_pb2.Timestamp.")
raise ValueError(
"Invalid schedule type. Must be datetime or timestamp_pb2.Timestamp."
)
try:
self.client.ScheduleWorkflow(ScheduleWorkflowRequest(
name=name,
schedules=timestamp_schedules,
input=json.dumps(input),
**(options or {})
), metadata=get_metadata(self.token))
self.client.ScheduleWorkflow(
ScheduleWorkflowRequest(
name=name,
schedules=timestamp_schedules,
input=json.dumps(input),
**(options or {}),
),
metadata=get_metadata(self.token),
)
except grpc.RpcError as e:
raise ValueError(f"gRPC error: {e}")
def run_workflow(self, workflow_name: str, input: any, options: TriggerWorkflowParentOptions = None):
def run_workflow(
self,
workflow_name: str,
input: any,
options: TriggerWorkflowParentOptions = None,
):
try:
payload_data = json.dumps(input)
resp: TriggerWorkflowResponse = self.client.TriggerWorkflow(TriggerWorkflowRequest(
name=workflow_name,
input=payload_data,
**(options or {})
), metadata=get_metadata(self.token))
resp: TriggerWorkflowResponse = self.client.TriggerWorkflow(
TriggerWorkflowRequest(
name=workflow_name, input=payload_data, **(options or {})
),
metadata=get_metadata(self.token),
)
return resp.workflow_run_id
except grpc.RpcError as e:

View File

@@ -1,17 +1,29 @@
# relative imports
import json
import threading
from ..dispatcher_pb2 import GroupKeyActionEvent, StepActionEvent, ActionEventResponse, ActionType, AssignedAction, WorkerListenRequest, WorkerRegisterRequest, WorkerUnsubscribeRequest, WorkerRegisterResponse, OverridesData, HeartbeatRequest
from ..dispatcher_pb2_grpc import DispatcherStub
import time
from typing import Callable, List, Union
import grpc
from ..dispatcher_pb2 import (
ActionEventResponse,
ActionType,
AssignedAction,
GroupKeyActionEvent,
HeartbeatRequest,
OverridesData,
StepActionEvent,
WorkerListenRequest,
WorkerRegisterRequest,
WorkerRegisterResponse,
WorkerUnsubscribeRequest,
)
from ..dispatcher_pb2_grpc import DispatcherStub
from ..loader import ClientConfig
from ..logger import logger
import json
import grpc
from typing import Callable, List, Union
from ..metadata import get_metadata
from .events import proto_timestamp_now
import time
def new_dispatcher(conn, config: ClientConfig):
@@ -19,7 +31,8 @@ def new_dispatcher(conn, config: ClientConfig):
client=DispatcherStub(conn),
token=config.token,
)
class DispatcherClient:
def get_action_listener(self, ctx, req):
raise NotImplementedError
@@ -35,14 +48,35 @@ DEFAULT_REGISTER_TIMEOUT = 30
class GetActionListenerRequest:
def __init__(self, worker_name: str, services: List[str], actions: List[str], max_runs: int | None = None):
def __init__(
self,
worker_name: str,
services: List[str],
actions: List[str],
max_runs: int | None = None,
):
self.worker_name = worker_name
self.services = services
self.actions = actions
self.max_runs = max_runs
class Action:
def __init__(self, worker_id: str, tenant_id: str, workflow_run_id: str, get_group_key_run_id: str, job_id: str, job_name: str, job_run_id: str, step_id: str, step_run_id: str, action_id: str, action_payload: str, action_type: ActionType):
def __init__(
self,
worker_id: str,
tenant_id: str,
workflow_run_id: str,
get_group_key_run_id: str,
job_id: str,
job_name: str,
job_run_id: str,
step_id: str,
step_run_id: str,
action_id: str,
action_payload: str,
action_type: ActionType,
):
self.worker_id = worker_id
self.workflow_run_id = workflow_run_id
self.get_group_key_run_id = get_group_key_run_id
@@ -56,6 +90,7 @@ class Action:
self.action_payload = action_payload
self.action_type = action_type
class WorkerActionListener:
def actions(self, ctx, err_ch):
raise NotImplementedError
@@ -63,12 +98,14 @@ class WorkerActionListener:
def unregister(self):
raise NotImplementedError
START_STEP_RUN = 0
CANCEL_STEP_RUN = 1
START_GET_GROUP_KEY = 2
class ActionListenerImpl(WorkerActionListener):
def __init__(self, client : DispatcherStub, token, worker_id):
def __init__(self, client: DispatcherStub, token, worker_id):
self.client = client
self.token = token
self.worker_id = worker_id
@@ -105,7 +142,7 @@ class ActionListenerImpl(WorkerActionListener):
def start_heartbeater(self):
if self.heartbeat_thread is not None:
return
# create a new thread to send heartbeats
heartbeat_thread = threading.Thread(target=self.heartbeat)
heartbeat_thread.start()
@@ -114,8 +151,7 @@ class ActionListenerImpl(WorkerActionListener):
def actions(self):
while True:
logger.info(
"Connecting to Hatchet to establish listener for actions...")
logger.info("Connecting to Hatchet to establish listener for actions...")
try:
for assigned_action in self.get_listen_client():
@@ -125,10 +161,15 @@ class ActionListenerImpl(WorkerActionListener):
# Process the received action
action_type = self.map_action_type(assigned_action.actionType)
if assigned_action.actionPayload is None or assigned_action.actionPayload == "":
if (
assigned_action.actionPayload is None
or assigned_action.actionPayload == ""
):
action_payload = None
else:
action_payload = self.parse_action_payload(assigned_action.actionPayload)
action_payload = self.parse_action_payload(
assigned_action.actionPayload
)
action = Action(
tenant_id=assigned_action.tenantId,
@@ -156,7 +197,10 @@ class ActionListenerImpl(WorkerActionListener):
elif e.code() == grpc.StatusCode.DEADLINE_EXCEEDED:
logger.info("Deadline exceeded, retrying subscription")
continue
elif self.listen_strategy == "v2" and e.code() == grpc.StatusCode.UNIMPLEMENTED:
elif (
self.listen_strategy == "v2"
and e.code() == grpc.StatusCode.UNIMPLEMENTED
):
# ListenV2 is not available, fallback to Listen
self.listen_strategy = "v1"
self.run_heartbeat = False
@@ -170,7 +214,7 @@ class ActionListenerImpl(WorkerActionListener):
self.retries = self.retries + 1
def parse_action_payload(self, payload : str):
def parse_action_payload(self, payload: str):
try:
payload_data = json.loads(payload)
except json.JSONDecodeError as e:
@@ -187,43 +231,46 @@ class ActionListenerImpl(WorkerActionListener):
else:
# self.logger.error(f"Unknown action type: {action_type}")
return None
def get_listen_client(self):
current_time = int(time.time())
if current_time-self.last_connection_attempt > DEFAULT_ACTION_LISTENER_RETRY_INTERVAL:
if (
current_time - self.last_connection_attempt
> DEFAULT_ACTION_LISTENER_RETRY_INTERVAL
):
self.retries = 0
if self.retries > DEFAULT_ACTION_LISTENER_RETRY_COUNT:
raise Exception(
f"Could not subscribe to the worker after {DEFAULT_ACTION_LISTENER_RETRY_COUNT} retries")
f"Could not subscribe to the worker after {DEFAULT_ACTION_LISTENER_RETRY_COUNT} retries"
)
elif self.retries >= 1:
# logger.info
# if we are retrying, we wait for a bit. this should eventually be replaced with exp backoff + jitter
time.sleep(DEFAULT_ACTION_LISTENER_RETRY_INTERVAL)
logger.info(
f"Could not connect to Hatchet, retrying... {self.retries}/{DEFAULT_ACTION_LISTENER_RETRY_COUNT}")
f"Could not connect to Hatchet, retrying... {self.retries}/{DEFAULT_ACTION_LISTENER_RETRY_COUNT}"
)
if self.listen_strategy == "v2":
listener = self.client.ListenV2(WorkerListenRequest(
workerId=self.worker_id
),
listener = self.client.ListenV2(
WorkerListenRequest(workerId=self.worker_id),
metadata=get_metadata(self.token),
)
self.start_heartbeater()
else:
# if ListenV2 is not available, fallback to Listen
listener = self.client.Listen(WorkerListenRequest(
workerId=self.worker_id
),
listener = self.client.Listen(
WorkerListenRequest(workerId=self.worker_id),
timeout=DEFAULT_ACTION_TIMEOUT,
metadata=get_metadata(self.token),
)
self.last_connection_attempt = current_time
logger.info('Listener established.')
logger.info("Listener established.")
return listener
def unregister(self):
@@ -231,17 +278,16 @@ class ActionListenerImpl(WorkerActionListener):
try:
self.client.Unsubscribe(
WorkerUnsubscribeRequest(
workerId=self.worker_id
),
WorkerUnsubscribeRequest(workerId=self.worker_id),
timeout=DEFAULT_REGISTER_TIMEOUT,
metadata=get_metadata(self.token),
)
except grpc.RpcError as e:
raise Exception(f"Failed to unsubscribe: {e}")
class DispatcherClientImpl(DispatcherClient):
def __init__(self, client : DispatcherStub, token):
def __init__(self, client: DispatcherStub, token):
self.client = client
self.token = token
# self.logger = logger
@@ -249,26 +295,39 @@ class DispatcherClientImpl(DispatcherClient):
def get_action_listener(self, req: GetActionListenerRequest) -> ActionListenerImpl:
# Register the worker
response : WorkerRegisterResponse = self.client.Register(WorkerRegisterRequest(
workerName=req.worker_name,
actions=req.actions,
services=req.services,
maxRuns=req.max_runs
), timeout=DEFAULT_REGISTER_TIMEOUT, metadata=get_metadata(self.token))
response: WorkerRegisterResponse = self.client.Register(
WorkerRegisterRequest(
workerName=req.worker_name,
actions=req.actions,
services=req.services,
maxRuns=req.max_runs,
),
timeout=DEFAULT_REGISTER_TIMEOUT,
metadata=get_metadata(self.token),
)
return ActionListenerImpl(self.client, self.token, response.workerId)
def send_step_action_event(self, in_: StepActionEvent):
response : ActionEventResponse = self.client.SendStepActionEvent(in_, metadata=get_metadata(self.token),)
response: ActionEventResponse = self.client.SendStepActionEvent(
in_,
metadata=get_metadata(self.token),
)
return response
def send_group_key_action_event(self, in_: GroupKeyActionEvent):
response : ActionEventResponse = self.client.SendGroupKeyActionEvent(in_, metadata=get_metadata(self.token),)
response: ActionEventResponse = self.client.SendGroupKeyActionEvent(
in_,
metadata=get_metadata(self.token),
)
return response
def put_overrides_data(self, data: OverridesData):
response : ActionEventResponse = self.client.PutOverridesData(data, metadata=get_metadata(self.token),)
response: ActionEventResponse = self.client.PutOverridesData(
data,
metadata=get_metadata(self.token),
)
return response

View File

@@ -1,19 +1,22 @@
from ..events_pb2_grpc import EventsServiceStub
from ..events_pb2 import PushEventRequest, PutLogRequest, PutStreamEventRequest
import datetime
from ..loader import ClientConfig
import json
import grpc
from google.protobuf import timestamp_pb2
from ..events_pb2 import PushEventRequest, PutLogRequest, PutStreamEventRequest
from ..events_pb2_grpc import EventsServiceStub
from ..loader import ClientConfig
from ..metadata import get_metadata
def new_event(conn, config: ClientConfig):
return EventClientImpl(
client=EventsServiceStub(conn),
config=config,
)
def proto_timestamp_now():
t = datetime.datetime.now().timestamp()
seconds = int(t)
@@ -21,6 +24,7 @@ def proto_timestamp_now():
return timestamp_pb2.Timestamp(seconds=seconds, nanos=nanos)
class EventClientImpl:
def __init__(self, client: EventsServiceStub, config: ClientConfig):
self.client = client
@@ -28,11 +32,11 @@ class EventClientImpl:
self.namespace = config.namespace
def push(self, event_key, payload):
namespaced_event_key = self.namespace + event_key
try:
payload_bytes = json.dumps(payload).encode('utf-8')
payload_bytes = json.dumps(payload).encode("utf-8")
except json.UnicodeEncodeError as e:
raise ValueError(f"Error encoding payload: {e}")
@@ -46,7 +50,7 @@ class EventClientImpl:
self.client.Push(request, metadata=get_metadata(self.token))
except grpc.RpcError as e:
raise ValueError(f"gRPC error: {e}")
def log(self, message: str, step_run_id: str):
try:
request = PutLogRequest(
@@ -58,16 +62,16 @@ class EventClientImpl:
self.client.PutLog(request, metadata=get_metadata(self.token))
except Exception as e:
raise ValueError(f"Error logging: {e}")
def stream(self, data: str | bytes, step_run_id: str):
try:
if isinstance(data, str):
data_bytes = data.encode('utf-8')
data_bytes = data.encode("utf-8")
elif isinstance(data, bytes):
data_bytes = data
else:
raise ValueError("Invalid data type. Expected str, bytes, or file.")
request = PutStreamEventRequest(
stepRunId=step_run_id,
createdAt=proto_timestamp_now(),
@@ -75,4 +79,4 @@ class EventClientImpl:
)
self.client.PutStreamEvent(request, metadata=get_metadata(self.token))
except Exception as e:
raise ValueError(f"Error putting stream event: {e}")
raise ValueError(f"Error putting stream event: {e}")

View File

@@ -1,33 +1,42 @@
import asyncio
import json
from typing import AsyncGenerator
import grpc
from hatchet_sdk.connection import new_conn
from ..dispatcher_pb2_grpc import DispatcherStub
from ..dispatcher_pb2 import SubscribeToWorkflowEventsRequest, ResourceEventType, WorkflowEvent, RESOURCE_TYPE_STEP_RUN, RESOURCE_TYPE_WORKFLOW_RUN
import grpc
from hatchet_sdk.connection import new_conn
from ..dispatcher_pb2 import (
RESOURCE_TYPE_STEP_RUN,
RESOURCE_TYPE_WORKFLOW_RUN,
ResourceEventType,
SubscribeToWorkflowEventsRequest,
WorkflowEvent,
)
from ..dispatcher_pb2_grpc import DispatcherStub
from ..loader import ClientConfig
from ..metadata import get_metadata
import json
import asyncio
DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5 # seconds
DEFAULT_ACTION_LISTENER_RETRY_COUNT = 5
class StepRunEventType:
STEP_RUN_EVENT_TYPE_STARTED = 'STEP_RUN_EVENT_TYPE_STARTED'
STEP_RUN_EVENT_TYPE_COMPLETED = 'STEP_RUN_EVENT_TYPE_COMPLETED'
STEP_RUN_EVENT_TYPE_FAILED = 'STEP_RUN_EVENT_TYPE_FAILED'
STEP_RUN_EVENT_TYPE_CANCELLED = 'STEP_RUN_EVENT_TYPE_CANCELLED'
STEP_RUN_EVENT_TYPE_TIMED_OUT = 'STEP_RUN_EVENT_TYPE_TIMED_OUT'
STEP_RUN_EVENT_TYPE_STREAM = 'STEP_RUN_EVENT_TYPE_STREAM'
STEP_RUN_EVENT_TYPE_STARTED = "STEP_RUN_EVENT_TYPE_STARTED"
STEP_RUN_EVENT_TYPE_COMPLETED = "STEP_RUN_EVENT_TYPE_COMPLETED"
STEP_RUN_EVENT_TYPE_FAILED = "STEP_RUN_EVENT_TYPE_FAILED"
STEP_RUN_EVENT_TYPE_CANCELLED = "STEP_RUN_EVENT_TYPE_CANCELLED"
STEP_RUN_EVENT_TYPE_TIMED_OUT = "STEP_RUN_EVENT_TYPE_TIMED_OUT"
STEP_RUN_EVENT_TYPE_STREAM = "STEP_RUN_EVENT_TYPE_STREAM"
class WorkflowRunEventType:
WORKFLOW_RUN_EVENT_TYPE_STARTED = 'WORKFLOW_RUN_EVENT_TYPE_STARTED'
WORKFLOW_RUN_EVENT_TYPE_COMPLETED = 'WORKFLOW_RUN_EVENT_TYPE_COMPLETED'
WORKFLOW_RUN_EVENT_TYPE_FAILED = 'WORKFLOW_RUN_EVENT_TYPE_FAILED'
WORKFLOW_RUN_EVENT_TYPE_CANCELLED = 'WORKFLOW_RUN_EVENT_TYPE_CANCELLED'
WORKFLOW_RUN_EVENT_TYPE_TIMED_OUT = 'WORKFLOW_RUN_EVENT_TYPE_TIMED_OUT'
WORKFLOW_RUN_EVENT_TYPE_STARTED = "WORKFLOW_RUN_EVENT_TYPE_STARTED"
WORKFLOW_RUN_EVENT_TYPE_COMPLETED = "WORKFLOW_RUN_EVENT_TYPE_COMPLETED"
WORKFLOW_RUN_EVENT_TYPE_FAILED = "WORKFLOW_RUN_EVENT_TYPE_FAILED"
WORKFLOW_RUN_EVENT_TYPE_CANCELLED = "WORKFLOW_RUN_EVENT_TYPE_CANCELLED"
WORKFLOW_RUN_EVENT_TYPE_TIMED_OUT = "WORKFLOW_RUN_EVENT_TYPE_TIMED_OUT"
step_run_event_type_mapping = {
ResourceEventType.RESOURCE_EVENT_TYPE_STARTED: StepRunEventType.STEP_RUN_EVENT_TYPE_STARTED,
@@ -46,6 +55,7 @@ workflow_run_event_type_mapping = {
ResourceEventType.RESOURCE_EVENT_TYPE_TIMED_OUT: WorkflowRunEventType.WORKFLOW_RUN_EVENT_TYPE_TIMED_OUT,
}
class StepRunEvent:
def __init__(self, type: StepRunEventType, payload: str):
self.type = type
@@ -54,9 +64,7 @@ class StepRunEvent:
def new_listener(conn, config: ClientConfig):
return ListenerClientImpl(
client=DispatcherStub(conn),
token=config.token,
config=config
client=DispatcherStub(conn), token=config.token, config=config
)
@@ -87,10 +95,13 @@ class HatchetListener:
eventType = None
if workflow_event.resourceType == RESOURCE_TYPE_STEP_RUN:
if workflow_event.eventType in step_run_event_type_mapping:
eventType = step_run_event_type_mapping[workflow_event.eventType]
eventType = step_run_event_type_mapping[
workflow_event.eventType
]
else:
raise Exception(
f"Unknown event type: {workflow_event.eventType}")
f"Unknown event type: {workflow_event.eventType}"
)
payload = None
try:
@@ -103,13 +114,16 @@ class HatchetListener:
yield StepRunEvent(type=eventType, payload=payload)
elif workflow_event.resourceType == RESOURCE_TYPE_WORKFLOW_RUN:
if workflow_event.eventType in workflow_run_event_type_mapping:
eventType = workflow_run_event_type_mapping[workflow_event.eventType]
eventType = workflow_run_event_type_mapping[
workflow_event.eventType
]
else:
raise Exception(
f"Unknown event type: {workflow_event.eventType}")
f"Unknown event type: {workflow_event.eventType}"
)
payload = None
try:
if workflow_event.eventPayload:
payload = json.loads(workflow_event.eventPayload)
@@ -117,10 +131,10 @@ class HatchetListener:
pass
yield StepRunEvent(type=eventType, payload=payload)
if workflow_event.hangup:
listener = None
print('hangup stopping listener...')
print("hangup stopping listener...")
break
except grpc.RpcError as e:
@@ -151,7 +165,9 @@ class HatchetListener:
listener = self.client.SubscribeToWorkflowEvents(
SubscribeToWorkflowEventsRequest(
workflowRunId=self.workflow_run_id,
), metadata=get_metadata(self.token))
),
metadata=get_metadata(self.token),
)
return listener
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.UNAVAILABLE:

View File

@@ -18,6 +18,7 @@ __version__ = "1.0.0"
# import apis into sdk package
from hatchet_sdk.clients.rest.api.api_token_api import APITokenApi
from hatchet_sdk.clients.rest.api.default_api import DefaultApi
from hatchet_sdk.clients.rest.api.event_api import EventApi
from hatchet_sdk.clients.rest.api.github_api import GithubApi
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
@@ -30,18 +31,20 @@ from hatchet_sdk.clients.rest.api.user_api import UserApi
from hatchet_sdk.clients.rest.api.worker_api import WorkerApi
from hatchet_sdk.clients.rest.api.workflow_api import WorkflowApi
from hatchet_sdk.clients.rest.api.workflow_run_api import WorkflowRunApi
from hatchet_sdk.clients.rest.api.default_api import DefaultApi
from hatchet_sdk.clients.rest.api_client import ApiClient
# import ApiClient
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.api_client import ApiClient
from hatchet_sdk.clients.rest.configuration import Configuration
from hatchet_sdk.clients.rest.exceptions import OpenApiException
from hatchet_sdk.clients.rest.exceptions import ApiTypeError
from hatchet_sdk.clients.rest.exceptions import ApiValueError
from hatchet_sdk.clients.rest.exceptions import ApiKeyError
from hatchet_sdk.clients.rest.exceptions import ApiAttributeError
from hatchet_sdk.clients.rest.exceptions import ApiException
from hatchet_sdk.clients.rest.exceptions import (
ApiAttributeError,
ApiException,
ApiKeyError,
ApiTypeError,
ApiValueError,
OpenApiException,
)
from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRequest
# import models into sdk package
from hatchet_sdk.clients.rest.models.api_error import APIError
@@ -51,36 +54,63 @@ from hatchet_sdk.clients.rest.models.api_meta_auth import APIMetaAuth
from hatchet_sdk.clients.rest.models.api_meta_integration import APIMetaIntegration
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
from hatchet_sdk.clients.rest.models.api_token import APIToken
from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRequest
from hatchet_sdk.clients.rest.models.create_api_token_request import CreateAPITokenRequest
from hatchet_sdk.clients.rest.models.create_api_token_response import CreateAPITokenResponse
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import CreatePullRequestFromStepRun
from hatchet_sdk.clients.rest.models.create_sns_integration_request import CreateSNSIntegrationRequest
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import CreateTenantInviteRequest
from hatchet_sdk.clients.rest.models.create_api_token_request import (
CreateAPITokenRequest,
)
from hatchet_sdk.clients.rest.models.create_api_token_response import (
CreateAPITokenResponse,
)
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import (
CreatePullRequestFromStepRun,
)
from hatchet_sdk.clients.rest.models.create_sns_integration_request import (
CreateSNSIntegrationRequest,
)
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import (
CreateTenantInviteRequest,
)
from hatchet_sdk.clients.rest.models.create_tenant_request import CreateTenantRequest
from hatchet_sdk.clients.rest.models.event import Event
from hatchet_sdk.clients.rest.models.event_data import EventData
from hatchet_sdk.clients.rest.models.event_key_list import EventKeyList
from hatchet_sdk.clients.rest.models.event_list import EventList
from hatchet_sdk.clients.rest.models.event_order_by_direction import EventOrderByDirection
from hatchet_sdk.clients.rest.models.event_order_by_direction import (
EventOrderByDirection,
)
from hatchet_sdk.clients.rest.models.event_order_by_field import EventOrderByField
from hatchet_sdk.clients.rest.models.event_workflow_run_summary import EventWorkflowRunSummary
from hatchet_sdk.clients.rest.models.get_step_run_diff_response import GetStepRunDiffResponse
from hatchet_sdk.clients.rest.models.github_app_installation import GithubAppInstallation
from hatchet_sdk.clients.rest.models.event_workflow_run_summary import (
EventWorkflowRunSummary,
)
from hatchet_sdk.clients.rest.models.get_step_run_diff_response import (
GetStepRunDiffResponse,
)
from hatchet_sdk.clients.rest.models.github_app_installation import (
GithubAppInstallation,
)
from hatchet_sdk.clients.rest.models.github_branch import GithubBranch
from hatchet_sdk.clients.rest.models.github_repo import GithubRepo
from hatchet_sdk.clients.rest.models.job import Job
from hatchet_sdk.clients.rest.models.job_run import JobRun
from hatchet_sdk.clients.rest.models.job_run_status import JobRunStatus
from hatchet_sdk.clients.rest.models.link_github_repository_request import LinkGithubRepositoryRequest
from hatchet_sdk.clients.rest.models.list_api_tokens_response import ListAPITokensResponse
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import ListGithubAppInstallationsResponse
from hatchet_sdk.clients.rest.models.list_pull_requests_response import ListPullRequestsResponse
from hatchet_sdk.clients.rest.models.link_github_repository_request import (
LinkGithubRepositoryRequest,
)
from hatchet_sdk.clients.rest.models.list_api_tokens_response import (
ListAPITokensResponse,
)
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import (
ListGithubAppInstallationsResponse,
)
from hatchet_sdk.clients.rest.models.list_pull_requests_response import (
ListPullRequestsResponse,
)
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
from hatchet_sdk.clients.rest.models.log_line import LogLine
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import LogLineOrderByDirection
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import (
LogLineOrderByDirection,
)
from hatchet_sdk.clients.rest.models.log_line_order_by_field import LogLineOrderByField
from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
from hatchet_sdk.clients.rest.models.pull_request import PullRequest
@@ -100,29 +130,47 @@ from hatchet_sdk.clients.rest.models.tenant_list import TenantList
from hatchet_sdk.clients.rest.models.tenant_member import TenantMember
from hatchet_sdk.clients.rest.models.tenant_member_list import TenantMemberList
from hatchet_sdk.clients.rest.models.tenant_member_role import TenantMemberRole
from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import TriggerWorkflowRunRequest
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import UpdateTenantInviteRequest
from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import (
TriggerWorkflowRunRequest,
)
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import (
UpdateTenantInviteRequest,
)
from hatchet_sdk.clients.rest.models.user import User
from hatchet_sdk.clients.rest.models.user_change_password_request import UserChangePasswordRequest
from hatchet_sdk.clients.rest.models.user_change_password_request import (
UserChangePasswordRequest,
)
from hatchet_sdk.clients.rest.models.user_login_request import UserLoginRequest
from hatchet_sdk.clients.rest.models.user_register_request import UserRegisterRequest
from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import UserTenantMembershipsList
from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import (
UserTenantMembershipsList,
)
from hatchet_sdk.clients.rest.models.user_tenant_public import UserTenantPublic
from hatchet_sdk.clients.rest.models.worker import Worker
from hatchet_sdk.clients.rest.models.worker_list import WorkerList
from hatchet_sdk.clients.rest.models.workflow import Workflow
from hatchet_sdk.clients.rest.models.workflow_concurrency import WorkflowConcurrency
from hatchet_sdk.clients.rest.models.workflow_deployment_config import WorkflowDeploymentConfig
from hatchet_sdk.clients.rest.models.workflow_deployment_config import (
WorkflowDeploymentConfig,
)
from hatchet_sdk.clients.rest.models.workflow_list import WorkflowList
from hatchet_sdk.clients.rest.models.workflow_metrics import WorkflowMetrics
from hatchet_sdk.clients.rest.models.workflow_run import WorkflowRun
from hatchet_sdk.clients.rest.models.workflow_run_list import WorkflowRunList
from hatchet_sdk.clients.rest.models.workflow_run_status import WorkflowRunStatus
from hatchet_sdk.clients.rest.models.workflow_run_triggered_by import WorkflowRunTriggeredBy
from hatchet_sdk.clients.rest.models.workflow_run_triggered_by import (
WorkflowRunTriggeredBy,
)
from hatchet_sdk.clients.rest.models.workflow_tag import WorkflowTag
from hatchet_sdk.clients.rest.models.workflow_trigger_cron_ref import WorkflowTriggerCronRef
from hatchet_sdk.clients.rest.models.workflow_trigger_event_ref import WorkflowTriggerEventRef
from hatchet_sdk.clients.rest.models.workflow_trigger_cron_ref import (
WorkflowTriggerCronRef,
)
from hatchet_sdk.clients.rest.models.workflow_trigger_event_ref import (
WorkflowTriggerEventRef,
)
from hatchet_sdk.clients.rest.models.workflow_triggers import WorkflowTriggers
from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion
from hatchet_sdk.clients.rest.models.workflow_version_definition import WorkflowVersionDefinition
from hatchet_sdk.clients.rest.models.workflow_version_definition import (
WorkflowVersionDefinition,
)
from hatchet_sdk.clients.rest.models.workflow_version_meta import WorkflowVersionMeta

View File

@@ -2,6 +2,7 @@
# import apis into api package
from hatchet_sdk.clients.rest.api.api_token_api import APITokenApi
from hatchet_sdk.clients.rest.api.default_api import DefaultApi
from hatchet_sdk.clients.rest.api.event_api import EventApi
from hatchet_sdk.clients.rest.api.github_api import GithubApi
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
@@ -14,5 +15,3 @@ from hatchet_sdk.clients.rest.api.user_api import UserApi
from hatchet_sdk.clients.rest.api.worker_api import WorkerApi
from hatchet_sdk.clients.rest.api.workflow_api import WorkflowApi
from hatchet_sdk.clients.rest.api.workflow_run_api import WorkflowRunApi
from hatchet_sdk.clients.rest.api.default_api import DefaultApi

View File

@@ -12,19 +12,22 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from pydantic import Field
from typing import Optional
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.create_api_token_request import CreateAPITokenRequest
from hatchet_sdk.clients.rest.models.create_api_token_response import CreateAPITokenResponse
from hatchet_sdk.clients.rest.models.list_api_tokens_response import ListAPITokensResponse
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.models.create_api_token_request import (
CreateAPITokenRequest,
)
from hatchet_sdk.clients.rest.models.create_api_token_response import (
CreateAPITokenResponse,
)
from hatchet_sdk.clients.rest.models.list_api_tokens_response import (
ListAPITokensResponse,
)
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -40,19 +43,22 @@ class APITokenApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def api_token_create(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_api_token_request: Optional[CreateAPITokenRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -87,7 +93,7 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_create_serialize(
tenant=tenant,
@@ -95,17 +101,16 @@ class APITokenApi:
_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': "CreateAPITokenResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "CreateAPITokenResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -113,19 +118,22 @@ class APITokenApi:
response_types_map=_response_types_map,
).data
@validate_call
def api_token_create_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_api_token_request: Optional[CreateAPITokenRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -160,7 +168,7 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_create_serialize(
tenant=tenant,
@@ -168,17 +176,16 @@ class APITokenApi:
_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': "CreateAPITokenResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "CreateAPITokenResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -186,19 +193,22 @@ class APITokenApi:
response_types_map=_response_types_map,
)
@validate_call
def api_token_create_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_api_token_request: Optional[CreateAPITokenRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -233,7 +243,7 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_create_serialize(
tenant=tenant,
@@ -241,21 +251,19 @@ class APITokenApi:
_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': "CreateAPITokenResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "CreateAPITokenResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _api_token_create_serialize(
self,
tenant,
@@ -268,8 +276,7 @@ class APITokenApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -280,7 +287,7 @@ class APITokenApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
# process the query parameters
# process the header parameters
# process the form parameters
@@ -288,37 +295,27 @@ class APITokenApi:
if create_api_token_request is not None:
_body_params = create_api_token_request
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# 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] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/tenants/{tenant}/api-tokens',
method="POST",
resource_path="/api/v1/tenants/{tenant}/api-tokens",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -328,23 +325,24 @@ class APITokenApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def api_token_list(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -377,24 +375,23 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_list_serialize(
tenant=tenant,
_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': "ListAPITokensResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "ListAPITokensResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -402,18 +399,21 @@ class APITokenApi:
response_types_map=_response_types_map,
).data
@validate_call
def api_token_list_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -446,24 +446,23 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_list_serialize(
tenant=tenant,
_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': "ListAPITokensResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "ListAPITokensResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -471,18 +470,21 @@ class APITokenApi:
response_types_map=_response_types_map,
)
@validate_call
def api_token_list_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -515,28 +517,26 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_list_serialize(
tenant=tenant,
_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': "ListAPITokensResponse",
'400': "APIErrors",
'403': "APIErrors",
"200": "ListAPITokensResponse",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _api_token_list_serialize(
self,
tenant,
@@ -548,8 +548,7 @@ class APITokenApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -560,30 +559,23 @@ class APITokenApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/tenants/{tenant}/api-tokens',
method="GET",
resource_path="/api/v1/tenants/{tenant}/api-tokens",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -593,23 +585,24 @@ class APITokenApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def api_token_update_revoke(
self,
api_token: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The API token")],
api_token: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The API token"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -642,24 +635,23 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_update_revoke_serialize(
api_token=api_token,
_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]] = {
'204': None,
'400': "APIErrors",
'403': "APIErrors",
"204": None,
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -667,18 +659,21 @@ class APITokenApi:
response_types_map=_response_types_map,
).data
@validate_call
def api_token_update_revoke_with_http_info(
self,
api_token: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The API token")],
api_token: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The API token"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -711,24 +706,23 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_update_revoke_serialize(
api_token=api_token,
_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]] = {
'204': None,
'400': "APIErrors",
'403': "APIErrors",
"204": None,
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -736,18 +730,21 @@ class APITokenApi:
response_types_map=_response_types_map,
)
@validate_call
def api_token_update_revoke_without_preload_content(
self,
api_token: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The API token")],
api_token: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The API token"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -780,28 +777,26 @@ class APITokenApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._api_token_update_revoke_serialize(
api_token=api_token,
_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]] = {
'204': None,
'400': "APIErrors",
'403': "APIErrors",
"204": None,
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _api_token_update_revoke_serialize(
self,
api_token,
@@ -813,8 +808,7 @@ class APITokenApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -825,30 +819,23 @@ class APITokenApi:
# process the path parameters
if api_token is not None:
_path_params['api-token'] = api_token
_path_params["api-token"] = api_token
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/api-tokens/{api-token}',
method="POST",
resource_path="/api/v1/api-tokens/{api-token}",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -858,7 +845,5 @@ class APITokenApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)

View File

@@ -12,17 +12,17 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from pydantic import Field
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.tenant_invite import TenantInvite
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import UpdateTenantInviteRequest
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.models.tenant_invite import TenantInvite
from hatchet_sdk.clients.rest.models.update_tenant_invite_request import (
UpdateTenantInviteRequest,
)
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -38,19 +38,30 @@ class DefaultApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def tenant_invite_delete(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -85,7 +96,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_delete_serialize(
tenant=tenant,
@@ -93,16 +104,15 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -110,19 +120,30 @@ class DefaultApi:
response_types_map=_response_types_map,
).data
@validate_call
def tenant_invite_delete_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -157,7 +178,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_delete_serialize(
tenant=tenant,
@@ -165,16 +186,15 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -182,19 +202,30 @@ class DefaultApi:
response_types_map=_response_types_map,
)
@validate_call
def tenant_invite_delete_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -229,7 +260,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_delete_serialize(
tenant=tenant,
@@ -237,20 +268,18 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _tenant_invite_delete_serialize(
self,
tenant,
@@ -263,8 +292,7 @@ class DefaultApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -275,32 +303,25 @@ class DefaultApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
if tenant_invite is not None:
_path_params['tenant-invite'] = tenant_invite
_path_params["tenant-invite"] = tenant_invite
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/api/v1/tenants/{tenant}/invites/{tenant-invite}',
method="DELETE",
resource_path="/api/v1/tenants/{tenant}/invites/{tenant-invite}",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -310,25 +331,36 @@ class DefaultApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def tenant_invite_update(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
update_tenant_invite_request: Annotated[UpdateTenantInviteRequest, Field(description="The tenant invite to update")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
update_tenant_invite_request: Annotated[
UpdateTenantInviteRequest, Field(description="The tenant invite to update")
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -365,7 +397,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_update_serialize(
tenant=tenant,
@@ -374,16 +406,15 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -391,20 +422,33 @@ class DefaultApi:
response_types_map=_response_types_map,
).data
@validate_call
def tenant_invite_update_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
update_tenant_invite_request: Annotated[UpdateTenantInviteRequest, Field(description="The tenant invite to update")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
update_tenant_invite_request: Annotated[
UpdateTenantInviteRequest, Field(description="The tenant invite to update")
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -441,7 +485,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_update_serialize(
tenant=tenant,
@@ -450,16 +494,15 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -467,20 +510,33 @@ class DefaultApi:
response_types_map=_response_types_map,
)
@validate_call
def tenant_invite_update_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant_invite: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant invite id")],
update_tenant_invite_request: Annotated[UpdateTenantInviteRequest, Field(description="The tenant invite to update")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
tenant_invite: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The tenant invite id",
),
],
update_tenant_invite_request: Annotated[
UpdateTenantInviteRequest, Field(description="The tenant invite to update")
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -517,7 +573,7 @@ class DefaultApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._tenant_invite_update_serialize(
tenant=tenant,
@@ -526,20 +582,18 @@ class DefaultApi:
_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': "TenantInvite",
'400': "APIErrors",
"200": "TenantInvite",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _tenant_invite_update_serialize(
self,
tenant,
@@ -553,8 +607,7 @@ class DefaultApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -565,9 +618,9 @@ class DefaultApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
if tenant_invite is not None:
_path_params['tenant-invite'] = tenant_invite
_path_params["tenant-invite"] = tenant_invite
# process the query parameters
# process the header parameters
# process the form parameters
@@ -575,37 +628,27 @@ class DefaultApi:
if update_tenant_invite_request is not None:
_body_params = update_tenant_invite_request
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# 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] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='PATCH',
resource_path='/api/v1/tenants/{tenant}/invites/{tenant-invite}',
method="PATCH",
resource_path="/api/v1/tenants/{tenant}/invites/{tenant-invite}",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -615,7 +658,5 @@ class DefaultApi:
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

View File

@@ -12,10 +12,10 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
@@ -34,7 +34,6 @@ class HealthcheckApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def liveness_get(
self,
@@ -42,9 +41,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -75,22 +73,21 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._liveness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -98,7 +95,6 @@ class HealthcheckApi:
response_types_map=_response_types_map,
).data
@validate_call
def liveness_get_with_http_info(
self,
@@ -106,9 +102,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -139,22 +134,21 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._liveness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -162,7 +156,6 @@ class HealthcheckApi:
response_types_map=_response_types_map,
)
@validate_call
def liveness_get_without_preload_content(
self,
@@ -170,9 +163,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -203,26 +195,24 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._liveness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _liveness_get_serialize(
self,
_request_auth,
@@ -233,8 +223,7 @@ class HealthcheckApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -249,16 +238,12 @@ class HealthcheckApi:
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = [
]
_auth_settings: List[str] = []
return self.api_client.param_serialize(
method='GET',
resource_path='/api/live',
method="GET",
resource_path="/api/live",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -268,12 +253,9 @@ class HealthcheckApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def readiness_get(
self,
@@ -281,9 +263,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -314,22 +295,21 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._readiness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -337,7 +317,6 @@ class HealthcheckApi:
response_types_map=_response_types_map,
).data
@validate_call
def readiness_get_with_http_info(
self,
@@ -345,9 +324,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -378,22 +356,21 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._readiness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -401,7 +378,6 @@ class HealthcheckApi:
response_types_map=_response_types_map,
)
@validate_call
def readiness_get_without_preload_content(
self,
@@ -409,9 +385,8 @@ class HealthcheckApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -442,26 +417,24 @@ class HealthcheckApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._readiness_get_serialize(
_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,
'500': None,
"200": None,
"500": None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _readiness_get_serialize(
self,
_request_auth,
@@ -472,8 +445,7 @@ class HealthcheckApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -488,16 +460,12 @@ class HealthcheckApi:
# process the form parameters
# process the body parameter
# authentication setting
_auth_settings: List[str] = [
]
_auth_settings: List[str] = []
return self.api_client.param_serialize(
method='GET',
resource_path='/api/ready',
method="GET",
resource_path="/api/ready",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -507,7 +475,5 @@ class HealthcheckApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)

View File

@@ -12,20 +12,19 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import LogLineOrderByDirection
from hatchet_sdk.clients.rest.models.log_line_order_by_field import LogLineOrderByField
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
from hatchet_sdk.clients.rest.models.log_line_order_by_direction import (
LogLineOrderByDirection,
)
from hatchet_sdk.clients.rest.models.log_line_order_by_field import LogLineOrderByField
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -41,24 +40,40 @@ class LogApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def log_line_list(
self,
step_run: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The step run id")],
offset: Annotated[Optional[StrictInt], Field(description="The number to skip")] = None,
limit: Annotated[Optional[StrictInt], Field(description="The number to limit by")] = None,
levels: Annotated[Optional[List[LogLineLevel]], Field(description="A list of levels to filter by")] = None,
search: Annotated[Optional[StrictStr], Field(description="The search query to filter for")] = None,
order_by_field: Annotated[Optional[LogLineOrderByField], Field(description="What to order by")] = None,
order_by_direction: Annotated[Optional[LogLineOrderByDirection], Field(description="The order direction")] = None,
step_run: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The step run id"
),
],
offset: Annotated[
Optional[StrictInt], Field(description="The number to skip")
] = None,
limit: Annotated[
Optional[StrictInt], Field(description="The number to limit by")
] = None,
levels: Annotated[
Optional[List[LogLineLevel]],
Field(description="A list of levels to filter by"),
] = None,
search: Annotated[
Optional[StrictStr], Field(description="The search query to filter for")
] = None,
order_by_field: Annotated[
Optional[LogLineOrderByField], Field(description="What to order by")
] = None,
order_by_direction: Annotated[
Optional[LogLineOrderByDirection], Field(description="The order direction")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -103,7 +118,7 @@ class LogApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._log_line_list_serialize(
step_run=step_run,
@@ -116,17 +131,16 @@ class LogApi:
_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': "LogLineList",
'400': "APIErrors",
'403': "APIErrors",
"200": "LogLineList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -134,24 +148,40 @@ class LogApi:
response_types_map=_response_types_map,
).data
@validate_call
def log_line_list_with_http_info(
self,
step_run: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The step run id")],
offset: Annotated[Optional[StrictInt], Field(description="The number to skip")] = None,
limit: Annotated[Optional[StrictInt], Field(description="The number to limit by")] = None,
levels: Annotated[Optional[List[LogLineLevel]], Field(description="A list of levels to filter by")] = None,
search: Annotated[Optional[StrictStr], Field(description="The search query to filter for")] = None,
order_by_field: Annotated[Optional[LogLineOrderByField], Field(description="What to order by")] = None,
order_by_direction: Annotated[Optional[LogLineOrderByDirection], Field(description="The order direction")] = None,
step_run: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The step run id"
),
],
offset: Annotated[
Optional[StrictInt], Field(description="The number to skip")
] = None,
limit: Annotated[
Optional[StrictInt], Field(description="The number to limit by")
] = None,
levels: Annotated[
Optional[List[LogLineLevel]],
Field(description="A list of levels to filter by"),
] = None,
search: Annotated[
Optional[StrictStr], Field(description="The search query to filter for")
] = None,
order_by_field: Annotated[
Optional[LogLineOrderByField], Field(description="What to order by")
] = None,
order_by_direction: Annotated[
Optional[LogLineOrderByDirection], Field(description="The order direction")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -196,7 +226,7 @@ class LogApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._log_line_list_serialize(
step_run=step_run,
@@ -209,17 +239,16 @@ class LogApi:
_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': "LogLineList",
'400': "APIErrors",
'403': "APIErrors",
"200": "LogLineList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -227,24 +256,40 @@ class LogApi:
response_types_map=_response_types_map,
)
@validate_call
def log_line_list_without_preload_content(
self,
step_run: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The step run id")],
offset: Annotated[Optional[StrictInt], Field(description="The number to skip")] = None,
limit: Annotated[Optional[StrictInt], Field(description="The number to limit by")] = None,
levels: Annotated[Optional[List[LogLineLevel]], Field(description="A list of levels to filter by")] = None,
search: Annotated[Optional[StrictStr], Field(description="The search query to filter for")] = None,
order_by_field: Annotated[Optional[LogLineOrderByField], Field(description="What to order by")] = None,
order_by_direction: Annotated[Optional[LogLineOrderByDirection], Field(description="The order direction")] = None,
step_run: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The step run id"
),
],
offset: Annotated[
Optional[StrictInt], Field(description="The number to skip")
] = None,
limit: Annotated[
Optional[StrictInt], Field(description="The number to limit by")
] = None,
levels: Annotated[
Optional[List[LogLineLevel]],
Field(description="A list of levels to filter by"),
] = None,
search: Annotated[
Optional[StrictStr], Field(description="The search query to filter for")
] = None,
order_by_field: Annotated[
Optional[LogLineOrderByField], Field(description="What to order by")
] = None,
order_by_direction: Annotated[
Optional[LogLineOrderByDirection], Field(description="The order direction")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -289,7 +334,7 @@ class LogApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._log_line_list_serialize(
step_run=step_run,
@@ -302,21 +347,19 @@ class LogApi:
_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': "LogLineList",
'400': "APIErrors",
'403': "APIErrors",
"200": "LogLineList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _log_line_list_serialize(
self,
step_run,
@@ -335,7 +378,7 @@ class LogApi:
_host = None
_collection_formats: Dict[str, str] = {
'levels': 'multi',
"levels": "multi",
}
_path_params: Dict[str, str] = {}
@@ -347,54 +390,47 @@ class LogApi:
# process the path parameters
if step_run is not None:
_path_params['step-run'] = step_run
_path_params["step-run"] = step_run
# process the query parameters
if offset is not None:
_query_params.append(('offset', offset))
_query_params.append(("offset", offset))
if limit is not None:
_query_params.append(('limit', limit))
_query_params.append(("limit", limit))
if levels is not None:
_query_params.append(('levels', levels))
_query_params.append(("levels", levels))
if search is not None:
_query_params.append(('search', search))
_query_params.append(("search", search))
if order_by_field is not None:
_query_params.append(('orderByField', order_by_field.value))
_query_params.append(("orderByField", order_by_field.value))
if order_by_direction is not None:
_query_params.append(('orderByDirection', order_by_direction.value))
_query_params.append(("orderByDirection", order_by_direction.value))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/step-runs/{step-run}/logs',
method="GET",
resource_path="/api/v1/step-runs/{step-run}/logs",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -404,7 +440,5 @@ class LogApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)

View File

@@ -12,15 +12,15 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.api_meta import APIMeta
from hatchet_sdk.clients.rest.models.api_meta_integration import APIMetaIntegration
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.models.api_meta import APIMeta
from hatchet_sdk.clients.rest.models.api_meta_integration import APIMetaIntegration
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -36,7 +36,6 @@ class MetadataApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def metadata_get(
self,
@@ -44,9 +43,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -77,22 +75,21 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_get_serialize(
_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': "APIMeta",
'400': "APIErrors",
"200": "APIMeta",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -100,7 +97,6 @@ class MetadataApi:
response_types_map=_response_types_map,
).data
@validate_call
def metadata_get_with_http_info(
self,
@@ -108,9 +104,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -141,22 +136,21 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_get_serialize(
_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': "APIMeta",
'400': "APIErrors",
"200": "APIMeta",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -164,7 +158,6 @@ class MetadataApi:
response_types_map=_response_types_map,
)
@validate_call
def metadata_get_without_preload_content(
self,
@@ -172,9 +165,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -205,26 +197,24 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_get_serialize(
_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': "APIMeta",
'400': "APIErrors",
"200": "APIMeta",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _metadata_get_serialize(
self,
_request_auth,
@@ -235,8 +225,7 @@ class MetadataApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -251,22 +240,17 @@ class MetadataApi:
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_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='/api/v1/meta',
method="GET",
resource_path="/api/v1/meta",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -276,12 +260,9 @@ class MetadataApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def metadata_list_integrations(
self,
@@ -289,9 +270,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -322,22 +302,21 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_list_integrations_serialize(
_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[APIMetaIntegration]",
'400': "APIErrors",
"200": "List[APIMetaIntegration]",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -345,7 +324,6 @@ class MetadataApi:
response_types_map=_response_types_map,
).data
@validate_call
def metadata_list_integrations_with_http_info(
self,
@@ -353,9 +331,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -386,22 +363,21 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_list_integrations_serialize(
_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[APIMetaIntegration]",
'400': "APIErrors",
"200": "List[APIMetaIntegration]",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -409,7 +385,6 @@ class MetadataApi:
response_types_map=_response_types_map,
)
@validate_call
def metadata_list_integrations_without_preload_content(
self,
@@ -417,9 +392,8 @@ class MetadataApi:
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -450,26 +424,24 @@ class MetadataApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._metadata_list_integrations_serialize(
_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[APIMetaIntegration]",
'400': "APIErrors",
"200": "List[APIMetaIntegration]",
"400": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _metadata_list_integrations_serialize(
self,
_request_auth,
@@ -480,8 +452,7 @@ class MetadataApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -496,24 +467,17 @@ class MetadataApi:
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/meta/integrations',
method="GET",
resource_path="/api/v1/meta/integrations",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -523,7 +487,5 @@ class MetadataApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)

View File

@@ -12,19 +12,18 @@
""" # noqa: E501
import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from pydantic import Field
from typing import Optional
from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.create_sns_integration_request import CreateSNSIntegrationRequest
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.models.create_sns_integration_request import (
CreateSNSIntegrationRequest,
)
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -40,19 +39,22 @@ class SNSApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def sns_create(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -87,7 +89,7 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_create_serialize(
tenant=tenant,
@@ -95,18 +97,17 @@ class SNSApi:
_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': "SNSIntegration",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"201": "SNSIntegration",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -114,19 +115,22 @@ class SNSApi:
response_types_map=_response_types_map,
).data
@validate_call
def sns_create_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -161,7 +165,7 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_create_serialize(
tenant=tenant,
@@ -169,18 +173,17 @@ class SNSApi:
_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': "SNSIntegration",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"201": "SNSIntegration",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -188,19 +191,22 @@ class SNSApi:
response_types_map=_response_types_map,
)
@validate_call
def sns_create_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -235,7 +241,7 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_create_serialize(
tenant=tenant,
@@ -243,22 +249,20 @@ class SNSApi:
_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': "SNSIntegration",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"201": "SNSIntegration",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _sns_create_serialize(
self,
tenant,
@@ -271,8 +275,7 @@ class SNSApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -283,7 +286,7 @@ class SNSApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
# process the query parameters
# process the header parameters
# process the form parameters
@@ -291,37 +294,27 @@ class SNSApi:
if create_sns_integration_request is not None:
_body_params = create_sns_integration_request
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# 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] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='POST',
resource_path='/api/v1/tenants/{tenant}/sns',
method="POST",
resource_path="/api/v1/tenants/{tenant}/sns",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -331,23 +324,27 @@ class SNSApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def sns_delete(
self,
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
sns: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The SNS integration id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -380,25 +377,24 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_delete_serialize(
sns=sns,
_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]] = {
'204': None,
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"204": None,
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -406,18 +402,24 @@ class SNSApi:
response_types_map=_response_types_map,
).data
@validate_call
def sns_delete_with_http_info(
self,
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
sns: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The SNS integration id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -450,25 +452,24 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_delete_serialize(
sns=sns,
_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]] = {
'204': None,
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"204": None,
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -476,18 +477,24 @@ class SNSApi:
response_types_map=_response_types_map,
)
@validate_call
def sns_delete_without_preload_content(
self,
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
sns: Annotated[
str,
Field(
min_length=36,
strict=True,
max_length=36,
description="The SNS integration id",
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -520,29 +527,27 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_delete_serialize(
sns=sns,
_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]] = {
'204': None,
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"204": None,
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _sns_delete_serialize(
self,
sns,
@@ -554,8 +559,7 @@ class SNSApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -566,30 +570,23 @@ class SNSApi:
# process the path parameters
if sns is not None:
_path_params['sns'] = sns
_path_params["sns"] = sns
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/api/v1/sns/{sns}',
method="DELETE",
resource_path="/api/v1/sns/{sns}",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -599,23 +596,24 @@ class SNSApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)
@validate_call
def sns_list(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -648,25 +646,24 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_list_serialize(
tenant=tenant,
_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': "ListSNSIntegrations",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"200": "ListSNSIntegrations",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -674,18 +671,21 @@ class SNSApi:
response_types_map=_response_types_map,
).data
@validate_call
def sns_list_with_http_info(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -718,25 +718,24 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_list_serialize(
tenant=tenant,
_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': "ListSNSIntegrations",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"200": "ListSNSIntegrations",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
@@ -744,18 +743,21 @@ class SNSApi:
response_types_map=_response_types_map,
)
@validate_call
def sns_list_without_preload_content(
self,
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
@@ -788,29 +790,27 @@ class SNSApi:
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
""" # noqa: E501
_param = self._sns_list_serialize(
tenant=tenant,
_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': "ListSNSIntegrations",
'400': "APIErrors",
'401': "APIErrors",
'405': "APIErrors",
"200": "ListSNSIntegrations",
"400": "APIErrors",
"401": "APIErrors",
"405": "APIErrors",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _sns_list_serialize(
self,
tenant,
@@ -822,8 +822,7 @@ class SNSApi:
_host = None
_collection_formats: Dict[str, str] = {
}
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
@@ -834,30 +833,23 @@ class SNSApi:
# process the path parameters
if tenant is not None:
_path_params['tenant'] = tenant
_path_params["tenant"] = tenant
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = [
'cookieAuth',
'bearerAuth'
]
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method='GET',
resource_path='/api/v1/tenants/{tenant}/sns',
method="GET",
resource_path="/api/v1/tenants/{tenant}/sns",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@@ -867,7 +859,5 @@ class SNSApi:
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
_request_auth=_request_auth,
)

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