erdo 0.1.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- erdo/__init__.py +35 -0
- erdo/_generated/__init__.py +18 -0
- erdo/_generated/actions/__init__.py +34 -0
- erdo/_generated/actions/analysis.py +179 -0
- erdo/_generated/actions/bot.py +186 -0
- erdo/_generated/actions/codeexec.py +199 -0
- erdo/_generated/actions/llm.py +148 -0
- erdo/_generated/actions/memory.py +463 -0
- erdo/_generated/actions/pdfextractor.py +97 -0
- erdo/_generated/actions/resource_definitions.py +296 -0
- erdo/_generated/actions/sqlexec.py +90 -0
- erdo/_generated/actions/utils.py +475 -0
- erdo/_generated/actions/webparser.py +119 -0
- erdo/_generated/actions/websearch.py +85 -0
- erdo/_generated/condition/__init__.py +556 -0
- erdo/_generated/internal.py +51 -0
- erdo/_generated/internal_actions.py +91 -0
- erdo/_generated/parameters.py +17 -0
- erdo/_generated/secrets.py +17 -0
- erdo/_generated/template_functions.py +55 -0
- erdo/_generated/types.py +3907 -0
- erdo/actions/__init__.py +40 -0
- erdo/bot_permissions.py +266 -0
- erdo/cli_entry.py +73 -0
- erdo/conditions/__init__.py +11 -0
- erdo/config/__init__.py +5 -0
- erdo/config/config.py +140 -0
- erdo/formatting.py +279 -0
- erdo/install_cli.py +140 -0
- erdo/integrations.py +131 -0
- erdo/invoke/__init__.py +11 -0
- erdo/invoke/client.py +234 -0
- erdo/invoke/invoke.py +555 -0
- erdo/state.py +376 -0
- erdo/sync/__init__.py +17 -0
- erdo/sync/client.py +95 -0
- erdo/sync/extractor.py +492 -0
- erdo/sync/sync.py +327 -0
- erdo/template.py +136 -0
- erdo/test/__init__.py +41 -0
- erdo/test/evaluate.py +272 -0
- erdo/test/runner.py +263 -0
- erdo/types.py +1431 -0
- erdo-0.1.31.dist-info/METADATA +471 -0
- erdo-0.1.31.dist-info/RECORD +48 -0
- erdo-0.1.31.dist-info/WHEEL +4 -0
- erdo-0.1.31.dist-info/entry_points.txt +2 -0
- erdo-0.1.31.dist-info/licenses/LICENSE +22 -0
erdo/_generated/types.py
ADDED
|
@@ -0,0 +1,3907 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""
|
|
4
|
+
Auto-generated type definitions from shared Go types.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
from enum import Enum
|
|
12
|
+
from typing import Any, Dict, List, Optional, Union
|
|
13
|
+
from uuid import UUID
|
|
14
|
+
|
|
15
|
+
# Import TemplateString for Union types
|
|
16
|
+
if False: # TYPE_CHECKING
|
|
17
|
+
from erdo.template import TemplateString
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# ParameterType (from ParameterType in Go)
|
|
21
|
+
class ParameterType(str, Enum):
|
|
22
|
+
"""Enum for ParameterType values"""
|
|
23
|
+
|
|
24
|
+
STRING = "string"
|
|
25
|
+
INTEGER = "integer"
|
|
26
|
+
FLOAT = "float"
|
|
27
|
+
BOOL = "bool"
|
|
28
|
+
JSON = "json"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# ParameterHydrationBehaviour (from ParameterHydrationBehaviour in Go)
|
|
32
|
+
class ParameterHydrationBehaviour(str, Enum):
|
|
33
|
+
"""Enum for ParameterHydrationBehaviour values"""
|
|
34
|
+
|
|
35
|
+
HYDRATE = "hydrate"
|
|
36
|
+
RAW = "raw"
|
|
37
|
+
NONE = "none"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# OutputVisibility (from OutputVisibility in Go)
|
|
41
|
+
class OutputVisibility(str, Enum):
|
|
42
|
+
"""Enum for OutputVisibility values"""
|
|
43
|
+
|
|
44
|
+
VISIBLE = "visible"
|
|
45
|
+
HIDDEN = "hidden"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# OutputContentType (from OutputContentType in Go)
|
|
49
|
+
class OutputContentType(str, Enum):
|
|
50
|
+
"""Enum for OutputContentType values"""
|
|
51
|
+
|
|
52
|
+
TEXT = "text"
|
|
53
|
+
JSON = "json"
|
|
54
|
+
HTML = "html"
|
|
55
|
+
TOOL_INVOCATION = "tool_invocation"
|
|
56
|
+
TOOL_RESULT = "tool_result"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# HandlerType (from HandlerType in Go)
|
|
60
|
+
class HandlerType(str, Enum):
|
|
61
|
+
"""Enum for HandlerType values"""
|
|
62
|
+
|
|
63
|
+
INTERMEDIATE = "intermediate"
|
|
64
|
+
FINAL = "final"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# ExecutionModeType (from ExecutionModeType in Go)
|
|
68
|
+
class ExecutionModeType(str, Enum):
|
|
69
|
+
"""Enum for ExecutionModeType values"""
|
|
70
|
+
|
|
71
|
+
ALL = "all"
|
|
72
|
+
ITERATE_OVER = "iterate_over"
|
|
73
|
+
ALL_BACKGROUND = "all_background"
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Model (from Model in Go)
|
|
77
|
+
class LlmModel(str, Enum):
|
|
78
|
+
"""Enum for LlmModel values"""
|
|
79
|
+
|
|
80
|
+
CLAUDE_SONNET_4 = "claude-sonnet-4"
|
|
81
|
+
CLAUDE_SONNET_4_5 = "claude-sonnet-4-5"
|
|
82
|
+
CLAUDE_HAIKU_4_5 = "claude-haiku-4-5"
|
|
83
|
+
GPT_4O = "gpt-4o"
|
|
84
|
+
GPT_4O_MINI = "gpt-4o-mini"
|
|
85
|
+
GPT_4_1 = "gpt-4.1"
|
|
86
|
+
GPT_4_1_MINI = "gpt-4.1-mini"
|
|
87
|
+
GPT_4_1_NANO = "gpt-4.1-nano"
|
|
88
|
+
GPT_5 = "gpt-5"
|
|
89
|
+
GPT_5_MINI = "gpt-5-mini"
|
|
90
|
+
GPT_5_NANO = "gpt-5-nano"
|
|
91
|
+
GEMINI_2_5_PRO = "gemini-2.5-pro"
|
|
92
|
+
GEMINI_2_5_FLASH = "gemini-2.5-flash"
|
|
93
|
+
GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# OutputBehaviorType (from OutputBehaviorType in Go)
|
|
97
|
+
class OutputBehaviorType(str, Enum):
|
|
98
|
+
"""Enum for OutputBehaviorType values"""
|
|
99
|
+
|
|
100
|
+
STEP_ONLY = "step_only"
|
|
101
|
+
MERGE = "merge"
|
|
102
|
+
OVERWRITE = "overwrite"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# CredentialSource (from CredentialSource in Go)
|
|
106
|
+
class CredentialSource(str, Enum):
|
|
107
|
+
"""Enum for CredentialSource values"""
|
|
108
|
+
|
|
109
|
+
INTEGRATION_CREDENTIALS = "integration_credentials"
|
|
110
|
+
CONFIG_PROVIDER_CREDENTIALS = "config_provider_credentials"
|
|
111
|
+
SEGMENT = "segment"
|
|
112
|
+
DATASET_PARAMETERS = "dataset_parameters"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# SensitivityLevel (from SensitivityLevel in Go)
|
|
116
|
+
class SensitivityLevel(str, Enum):
|
|
117
|
+
"""Enum for SensitivityLevel values"""
|
|
118
|
+
|
|
119
|
+
NEVER_VIEWABLE = "never_viewable"
|
|
120
|
+
OWNER_VIEWABLE = "owner_viewable"
|
|
121
|
+
ADMIN_VIEWABLE = "admin_viewable"
|
|
122
|
+
EDIT_VIEWABLE = "edit_viewable"
|
|
123
|
+
ALL_VIEWABLE = "all_viewable"
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# JSONSchemaType (from JSONSchemaType in Go)
|
|
127
|
+
class JSONSchemaType(str, Enum):
|
|
128
|
+
"""Enum for JSONSchemaType values"""
|
|
129
|
+
|
|
130
|
+
STRING = "string"
|
|
131
|
+
NUMBER = "number"
|
|
132
|
+
BOOLEAN = "boolean"
|
|
133
|
+
OBJECT = "object"
|
|
134
|
+
ARRAY = "array"
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# InvocationEventType (from InvocationEventType in Go)
|
|
138
|
+
class InvocationEventType(str, Enum):
|
|
139
|
+
"""Enum for InvocationEventType values"""
|
|
140
|
+
|
|
141
|
+
BOT_STARTED = "bot started"
|
|
142
|
+
MESSAGE_CREATED = "message created"
|
|
143
|
+
MESSAGE_FINISHED = "message finished"
|
|
144
|
+
MESSAGE_CONTENT_DELTA = "message content delta"
|
|
145
|
+
CREATE_MESSAGE_CONTENT = "create message content"
|
|
146
|
+
MESSAGE_CONTENT_RESULT = "message content result"
|
|
147
|
+
STEP_OUTPUT_CREATED = "step output created"
|
|
148
|
+
STEP_OUTPUT_FINISHED = "step output finished"
|
|
149
|
+
STEP_OUTPUT_CONTENT_DELTA = "step output content delta"
|
|
150
|
+
CREATE_STEP_OUTPUT_CONTENT = "create step output content"
|
|
151
|
+
STEP_OUTPUT_CONTENT_RESULT = "step output content result"
|
|
152
|
+
STEP_STARTED = "step started"
|
|
153
|
+
STEP_RESULT = "step result"
|
|
154
|
+
RESULT_HANDLER_STARTED = "result handler started"
|
|
155
|
+
REQUIRES_INFO = "requires info"
|
|
156
|
+
ERROR = "error"
|
|
157
|
+
STATUS = "status"
|
|
158
|
+
RESULT = "result"
|
|
159
|
+
DATASET_CREATED = "dataset created"
|
|
160
|
+
LOG = "log"
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# Status (from Status in Go)
|
|
164
|
+
class Status(str, Enum):
|
|
165
|
+
"""Enum for Status values"""
|
|
166
|
+
|
|
167
|
+
SKIPPED = "skipped"
|
|
168
|
+
SUCCESS = "success"
|
|
169
|
+
BREAK = "break"
|
|
170
|
+
ERROR = "error"
|
|
171
|
+
REQUIRES_INFO = "requires info"
|
|
172
|
+
GO_TO_STEP = "go to step"
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# Error (from Error in Go)
|
|
176
|
+
class Error(str, Enum):
|
|
177
|
+
"""Enum for Error values"""
|
|
178
|
+
|
|
179
|
+
ACTION_NOT_FOUND = "action not found"
|
|
180
|
+
INTERNAL_ERROR = "internal error"
|
|
181
|
+
INFO_NEEDED = "info needed"
|
|
182
|
+
TERMINATED = "terminated"
|
|
183
|
+
BAD_REQUEST = "bad request"
|
|
184
|
+
TIMEOUT = "timeout"
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# DatasetType (from DatasetType in Go)
|
|
188
|
+
class DatasetType(str, Enum):
|
|
189
|
+
"""Enum for DatasetType values"""
|
|
190
|
+
|
|
191
|
+
FILE = "file"
|
|
192
|
+
DATABASE = "database"
|
|
193
|
+
INTEGRATION = "integration"
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# IntegrationType (from IntegrationType in Go)
|
|
197
|
+
class IntegrationType(str, Enum):
|
|
198
|
+
"""Enum for IntegrationType values"""
|
|
199
|
+
|
|
200
|
+
API = "api"
|
|
201
|
+
DATABASE = "database"
|
|
202
|
+
FILE = "file"
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# AuthType (from AuthType in Go)
|
|
206
|
+
class AuthType(str, Enum):
|
|
207
|
+
"""Enum for AuthType values"""
|
|
208
|
+
|
|
209
|
+
OAUTH2 = "oauth2"
|
|
210
|
+
API_KEY = "api_key"
|
|
211
|
+
DATABASE = "database"
|
|
212
|
+
BASIC_AUTH = "basic_auth"
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# IntegrationStatus (from IntegrationStatus in Go)
|
|
216
|
+
class IntegrationStatus(str, Enum):
|
|
217
|
+
"""Enum for IntegrationStatus values"""
|
|
218
|
+
|
|
219
|
+
ACTIVE = "active"
|
|
220
|
+
INACTIVE = "inactive"
|
|
221
|
+
BETA = "beta"
|
|
222
|
+
COMING_SOON = "coming_soon"
|
|
223
|
+
ERROR = "error"
|
|
224
|
+
NEEDS_REAUTH = "needs_reauth"
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# SegmentSelectionType (from SegmentSelectionType in Go)
|
|
228
|
+
class SegmentSelectionType(str, Enum):
|
|
229
|
+
"""Enum for SegmentSelectionType values"""
|
|
230
|
+
|
|
231
|
+
SINGLE = "single"
|
|
232
|
+
MULTIPLE = "multiple"
|
|
233
|
+
REQUIRED = "required"
|
|
234
|
+
OPTIONAL = "optional"
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
# ExpiryType (from ExpiryType in Go)
|
|
238
|
+
class ExpiryType(str, Enum):
|
|
239
|
+
"""Enum for ExpiryType values"""
|
|
240
|
+
|
|
241
|
+
OAUTH_DEFAULT = "oauth_default"
|
|
242
|
+
CONSTANT = "constant"
|
|
243
|
+
OAUTH_FIELD = "oauth_field"
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
# ResourceType (from ResourceType in Go)
|
|
247
|
+
class ResourceType(str, Enum):
|
|
248
|
+
"""Enum for ResourceType values"""
|
|
249
|
+
|
|
250
|
+
TABLE = "table"
|
|
251
|
+
ENDPOINT = "endpoint"
|
|
252
|
+
DOCUMENT = "document"
|
|
253
|
+
PARTIAL_DOCUMENT = "partial_document"
|
|
254
|
+
ENTITY = "entity"
|
|
255
|
+
SHEET = "sheet"
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# ResourceState (from ResourceState in Go)
|
|
259
|
+
class ResourceState(str, Enum):
|
|
260
|
+
"""Enum for ResourceState values"""
|
|
261
|
+
|
|
262
|
+
ACTIVE = "active"
|
|
263
|
+
REMOVED = "removed"
|
|
264
|
+
DELETED = "deleted"
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
# ResourceRelationshipType (from ResourceRelationshipType in Go)
|
|
268
|
+
class ResourceRelationshipType(str, Enum):
|
|
269
|
+
"""Enum for ResourceRelationshipType values"""
|
|
270
|
+
|
|
271
|
+
ACCEPTS = "accepts"
|
|
272
|
+
RETURNS = "returns"
|
|
273
|
+
LINKS_TO = "links_to"
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
# ResourceAttachType (from ResourceAttachType in Go)
|
|
277
|
+
class ResourceAttachType(str, Enum):
|
|
278
|
+
"""Enum for ResourceAttachType values"""
|
|
279
|
+
|
|
280
|
+
ALWAYS = "always"
|
|
281
|
+
SEARCHABLE = "searchable"
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
# Strongly-typed classes from Go structs
|
|
285
|
+
@dataclass
|
|
286
|
+
class Bot:
|
|
287
|
+
"""Bot matching Go backend structure."""
|
|
288
|
+
|
|
289
|
+
id: str
|
|
290
|
+
name: str
|
|
291
|
+
description: str
|
|
292
|
+
code: str
|
|
293
|
+
file_path: str
|
|
294
|
+
organization_id: str
|
|
295
|
+
visibility: str
|
|
296
|
+
source: str
|
|
297
|
+
key: Optional[str] = None
|
|
298
|
+
persona: Optional[str] = None
|
|
299
|
+
running_status: Optional[Union[str, TemplateString]] = None
|
|
300
|
+
finished_status: Optional[Union[str, TemplateString]] = None
|
|
301
|
+
running_status_context: Optional[Union[str, TemplateString]] = None
|
|
302
|
+
finished_status_context: Optional[Union[str, TemplateString]] = None
|
|
303
|
+
running_status_prompt: Optional[Union[str, TemplateString]] = None
|
|
304
|
+
finished_status_prompt: Optional[Union[str, TemplateString]] = None
|
|
305
|
+
created_at: Optional[datetime] = None
|
|
306
|
+
updated_at: Optional[datetime] = None
|
|
307
|
+
|
|
308
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
309
|
+
"""Convert to dict format expected by backend."""
|
|
310
|
+
result = {}
|
|
311
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
312
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
313
|
+
result["description"] = (
|
|
314
|
+
self.description.value
|
|
315
|
+
if hasattr(self.description, "value")
|
|
316
|
+
else self.description
|
|
317
|
+
)
|
|
318
|
+
result["code"] = self.code.value if hasattr(self.code, "value") else self.code
|
|
319
|
+
result["file_path"] = (
|
|
320
|
+
self.file_path.value if hasattr(self.file_path, "value") else self.file_path
|
|
321
|
+
)
|
|
322
|
+
if self.key is not None:
|
|
323
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
324
|
+
if self.persona is not None:
|
|
325
|
+
result["persona"] = (
|
|
326
|
+
self.persona.value if hasattr(self.persona, "value") else self.persona
|
|
327
|
+
)
|
|
328
|
+
if self.running_status is not None:
|
|
329
|
+
result["running_status"] = (
|
|
330
|
+
str(self.running_status)
|
|
331
|
+
if hasattr(self.running_status, "__str__")
|
|
332
|
+
else self.running_status
|
|
333
|
+
)
|
|
334
|
+
if self.finished_status is not None:
|
|
335
|
+
result["finished_status"] = (
|
|
336
|
+
str(self.finished_status)
|
|
337
|
+
if hasattr(self.finished_status, "__str__")
|
|
338
|
+
else self.finished_status
|
|
339
|
+
)
|
|
340
|
+
if self.running_status_context is not None:
|
|
341
|
+
result["running_status_context"] = (
|
|
342
|
+
str(self.running_status_context)
|
|
343
|
+
if hasattr(self.running_status_context, "__str__")
|
|
344
|
+
else self.running_status_context
|
|
345
|
+
)
|
|
346
|
+
if self.finished_status_context is not None:
|
|
347
|
+
result["finished_status_context"] = (
|
|
348
|
+
str(self.finished_status_context)
|
|
349
|
+
if hasattr(self.finished_status_context, "__str__")
|
|
350
|
+
else self.finished_status_context
|
|
351
|
+
)
|
|
352
|
+
if self.running_status_prompt is not None:
|
|
353
|
+
result["running_status_prompt"] = (
|
|
354
|
+
str(self.running_status_prompt)
|
|
355
|
+
if hasattr(self.running_status_prompt, "__str__")
|
|
356
|
+
else self.running_status_prompt
|
|
357
|
+
)
|
|
358
|
+
if self.finished_status_prompt is not None:
|
|
359
|
+
result["finished_status_prompt"] = (
|
|
360
|
+
str(self.finished_status_prompt)
|
|
361
|
+
if hasattr(self.finished_status_prompt, "__str__")
|
|
362
|
+
else self.finished_status_prompt
|
|
363
|
+
)
|
|
364
|
+
if self.created_at is not None:
|
|
365
|
+
result["created_at"] = (
|
|
366
|
+
self.created_at.value
|
|
367
|
+
if hasattr(self.created_at, "value")
|
|
368
|
+
else self.created_at
|
|
369
|
+
)
|
|
370
|
+
if self.updated_at is not None:
|
|
371
|
+
result["updated_at"] = (
|
|
372
|
+
self.updated_at.value
|
|
373
|
+
if hasattr(self.updated_at, "value")
|
|
374
|
+
else self.updated_at
|
|
375
|
+
)
|
|
376
|
+
result["organization_id"] = (
|
|
377
|
+
self.organization_id.value
|
|
378
|
+
if hasattr(self.organization_id, "value")
|
|
379
|
+
else self.organization_id
|
|
380
|
+
)
|
|
381
|
+
result["visibility"] = (
|
|
382
|
+
self.visibility.value
|
|
383
|
+
if hasattr(self.visibility, "value")
|
|
384
|
+
else self.visibility
|
|
385
|
+
)
|
|
386
|
+
result["source"] = (
|
|
387
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
388
|
+
)
|
|
389
|
+
return result
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
@dataclass
|
|
393
|
+
class ParameterDefinition:
|
|
394
|
+
"""ParameterDefinition matching Go backend structure."""
|
|
395
|
+
|
|
396
|
+
name: str
|
|
397
|
+
key: str
|
|
398
|
+
type: Any
|
|
399
|
+
is_required: bool
|
|
400
|
+
id: Optional[UUID] = None
|
|
401
|
+
bot_id: Optional[UUID] = None
|
|
402
|
+
description: Optional[str] = None
|
|
403
|
+
created_at: Optional[datetime] = None
|
|
404
|
+
updated_at: Optional[datetime] = None
|
|
405
|
+
value_sources: List["ParameterValueSource"] = None
|
|
406
|
+
interpreters: List["ParameterInterpreter"] = None
|
|
407
|
+
|
|
408
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
409
|
+
"""Convert to dict format expected by backend."""
|
|
410
|
+
result = {}
|
|
411
|
+
if self.id is not None:
|
|
412
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
413
|
+
if self.bot_id is not None:
|
|
414
|
+
result["bot_id"] = (
|
|
415
|
+
self.bot_id.value if hasattr(self.bot_id, "value") else self.bot_id
|
|
416
|
+
)
|
|
417
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
418
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
419
|
+
if self.description is not None:
|
|
420
|
+
result["description"] = (
|
|
421
|
+
self.description.value
|
|
422
|
+
if hasattr(self.description, "value")
|
|
423
|
+
else self.description
|
|
424
|
+
)
|
|
425
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
426
|
+
result["is_required"] = (
|
|
427
|
+
self.is_required.value
|
|
428
|
+
if hasattr(self.is_required, "value")
|
|
429
|
+
else self.is_required
|
|
430
|
+
)
|
|
431
|
+
if self.created_at is not None:
|
|
432
|
+
result["created_at"] = (
|
|
433
|
+
self.created_at.value
|
|
434
|
+
if hasattr(self.created_at, "value")
|
|
435
|
+
else self.created_at
|
|
436
|
+
)
|
|
437
|
+
if self.updated_at is not None:
|
|
438
|
+
result["updated_at"] = (
|
|
439
|
+
self.updated_at.value
|
|
440
|
+
if hasattr(self.updated_at, "value")
|
|
441
|
+
else self.updated_at
|
|
442
|
+
)
|
|
443
|
+
if self.value_sources is not None:
|
|
444
|
+
result["value_sources"] = (
|
|
445
|
+
self.value_sources.value
|
|
446
|
+
if hasattr(self.value_sources, "value")
|
|
447
|
+
else self.value_sources
|
|
448
|
+
)
|
|
449
|
+
if self.interpreters is not None:
|
|
450
|
+
result["interpreters"] = (
|
|
451
|
+
self.interpreters.value
|
|
452
|
+
if hasattr(self.interpreters, "value")
|
|
453
|
+
else self.interpreters
|
|
454
|
+
)
|
|
455
|
+
return result
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
@dataclass
|
|
459
|
+
class ParameterValueSource:
|
|
460
|
+
"""ParameterValueSource matching Go backend structure."""
|
|
461
|
+
|
|
462
|
+
type: Any
|
|
463
|
+
parameters: Dict[str, Any]
|
|
464
|
+
id: Optional[UUID] = None
|
|
465
|
+
parameter_definition_id: Optional[UUID] = None
|
|
466
|
+
created_at: Optional[datetime] = None
|
|
467
|
+
updated_at: Optional[datetime] = None
|
|
468
|
+
on_populate: List["ParameterValueSourceHandler"] = None
|
|
469
|
+
|
|
470
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
471
|
+
"""Convert to dict format expected by backend."""
|
|
472
|
+
result = {}
|
|
473
|
+
if self.id is not None:
|
|
474
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
475
|
+
if self.parameter_definition_id is not None:
|
|
476
|
+
result["parameter_definition_id"] = (
|
|
477
|
+
self.parameter_definition_id.value
|
|
478
|
+
if hasattr(self.parameter_definition_id, "value")
|
|
479
|
+
else self.parameter_definition_id
|
|
480
|
+
)
|
|
481
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
482
|
+
result["parameters"] = (
|
|
483
|
+
self.parameters.value
|
|
484
|
+
if hasattr(self.parameters, "value")
|
|
485
|
+
else self.parameters
|
|
486
|
+
)
|
|
487
|
+
if self.created_at is not None:
|
|
488
|
+
result["created_at"] = (
|
|
489
|
+
self.created_at.value
|
|
490
|
+
if hasattr(self.created_at, "value")
|
|
491
|
+
else self.created_at
|
|
492
|
+
)
|
|
493
|
+
if self.updated_at is not None:
|
|
494
|
+
result["updated_at"] = (
|
|
495
|
+
self.updated_at.value
|
|
496
|
+
if hasattr(self.updated_at, "value")
|
|
497
|
+
else self.updated_at
|
|
498
|
+
)
|
|
499
|
+
if self.on_populate is not None:
|
|
500
|
+
result["on_populate"] = (
|
|
501
|
+
self.on_populate.value
|
|
502
|
+
if hasattr(self.on_populate, "value")
|
|
503
|
+
else self.on_populate
|
|
504
|
+
)
|
|
505
|
+
return result
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
@dataclass
|
|
509
|
+
class ParameterValueSourceHandler:
|
|
510
|
+
"""ParameterValueSourceHandler matching Go backend structure."""
|
|
511
|
+
|
|
512
|
+
action_type: str
|
|
513
|
+
parameters: Dict[str, Any]
|
|
514
|
+
execution_mode: str
|
|
515
|
+
id: Optional[UUID] = None
|
|
516
|
+
parameter_value_source_id: Optional[UUID] = None
|
|
517
|
+
created_at: Optional[datetime] = None
|
|
518
|
+
updated_at: Optional[datetime] = None
|
|
519
|
+
|
|
520
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
521
|
+
"""Convert to dict format expected by backend."""
|
|
522
|
+
result = {}
|
|
523
|
+
if self.id is not None:
|
|
524
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
525
|
+
if self.parameter_value_source_id is not None:
|
|
526
|
+
result["parameter_value_source_id"] = (
|
|
527
|
+
self.parameter_value_source_id.value
|
|
528
|
+
if hasattr(self.parameter_value_source_id, "value")
|
|
529
|
+
else self.parameter_value_source_id
|
|
530
|
+
)
|
|
531
|
+
result["action_type"] = (
|
|
532
|
+
self.action_type.value
|
|
533
|
+
if hasattr(self.action_type, "value")
|
|
534
|
+
else self.action_type
|
|
535
|
+
)
|
|
536
|
+
result["parameters"] = (
|
|
537
|
+
self.parameters.value
|
|
538
|
+
if hasattr(self.parameters, "value")
|
|
539
|
+
else self.parameters
|
|
540
|
+
)
|
|
541
|
+
result["execution_mode"] = (
|
|
542
|
+
self.execution_mode.value
|
|
543
|
+
if hasattr(self.execution_mode, "value")
|
|
544
|
+
else self.execution_mode
|
|
545
|
+
)
|
|
546
|
+
if self.created_at is not None:
|
|
547
|
+
result["created_at"] = (
|
|
548
|
+
self.created_at.value
|
|
549
|
+
if hasattr(self.created_at, "value")
|
|
550
|
+
else self.created_at
|
|
551
|
+
)
|
|
552
|
+
if self.updated_at is not None:
|
|
553
|
+
result["updated_at"] = (
|
|
554
|
+
self.updated_at.value
|
|
555
|
+
if hasattr(self.updated_at, "value")
|
|
556
|
+
else self.updated_at
|
|
557
|
+
)
|
|
558
|
+
return result
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@dataclass
|
|
562
|
+
class ParameterInterpreter:
|
|
563
|
+
"""ParameterInterpreter matching Go backend structure."""
|
|
564
|
+
|
|
565
|
+
action_type: str
|
|
566
|
+
parameters: Dict[str, Any]
|
|
567
|
+
interpreter_order: int
|
|
568
|
+
id: Optional[UUID] = None
|
|
569
|
+
parameter_definition_id: Optional[UUID] = None
|
|
570
|
+
created_at: Optional[datetime] = None
|
|
571
|
+
updated_at: Optional[datetime] = None
|
|
572
|
+
|
|
573
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
574
|
+
"""Convert to dict format expected by backend."""
|
|
575
|
+
result = {}
|
|
576
|
+
if self.id is not None:
|
|
577
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
578
|
+
if self.parameter_definition_id is not None:
|
|
579
|
+
result["parameter_definition_id"] = (
|
|
580
|
+
self.parameter_definition_id.value
|
|
581
|
+
if hasattr(self.parameter_definition_id, "value")
|
|
582
|
+
else self.parameter_definition_id
|
|
583
|
+
)
|
|
584
|
+
result["action_type"] = (
|
|
585
|
+
self.action_type.value
|
|
586
|
+
if hasattr(self.action_type, "value")
|
|
587
|
+
else self.action_type
|
|
588
|
+
)
|
|
589
|
+
result["parameters"] = (
|
|
590
|
+
self.parameters.value
|
|
591
|
+
if hasattr(self.parameters, "value")
|
|
592
|
+
else self.parameters
|
|
593
|
+
)
|
|
594
|
+
result["interpreter_order"] = (
|
|
595
|
+
self.interpreter_order.value
|
|
596
|
+
if hasattr(self.interpreter_order, "value")
|
|
597
|
+
else self.interpreter_order
|
|
598
|
+
)
|
|
599
|
+
if self.created_at is not None:
|
|
600
|
+
result["created_at"] = (
|
|
601
|
+
self.created_at.value
|
|
602
|
+
if hasattr(self.created_at, "value")
|
|
603
|
+
else self.created_at
|
|
604
|
+
)
|
|
605
|
+
if self.updated_at is not None:
|
|
606
|
+
result["updated_at"] = (
|
|
607
|
+
self.updated_at.value
|
|
608
|
+
if hasattr(self.updated_at, "value")
|
|
609
|
+
else self.updated_at
|
|
610
|
+
)
|
|
611
|
+
return result
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
@dataclass
|
|
615
|
+
class UpsertBotRequest:
|
|
616
|
+
"""UpsertBotRequest matching Go backend structure."""
|
|
617
|
+
|
|
618
|
+
bot: "Bot"
|
|
619
|
+
steps: List["APIStepWithHandlers"]
|
|
620
|
+
source: str
|
|
621
|
+
parameter_definitions: List["APIParameterDefinition"] = None
|
|
622
|
+
|
|
623
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
624
|
+
"""Convert to dict format expected by backend."""
|
|
625
|
+
result = {}
|
|
626
|
+
result["bot"] = self.bot.value if hasattr(self.bot, "value") else self.bot
|
|
627
|
+
result["steps"] = (
|
|
628
|
+
self.steps.value if hasattr(self.steps, "value") else self.steps
|
|
629
|
+
)
|
|
630
|
+
result["source"] = (
|
|
631
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
632
|
+
)
|
|
633
|
+
if self.parameter_definitions is not None:
|
|
634
|
+
result["parameter_definitions"] = (
|
|
635
|
+
self.parameter_definitions.value
|
|
636
|
+
if hasattr(self.parameter_definitions, "value")
|
|
637
|
+
else self.parameter_definitions
|
|
638
|
+
)
|
|
639
|
+
return result
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
@dataclass
|
|
643
|
+
class BotsResponse:
|
|
644
|
+
"""BotsResponse matching Go backend structure."""
|
|
645
|
+
|
|
646
|
+
bots: List["Bot"]
|
|
647
|
+
|
|
648
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
649
|
+
"""Convert to dict format expected by backend."""
|
|
650
|
+
result = {}
|
|
651
|
+
result["bots"] = self.bots.value if hasattr(self.bots, "value") else self.bots
|
|
652
|
+
return result
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
@dataclass
|
|
656
|
+
class StepsResponse:
|
|
657
|
+
"""StepsResponse matching Go backend structure."""
|
|
658
|
+
|
|
659
|
+
steps: List["APIStep"]
|
|
660
|
+
|
|
661
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
662
|
+
"""Convert to dict format expected by backend."""
|
|
663
|
+
result = {}
|
|
664
|
+
result["steps"] = (
|
|
665
|
+
self.steps.value if hasattr(self.steps, "value") else self.steps
|
|
666
|
+
)
|
|
667
|
+
return result
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
@dataclass
|
|
671
|
+
class ServiceDefinition:
|
|
672
|
+
"""ServiceDefinition matching Go backend structure."""
|
|
673
|
+
|
|
674
|
+
name: str
|
|
675
|
+
description: str
|
|
676
|
+
actions: List["ActionDefinition"]
|
|
677
|
+
|
|
678
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
679
|
+
"""Convert to dict format expected by backend."""
|
|
680
|
+
result = {}
|
|
681
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
682
|
+
result["description"] = (
|
|
683
|
+
self.description.value
|
|
684
|
+
if hasattr(self.description, "value")
|
|
685
|
+
else self.description
|
|
686
|
+
)
|
|
687
|
+
result["actions"] = (
|
|
688
|
+
self.actions.value if hasattr(self.actions, "value") else self.actions
|
|
689
|
+
)
|
|
690
|
+
return result
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
@dataclass
|
|
694
|
+
class ActionDefinition:
|
|
695
|
+
"""ActionDefinition matching Go backend structure."""
|
|
696
|
+
|
|
697
|
+
name: str
|
|
698
|
+
description: str
|
|
699
|
+
parameters: List["ParameterDefinition"]
|
|
700
|
+
result_schema: Optional["ResultSchema"] = None
|
|
701
|
+
|
|
702
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
703
|
+
"""Convert to dict format expected by backend."""
|
|
704
|
+
result = {}
|
|
705
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
706
|
+
result["description"] = (
|
|
707
|
+
self.description.value
|
|
708
|
+
if hasattr(self.description, "value")
|
|
709
|
+
else self.description
|
|
710
|
+
)
|
|
711
|
+
result["parameters"] = (
|
|
712
|
+
self.parameters.value
|
|
713
|
+
if hasattr(self.parameters, "value")
|
|
714
|
+
else self.parameters
|
|
715
|
+
)
|
|
716
|
+
if self.result_schema is not None:
|
|
717
|
+
result["result_schema"] = (
|
|
718
|
+
self.result_schema.value
|
|
719
|
+
if hasattr(self.result_schema, "value")
|
|
720
|
+
else self.result_schema
|
|
721
|
+
)
|
|
722
|
+
return result
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
@dataclass
|
|
726
|
+
class ResultSchema:
|
|
727
|
+
"""ResultSchema matching Go backend structure."""
|
|
728
|
+
|
|
729
|
+
properties: Dict[str, Any]
|
|
730
|
+
description: str = None
|
|
731
|
+
required_fields: List[str] = None
|
|
732
|
+
optional_fields: List[str] = None
|
|
733
|
+
examples: List[Dict[str, Any]] = None
|
|
734
|
+
|
|
735
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
736
|
+
"""Convert to dict format expected by backend."""
|
|
737
|
+
result = {}
|
|
738
|
+
if self.description is not None:
|
|
739
|
+
result["description"] = (
|
|
740
|
+
self.description.value
|
|
741
|
+
if hasattr(self.description, "value")
|
|
742
|
+
else self.description
|
|
743
|
+
)
|
|
744
|
+
if self.required_fields is not None:
|
|
745
|
+
result["required_fields"] = (
|
|
746
|
+
self.required_fields.value
|
|
747
|
+
if hasattr(self.required_fields, "value")
|
|
748
|
+
else self.required_fields
|
|
749
|
+
)
|
|
750
|
+
if self.optional_fields is not None:
|
|
751
|
+
result["optional_fields"] = (
|
|
752
|
+
self.optional_fields.value
|
|
753
|
+
if hasattr(self.optional_fields, "value")
|
|
754
|
+
else self.optional_fields
|
|
755
|
+
)
|
|
756
|
+
result["properties"] = (
|
|
757
|
+
self.properties.value
|
|
758
|
+
if hasattr(self.properties, "value")
|
|
759
|
+
else self.properties
|
|
760
|
+
)
|
|
761
|
+
if self.examples is not None:
|
|
762
|
+
result["examples"] = (
|
|
763
|
+
self.examples.value
|
|
764
|
+
if hasattr(self.examples, "value")
|
|
765
|
+
else self.examples
|
|
766
|
+
)
|
|
767
|
+
return result
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
@dataclass
|
|
771
|
+
class PropertySchema:
|
|
772
|
+
"""PropertySchema matching Go backend structure."""
|
|
773
|
+
|
|
774
|
+
type: Any
|
|
775
|
+
description: str = None
|
|
776
|
+
items: Optional["PropertySchema"] = None
|
|
777
|
+
properties: Dict[str, Any] = None
|
|
778
|
+
example: Any = None
|
|
779
|
+
enum: List[str] = None
|
|
780
|
+
|
|
781
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
782
|
+
"""Convert to dict format expected by backend."""
|
|
783
|
+
result = {}
|
|
784
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
785
|
+
if self.description is not None:
|
|
786
|
+
result["description"] = (
|
|
787
|
+
self.description.value
|
|
788
|
+
if hasattr(self.description, "value")
|
|
789
|
+
else self.description
|
|
790
|
+
)
|
|
791
|
+
if self.items is not None:
|
|
792
|
+
result["items"] = (
|
|
793
|
+
self.items.value if hasattr(self.items, "value") else self.items
|
|
794
|
+
)
|
|
795
|
+
if self.properties is not None:
|
|
796
|
+
result["properties"] = (
|
|
797
|
+
self.properties.value
|
|
798
|
+
if hasattr(self.properties, "value")
|
|
799
|
+
else self.properties
|
|
800
|
+
)
|
|
801
|
+
if self.example is not None:
|
|
802
|
+
result["example"] = (
|
|
803
|
+
self.example.value if hasattr(self.example, "value") else self.example
|
|
804
|
+
)
|
|
805
|
+
if self.enum is not None:
|
|
806
|
+
result["enum"] = (
|
|
807
|
+
self.enum.value if hasattr(self.enum, "value") else self.enum
|
|
808
|
+
)
|
|
809
|
+
return result
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
@dataclass
|
|
813
|
+
class IntegrationSchema:
|
|
814
|
+
"""IntegrationSchema matching Go backend structure."""
|
|
815
|
+
|
|
816
|
+
key: str
|
|
817
|
+
name: str
|
|
818
|
+
description: str
|
|
819
|
+
type: str
|
|
820
|
+
auth_types: List[str]
|
|
821
|
+
credential_schema: Dict[str, Any]
|
|
822
|
+
available_scopes: List[str]
|
|
823
|
+
documentation_url: str
|
|
824
|
+
codegen_details: Optional[CodegenDetails] = None
|
|
825
|
+
analysis_details: Optional[AnalysisDetails] = None
|
|
826
|
+
|
|
827
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
828
|
+
"""Convert to dict format expected by backend."""
|
|
829
|
+
result = {}
|
|
830
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
831
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
832
|
+
result["description"] = (
|
|
833
|
+
self.description.value
|
|
834
|
+
if hasattr(self.description, "value")
|
|
835
|
+
else self.description
|
|
836
|
+
)
|
|
837
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
838
|
+
result["auth_types"] = (
|
|
839
|
+
self.auth_types.value
|
|
840
|
+
if hasattr(self.auth_types, "value")
|
|
841
|
+
else self.auth_types
|
|
842
|
+
)
|
|
843
|
+
result["credential_schema"] = (
|
|
844
|
+
self.credential_schema.value
|
|
845
|
+
if hasattr(self.credential_schema, "value")
|
|
846
|
+
else self.credential_schema
|
|
847
|
+
)
|
|
848
|
+
result["available_scopes"] = (
|
|
849
|
+
self.available_scopes.value
|
|
850
|
+
if hasattr(self.available_scopes, "value")
|
|
851
|
+
else self.available_scopes
|
|
852
|
+
)
|
|
853
|
+
result["documentation_url"] = (
|
|
854
|
+
self.documentation_url.value
|
|
855
|
+
if hasattr(self.documentation_url, "value")
|
|
856
|
+
else self.documentation_url
|
|
857
|
+
)
|
|
858
|
+
if self.codegen_details is not None:
|
|
859
|
+
result["codegen_details"] = (
|
|
860
|
+
self.codegen_details.value
|
|
861
|
+
if hasattr(self.codegen_details, "value")
|
|
862
|
+
else self.codegen_details
|
|
863
|
+
)
|
|
864
|
+
if self.analysis_details is not None:
|
|
865
|
+
result["analysis_details"] = (
|
|
866
|
+
self.analysis_details.value
|
|
867
|
+
if hasattr(self.analysis_details, "value")
|
|
868
|
+
else self.analysis_details
|
|
869
|
+
)
|
|
870
|
+
return result
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
@dataclass
|
|
874
|
+
class CodegenDetails:
|
|
875
|
+
"""CodegenDetails matching Go backend structure."""
|
|
876
|
+
|
|
877
|
+
code: str
|
|
878
|
+
imports: List[str]
|
|
879
|
+
hint: str = None
|
|
880
|
+
edp_hint: str = None
|
|
881
|
+
|
|
882
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
883
|
+
"""Convert to dict format expected by backend."""
|
|
884
|
+
result = {}
|
|
885
|
+
result["code"] = self.code.value if hasattr(self.code, "value") else self.code
|
|
886
|
+
result["imports"] = (
|
|
887
|
+
self.imports.value if hasattr(self.imports, "value") else self.imports
|
|
888
|
+
)
|
|
889
|
+
if self.hint is not None:
|
|
890
|
+
result["hint"] = (
|
|
891
|
+
self.hint.value if hasattr(self.hint, "value") else self.hint
|
|
892
|
+
)
|
|
893
|
+
if self.edp_hint is not None:
|
|
894
|
+
result["edp_hint"] = (
|
|
895
|
+
self.edp_hint.value
|
|
896
|
+
if hasattr(self.edp_hint, "value")
|
|
897
|
+
else self.edp_hint
|
|
898
|
+
)
|
|
899
|
+
return result
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
@dataclass
|
|
903
|
+
class AnalysisDetails:
|
|
904
|
+
"""AnalysisDetails matching Go backend structure."""
|
|
905
|
+
|
|
906
|
+
imports: List[str]
|
|
907
|
+
code: str
|
|
908
|
+
|
|
909
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
910
|
+
"""Convert to dict format expected by backend."""
|
|
911
|
+
result = {}
|
|
912
|
+
result["imports"] = (
|
|
913
|
+
self.imports.value if hasattr(self.imports, "value") else self.imports
|
|
914
|
+
)
|
|
915
|
+
result["code"] = self.code.value if hasattr(self.code, "value") else self.code
|
|
916
|
+
return result
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
@dataclass
|
|
920
|
+
class CredentialSchema:
|
|
921
|
+
"""CredentialSchema matching Go backend structure."""
|
|
922
|
+
|
|
923
|
+
type: str
|
|
924
|
+
description: str
|
|
925
|
+
required: bool
|
|
926
|
+
source: Any
|
|
927
|
+
sensitivity: Any = None
|
|
928
|
+
jq: str = None
|
|
929
|
+
header: str = None
|
|
930
|
+
|
|
931
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
932
|
+
"""Convert to dict format expected by backend."""
|
|
933
|
+
result = {}
|
|
934
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
935
|
+
result["description"] = (
|
|
936
|
+
self.description.value
|
|
937
|
+
if hasattr(self.description, "value")
|
|
938
|
+
else self.description
|
|
939
|
+
)
|
|
940
|
+
result["required"] = (
|
|
941
|
+
self.required.value if hasattr(self.required, "value") else self.required
|
|
942
|
+
)
|
|
943
|
+
result["source"] = (
|
|
944
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
945
|
+
)
|
|
946
|
+
if self.sensitivity is not None:
|
|
947
|
+
result["sensitivity"] = (
|
|
948
|
+
self.sensitivity.value
|
|
949
|
+
if hasattr(self.sensitivity, "value")
|
|
950
|
+
else self.sensitivity
|
|
951
|
+
)
|
|
952
|
+
if self.jq is not None:
|
|
953
|
+
result["jq"] = self.jq.value if hasattr(self.jq, "value") else self.jq
|
|
954
|
+
if self.header is not None:
|
|
955
|
+
result["header"] = (
|
|
956
|
+
self.header.value if hasattr(self.header, "value") else self.header
|
|
957
|
+
)
|
|
958
|
+
return result
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
@dataclass
|
|
962
|
+
class ExportActionsResponse:
|
|
963
|
+
"""ExportActionsResponse matching Go backend structure."""
|
|
964
|
+
|
|
965
|
+
services: Dict[str, Any]
|
|
966
|
+
integrations: Dict[str, Any]
|
|
967
|
+
|
|
968
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
969
|
+
"""Convert to dict format expected by backend."""
|
|
970
|
+
result = {}
|
|
971
|
+
result["services"] = (
|
|
972
|
+
self.services.value if hasattr(self.services, "value") else self.services
|
|
973
|
+
)
|
|
974
|
+
result["integrations"] = (
|
|
975
|
+
self.integrations.value
|
|
976
|
+
if hasattr(self.integrations, "value")
|
|
977
|
+
else self.integrations
|
|
978
|
+
)
|
|
979
|
+
return result
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
@dataclass
|
|
983
|
+
class ConditionDefinition:
|
|
984
|
+
"""ConditionDefinition matching Go backend structure."""
|
|
985
|
+
|
|
986
|
+
type: str
|
|
987
|
+
conditions: List["ConditionDefinition"] = None
|
|
988
|
+
leaf: Dict[str, Any] = None
|
|
989
|
+
|
|
990
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
991
|
+
"""Convert to dict format expected by backend."""
|
|
992
|
+
result = {}
|
|
993
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
994
|
+
if self.conditions is not None:
|
|
995
|
+
result["conditions"] = (
|
|
996
|
+
self.conditions.value
|
|
997
|
+
if hasattr(self.conditions, "value")
|
|
998
|
+
else self.conditions
|
|
999
|
+
)
|
|
1000
|
+
if self.leaf is not None:
|
|
1001
|
+
result["leaf"] = (
|
|
1002
|
+
self.leaf.value if hasattr(self.leaf, "value") else self.leaf
|
|
1003
|
+
)
|
|
1004
|
+
return result
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
@dataclass
|
|
1008
|
+
class TempCondition:
|
|
1009
|
+
"""TempCondition matching Go backend structure."""
|
|
1010
|
+
|
|
1011
|
+
type: str
|
|
1012
|
+
conditions: Any = None
|
|
1013
|
+
leaf: Dict[str, Any] = None
|
|
1014
|
+
|
|
1015
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1016
|
+
"""Convert to dict format expected by backend."""
|
|
1017
|
+
result = {}
|
|
1018
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1019
|
+
if self.conditions is not None:
|
|
1020
|
+
result["conditions"] = (
|
|
1021
|
+
self.conditions.value
|
|
1022
|
+
if hasattr(self.conditions, "value")
|
|
1023
|
+
else self.conditions
|
|
1024
|
+
)
|
|
1025
|
+
if self.leaf is not None:
|
|
1026
|
+
result["leaf"] = (
|
|
1027
|
+
self.leaf.value if hasattr(self.leaf, "value") else self.leaf
|
|
1028
|
+
)
|
|
1029
|
+
return result
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
@dataclass
|
|
1033
|
+
class JSONSchemaProperty:
|
|
1034
|
+
"""JSONSchemaProperty matching Go backend structure."""
|
|
1035
|
+
|
|
1036
|
+
type: Any
|
|
1037
|
+
description: str = None
|
|
1038
|
+
items: Optional["JSONSchemaProperty"] = None
|
|
1039
|
+
enum: List[str] = None
|
|
1040
|
+
|
|
1041
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1042
|
+
"""Convert to dict format expected by backend."""
|
|
1043
|
+
result = {}
|
|
1044
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1045
|
+
if self.description is not None:
|
|
1046
|
+
result["description"] = (
|
|
1047
|
+
self.description.value
|
|
1048
|
+
if hasattr(self.description, "value")
|
|
1049
|
+
else self.description
|
|
1050
|
+
)
|
|
1051
|
+
if self.items is not None:
|
|
1052
|
+
result["items"] = (
|
|
1053
|
+
self.items.value if hasattr(self.items, "value") else self.items
|
|
1054
|
+
)
|
|
1055
|
+
if self.enum is not None:
|
|
1056
|
+
result["enum"] = (
|
|
1057
|
+
self.enum.value if hasattr(self.enum, "value") else self.enum
|
|
1058
|
+
)
|
|
1059
|
+
return result
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
@dataclass
|
|
1063
|
+
class JSONSchema:
|
|
1064
|
+
"""JSONSchema matching Go backend structure."""
|
|
1065
|
+
|
|
1066
|
+
type: Any
|
|
1067
|
+
properties: Dict[str, Any] = None
|
|
1068
|
+
required: List[str] = None
|
|
1069
|
+
items: Optional["JSONSchemaProperty"] = None
|
|
1070
|
+
|
|
1071
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1072
|
+
"""Convert to dict format expected by backend."""
|
|
1073
|
+
result = {}
|
|
1074
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1075
|
+
if self.properties is not None:
|
|
1076
|
+
result["properties"] = (
|
|
1077
|
+
self.properties.value
|
|
1078
|
+
if hasattr(self.properties, "value")
|
|
1079
|
+
else self.properties
|
|
1080
|
+
)
|
|
1081
|
+
if self.required is not None:
|
|
1082
|
+
result["required"] = (
|
|
1083
|
+
self.required.value
|
|
1084
|
+
if hasattr(self.required, "value")
|
|
1085
|
+
else self.required
|
|
1086
|
+
)
|
|
1087
|
+
if self.items is not None:
|
|
1088
|
+
result["items"] = (
|
|
1089
|
+
self.items.value if hasattr(self.items, "value") else self.items
|
|
1090
|
+
)
|
|
1091
|
+
return result
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
@dataclass
|
|
1095
|
+
class Tool:
|
|
1096
|
+
"""Tool matching Go backend structure."""
|
|
1097
|
+
|
|
1098
|
+
name: str
|
|
1099
|
+
description: str
|
|
1100
|
+
input_schema: "JSONSchema"
|
|
1101
|
+
action_type: str
|
|
1102
|
+
parameters: Dict[str, Any]
|
|
1103
|
+
bot_output_visibility: str = None
|
|
1104
|
+
history_content_type: str = None
|
|
1105
|
+
ui_content_type: str = None
|
|
1106
|
+
as_root: bool = None
|
|
1107
|
+
running_status: Optional[Union[str, TemplateString]] = None
|
|
1108
|
+
finished_status: Optional[Union[str, TemplateString]] = None
|
|
1109
|
+
|
|
1110
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1111
|
+
"""Convert to dict format expected by backend."""
|
|
1112
|
+
result = {}
|
|
1113
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
1114
|
+
result["description"] = (
|
|
1115
|
+
self.description.value
|
|
1116
|
+
if hasattr(self.description, "value")
|
|
1117
|
+
else self.description
|
|
1118
|
+
)
|
|
1119
|
+
result["input_schema"] = (
|
|
1120
|
+
self.input_schema.value
|
|
1121
|
+
if hasattr(self.input_schema, "value")
|
|
1122
|
+
else self.input_schema
|
|
1123
|
+
)
|
|
1124
|
+
result["action_type"] = (
|
|
1125
|
+
self.action_type.value
|
|
1126
|
+
if hasattr(self.action_type, "value")
|
|
1127
|
+
else self.action_type
|
|
1128
|
+
)
|
|
1129
|
+
result["parameters"] = (
|
|
1130
|
+
self.parameters.value
|
|
1131
|
+
if hasattr(self.parameters, "value")
|
|
1132
|
+
else self.parameters
|
|
1133
|
+
)
|
|
1134
|
+
if self.bot_output_visibility is not None:
|
|
1135
|
+
result["bot_output_visibility"] = (
|
|
1136
|
+
self.bot_output_visibility.value
|
|
1137
|
+
if hasattr(self.bot_output_visibility, "value")
|
|
1138
|
+
else self.bot_output_visibility
|
|
1139
|
+
)
|
|
1140
|
+
if self.history_content_type is not None:
|
|
1141
|
+
result["history_content_type"] = (
|
|
1142
|
+
self.history_content_type.value
|
|
1143
|
+
if hasattr(self.history_content_type, "value")
|
|
1144
|
+
else self.history_content_type
|
|
1145
|
+
)
|
|
1146
|
+
if self.ui_content_type is not None:
|
|
1147
|
+
result["ui_content_type"] = (
|
|
1148
|
+
self.ui_content_type.value
|
|
1149
|
+
if hasattr(self.ui_content_type, "value")
|
|
1150
|
+
else self.ui_content_type
|
|
1151
|
+
)
|
|
1152
|
+
if self.as_root is not None:
|
|
1153
|
+
result["as_root"] = (
|
|
1154
|
+
self.as_root.value if hasattr(self.as_root, "value") else self.as_root
|
|
1155
|
+
)
|
|
1156
|
+
if self.running_status is not None:
|
|
1157
|
+
result["running_status"] = (
|
|
1158
|
+
str(self.running_status)
|
|
1159
|
+
if hasattr(self.running_status, "__str__")
|
|
1160
|
+
else self.running_status
|
|
1161
|
+
)
|
|
1162
|
+
if self.finished_status is not None:
|
|
1163
|
+
result["finished_status"] = (
|
|
1164
|
+
str(self.finished_status)
|
|
1165
|
+
if hasattr(self.finished_status, "__str__")
|
|
1166
|
+
else self.finished_status
|
|
1167
|
+
)
|
|
1168
|
+
return result
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
@dataclass
|
|
1172
|
+
class Message:
|
|
1173
|
+
"""Message matching Go backend structure."""
|
|
1174
|
+
|
|
1175
|
+
id: str
|
|
1176
|
+
role: str
|
|
1177
|
+
content: str
|
|
1178
|
+
created_at: Optional[datetime] = None
|
|
1179
|
+
|
|
1180
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1181
|
+
"""Convert to dict format expected by backend."""
|
|
1182
|
+
result = {}
|
|
1183
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1184
|
+
result["role"] = self.role.value if hasattr(self.role, "value") else self.role
|
|
1185
|
+
result["content"] = (
|
|
1186
|
+
self.content.value if hasattr(self.content, "value") else self.content
|
|
1187
|
+
)
|
|
1188
|
+
if self.created_at is not None:
|
|
1189
|
+
result["created_at"] = (
|
|
1190
|
+
self.created_at.value
|
|
1191
|
+
if hasattr(self.created_at, "value")
|
|
1192
|
+
else self.created_at
|
|
1193
|
+
)
|
|
1194
|
+
return result
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
@dataclass
|
|
1198
|
+
class SystemParameters:
|
|
1199
|
+
"""SystemParameters matching Go backend structure."""
|
|
1200
|
+
|
|
1201
|
+
current_date: str
|
|
1202
|
+
messages: List["Message"]
|
|
1203
|
+
session_messages: List["Message"]
|
|
1204
|
+
current_message: str
|
|
1205
|
+
thread_id: UUID
|
|
1206
|
+
organization_id: str
|
|
1207
|
+
invocation_id: UUID
|
|
1208
|
+
|
|
1209
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1210
|
+
"""Convert to dict format expected by backend."""
|
|
1211
|
+
result = {}
|
|
1212
|
+
result["current_date"] = (
|
|
1213
|
+
self.current_date.value
|
|
1214
|
+
if hasattr(self.current_date, "value")
|
|
1215
|
+
else self.current_date
|
|
1216
|
+
)
|
|
1217
|
+
result["messages"] = (
|
|
1218
|
+
self.messages.value if hasattr(self.messages, "value") else self.messages
|
|
1219
|
+
)
|
|
1220
|
+
result["session_messages"] = (
|
|
1221
|
+
self.session_messages.value
|
|
1222
|
+
if hasattr(self.session_messages, "value")
|
|
1223
|
+
else self.session_messages
|
|
1224
|
+
)
|
|
1225
|
+
result["current_message"] = (
|
|
1226
|
+
self.current_message.value
|
|
1227
|
+
if hasattr(self.current_message, "value")
|
|
1228
|
+
else self.current_message
|
|
1229
|
+
)
|
|
1230
|
+
result["thread_id"] = (
|
|
1231
|
+
self.thread_id.value if hasattr(self.thread_id, "value") else self.thread_id
|
|
1232
|
+
)
|
|
1233
|
+
result["organization_id"] = (
|
|
1234
|
+
self.organization_id.value
|
|
1235
|
+
if hasattr(self.organization_id, "value")
|
|
1236
|
+
else self.organization_id
|
|
1237
|
+
)
|
|
1238
|
+
result["invocation_id"] = (
|
|
1239
|
+
self.invocation_id.value
|
|
1240
|
+
if hasattr(self.invocation_id, "value")
|
|
1241
|
+
else self.invocation_id
|
|
1242
|
+
)
|
|
1243
|
+
return result
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
@dataclass
|
|
1247
|
+
class Result:
|
|
1248
|
+
"""Result matching Go backend structure."""
|
|
1249
|
+
|
|
1250
|
+
status: Any
|
|
1251
|
+
parameters: Optional[Dict[str, Any]] = None
|
|
1252
|
+
output: Optional[Dict[str, Any]] = None
|
|
1253
|
+
message: Optional[str] = None
|
|
1254
|
+
error: Optional[Any] = None
|
|
1255
|
+
|
|
1256
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1257
|
+
"""Convert to dict format expected by backend."""
|
|
1258
|
+
result = {}
|
|
1259
|
+
result["status"] = (
|
|
1260
|
+
self.status.value if hasattr(self.status, "value") else self.status
|
|
1261
|
+
)
|
|
1262
|
+
if self.parameters is not None:
|
|
1263
|
+
result["parameters"] = (
|
|
1264
|
+
self.parameters.value
|
|
1265
|
+
if hasattr(self.parameters, "value")
|
|
1266
|
+
else self.parameters
|
|
1267
|
+
)
|
|
1268
|
+
if self.output is not None:
|
|
1269
|
+
result["output"] = (
|
|
1270
|
+
self.output.value if hasattr(self.output, "value") else self.output
|
|
1271
|
+
)
|
|
1272
|
+
if self.message is not None:
|
|
1273
|
+
result["message"] = (
|
|
1274
|
+
self.message.value if hasattr(self.message, "value") else self.message
|
|
1275
|
+
)
|
|
1276
|
+
if self.error is not None:
|
|
1277
|
+
result["error"] = (
|
|
1278
|
+
self.error.value if hasattr(self.error, "value") else self.error
|
|
1279
|
+
)
|
|
1280
|
+
return result
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
@dataclass
|
|
1284
|
+
class APIStep:
|
|
1285
|
+
"""APIStep matching Go backend structure."""
|
|
1286
|
+
|
|
1287
|
+
id: str
|
|
1288
|
+
bot_id: str
|
|
1289
|
+
action_type: str
|
|
1290
|
+
parameters: Any
|
|
1291
|
+
step_order: int
|
|
1292
|
+
output_content_type: str
|
|
1293
|
+
user_output_visibility: str
|
|
1294
|
+
bot_output_visibility: str
|
|
1295
|
+
execution_mode: "APIExecutionMode"
|
|
1296
|
+
output_behaviour: Any
|
|
1297
|
+
output_channels: List[str]
|
|
1298
|
+
depends_on: Optional[List[str]] = None
|
|
1299
|
+
key: Optional[str] = None
|
|
1300
|
+
running_status: Optional[Union[str, TemplateString]] = None
|
|
1301
|
+
finished_status: Optional[Union[str, TemplateString]] = None
|
|
1302
|
+
history_content_type: Optional[str] = None
|
|
1303
|
+
history_role: Optional[str] = None
|
|
1304
|
+
ui_content_type: Optional[str] = None
|
|
1305
|
+
parameter_hydration_behaviour: Optional[Any] = None
|
|
1306
|
+
result_handler_id: Optional[str] = None
|
|
1307
|
+
created_at: Optional[datetime] = None
|
|
1308
|
+
updated_at: Optional[datetime] = None
|
|
1309
|
+
|
|
1310
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1311
|
+
"""Convert to dict format expected by backend."""
|
|
1312
|
+
result = {}
|
|
1313
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1314
|
+
result["bot_id"] = (
|
|
1315
|
+
self.bot_id.value if hasattr(self.bot_id, "value") else self.bot_id
|
|
1316
|
+
)
|
|
1317
|
+
result["action_type"] = (
|
|
1318
|
+
self.action_type.value
|
|
1319
|
+
if hasattr(self.action_type, "value")
|
|
1320
|
+
else self.action_type
|
|
1321
|
+
)
|
|
1322
|
+
result["parameters"] = (
|
|
1323
|
+
self.parameters.value
|
|
1324
|
+
if hasattr(self.parameters, "value")
|
|
1325
|
+
else self.parameters
|
|
1326
|
+
)
|
|
1327
|
+
if self.depends_on is not None:
|
|
1328
|
+
result["depends_on"] = (
|
|
1329
|
+
self.depends_on.value
|
|
1330
|
+
if hasattr(self.depends_on, "value")
|
|
1331
|
+
else self.depends_on
|
|
1332
|
+
)
|
|
1333
|
+
if self.key is not None:
|
|
1334
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
1335
|
+
result["step_order"] = (
|
|
1336
|
+
self.step_order.value
|
|
1337
|
+
if hasattr(self.step_order, "value")
|
|
1338
|
+
else self.step_order
|
|
1339
|
+
)
|
|
1340
|
+
result["output_content_type"] = (
|
|
1341
|
+
self.output_content_type.value
|
|
1342
|
+
if hasattr(self.output_content_type, "value")
|
|
1343
|
+
else self.output_content_type
|
|
1344
|
+
)
|
|
1345
|
+
result["user_output_visibility"] = (
|
|
1346
|
+
self.user_output_visibility.value
|
|
1347
|
+
if hasattr(self.user_output_visibility, "value")
|
|
1348
|
+
else self.user_output_visibility
|
|
1349
|
+
)
|
|
1350
|
+
result["bot_output_visibility"] = (
|
|
1351
|
+
self.bot_output_visibility.value
|
|
1352
|
+
if hasattr(self.bot_output_visibility, "value")
|
|
1353
|
+
else self.bot_output_visibility
|
|
1354
|
+
)
|
|
1355
|
+
result["execution_mode"] = (
|
|
1356
|
+
self.execution_mode.value
|
|
1357
|
+
if hasattr(self.execution_mode, "value")
|
|
1358
|
+
else self.execution_mode
|
|
1359
|
+
)
|
|
1360
|
+
result["output_behaviour"] = (
|
|
1361
|
+
self.output_behaviour.value
|
|
1362
|
+
if hasattr(self.output_behaviour, "value")
|
|
1363
|
+
else self.output_behaviour
|
|
1364
|
+
)
|
|
1365
|
+
result["output_channels"] = (
|
|
1366
|
+
self.output_channels.value
|
|
1367
|
+
if hasattr(self.output_channels, "value")
|
|
1368
|
+
else self.output_channels
|
|
1369
|
+
)
|
|
1370
|
+
if self.running_status is not None:
|
|
1371
|
+
result["running_status"] = (
|
|
1372
|
+
str(self.running_status)
|
|
1373
|
+
if hasattr(self.running_status, "__str__")
|
|
1374
|
+
else self.running_status
|
|
1375
|
+
)
|
|
1376
|
+
if self.finished_status is not None:
|
|
1377
|
+
result["finished_status"] = (
|
|
1378
|
+
str(self.finished_status)
|
|
1379
|
+
if hasattr(self.finished_status, "__str__")
|
|
1380
|
+
else self.finished_status
|
|
1381
|
+
)
|
|
1382
|
+
if self.history_content_type is not None:
|
|
1383
|
+
result["history_content_type"] = (
|
|
1384
|
+
self.history_content_type.value
|
|
1385
|
+
if hasattr(self.history_content_type, "value")
|
|
1386
|
+
else self.history_content_type
|
|
1387
|
+
)
|
|
1388
|
+
if self.history_role is not None:
|
|
1389
|
+
result["history_role"] = (
|
|
1390
|
+
self.history_role.value
|
|
1391
|
+
if hasattr(self.history_role, "value")
|
|
1392
|
+
else self.history_role
|
|
1393
|
+
)
|
|
1394
|
+
if self.ui_content_type is not None:
|
|
1395
|
+
result["ui_content_type"] = (
|
|
1396
|
+
self.ui_content_type.value
|
|
1397
|
+
if hasattr(self.ui_content_type, "value")
|
|
1398
|
+
else self.ui_content_type
|
|
1399
|
+
)
|
|
1400
|
+
if self.parameter_hydration_behaviour is not None:
|
|
1401
|
+
result["parameter_hydration_behaviour"] = (
|
|
1402
|
+
self.parameter_hydration_behaviour.value
|
|
1403
|
+
if hasattr(self.parameter_hydration_behaviour, "value")
|
|
1404
|
+
else self.parameter_hydration_behaviour
|
|
1405
|
+
)
|
|
1406
|
+
if self.result_handler_id is not None:
|
|
1407
|
+
result["result_handler_id"] = (
|
|
1408
|
+
self.result_handler_id.value
|
|
1409
|
+
if hasattr(self.result_handler_id, "value")
|
|
1410
|
+
else self.result_handler_id
|
|
1411
|
+
)
|
|
1412
|
+
if self.created_at is not None:
|
|
1413
|
+
result["created_at"] = (
|
|
1414
|
+
self.created_at.value
|
|
1415
|
+
if hasattr(self.created_at, "value")
|
|
1416
|
+
else self.created_at
|
|
1417
|
+
)
|
|
1418
|
+
if self.updated_at is not None:
|
|
1419
|
+
result["updated_at"] = (
|
|
1420
|
+
self.updated_at.value
|
|
1421
|
+
if hasattr(self.updated_at, "value")
|
|
1422
|
+
else self.updated_at
|
|
1423
|
+
)
|
|
1424
|
+
return result
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
@dataclass
|
|
1428
|
+
class APIParameterValueSource:
|
|
1429
|
+
"""APIParameterValueSource matching Go backend structure."""
|
|
1430
|
+
|
|
1431
|
+
type: Any
|
|
1432
|
+
parameters: Any
|
|
1433
|
+
id: Optional[UUID] = None
|
|
1434
|
+
parameter_definition_id: Optional[UUID] = None
|
|
1435
|
+
created_at: Optional[datetime] = None
|
|
1436
|
+
updated_at: Optional[datetime] = None
|
|
1437
|
+
on_populate: List["APIParameterValueSourceHandler"] = None
|
|
1438
|
+
|
|
1439
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1440
|
+
"""Convert to dict format expected by backend."""
|
|
1441
|
+
result = {}
|
|
1442
|
+
if self.id is not None:
|
|
1443
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1444
|
+
if self.parameter_definition_id is not None:
|
|
1445
|
+
result["parameter_definition_id"] = (
|
|
1446
|
+
self.parameter_definition_id.value
|
|
1447
|
+
if hasattr(self.parameter_definition_id, "value")
|
|
1448
|
+
else self.parameter_definition_id
|
|
1449
|
+
)
|
|
1450
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1451
|
+
result["parameters"] = (
|
|
1452
|
+
self.parameters.value
|
|
1453
|
+
if hasattr(self.parameters, "value")
|
|
1454
|
+
else self.parameters
|
|
1455
|
+
)
|
|
1456
|
+
if self.created_at is not None:
|
|
1457
|
+
result["created_at"] = (
|
|
1458
|
+
self.created_at.value
|
|
1459
|
+
if hasattr(self.created_at, "value")
|
|
1460
|
+
else self.created_at
|
|
1461
|
+
)
|
|
1462
|
+
if self.updated_at is not None:
|
|
1463
|
+
result["updated_at"] = (
|
|
1464
|
+
self.updated_at.value
|
|
1465
|
+
if hasattr(self.updated_at, "value")
|
|
1466
|
+
else self.updated_at
|
|
1467
|
+
)
|
|
1468
|
+
if self.on_populate is not None:
|
|
1469
|
+
result["on_populate"] = (
|
|
1470
|
+
self.on_populate.value
|
|
1471
|
+
if hasattr(self.on_populate, "value")
|
|
1472
|
+
else self.on_populate
|
|
1473
|
+
)
|
|
1474
|
+
return result
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
@dataclass
|
|
1478
|
+
class APIParameterValueSourceHandler:
|
|
1479
|
+
"""APIParameterValueSourceHandler matching Go backend structure."""
|
|
1480
|
+
|
|
1481
|
+
action_type: str
|
|
1482
|
+
parameters: Any
|
|
1483
|
+
execution_mode: "APIExecutionMode"
|
|
1484
|
+
id: Optional[UUID] = None
|
|
1485
|
+
parameter_value_source_id: Optional[UUID] = None
|
|
1486
|
+
created_at: Optional[datetime] = None
|
|
1487
|
+
updated_at: Optional[datetime] = None
|
|
1488
|
+
|
|
1489
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1490
|
+
"""Convert to dict format expected by backend."""
|
|
1491
|
+
result = {}
|
|
1492
|
+
if self.id is not None:
|
|
1493
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1494
|
+
if self.parameter_value_source_id is not None:
|
|
1495
|
+
result["parameter_value_source_id"] = (
|
|
1496
|
+
self.parameter_value_source_id.value
|
|
1497
|
+
if hasattr(self.parameter_value_source_id, "value")
|
|
1498
|
+
else self.parameter_value_source_id
|
|
1499
|
+
)
|
|
1500
|
+
result["action_type"] = (
|
|
1501
|
+
self.action_type.value
|
|
1502
|
+
if hasattr(self.action_type, "value")
|
|
1503
|
+
else self.action_type
|
|
1504
|
+
)
|
|
1505
|
+
result["parameters"] = (
|
|
1506
|
+
self.parameters.value
|
|
1507
|
+
if hasattr(self.parameters, "value")
|
|
1508
|
+
else self.parameters
|
|
1509
|
+
)
|
|
1510
|
+
result["execution_mode"] = (
|
|
1511
|
+
self.execution_mode.value
|
|
1512
|
+
if hasattr(self.execution_mode, "value")
|
|
1513
|
+
else self.execution_mode
|
|
1514
|
+
)
|
|
1515
|
+
if self.created_at is not None:
|
|
1516
|
+
result["created_at"] = (
|
|
1517
|
+
self.created_at.value
|
|
1518
|
+
if hasattr(self.created_at, "value")
|
|
1519
|
+
else self.created_at
|
|
1520
|
+
)
|
|
1521
|
+
if self.updated_at is not None:
|
|
1522
|
+
result["updated_at"] = (
|
|
1523
|
+
self.updated_at.value
|
|
1524
|
+
if hasattr(self.updated_at, "value")
|
|
1525
|
+
else self.updated_at
|
|
1526
|
+
)
|
|
1527
|
+
return result
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
@dataclass
|
|
1531
|
+
class APIParameterInterpreter:
|
|
1532
|
+
"""APIParameterInterpreter matching Go backend structure."""
|
|
1533
|
+
|
|
1534
|
+
action_type: str
|
|
1535
|
+
parameters: Any
|
|
1536
|
+
interpreter_order: int
|
|
1537
|
+
id: Optional[UUID] = None
|
|
1538
|
+
parameter_definition_id: Optional[UUID] = None
|
|
1539
|
+
created_at: Optional[datetime] = None
|
|
1540
|
+
updated_at: Optional[datetime] = None
|
|
1541
|
+
|
|
1542
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1543
|
+
"""Convert to dict format expected by backend."""
|
|
1544
|
+
result = {}
|
|
1545
|
+
if self.id is not None:
|
|
1546
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1547
|
+
if self.parameter_definition_id is not None:
|
|
1548
|
+
result["parameter_definition_id"] = (
|
|
1549
|
+
self.parameter_definition_id.value
|
|
1550
|
+
if hasattr(self.parameter_definition_id, "value")
|
|
1551
|
+
else self.parameter_definition_id
|
|
1552
|
+
)
|
|
1553
|
+
result["action_type"] = (
|
|
1554
|
+
self.action_type.value
|
|
1555
|
+
if hasattr(self.action_type, "value")
|
|
1556
|
+
else self.action_type
|
|
1557
|
+
)
|
|
1558
|
+
result["parameters"] = (
|
|
1559
|
+
self.parameters.value
|
|
1560
|
+
if hasattr(self.parameters, "value")
|
|
1561
|
+
else self.parameters
|
|
1562
|
+
)
|
|
1563
|
+
result["interpreter_order"] = (
|
|
1564
|
+
self.interpreter_order.value
|
|
1565
|
+
if hasattr(self.interpreter_order, "value")
|
|
1566
|
+
else self.interpreter_order
|
|
1567
|
+
)
|
|
1568
|
+
if self.created_at is not None:
|
|
1569
|
+
result["created_at"] = (
|
|
1570
|
+
self.created_at.value
|
|
1571
|
+
if hasattr(self.created_at, "value")
|
|
1572
|
+
else self.created_at
|
|
1573
|
+
)
|
|
1574
|
+
if self.updated_at is not None:
|
|
1575
|
+
result["updated_at"] = (
|
|
1576
|
+
self.updated_at.value
|
|
1577
|
+
if hasattr(self.updated_at, "value")
|
|
1578
|
+
else self.updated_at
|
|
1579
|
+
)
|
|
1580
|
+
return result
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
@dataclass
|
|
1584
|
+
class APIExecutionMode:
|
|
1585
|
+
"""APIExecutionMode matching Go backend structure."""
|
|
1586
|
+
|
|
1587
|
+
mode: Any
|
|
1588
|
+
data: Any
|
|
1589
|
+
if_condition: Optional["APIConditionDefinition"] = None
|
|
1590
|
+
|
|
1591
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1592
|
+
"""Convert to dict format expected by backend."""
|
|
1593
|
+
result = {}
|
|
1594
|
+
result["mode"] = self.mode.value if hasattr(self.mode, "value") else self.mode
|
|
1595
|
+
result["data"] = self.data.value if hasattr(self.data, "value") else self.data
|
|
1596
|
+
if self.if_condition is not None:
|
|
1597
|
+
result["if_condition"] = (
|
|
1598
|
+
self.if_condition.value
|
|
1599
|
+
if hasattr(self.if_condition, "value")
|
|
1600
|
+
else self.if_condition
|
|
1601
|
+
)
|
|
1602
|
+
return result
|
|
1603
|
+
|
|
1604
|
+
|
|
1605
|
+
@dataclass
|
|
1606
|
+
class APIConditionDefinition:
|
|
1607
|
+
"""APIConditionDefinition matching Go backend structure."""
|
|
1608
|
+
|
|
1609
|
+
type: str
|
|
1610
|
+
conditions: List["APIConditionDefinition"] = None
|
|
1611
|
+
leaf: Any = None
|
|
1612
|
+
|
|
1613
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1614
|
+
"""Convert to dict format expected by backend."""
|
|
1615
|
+
result = {}
|
|
1616
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1617
|
+
if self.conditions is not None:
|
|
1618
|
+
result["conditions"] = (
|
|
1619
|
+
self.conditions.value
|
|
1620
|
+
if hasattr(self.conditions, "value")
|
|
1621
|
+
else self.conditions
|
|
1622
|
+
)
|
|
1623
|
+
if self.leaf is not None:
|
|
1624
|
+
result["leaf"] = (
|
|
1625
|
+
self.leaf.value if hasattr(self.leaf, "value") else self.leaf
|
|
1626
|
+
)
|
|
1627
|
+
return result
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
@dataclass
|
|
1631
|
+
class APITool:
|
|
1632
|
+
"""APITool matching Go backend structure."""
|
|
1633
|
+
|
|
1634
|
+
name: str
|
|
1635
|
+
description: str
|
|
1636
|
+
input_schema: Any
|
|
1637
|
+
action_type: str
|
|
1638
|
+
parameters: Any
|
|
1639
|
+
bot_output_visibility: str = None
|
|
1640
|
+
history_content_type: str = None
|
|
1641
|
+
ui_content_type: str = None
|
|
1642
|
+
as_root: bool = None
|
|
1643
|
+
running_status: Optional[Union[str, TemplateString]] = None
|
|
1644
|
+
finished_status: Optional[Union[str, TemplateString]] = None
|
|
1645
|
+
|
|
1646
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1647
|
+
"""Convert to dict format expected by backend."""
|
|
1648
|
+
result = {}
|
|
1649
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
1650
|
+
result["description"] = (
|
|
1651
|
+
self.description.value
|
|
1652
|
+
if hasattr(self.description, "value")
|
|
1653
|
+
else self.description
|
|
1654
|
+
)
|
|
1655
|
+
result["input_schema"] = (
|
|
1656
|
+
self.input_schema.value
|
|
1657
|
+
if hasattr(self.input_schema, "value")
|
|
1658
|
+
else self.input_schema
|
|
1659
|
+
)
|
|
1660
|
+
result["action_type"] = (
|
|
1661
|
+
self.action_type.value
|
|
1662
|
+
if hasattr(self.action_type, "value")
|
|
1663
|
+
else self.action_type
|
|
1664
|
+
)
|
|
1665
|
+
result["parameters"] = (
|
|
1666
|
+
self.parameters.value
|
|
1667
|
+
if hasattr(self.parameters, "value")
|
|
1668
|
+
else self.parameters
|
|
1669
|
+
)
|
|
1670
|
+
if self.bot_output_visibility is not None:
|
|
1671
|
+
result["bot_output_visibility"] = (
|
|
1672
|
+
self.bot_output_visibility.value
|
|
1673
|
+
if hasattr(self.bot_output_visibility, "value")
|
|
1674
|
+
else self.bot_output_visibility
|
|
1675
|
+
)
|
|
1676
|
+
if self.history_content_type is not None:
|
|
1677
|
+
result["history_content_type"] = (
|
|
1678
|
+
self.history_content_type.value
|
|
1679
|
+
if hasattr(self.history_content_type, "value")
|
|
1680
|
+
else self.history_content_type
|
|
1681
|
+
)
|
|
1682
|
+
if self.ui_content_type is not None:
|
|
1683
|
+
result["ui_content_type"] = (
|
|
1684
|
+
self.ui_content_type.value
|
|
1685
|
+
if hasattr(self.ui_content_type, "value")
|
|
1686
|
+
else self.ui_content_type
|
|
1687
|
+
)
|
|
1688
|
+
if self.as_root is not None:
|
|
1689
|
+
result["as_root"] = (
|
|
1690
|
+
self.as_root.value if hasattr(self.as_root, "value") else self.as_root
|
|
1691
|
+
)
|
|
1692
|
+
if self.running_status is not None:
|
|
1693
|
+
result["running_status"] = (
|
|
1694
|
+
str(self.running_status)
|
|
1695
|
+
if hasattr(self.running_status, "__str__")
|
|
1696
|
+
else self.running_status
|
|
1697
|
+
)
|
|
1698
|
+
if self.finished_status is not None:
|
|
1699
|
+
result["finished_status"] = (
|
|
1700
|
+
str(self.finished_status)
|
|
1701
|
+
if hasattr(self.finished_status, "__str__")
|
|
1702
|
+
else self.finished_status
|
|
1703
|
+
)
|
|
1704
|
+
return result
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
@dataclass
|
|
1708
|
+
class APIResultHandler:
|
|
1709
|
+
"""APIResultHandler matching Go backend structure."""
|
|
1710
|
+
|
|
1711
|
+
type: str
|
|
1712
|
+
if_conditions: "APIConditionDefinition"
|
|
1713
|
+
result_handler_order: int
|
|
1714
|
+
output_content_type: str
|
|
1715
|
+
steps: List["APIStepWithHandlers"]
|
|
1716
|
+
history_content_type: Optional[str] = None
|
|
1717
|
+
ui_content_type: Optional[str] = None
|
|
1718
|
+
|
|
1719
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1720
|
+
"""Convert to dict format expected by backend."""
|
|
1721
|
+
result = {}
|
|
1722
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1723
|
+
result["if_conditions"] = (
|
|
1724
|
+
self.if_conditions.value
|
|
1725
|
+
if hasattr(self.if_conditions, "value")
|
|
1726
|
+
else self.if_conditions
|
|
1727
|
+
)
|
|
1728
|
+
result["result_handler_order"] = (
|
|
1729
|
+
self.result_handler_order.value
|
|
1730
|
+
if hasattr(self.result_handler_order, "value")
|
|
1731
|
+
else self.result_handler_order
|
|
1732
|
+
)
|
|
1733
|
+
result["output_content_type"] = (
|
|
1734
|
+
self.output_content_type.value
|
|
1735
|
+
if hasattr(self.output_content_type, "value")
|
|
1736
|
+
else self.output_content_type
|
|
1737
|
+
)
|
|
1738
|
+
if self.history_content_type is not None:
|
|
1739
|
+
result["history_content_type"] = (
|
|
1740
|
+
self.history_content_type.value
|
|
1741
|
+
if hasattr(self.history_content_type, "value")
|
|
1742
|
+
else self.history_content_type
|
|
1743
|
+
)
|
|
1744
|
+
if self.ui_content_type is not None:
|
|
1745
|
+
result["ui_content_type"] = (
|
|
1746
|
+
self.ui_content_type.value
|
|
1747
|
+
if hasattr(self.ui_content_type, "value")
|
|
1748
|
+
else self.ui_content_type
|
|
1749
|
+
)
|
|
1750
|
+
result["steps"] = (
|
|
1751
|
+
self.steps.value if hasattr(self.steps, "value") else self.steps
|
|
1752
|
+
)
|
|
1753
|
+
return result
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
@dataclass
|
|
1757
|
+
class APIParameterDefinition:
|
|
1758
|
+
"""APIParameterDefinition matching Go backend structure."""
|
|
1759
|
+
|
|
1760
|
+
name: str
|
|
1761
|
+
key: str
|
|
1762
|
+
type: str
|
|
1763
|
+
is_required: bool
|
|
1764
|
+
id: Optional[UUID] = None
|
|
1765
|
+
bot_id: Optional[UUID] = None
|
|
1766
|
+
description: Optional[str] = None
|
|
1767
|
+
created_at: Optional[datetime] = None
|
|
1768
|
+
updated_at: Optional[datetime] = None
|
|
1769
|
+
|
|
1770
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1771
|
+
"""Convert to dict format expected by backend."""
|
|
1772
|
+
result = {}
|
|
1773
|
+
if self.id is not None:
|
|
1774
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1775
|
+
if self.bot_id is not None:
|
|
1776
|
+
result["bot_id"] = (
|
|
1777
|
+
self.bot_id.value if hasattr(self.bot_id, "value") else self.bot_id
|
|
1778
|
+
)
|
|
1779
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
1780
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
1781
|
+
if self.description is not None:
|
|
1782
|
+
result["description"] = (
|
|
1783
|
+
self.description.value
|
|
1784
|
+
if hasattr(self.description, "value")
|
|
1785
|
+
else self.description
|
|
1786
|
+
)
|
|
1787
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1788
|
+
result["is_required"] = (
|
|
1789
|
+
self.is_required.value
|
|
1790
|
+
if hasattr(self.is_required, "value")
|
|
1791
|
+
else self.is_required
|
|
1792
|
+
)
|
|
1793
|
+
if self.created_at is not None:
|
|
1794
|
+
result["created_at"] = (
|
|
1795
|
+
self.created_at.value
|
|
1796
|
+
if hasattr(self.created_at, "value")
|
|
1797
|
+
else self.created_at
|
|
1798
|
+
)
|
|
1799
|
+
if self.updated_at is not None:
|
|
1800
|
+
result["updated_at"] = (
|
|
1801
|
+
self.updated_at.value
|
|
1802
|
+
if hasattr(self.updated_at, "value")
|
|
1803
|
+
else self.updated_at
|
|
1804
|
+
)
|
|
1805
|
+
return result
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
@dataclass
|
|
1809
|
+
class APIStepWithHandlers:
|
|
1810
|
+
"""APIStepWithHandlers matching Go backend structure."""
|
|
1811
|
+
|
|
1812
|
+
step: "APIStep"
|
|
1813
|
+
result_handlers: List["APIResultHandler"]
|
|
1814
|
+
|
|
1815
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1816
|
+
"""Convert to dict format expected by backend."""
|
|
1817
|
+
result = {}
|
|
1818
|
+
result["step"] = self.step.value if hasattr(self.step, "value") else self.step
|
|
1819
|
+
result["result_handlers"] = (
|
|
1820
|
+
self.result_handlers.value
|
|
1821
|
+
if hasattr(self.result_handlers, "value")
|
|
1822
|
+
else self.result_handlers
|
|
1823
|
+
)
|
|
1824
|
+
return result
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
@dataclass
|
|
1828
|
+
class Dataset:
|
|
1829
|
+
"""Dataset matching Go backend structure."""
|
|
1830
|
+
|
|
1831
|
+
id: UUID
|
|
1832
|
+
type: DatasetType
|
|
1833
|
+
key: Optional[str] = None
|
|
1834
|
+
name: Optional[str] = None
|
|
1835
|
+
description: Optional[str] = None
|
|
1836
|
+
analysis_summary: Optional[str] = None
|
|
1837
|
+
last_analyzed: Optional[datetime] = None
|
|
1838
|
+
instructions: Optional[str] = None
|
|
1839
|
+
file: Optional[str] = None
|
|
1840
|
+
file_type: Optional[str] = None
|
|
1841
|
+
filename: Optional[str] = None
|
|
1842
|
+
url: Optional[str] = None
|
|
1843
|
+
integration_id: Optional[UUID] = None
|
|
1844
|
+
integration_config_id: Optional[UUID] = None
|
|
1845
|
+
integration_config: Optional[IntegrationConfig] = None
|
|
1846
|
+
encrypted_integration_credentials: Optional[Dict[str, str]] = None
|
|
1847
|
+
credential_schema: Optional[Dict[str, Any]] = None
|
|
1848
|
+
codegen_details: Optional[CodegenDetails] = None
|
|
1849
|
+
analysis_details: Optional[AnalysisDetails] = None
|
|
1850
|
+
available_scopes: Optional[List[str]] = None
|
|
1851
|
+
parameters: Optional[Dict[str, Any]] = None
|
|
1852
|
+
|
|
1853
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1854
|
+
"""Convert to dict format expected by backend."""
|
|
1855
|
+
result = {}
|
|
1856
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1857
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
1858
|
+
if self.key is not None:
|
|
1859
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
1860
|
+
if self.name is not None:
|
|
1861
|
+
result["name"] = (
|
|
1862
|
+
self.name.value if hasattr(self.name, "value") else self.name
|
|
1863
|
+
)
|
|
1864
|
+
if self.description is not None:
|
|
1865
|
+
result["description"] = (
|
|
1866
|
+
self.description.value
|
|
1867
|
+
if hasattr(self.description, "value")
|
|
1868
|
+
else self.description
|
|
1869
|
+
)
|
|
1870
|
+
if self.analysis_summary is not None:
|
|
1871
|
+
result["analysis_summary"] = (
|
|
1872
|
+
self.analysis_summary.value
|
|
1873
|
+
if hasattr(self.analysis_summary, "value")
|
|
1874
|
+
else self.analysis_summary
|
|
1875
|
+
)
|
|
1876
|
+
if self.last_analyzed is not None:
|
|
1877
|
+
result["last_analyzed"] = (
|
|
1878
|
+
self.last_analyzed.value
|
|
1879
|
+
if hasattr(self.last_analyzed, "value")
|
|
1880
|
+
else self.last_analyzed
|
|
1881
|
+
)
|
|
1882
|
+
if self.instructions is not None:
|
|
1883
|
+
result["instructions"] = (
|
|
1884
|
+
self.instructions.value
|
|
1885
|
+
if hasattr(self.instructions, "value")
|
|
1886
|
+
else self.instructions
|
|
1887
|
+
)
|
|
1888
|
+
if self.file is not None:
|
|
1889
|
+
result["file"] = (
|
|
1890
|
+
self.file.value if hasattr(self.file, "value") else self.file
|
|
1891
|
+
)
|
|
1892
|
+
if self.file_type is not None:
|
|
1893
|
+
result["file_type"] = (
|
|
1894
|
+
self.file_type.value
|
|
1895
|
+
if hasattr(self.file_type, "value")
|
|
1896
|
+
else self.file_type
|
|
1897
|
+
)
|
|
1898
|
+
if self.filename is not None:
|
|
1899
|
+
result["filename"] = (
|
|
1900
|
+
self.filename.value
|
|
1901
|
+
if hasattr(self.filename, "value")
|
|
1902
|
+
else self.filename
|
|
1903
|
+
)
|
|
1904
|
+
if self.url is not None:
|
|
1905
|
+
result["url"] = self.url.value if hasattr(self.url, "value") else self.url
|
|
1906
|
+
if self.integration_id is not None:
|
|
1907
|
+
result["integration_id"] = (
|
|
1908
|
+
self.integration_id.value
|
|
1909
|
+
if hasattr(self.integration_id, "value")
|
|
1910
|
+
else self.integration_id
|
|
1911
|
+
)
|
|
1912
|
+
if self.integration_config_id is not None:
|
|
1913
|
+
result["integration_config_id"] = (
|
|
1914
|
+
self.integration_config_id.value
|
|
1915
|
+
if hasattr(self.integration_config_id, "value")
|
|
1916
|
+
else self.integration_config_id
|
|
1917
|
+
)
|
|
1918
|
+
if self.integration_config is not None:
|
|
1919
|
+
result["integration_config"] = (
|
|
1920
|
+
self.integration_config.value
|
|
1921
|
+
if hasattr(self.integration_config, "value")
|
|
1922
|
+
else self.integration_config
|
|
1923
|
+
)
|
|
1924
|
+
if self.encrypted_integration_credentials is not None:
|
|
1925
|
+
result["encrypted_integration_credentials"] = (
|
|
1926
|
+
self.encrypted_integration_credentials.value
|
|
1927
|
+
if hasattr(self.encrypted_integration_credentials, "value")
|
|
1928
|
+
else self.encrypted_integration_credentials
|
|
1929
|
+
)
|
|
1930
|
+
if self.credential_schema is not None:
|
|
1931
|
+
result["credential_schema"] = (
|
|
1932
|
+
self.credential_schema.value
|
|
1933
|
+
if hasattr(self.credential_schema, "value")
|
|
1934
|
+
else self.credential_schema
|
|
1935
|
+
)
|
|
1936
|
+
if self.codegen_details is not None:
|
|
1937
|
+
result["codegen_details"] = (
|
|
1938
|
+
self.codegen_details.value
|
|
1939
|
+
if hasattr(self.codegen_details, "value")
|
|
1940
|
+
else self.codegen_details
|
|
1941
|
+
)
|
|
1942
|
+
if self.analysis_details is not None:
|
|
1943
|
+
result["analysis_details"] = (
|
|
1944
|
+
self.analysis_details.value
|
|
1945
|
+
if hasattr(self.analysis_details, "value")
|
|
1946
|
+
else self.analysis_details
|
|
1947
|
+
)
|
|
1948
|
+
if self.available_scopes is not None:
|
|
1949
|
+
result["available_scopes"] = (
|
|
1950
|
+
self.available_scopes.value
|
|
1951
|
+
if hasattr(self.available_scopes, "value")
|
|
1952
|
+
else self.available_scopes
|
|
1953
|
+
)
|
|
1954
|
+
if self.parameters is not None:
|
|
1955
|
+
result["parameters"] = (
|
|
1956
|
+
self.parameters.value
|
|
1957
|
+
if hasattr(self.parameters, "value")
|
|
1958
|
+
else self.parameters
|
|
1959
|
+
)
|
|
1960
|
+
return result
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
@dataclass
|
|
1964
|
+
class BotResource:
|
|
1965
|
+
"""BotResource matching Go backend structure."""
|
|
1966
|
+
|
|
1967
|
+
id: int
|
|
1968
|
+
created_by: str
|
|
1969
|
+
extra: Dict[str, Any]
|
|
1970
|
+
dataset: Optional[Dataset] = None
|
|
1971
|
+
|
|
1972
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1973
|
+
"""Convert to dict format expected by backend."""
|
|
1974
|
+
result = {}
|
|
1975
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
1976
|
+
if self.dataset is not None:
|
|
1977
|
+
result["dataset"] = (
|
|
1978
|
+
self.dataset.value if hasattr(self.dataset, "value") else self.dataset
|
|
1979
|
+
)
|
|
1980
|
+
result["created_by"] = (
|
|
1981
|
+
self.created_by.value
|
|
1982
|
+
if hasattr(self.created_by, "value")
|
|
1983
|
+
else self.created_by
|
|
1984
|
+
)
|
|
1985
|
+
result["extra"] = (
|
|
1986
|
+
self.extra.value if hasattr(self.extra, "value") else self.extra
|
|
1987
|
+
)
|
|
1988
|
+
return result
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
@dataclass
|
|
1992
|
+
class UIConfigIcon:
|
|
1993
|
+
"""UIConfigIcon matching Go backend structure."""
|
|
1994
|
+
|
|
1995
|
+
set: str
|
|
1996
|
+
name: str
|
|
1997
|
+
|
|
1998
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
1999
|
+
"""Convert to dict format expected by backend."""
|
|
2000
|
+
result = {}
|
|
2001
|
+
result["set"] = self.set.value if hasattr(self.set, "value") else self.set
|
|
2002
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2003
|
+
return result
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
@dataclass
|
|
2007
|
+
class UIConfig:
|
|
2008
|
+
"""UIConfig matching Go backend structure."""
|
|
2009
|
+
|
|
2010
|
+
brand_logo_icon: "UIConfigIcon"
|
|
2011
|
+
brand_color: str
|
|
2012
|
+
button_style: str
|
|
2013
|
+
|
|
2014
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2015
|
+
"""Convert to dict format expected by backend."""
|
|
2016
|
+
result = {}
|
|
2017
|
+
result["brand_logo_icon"] = (
|
|
2018
|
+
self.brand_logo_icon.value
|
|
2019
|
+
if hasattr(self.brand_logo_icon, "value")
|
|
2020
|
+
else self.brand_logo_icon
|
|
2021
|
+
)
|
|
2022
|
+
result["brand_color"] = (
|
|
2023
|
+
self.brand_color.value
|
|
2024
|
+
if hasattr(self.brand_color, "value")
|
|
2025
|
+
else self.brand_color
|
|
2026
|
+
)
|
|
2027
|
+
result["button_style"] = (
|
|
2028
|
+
self.button_style.value
|
|
2029
|
+
if hasattr(self.button_style, "value")
|
|
2030
|
+
else self.button_style
|
|
2031
|
+
)
|
|
2032
|
+
return result
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
@dataclass
|
|
2036
|
+
class ErrorHandlingConfig:
|
|
2037
|
+
"""ErrorHandlingConfig matching Go backend structure."""
|
|
2038
|
+
|
|
2039
|
+
ignore_errors: List[str] = None
|
|
2040
|
+
error_path: str = None
|
|
2041
|
+
|
|
2042
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2043
|
+
"""Convert to dict format expected by backend."""
|
|
2044
|
+
result = {}
|
|
2045
|
+
if self.ignore_errors is not None:
|
|
2046
|
+
result["ignore_errors"] = (
|
|
2047
|
+
self.ignore_errors.value
|
|
2048
|
+
if hasattr(self.ignore_errors, "value")
|
|
2049
|
+
else self.ignore_errors
|
|
2050
|
+
)
|
|
2051
|
+
if self.error_path is not None:
|
|
2052
|
+
result["error_path"] = (
|
|
2053
|
+
self.error_path.value
|
|
2054
|
+
if hasattr(self.error_path, "value")
|
|
2055
|
+
else self.error_path
|
|
2056
|
+
)
|
|
2057
|
+
return result
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
@dataclass
|
|
2061
|
+
class SegmentLevel:
|
|
2062
|
+
"""SegmentLevel matching Go backend structure."""
|
|
2063
|
+
|
|
2064
|
+
name: str
|
|
2065
|
+
type: str
|
|
2066
|
+
selectable: bool
|
|
2067
|
+
url_template: str = None
|
|
2068
|
+
method: str = None
|
|
2069
|
+
body: str = None
|
|
2070
|
+
id_path: str = None
|
|
2071
|
+
id_regex: str = None
|
|
2072
|
+
name_path: str = None
|
|
2073
|
+
parent_key: str = None
|
|
2074
|
+
required_credentials: List[str] = None
|
|
2075
|
+
|
|
2076
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2077
|
+
"""Convert to dict format expected by backend."""
|
|
2078
|
+
result = {}
|
|
2079
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2080
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2081
|
+
result["selectable"] = (
|
|
2082
|
+
self.selectable.value
|
|
2083
|
+
if hasattr(self.selectable, "value")
|
|
2084
|
+
else self.selectable
|
|
2085
|
+
)
|
|
2086
|
+
if self.url_template is not None:
|
|
2087
|
+
result["url_template"] = (
|
|
2088
|
+
self.url_template.value
|
|
2089
|
+
if hasattr(self.url_template, "value")
|
|
2090
|
+
else self.url_template
|
|
2091
|
+
)
|
|
2092
|
+
if self.method is not None:
|
|
2093
|
+
result["method"] = (
|
|
2094
|
+
self.method.value if hasattr(self.method, "value") else self.method
|
|
2095
|
+
)
|
|
2096
|
+
if self.body is not None:
|
|
2097
|
+
result["body"] = (
|
|
2098
|
+
self.body.value if hasattr(self.body, "value") else self.body
|
|
2099
|
+
)
|
|
2100
|
+
if self.id_path is not None:
|
|
2101
|
+
result["id_path"] = (
|
|
2102
|
+
self.id_path.value if hasattr(self.id_path, "value") else self.id_path
|
|
2103
|
+
)
|
|
2104
|
+
if self.id_regex is not None:
|
|
2105
|
+
result["id_regex"] = (
|
|
2106
|
+
self.id_regex.value
|
|
2107
|
+
if hasattr(self.id_regex, "value")
|
|
2108
|
+
else self.id_regex
|
|
2109
|
+
)
|
|
2110
|
+
if self.name_path is not None:
|
|
2111
|
+
result["name_path"] = (
|
|
2112
|
+
self.name_path.value
|
|
2113
|
+
if hasattr(self.name_path, "value")
|
|
2114
|
+
else self.name_path
|
|
2115
|
+
)
|
|
2116
|
+
if self.parent_key is not None:
|
|
2117
|
+
result["parent_key"] = (
|
|
2118
|
+
self.parent_key.value
|
|
2119
|
+
if hasattr(self.parent_key, "value")
|
|
2120
|
+
else self.parent_key
|
|
2121
|
+
)
|
|
2122
|
+
if self.required_credentials is not None:
|
|
2123
|
+
result["required_credentials"] = (
|
|
2124
|
+
self.required_credentials.value
|
|
2125
|
+
if hasattr(self.required_credentials, "value")
|
|
2126
|
+
else self.required_credentials
|
|
2127
|
+
)
|
|
2128
|
+
return result
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
@dataclass
|
|
2132
|
+
class SegmentConfig:
|
|
2133
|
+
"""SegmentConfig matching Go backend structure."""
|
|
2134
|
+
|
|
2135
|
+
selection_type: Any
|
|
2136
|
+
description: str
|
|
2137
|
+
hierarchical: bool
|
|
2138
|
+
levels: List["SegmentLevel"]
|
|
2139
|
+
min_selections: Optional[int] = None
|
|
2140
|
+
max_selections: Optional[int] = None
|
|
2141
|
+
base_url: str = None
|
|
2142
|
+
error_handling: Optional["ErrorHandlingConfig"] = None
|
|
2143
|
+
|
|
2144
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2145
|
+
"""Convert to dict format expected by backend."""
|
|
2146
|
+
result = {}
|
|
2147
|
+
result["selection_type"] = (
|
|
2148
|
+
self.selection_type.value
|
|
2149
|
+
if hasattr(self.selection_type, "value")
|
|
2150
|
+
else self.selection_type
|
|
2151
|
+
)
|
|
2152
|
+
if self.min_selections is not None:
|
|
2153
|
+
result["min_selections"] = (
|
|
2154
|
+
self.min_selections.value
|
|
2155
|
+
if hasattr(self.min_selections, "value")
|
|
2156
|
+
else self.min_selections
|
|
2157
|
+
)
|
|
2158
|
+
if self.max_selections is not None:
|
|
2159
|
+
result["max_selections"] = (
|
|
2160
|
+
self.max_selections.value
|
|
2161
|
+
if hasattr(self.max_selections, "value")
|
|
2162
|
+
else self.max_selections
|
|
2163
|
+
)
|
|
2164
|
+
result["description"] = (
|
|
2165
|
+
self.description.value
|
|
2166
|
+
if hasattr(self.description, "value")
|
|
2167
|
+
else self.description
|
|
2168
|
+
)
|
|
2169
|
+
result["hierarchical"] = (
|
|
2170
|
+
self.hierarchical.value
|
|
2171
|
+
if hasattr(self.hierarchical, "value")
|
|
2172
|
+
else self.hierarchical
|
|
2173
|
+
)
|
|
2174
|
+
if self.base_url is not None:
|
|
2175
|
+
result["base_url"] = (
|
|
2176
|
+
self.base_url.value
|
|
2177
|
+
if hasattr(self.base_url, "value")
|
|
2178
|
+
else self.base_url
|
|
2179
|
+
)
|
|
2180
|
+
result["levels"] = (
|
|
2181
|
+
self.levels.value if hasattr(self.levels, "value") else self.levels
|
|
2182
|
+
)
|
|
2183
|
+
if self.error_handling is not None:
|
|
2184
|
+
result["error_handling"] = (
|
|
2185
|
+
self.error_handling.value
|
|
2186
|
+
if hasattr(self.error_handling, "value")
|
|
2187
|
+
else self.error_handling
|
|
2188
|
+
)
|
|
2189
|
+
return result
|
|
2190
|
+
|
|
2191
|
+
|
|
2192
|
+
@dataclass
|
|
2193
|
+
class ResourceTypeConfig:
|
|
2194
|
+
"""ResourceTypeConfig matching Go backend structure."""
|
|
2195
|
+
|
|
2196
|
+
type: str
|
|
2197
|
+
url_template: str
|
|
2198
|
+
id_path: str
|
|
2199
|
+
name_path: str
|
|
2200
|
+
method: str = None
|
|
2201
|
+
body: str = None
|
|
2202
|
+
description_path: str = None
|
|
2203
|
+
|
|
2204
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2205
|
+
"""Convert to dict format expected by backend."""
|
|
2206
|
+
result = {}
|
|
2207
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2208
|
+
result["url_template"] = (
|
|
2209
|
+
self.url_template.value
|
|
2210
|
+
if hasattr(self.url_template, "value")
|
|
2211
|
+
else self.url_template
|
|
2212
|
+
)
|
|
2213
|
+
if self.method is not None:
|
|
2214
|
+
result["method"] = (
|
|
2215
|
+
self.method.value if hasattr(self.method, "value") else self.method
|
|
2216
|
+
)
|
|
2217
|
+
if self.body is not None:
|
|
2218
|
+
result["body"] = (
|
|
2219
|
+
self.body.value if hasattr(self.body, "value") else self.body
|
|
2220
|
+
)
|
|
2221
|
+
result["id_path"] = (
|
|
2222
|
+
self.id_path.value if hasattr(self.id_path, "value") else self.id_path
|
|
2223
|
+
)
|
|
2224
|
+
result["name_path"] = (
|
|
2225
|
+
self.name_path.value if hasattr(self.name_path, "value") else self.name_path
|
|
2226
|
+
)
|
|
2227
|
+
if self.description_path is not None:
|
|
2228
|
+
result["description_path"] = (
|
|
2229
|
+
self.description_path.value
|
|
2230
|
+
if hasattr(self.description_path, "value")
|
|
2231
|
+
else self.description_path
|
|
2232
|
+
)
|
|
2233
|
+
return result
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
@dataclass
|
|
2237
|
+
class DatasetResourceDiscoveryConfig:
|
|
2238
|
+
"""DatasetResourceDiscoveryConfig matching Go backend structure."""
|
|
2239
|
+
|
|
2240
|
+
min_resources_required: int
|
|
2241
|
+
table_query: str = None
|
|
2242
|
+
relationship_query: str = None
|
|
2243
|
+
index_query: str = None
|
|
2244
|
+
constraint_query: str = None
|
|
2245
|
+
statistics_query: str = None
|
|
2246
|
+
size_query: str = None
|
|
2247
|
+
base_url: str = None
|
|
2248
|
+
resource_types: List["ResourceTypeConfig"] = None
|
|
2249
|
+
error_handling: Optional["ErrorHandlingConfig"] = None
|
|
2250
|
+
|
|
2251
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2252
|
+
"""Convert to dict format expected by backend."""
|
|
2253
|
+
result = {}
|
|
2254
|
+
result["min_resources_required"] = (
|
|
2255
|
+
self.min_resources_required.value
|
|
2256
|
+
if hasattr(self.min_resources_required, "value")
|
|
2257
|
+
else self.min_resources_required
|
|
2258
|
+
)
|
|
2259
|
+
if self.table_query is not None:
|
|
2260
|
+
result["table_query"] = (
|
|
2261
|
+
self.table_query.value
|
|
2262
|
+
if hasattr(self.table_query, "value")
|
|
2263
|
+
else self.table_query
|
|
2264
|
+
)
|
|
2265
|
+
if self.relationship_query is not None:
|
|
2266
|
+
result["relationship_query"] = (
|
|
2267
|
+
self.relationship_query.value
|
|
2268
|
+
if hasattr(self.relationship_query, "value")
|
|
2269
|
+
else self.relationship_query
|
|
2270
|
+
)
|
|
2271
|
+
if self.index_query is not None:
|
|
2272
|
+
result["index_query"] = (
|
|
2273
|
+
self.index_query.value
|
|
2274
|
+
if hasattr(self.index_query, "value")
|
|
2275
|
+
else self.index_query
|
|
2276
|
+
)
|
|
2277
|
+
if self.constraint_query is not None:
|
|
2278
|
+
result["constraint_query"] = (
|
|
2279
|
+
self.constraint_query.value
|
|
2280
|
+
if hasattr(self.constraint_query, "value")
|
|
2281
|
+
else self.constraint_query
|
|
2282
|
+
)
|
|
2283
|
+
if self.statistics_query is not None:
|
|
2284
|
+
result["statistics_query"] = (
|
|
2285
|
+
self.statistics_query.value
|
|
2286
|
+
if hasattr(self.statistics_query, "value")
|
|
2287
|
+
else self.statistics_query
|
|
2288
|
+
)
|
|
2289
|
+
if self.size_query is not None:
|
|
2290
|
+
result["size_query"] = (
|
|
2291
|
+
self.size_query.value
|
|
2292
|
+
if hasattr(self.size_query, "value")
|
|
2293
|
+
else self.size_query
|
|
2294
|
+
)
|
|
2295
|
+
if self.base_url is not None:
|
|
2296
|
+
result["base_url"] = (
|
|
2297
|
+
self.base_url.value
|
|
2298
|
+
if hasattr(self.base_url, "value")
|
|
2299
|
+
else self.base_url
|
|
2300
|
+
)
|
|
2301
|
+
if self.resource_types is not None:
|
|
2302
|
+
result["resource_types"] = (
|
|
2303
|
+
self.resource_types.value
|
|
2304
|
+
if hasattr(self.resource_types, "value")
|
|
2305
|
+
else self.resource_types
|
|
2306
|
+
)
|
|
2307
|
+
if self.error_handling is not None:
|
|
2308
|
+
result["error_handling"] = (
|
|
2309
|
+
self.error_handling.value
|
|
2310
|
+
if hasattr(self.error_handling, "value")
|
|
2311
|
+
else self.error_handling
|
|
2312
|
+
)
|
|
2313
|
+
return result
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
@dataclass
|
|
2317
|
+
class ExpiryConfig:
|
|
2318
|
+
"""ExpiryConfig matching Go backend structure."""
|
|
2319
|
+
|
|
2320
|
+
type: Any
|
|
2321
|
+
duration: Any = None
|
|
2322
|
+
field_name: str = None
|
|
2323
|
+
refresh_token_duration: Optional[Any] = None
|
|
2324
|
+
|
|
2325
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2326
|
+
"""Convert to dict format expected by backend."""
|
|
2327
|
+
result = {}
|
|
2328
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2329
|
+
if self.duration is not None:
|
|
2330
|
+
result["duration"] = (
|
|
2331
|
+
self.duration.value
|
|
2332
|
+
if hasattr(self.duration, "value")
|
|
2333
|
+
else self.duration
|
|
2334
|
+
)
|
|
2335
|
+
if self.field_name is not None:
|
|
2336
|
+
result["field_name"] = (
|
|
2337
|
+
self.field_name.value
|
|
2338
|
+
if hasattr(self.field_name, "value")
|
|
2339
|
+
else self.field_name
|
|
2340
|
+
)
|
|
2341
|
+
if self.refresh_token_duration is not None:
|
|
2342
|
+
result["refresh_token_duration"] = (
|
|
2343
|
+
self.refresh_token_duration.value
|
|
2344
|
+
if hasattr(self.refresh_token_duration, "value")
|
|
2345
|
+
else self.refresh_token_duration
|
|
2346
|
+
)
|
|
2347
|
+
return result
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
@dataclass
|
|
2351
|
+
class SegmentOption:
|
|
2352
|
+
"""SegmentOption matching Go backend structure."""
|
|
2353
|
+
|
|
2354
|
+
id: str
|
|
2355
|
+
name: str
|
|
2356
|
+
type: str
|
|
2357
|
+
metadata: Dict[str, str]
|
|
2358
|
+
children: List["SegmentOption"]
|
|
2359
|
+
parent_id: Optional[str] = None
|
|
2360
|
+
|
|
2361
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2362
|
+
"""Convert to dict format expected by backend."""
|
|
2363
|
+
result = {}
|
|
2364
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
2365
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2366
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2367
|
+
if self.parent_id is not None:
|
|
2368
|
+
result["parent_id"] = (
|
|
2369
|
+
self.parent_id.value
|
|
2370
|
+
if hasattr(self.parent_id, "value")
|
|
2371
|
+
else self.parent_id
|
|
2372
|
+
)
|
|
2373
|
+
result["metadata"] = (
|
|
2374
|
+
self.metadata.value if hasattr(self.metadata, "value") else self.metadata
|
|
2375
|
+
)
|
|
2376
|
+
result["children"] = (
|
|
2377
|
+
self.children.value if hasattr(self.children, "value") else self.children
|
|
2378
|
+
)
|
|
2379
|
+
return result
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
@dataclass
|
|
2383
|
+
class IntegrationDefinition:
|
|
2384
|
+
"""IntegrationDefinition matching Go backend structure."""
|
|
2385
|
+
|
|
2386
|
+
name: str
|
|
2387
|
+
key: str
|
|
2388
|
+
type: Any
|
|
2389
|
+
auth_types: List[Any]
|
|
2390
|
+
status: Any
|
|
2391
|
+
description: Optional[str] = None
|
|
2392
|
+
provider_name: Optional[str] = None
|
|
2393
|
+
documentation_url: Optional[str] = None
|
|
2394
|
+
openapi_documentation_url: Optional[str] = None
|
|
2395
|
+
llms_txt_url: Optional[str] = None
|
|
2396
|
+
healthcheck_url: Optional[str] = None
|
|
2397
|
+
auth_url: Optional[str] = None
|
|
2398
|
+
token_url: Optional[str] = None
|
|
2399
|
+
client_id: Optional[str] = None
|
|
2400
|
+
client_secret: Optional[str] = None
|
|
2401
|
+
available_scopes: List[str] = None
|
|
2402
|
+
optional_scopes: List[str] = None
|
|
2403
|
+
scope_separator: Optional[str] = None
|
|
2404
|
+
api_version: Optional[str] = None
|
|
2405
|
+
api_version_description: Optional[str] = None
|
|
2406
|
+
credential_schema: Dict[str, Any] = None
|
|
2407
|
+
ui_config: Optional["UIConfig"] = None
|
|
2408
|
+
codegen_details: Optional[CodegenDetails] = None
|
|
2409
|
+
analysis_details: Optional[AnalysisDetails] = None
|
|
2410
|
+
segment_config: Optional["SegmentConfig"] = None
|
|
2411
|
+
dataset_resource_discovery_config: Optional["DatasetResourceDiscoveryConfig"] = None
|
|
2412
|
+
expiry_config: Optional["ExpiryConfig"] = None
|
|
2413
|
+
provider_credentials: Dict[str, Any] = None
|
|
2414
|
+
default_resource_attach_type: Optional[str] = None
|
|
2415
|
+
|
|
2416
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2417
|
+
"""Convert to dict format expected by backend."""
|
|
2418
|
+
result = {}
|
|
2419
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2420
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
2421
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2422
|
+
result["auth_types"] = (
|
|
2423
|
+
self.auth_types.value
|
|
2424
|
+
if hasattr(self.auth_types, "value")
|
|
2425
|
+
else self.auth_types
|
|
2426
|
+
)
|
|
2427
|
+
result["status"] = (
|
|
2428
|
+
self.status.value if hasattr(self.status, "value") else self.status
|
|
2429
|
+
)
|
|
2430
|
+
if self.description is not None:
|
|
2431
|
+
result["description"] = (
|
|
2432
|
+
self.description.value
|
|
2433
|
+
if hasattr(self.description, "value")
|
|
2434
|
+
else self.description
|
|
2435
|
+
)
|
|
2436
|
+
if self.provider_name is not None:
|
|
2437
|
+
result["provider_name"] = (
|
|
2438
|
+
self.provider_name.value
|
|
2439
|
+
if hasattr(self.provider_name, "value")
|
|
2440
|
+
else self.provider_name
|
|
2441
|
+
)
|
|
2442
|
+
if self.documentation_url is not None:
|
|
2443
|
+
result["documentation_url"] = (
|
|
2444
|
+
self.documentation_url.value
|
|
2445
|
+
if hasattr(self.documentation_url, "value")
|
|
2446
|
+
else self.documentation_url
|
|
2447
|
+
)
|
|
2448
|
+
if self.openapi_documentation_url is not None:
|
|
2449
|
+
result["openapi_documentation_url"] = (
|
|
2450
|
+
self.openapi_documentation_url.value
|
|
2451
|
+
if hasattr(self.openapi_documentation_url, "value")
|
|
2452
|
+
else self.openapi_documentation_url
|
|
2453
|
+
)
|
|
2454
|
+
if self.llms_txt_url is not None:
|
|
2455
|
+
result["llms_txt_url"] = (
|
|
2456
|
+
self.llms_txt_url.value
|
|
2457
|
+
if hasattr(self.llms_txt_url, "value")
|
|
2458
|
+
else self.llms_txt_url
|
|
2459
|
+
)
|
|
2460
|
+
if self.healthcheck_url is not None:
|
|
2461
|
+
result["healthcheck_url"] = (
|
|
2462
|
+
self.healthcheck_url.value
|
|
2463
|
+
if hasattr(self.healthcheck_url, "value")
|
|
2464
|
+
else self.healthcheck_url
|
|
2465
|
+
)
|
|
2466
|
+
if self.auth_url is not None:
|
|
2467
|
+
result["auth_url"] = (
|
|
2468
|
+
self.auth_url.value
|
|
2469
|
+
if hasattr(self.auth_url, "value")
|
|
2470
|
+
else self.auth_url
|
|
2471
|
+
)
|
|
2472
|
+
if self.token_url is not None:
|
|
2473
|
+
result["token_url"] = (
|
|
2474
|
+
self.token_url.value
|
|
2475
|
+
if hasattr(self.token_url, "value")
|
|
2476
|
+
else self.token_url
|
|
2477
|
+
)
|
|
2478
|
+
if self.client_id is not None:
|
|
2479
|
+
result["client_id"] = (
|
|
2480
|
+
self.client_id.value
|
|
2481
|
+
if hasattr(self.client_id, "value")
|
|
2482
|
+
else self.client_id
|
|
2483
|
+
)
|
|
2484
|
+
if self.client_secret is not None:
|
|
2485
|
+
result["client_secret"] = (
|
|
2486
|
+
self.client_secret.value
|
|
2487
|
+
if hasattr(self.client_secret, "value")
|
|
2488
|
+
else self.client_secret
|
|
2489
|
+
)
|
|
2490
|
+
if self.available_scopes is not None:
|
|
2491
|
+
result["available_scopes"] = (
|
|
2492
|
+
self.available_scopes.value
|
|
2493
|
+
if hasattr(self.available_scopes, "value")
|
|
2494
|
+
else self.available_scopes
|
|
2495
|
+
)
|
|
2496
|
+
if self.optional_scopes is not None:
|
|
2497
|
+
result["optional_scopes"] = (
|
|
2498
|
+
self.optional_scopes.value
|
|
2499
|
+
if hasattr(self.optional_scopes, "value")
|
|
2500
|
+
else self.optional_scopes
|
|
2501
|
+
)
|
|
2502
|
+
if self.scope_separator is not None:
|
|
2503
|
+
result["scope_separator"] = (
|
|
2504
|
+
self.scope_separator.value
|
|
2505
|
+
if hasattr(self.scope_separator, "value")
|
|
2506
|
+
else self.scope_separator
|
|
2507
|
+
)
|
|
2508
|
+
if self.api_version is not None:
|
|
2509
|
+
result["api_version"] = (
|
|
2510
|
+
self.api_version.value
|
|
2511
|
+
if hasattr(self.api_version, "value")
|
|
2512
|
+
else self.api_version
|
|
2513
|
+
)
|
|
2514
|
+
if self.api_version_description is not None:
|
|
2515
|
+
result["api_version_description"] = (
|
|
2516
|
+
self.api_version_description.value
|
|
2517
|
+
if hasattr(self.api_version_description, "value")
|
|
2518
|
+
else self.api_version_description
|
|
2519
|
+
)
|
|
2520
|
+
if self.credential_schema is not None:
|
|
2521
|
+
result["credential_schema"] = (
|
|
2522
|
+
self.credential_schema.value
|
|
2523
|
+
if hasattr(self.credential_schema, "value")
|
|
2524
|
+
else self.credential_schema
|
|
2525
|
+
)
|
|
2526
|
+
if self.ui_config is not None:
|
|
2527
|
+
result["ui_config"] = (
|
|
2528
|
+
self.ui_config.value
|
|
2529
|
+
if hasattr(self.ui_config, "value")
|
|
2530
|
+
else self.ui_config
|
|
2531
|
+
)
|
|
2532
|
+
if self.codegen_details is not None:
|
|
2533
|
+
result["codegen_details"] = (
|
|
2534
|
+
self.codegen_details.value
|
|
2535
|
+
if hasattr(self.codegen_details, "value")
|
|
2536
|
+
else self.codegen_details
|
|
2537
|
+
)
|
|
2538
|
+
if self.analysis_details is not None:
|
|
2539
|
+
result["analysis_details"] = (
|
|
2540
|
+
self.analysis_details.value
|
|
2541
|
+
if hasattr(self.analysis_details, "value")
|
|
2542
|
+
else self.analysis_details
|
|
2543
|
+
)
|
|
2544
|
+
if self.segment_config is not None:
|
|
2545
|
+
result["segment_config"] = (
|
|
2546
|
+
self.segment_config.value
|
|
2547
|
+
if hasattr(self.segment_config, "value")
|
|
2548
|
+
else self.segment_config
|
|
2549
|
+
)
|
|
2550
|
+
if self.dataset_resource_discovery_config is not None:
|
|
2551
|
+
result["dataset_resource_discovery_config"] = (
|
|
2552
|
+
self.dataset_resource_discovery_config.value
|
|
2553
|
+
if hasattr(self.dataset_resource_discovery_config, "value")
|
|
2554
|
+
else self.dataset_resource_discovery_config
|
|
2555
|
+
)
|
|
2556
|
+
if self.expiry_config is not None:
|
|
2557
|
+
result["expiry_config"] = (
|
|
2558
|
+
self.expiry_config.value
|
|
2559
|
+
if hasattr(self.expiry_config, "value")
|
|
2560
|
+
else self.expiry_config
|
|
2561
|
+
)
|
|
2562
|
+
if self.provider_credentials is not None:
|
|
2563
|
+
result["provider_credentials"] = (
|
|
2564
|
+
self.provider_credentials.value
|
|
2565
|
+
if hasattr(self.provider_credentials, "value")
|
|
2566
|
+
else self.provider_credentials
|
|
2567
|
+
)
|
|
2568
|
+
if self.default_resource_attach_type is not None:
|
|
2569
|
+
result["default_resource_attach_type"] = (
|
|
2570
|
+
self.default_resource_attach_type.value
|
|
2571
|
+
if hasattr(self.default_resource_attach_type, "value")
|
|
2572
|
+
else self.default_resource_attach_type
|
|
2573
|
+
)
|
|
2574
|
+
return result
|
|
2575
|
+
|
|
2576
|
+
|
|
2577
|
+
@dataclass
|
|
2578
|
+
class IntegrationConfig:
|
|
2579
|
+
"""IntegrationConfig matching Go backend structure."""
|
|
2580
|
+
|
|
2581
|
+
definition: "IntegrationDefinition"
|
|
2582
|
+
source: str
|
|
2583
|
+
file_path: str = None
|
|
2584
|
+
|
|
2585
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2586
|
+
"""Convert to dict format expected by backend."""
|
|
2587
|
+
result = {}
|
|
2588
|
+
result["definition"] = (
|
|
2589
|
+
self.definition.value
|
|
2590
|
+
if hasattr(self.definition, "value")
|
|
2591
|
+
else self.definition
|
|
2592
|
+
)
|
|
2593
|
+
result["source"] = (
|
|
2594
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
2595
|
+
)
|
|
2596
|
+
if self.file_path is not None:
|
|
2597
|
+
result["file_path"] = (
|
|
2598
|
+
self.file_path.value
|
|
2599
|
+
if hasattr(self.file_path, "value")
|
|
2600
|
+
else self.file_path
|
|
2601
|
+
)
|
|
2602
|
+
return result
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
@dataclass
|
|
2606
|
+
class PythonIntegrationInstance:
|
|
2607
|
+
"""PythonIntegrationInstance matching Go backend structure."""
|
|
2608
|
+
|
|
2609
|
+
config: IntegrationConfig
|
|
2610
|
+
credentials: Dict[str, Any]
|
|
2611
|
+
methods: List[str] = None
|
|
2612
|
+
|
|
2613
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2614
|
+
"""Convert to dict format expected by backend."""
|
|
2615
|
+
result = {}
|
|
2616
|
+
result["config"] = (
|
|
2617
|
+
self.config.value if hasattr(self.config, "value") else self.config
|
|
2618
|
+
)
|
|
2619
|
+
result["credentials"] = (
|
|
2620
|
+
self.credentials.value
|
|
2621
|
+
if hasattr(self.credentials, "value")
|
|
2622
|
+
else self.credentials
|
|
2623
|
+
)
|
|
2624
|
+
if self.methods is not None:
|
|
2625
|
+
result["methods"] = (
|
|
2626
|
+
self.methods.value if hasattr(self.methods, "value") else self.methods
|
|
2627
|
+
)
|
|
2628
|
+
return result
|
|
2629
|
+
|
|
2630
|
+
|
|
2631
|
+
@dataclass
|
|
2632
|
+
class IntegrationDiscovery:
|
|
2633
|
+
"""IntegrationDiscovery matching Go backend structure."""
|
|
2634
|
+
|
|
2635
|
+
config: IntegrationConfig
|
|
2636
|
+
file_path: str
|
|
2637
|
+
source_code: str
|
|
2638
|
+
instance: Optional["PythonIntegrationInstance"] = None
|
|
2639
|
+
|
|
2640
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2641
|
+
"""Convert to dict format expected by backend."""
|
|
2642
|
+
result = {}
|
|
2643
|
+
result["config"] = (
|
|
2644
|
+
self.config.value if hasattr(self.config, "value") else self.config
|
|
2645
|
+
)
|
|
2646
|
+
if self.instance is not None:
|
|
2647
|
+
result["instance"] = (
|
|
2648
|
+
self.instance.value
|
|
2649
|
+
if hasattr(self.instance, "value")
|
|
2650
|
+
else self.instance
|
|
2651
|
+
)
|
|
2652
|
+
result["file_path"] = (
|
|
2653
|
+
self.file_path.value if hasattr(self.file_path, "value") else self.file_path
|
|
2654
|
+
)
|
|
2655
|
+
result["source_code"] = (
|
|
2656
|
+
self.source_code.value
|
|
2657
|
+
if hasattr(self.source_code, "value")
|
|
2658
|
+
else self.source_code
|
|
2659
|
+
)
|
|
2660
|
+
return result
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
@dataclass
|
|
2664
|
+
class UpsertIntegrationRequest:
|
|
2665
|
+
"""UpsertIntegrationRequest matching Go backend structure."""
|
|
2666
|
+
|
|
2667
|
+
integration: "IntegrationDefinition"
|
|
2668
|
+
source: str
|
|
2669
|
+
|
|
2670
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2671
|
+
"""Convert to dict format expected by backend."""
|
|
2672
|
+
result = {}
|
|
2673
|
+
result["integration"] = (
|
|
2674
|
+
self.integration.value
|
|
2675
|
+
if hasattr(self.integration, "value")
|
|
2676
|
+
else self.integration
|
|
2677
|
+
)
|
|
2678
|
+
result["source"] = (
|
|
2679
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
2680
|
+
)
|
|
2681
|
+
return result
|
|
2682
|
+
|
|
2683
|
+
|
|
2684
|
+
@dataclass
|
|
2685
|
+
class UpsertIntegrationResponse:
|
|
2686
|
+
"""UpsertIntegrationResponse matching Go backend structure."""
|
|
2687
|
+
|
|
2688
|
+
integration_id: str
|
|
2689
|
+
status: str
|
|
2690
|
+
|
|
2691
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2692
|
+
"""Convert to dict format expected by backend."""
|
|
2693
|
+
result = {}
|
|
2694
|
+
result["integration_id"] = (
|
|
2695
|
+
self.integration_id.value
|
|
2696
|
+
if hasattr(self.integration_id, "value")
|
|
2697
|
+
else self.integration_id
|
|
2698
|
+
)
|
|
2699
|
+
result["status"] = (
|
|
2700
|
+
self.status.value if hasattr(self.status, "value") else self.status
|
|
2701
|
+
)
|
|
2702
|
+
return result
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
@dataclass
|
|
2706
|
+
class ListIntegrationsResponse:
|
|
2707
|
+
"""ListIntegrationsResponse matching Go backend structure."""
|
|
2708
|
+
|
|
2709
|
+
integrations: List["IntegrationDefinition"]
|
|
2710
|
+
|
|
2711
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2712
|
+
"""Convert to dict format expected by backend."""
|
|
2713
|
+
result = {}
|
|
2714
|
+
result["integrations"] = (
|
|
2715
|
+
self.integrations.value
|
|
2716
|
+
if hasattr(self.integrations, "value")
|
|
2717
|
+
else self.integrations
|
|
2718
|
+
)
|
|
2719
|
+
return result
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
@dataclass
|
|
2723
|
+
class ExportIntegrationsResponse:
|
|
2724
|
+
"""ExportIntegrationsResponse matching Go backend structure."""
|
|
2725
|
+
|
|
2726
|
+
integrations: Dict[str, Any]
|
|
2727
|
+
|
|
2728
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2729
|
+
"""Convert to dict format expected by backend."""
|
|
2730
|
+
result = {}
|
|
2731
|
+
result["integrations"] = (
|
|
2732
|
+
self.integrations.value
|
|
2733
|
+
if hasattr(self.integrations, "value")
|
|
2734
|
+
else self.integrations
|
|
2735
|
+
)
|
|
2736
|
+
return result
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
@dataclass
|
|
2740
|
+
class Memory:
|
|
2741
|
+
"""Memory matching Go backend structure."""
|
|
2742
|
+
|
|
2743
|
+
id: str
|
|
2744
|
+
content: str
|
|
2745
|
+
description: str
|
|
2746
|
+
tags: List[str]
|
|
2747
|
+
state: str
|
|
2748
|
+
created_by_entity_type: str
|
|
2749
|
+
created_by_id: str
|
|
2750
|
+
extra: Dict[str, Any]
|
|
2751
|
+
created_at: datetime
|
|
2752
|
+
updated_at: datetime
|
|
2753
|
+
type: str
|
|
2754
|
+
current_version: int
|
|
2755
|
+
approval_status: str
|
|
2756
|
+
estimated_stale_at: Optional[datetime] = None
|
|
2757
|
+
stale_when_text: Optional[str] = None
|
|
2758
|
+
created_from: Optional[str] = None
|
|
2759
|
+
organization_id: Optional[str] = None
|
|
2760
|
+
dataset_id: Optional[str] = None
|
|
2761
|
+
integration_config_id: Optional[str] = None
|
|
2762
|
+
user_id: Optional[str] = None
|
|
2763
|
+
thread_id: Optional[str] = None
|
|
2764
|
+
|
|
2765
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2766
|
+
"""Convert to dict format expected by backend."""
|
|
2767
|
+
result = {}
|
|
2768
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
2769
|
+
result["content"] = (
|
|
2770
|
+
self.content.value if hasattr(self.content, "value") else self.content
|
|
2771
|
+
)
|
|
2772
|
+
result["description"] = (
|
|
2773
|
+
self.description.value
|
|
2774
|
+
if hasattr(self.description, "value")
|
|
2775
|
+
else self.description
|
|
2776
|
+
)
|
|
2777
|
+
result["tags"] = self.tags.value if hasattr(self.tags, "value") else self.tags
|
|
2778
|
+
result["state"] = (
|
|
2779
|
+
self.state.value if hasattr(self.state, "value") else self.state
|
|
2780
|
+
)
|
|
2781
|
+
if self.estimated_stale_at is not None:
|
|
2782
|
+
result["estimated_stale_at"] = (
|
|
2783
|
+
self.estimated_stale_at.value
|
|
2784
|
+
if hasattr(self.estimated_stale_at, "value")
|
|
2785
|
+
else self.estimated_stale_at
|
|
2786
|
+
)
|
|
2787
|
+
if self.stale_when_text is not None:
|
|
2788
|
+
result["stale_when_text"] = (
|
|
2789
|
+
self.stale_when_text.value
|
|
2790
|
+
if hasattr(self.stale_when_text, "value")
|
|
2791
|
+
else self.stale_when_text
|
|
2792
|
+
)
|
|
2793
|
+
result["created_by_entity_type"] = (
|
|
2794
|
+
self.created_by_entity_type.value
|
|
2795
|
+
if hasattr(self.created_by_entity_type, "value")
|
|
2796
|
+
else self.created_by_entity_type
|
|
2797
|
+
)
|
|
2798
|
+
result["created_by_id"] = (
|
|
2799
|
+
self.created_by_id.value
|
|
2800
|
+
if hasattr(self.created_by_id, "value")
|
|
2801
|
+
else self.created_by_id
|
|
2802
|
+
)
|
|
2803
|
+
if self.created_from is not None:
|
|
2804
|
+
result["created_from"] = (
|
|
2805
|
+
self.created_from.value
|
|
2806
|
+
if hasattr(self.created_from, "value")
|
|
2807
|
+
else self.created_from
|
|
2808
|
+
)
|
|
2809
|
+
if self.organization_id is not None:
|
|
2810
|
+
result["organization_id"] = (
|
|
2811
|
+
self.organization_id.value
|
|
2812
|
+
if hasattr(self.organization_id, "value")
|
|
2813
|
+
else self.organization_id
|
|
2814
|
+
)
|
|
2815
|
+
result["extra"] = (
|
|
2816
|
+
self.extra.value if hasattr(self.extra, "value") else self.extra
|
|
2817
|
+
)
|
|
2818
|
+
result["created_at"] = (
|
|
2819
|
+
self.created_at.value
|
|
2820
|
+
if hasattr(self.created_at, "value")
|
|
2821
|
+
else self.created_at
|
|
2822
|
+
)
|
|
2823
|
+
result["updated_at"] = (
|
|
2824
|
+
self.updated_at.value
|
|
2825
|
+
if hasattr(self.updated_at, "value")
|
|
2826
|
+
else self.updated_at
|
|
2827
|
+
)
|
|
2828
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2829
|
+
if self.dataset_id is not None:
|
|
2830
|
+
result["dataset_id"] = (
|
|
2831
|
+
self.dataset_id.value
|
|
2832
|
+
if hasattr(self.dataset_id, "value")
|
|
2833
|
+
else self.dataset_id
|
|
2834
|
+
)
|
|
2835
|
+
if self.integration_config_id is not None:
|
|
2836
|
+
result["integration_config_id"] = (
|
|
2837
|
+
self.integration_config_id.value
|
|
2838
|
+
if hasattr(self.integration_config_id, "value")
|
|
2839
|
+
else self.integration_config_id
|
|
2840
|
+
)
|
|
2841
|
+
if self.user_id is not None:
|
|
2842
|
+
result["user_id"] = (
|
|
2843
|
+
self.user_id.value if hasattr(self.user_id, "value") else self.user_id
|
|
2844
|
+
)
|
|
2845
|
+
if self.thread_id is not None:
|
|
2846
|
+
result["thread_id"] = (
|
|
2847
|
+
self.thread_id.value
|
|
2848
|
+
if hasattr(self.thread_id, "value")
|
|
2849
|
+
else self.thread_id
|
|
2850
|
+
)
|
|
2851
|
+
result["current_version"] = (
|
|
2852
|
+
self.current_version.value
|
|
2853
|
+
if hasattr(self.current_version, "value")
|
|
2854
|
+
else self.current_version
|
|
2855
|
+
)
|
|
2856
|
+
result["approval_status"] = (
|
|
2857
|
+
self.approval_status.value
|
|
2858
|
+
if hasattr(self.approval_status, "value")
|
|
2859
|
+
else self.approval_status
|
|
2860
|
+
)
|
|
2861
|
+
return result
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
@dataclass
|
|
2865
|
+
class ResourceAnalysis:
|
|
2866
|
+
"""ResourceAnalysis matching Go backend structure."""
|
|
2867
|
+
|
|
2868
|
+
entity_key: str
|
|
2869
|
+
summary: Optional[str] = None
|
|
2870
|
+
last_analyzed: Optional[datetime] = None
|
|
2871
|
+
|
|
2872
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2873
|
+
"""Convert to dict format expected by backend."""
|
|
2874
|
+
result = {}
|
|
2875
|
+
if self.summary is not None:
|
|
2876
|
+
result["summary"] = (
|
|
2877
|
+
self.summary.value if hasattr(self.summary, "value") else self.summary
|
|
2878
|
+
)
|
|
2879
|
+
if self.last_analyzed is not None:
|
|
2880
|
+
result["last_analyzed"] = (
|
|
2881
|
+
self.last_analyzed.value
|
|
2882
|
+
if hasattr(self.last_analyzed, "value")
|
|
2883
|
+
else self.last_analyzed
|
|
2884
|
+
)
|
|
2885
|
+
result["entity_key"] = (
|
|
2886
|
+
self.entity_key.value
|
|
2887
|
+
if hasattr(self.entity_key, "value")
|
|
2888
|
+
else self.entity_key
|
|
2889
|
+
)
|
|
2890
|
+
return result
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
@dataclass
|
|
2894
|
+
class Resource:
|
|
2895
|
+
"""Resource matching Go backend structure."""
|
|
2896
|
+
|
|
2897
|
+
id: str
|
|
2898
|
+
key: str
|
|
2899
|
+
name: str
|
|
2900
|
+
type: Any
|
|
2901
|
+
use_cases: List[str]
|
|
2902
|
+
tags: List[str]
|
|
2903
|
+
created_at: datetime
|
|
2904
|
+
updated_at: datetime
|
|
2905
|
+
integration_config_id: str
|
|
2906
|
+
state: Any
|
|
2907
|
+
attach_type: Any
|
|
2908
|
+
dataset_id: str
|
|
2909
|
+
analyses: List["ResourceAnalysis"]
|
|
2910
|
+
related_resources: List[Resource]
|
|
2911
|
+
metadata: Dict[str, Any]
|
|
2912
|
+
description: Optional[str] = None
|
|
2913
|
+
instructions: Optional[str] = None
|
|
2914
|
+
|
|
2915
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2916
|
+
"""Convert to dict format expected by backend."""
|
|
2917
|
+
result = {}
|
|
2918
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
2919
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
2920
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2921
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
2922
|
+
if self.description is not None:
|
|
2923
|
+
result["description"] = (
|
|
2924
|
+
self.description.value
|
|
2925
|
+
if hasattr(self.description, "value")
|
|
2926
|
+
else self.description
|
|
2927
|
+
)
|
|
2928
|
+
result["use_cases"] = (
|
|
2929
|
+
self.use_cases.value if hasattr(self.use_cases, "value") else self.use_cases
|
|
2930
|
+
)
|
|
2931
|
+
result["tags"] = self.tags.value if hasattr(self.tags, "value") else self.tags
|
|
2932
|
+
result["created_at"] = (
|
|
2933
|
+
self.created_at.value
|
|
2934
|
+
if hasattr(self.created_at, "value")
|
|
2935
|
+
else self.created_at
|
|
2936
|
+
)
|
|
2937
|
+
result["updated_at"] = (
|
|
2938
|
+
self.updated_at.value
|
|
2939
|
+
if hasattr(self.updated_at, "value")
|
|
2940
|
+
else self.updated_at
|
|
2941
|
+
)
|
|
2942
|
+
result["integration_config_id"] = (
|
|
2943
|
+
self.integration_config_id.value
|
|
2944
|
+
if hasattr(self.integration_config_id, "value")
|
|
2945
|
+
else self.integration_config_id
|
|
2946
|
+
)
|
|
2947
|
+
result["state"] = (
|
|
2948
|
+
self.state.value if hasattr(self.state, "value") else self.state
|
|
2949
|
+
)
|
|
2950
|
+
result["attach_type"] = (
|
|
2951
|
+
self.attach_type.value
|
|
2952
|
+
if hasattr(self.attach_type, "value")
|
|
2953
|
+
else self.attach_type
|
|
2954
|
+
)
|
|
2955
|
+
result["dataset_id"] = (
|
|
2956
|
+
self.dataset_id.value
|
|
2957
|
+
if hasattr(self.dataset_id, "value")
|
|
2958
|
+
else self.dataset_id
|
|
2959
|
+
)
|
|
2960
|
+
if self.instructions is not None:
|
|
2961
|
+
result["instructions"] = (
|
|
2962
|
+
self.instructions.value
|
|
2963
|
+
if hasattr(self.instructions, "value")
|
|
2964
|
+
else self.instructions
|
|
2965
|
+
)
|
|
2966
|
+
result["analyses"] = (
|
|
2967
|
+
self.analyses.value if hasattr(self.analyses, "value") else self.analyses
|
|
2968
|
+
)
|
|
2969
|
+
result["related_resources"] = (
|
|
2970
|
+
self.related_resources.value
|
|
2971
|
+
if hasattr(self.related_resources, "value")
|
|
2972
|
+
else self.related_resources
|
|
2973
|
+
)
|
|
2974
|
+
result["metadata"] = (
|
|
2975
|
+
self.metadata.value if hasattr(self.metadata, "value") else self.metadata
|
|
2976
|
+
)
|
|
2977
|
+
return result
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
# Integration classes from Go structs
|
|
2981
|
+
@dataclass
|
|
2982
|
+
class UIConfigIcon:
|
|
2983
|
+
"""UIConfigIcon matching Go backend structure."""
|
|
2984
|
+
|
|
2985
|
+
set: str
|
|
2986
|
+
name: str
|
|
2987
|
+
|
|
2988
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
2989
|
+
"""Convert to dict format expected by backend."""
|
|
2990
|
+
result = {}
|
|
2991
|
+
result["set"] = self.set.value if hasattr(self.set, "value") else self.set
|
|
2992
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
2993
|
+
return result
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
@dataclass
|
|
2997
|
+
class UIConfig:
|
|
2998
|
+
"""UIConfig matching Go backend structure."""
|
|
2999
|
+
|
|
3000
|
+
brand_logo_icon: "UIConfigIcon"
|
|
3001
|
+
brand_color: str
|
|
3002
|
+
button_style: str
|
|
3003
|
+
|
|
3004
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3005
|
+
"""Convert to dict format expected by backend."""
|
|
3006
|
+
result = {}
|
|
3007
|
+
result["brand_logo_icon"] = (
|
|
3008
|
+
self.brand_logo_icon.value
|
|
3009
|
+
if hasattr(self.brand_logo_icon, "value")
|
|
3010
|
+
else self.brand_logo_icon
|
|
3011
|
+
)
|
|
3012
|
+
result["brand_color"] = (
|
|
3013
|
+
self.brand_color.value
|
|
3014
|
+
if hasattr(self.brand_color, "value")
|
|
3015
|
+
else self.brand_color
|
|
3016
|
+
)
|
|
3017
|
+
result["button_style"] = (
|
|
3018
|
+
self.button_style.value
|
|
3019
|
+
if hasattr(self.button_style, "value")
|
|
3020
|
+
else self.button_style
|
|
3021
|
+
)
|
|
3022
|
+
return result
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
@dataclass
|
|
3026
|
+
class ErrorHandlingConfig:
|
|
3027
|
+
"""ErrorHandlingConfig matching Go backend structure."""
|
|
3028
|
+
|
|
3029
|
+
ignore_errors: List[str] = None
|
|
3030
|
+
error_path: str = None
|
|
3031
|
+
|
|
3032
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3033
|
+
"""Convert to dict format expected by backend."""
|
|
3034
|
+
result = {}
|
|
3035
|
+
if self.ignore_errors is not None:
|
|
3036
|
+
result["ignore_errors"] = (
|
|
3037
|
+
self.ignore_errors.value
|
|
3038
|
+
if hasattr(self.ignore_errors, "value")
|
|
3039
|
+
else self.ignore_errors
|
|
3040
|
+
)
|
|
3041
|
+
if self.error_path is not None:
|
|
3042
|
+
result["error_path"] = (
|
|
3043
|
+
self.error_path.value
|
|
3044
|
+
if hasattr(self.error_path, "value")
|
|
3045
|
+
else self.error_path
|
|
3046
|
+
)
|
|
3047
|
+
return result
|
|
3048
|
+
|
|
3049
|
+
|
|
3050
|
+
@dataclass
|
|
3051
|
+
class SegmentLevel:
|
|
3052
|
+
"""SegmentLevel matching Go backend structure."""
|
|
3053
|
+
|
|
3054
|
+
name: str
|
|
3055
|
+
type: str
|
|
3056
|
+
selectable: bool
|
|
3057
|
+
url_template: str = None
|
|
3058
|
+
method: str = None
|
|
3059
|
+
body: str = None
|
|
3060
|
+
id_path: str = None
|
|
3061
|
+
id_regex: str = None
|
|
3062
|
+
name_path: str = None
|
|
3063
|
+
parent_key: str = None
|
|
3064
|
+
required_credentials: List[str] = None
|
|
3065
|
+
|
|
3066
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3067
|
+
"""Convert to dict format expected by backend."""
|
|
3068
|
+
result = {}
|
|
3069
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
3070
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
3071
|
+
result["selectable"] = (
|
|
3072
|
+
self.selectable.value
|
|
3073
|
+
if hasattr(self.selectable, "value")
|
|
3074
|
+
else self.selectable
|
|
3075
|
+
)
|
|
3076
|
+
if self.url_template is not None:
|
|
3077
|
+
result["url_template"] = (
|
|
3078
|
+
self.url_template.value
|
|
3079
|
+
if hasattr(self.url_template, "value")
|
|
3080
|
+
else self.url_template
|
|
3081
|
+
)
|
|
3082
|
+
if self.method is not None:
|
|
3083
|
+
result["method"] = (
|
|
3084
|
+
self.method.value if hasattr(self.method, "value") else self.method
|
|
3085
|
+
)
|
|
3086
|
+
if self.body is not None:
|
|
3087
|
+
result["body"] = (
|
|
3088
|
+
self.body.value if hasattr(self.body, "value") else self.body
|
|
3089
|
+
)
|
|
3090
|
+
if self.id_path is not None:
|
|
3091
|
+
result["id_path"] = (
|
|
3092
|
+
self.id_path.value if hasattr(self.id_path, "value") else self.id_path
|
|
3093
|
+
)
|
|
3094
|
+
if self.id_regex is not None:
|
|
3095
|
+
result["id_regex"] = (
|
|
3096
|
+
self.id_regex.value
|
|
3097
|
+
if hasattr(self.id_regex, "value")
|
|
3098
|
+
else self.id_regex
|
|
3099
|
+
)
|
|
3100
|
+
if self.name_path is not None:
|
|
3101
|
+
result["name_path"] = (
|
|
3102
|
+
self.name_path.value
|
|
3103
|
+
if hasattr(self.name_path, "value")
|
|
3104
|
+
else self.name_path
|
|
3105
|
+
)
|
|
3106
|
+
if self.parent_key is not None:
|
|
3107
|
+
result["parent_key"] = (
|
|
3108
|
+
self.parent_key.value
|
|
3109
|
+
if hasattr(self.parent_key, "value")
|
|
3110
|
+
else self.parent_key
|
|
3111
|
+
)
|
|
3112
|
+
if self.required_credentials is not None:
|
|
3113
|
+
result["required_credentials"] = (
|
|
3114
|
+
self.required_credentials.value
|
|
3115
|
+
if hasattr(self.required_credentials, "value")
|
|
3116
|
+
else self.required_credentials
|
|
3117
|
+
)
|
|
3118
|
+
return result
|
|
3119
|
+
|
|
3120
|
+
|
|
3121
|
+
@dataclass
|
|
3122
|
+
class SegmentConfig:
|
|
3123
|
+
"""SegmentConfig matching Go backend structure."""
|
|
3124
|
+
|
|
3125
|
+
selection_type: Any
|
|
3126
|
+
description: str
|
|
3127
|
+
hierarchical: bool
|
|
3128
|
+
levels: List["SegmentLevel"]
|
|
3129
|
+
min_selections: Optional[int] = None
|
|
3130
|
+
max_selections: Optional[int] = None
|
|
3131
|
+
base_url: str = None
|
|
3132
|
+
error_handling: Optional["ErrorHandlingConfig"] = None
|
|
3133
|
+
|
|
3134
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3135
|
+
"""Convert to dict format expected by backend."""
|
|
3136
|
+
result = {}
|
|
3137
|
+
result["selection_type"] = (
|
|
3138
|
+
self.selection_type.value
|
|
3139
|
+
if hasattr(self.selection_type, "value")
|
|
3140
|
+
else self.selection_type
|
|
3141
|
+
)
|
|
3142
|
+
if self.min_selections is not None:
|
|
3143
|
+
result["min_selections"] = (
|
|
3144
|
+
self.min_selections.value
|
|
3145
|
+
if hasattr(self.min_selections, "value")
|
|
3146
|
+
else self.min_selections
|
|
3147
|
+
)
|
|
3148
|
+
if self.max_selections is not None:
|
|
3149
|
+
result["max_selections"] = (
|
|
3150
|
+
self.max_selections.value
|
|
3151
|
+
if hasattr(self.max_selections, "value")
|
|
3152
|
+
else self.max_selections
|
|
3153
|
+
)
|
|
3154
|
+
result["description"] = (
|
|
3155
|
+
self.description.value
|
|
3156
|
+
if hasattr(self.description, "value")
|
|
3157
|
+
else self.description
|
|
3158
|
+
)
|
|
3159
|
+
result["hierarchical"] = (
|
|
3160
|
+
self.hierarchical.value
|
|
3161
|
+
if hasattr(self.hierarchical, "value")
|
|
3162
|
+
else self.hierarchical
|
|
3163
|
+
)
|
|
3164
|
+
if self.base_url is not None:
|
|
3165
|
+
result["base_url"] = (
|
|
3166
|
+
self.base_url.value
|
|
3167
|
+
if hasattr(self.base_url, "value")
|
|
3168
|
+
else self.base_url
|
|
3169
|
+
)
|
|
3170
|
+
result["levels"] = (
|
|
3171
|
+
self.levels.value if hasattr(self.levels, "value") else self.levels
|
|
3172
|
+
)
|
|
3173
|
+
if self.error_handling is not None:
|
|
3174
|
+
result["error_handling"] = (
|
|
3175
|
+
self.error_handling.value
|
|
3176
|
+
if hasattr(self.error_handling, "value")
|
|
3177
|
+
else self.error_handling
|
|
3178
|
+
)
|
|
3179
|
+
return result
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
@dataclass
|
|
3183
|
+
class ResourceTypeConfig:
|
|
3184
|
+
"""ResourceTypeConfig matching Go backend structure."""
|
|
3185
|
+
|
|
3186
|
+
type: str
|
|
3187
|
+
url_template: str
|
|
3188
|
+
id_path: str
|
|
3189
|
+
name_path: str
|
|
3190
|
+
method: str = None
|
|
3191
|
+
body: str = None
|
|
3192
|
+
description_path: str = None
|
|
3193
|
+
|
|
3194
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3195
|
+
"""Convert to dict format expected by backend."""
|
|
3196
|
+
result = {}
|
|
3197
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
3198
|
+
result["url_template"] = (
|
|
3199
|
+
self.url_template.value
|
|
3200
|
+
if hasattr(self.url_template, "value")
|
|
3201
|
+
else self.url_template
|
|
3202
|
+
)
|
|
3203
|
+
if self.method is not None:
|
|
3204
|
+
result["method"] = (
|
|
3205
|
+
self.method.value if hasattr(self.method, "value") else self.method
|
|
3206
|
+
)
|
|
3207
|
+
if self.body is not None:
|
|
3208
|
+
result["body"] = (
|
|
3209
|
+
self.body.value if hasattr(self.body, "value") else self.body
|
|
3210
|
+
)
|
|
3211
|
+
result["id_path"] = (
|
|
3212
|
+
self.id_path.value if hasattr(self.id_path, "value") else self.id_path
|
|
3213
|
+
)
|
|
3214
|
+
result["name_path"] = (
|
|
3215
|
+
self.name_path.value if hasattr(self.name_path, "value") else self.name_path
|
|
3216
|
+
)
|
|
3217
|
+
if self.description_path is not None:
|
|
3218
|
+
result["description_path"] = (
|
|
3219
|
+
self.description_path.value
|
|
3220
|
+
if hasattr(self.description_path, "value")
|
|
3221
|
+
else self.description_path
|
|
3222
|
+
)
|
|
3223
|
+
return result
|
|
3224
|
+
|
|
3225
|
+
|
|
3226
|
+
@dataclass
|
|
3227
|
+
class DatasetResourceDiscoveryConfig:
|
|
3228
|
+
"""DatasetResourceDiscoveryConfig matching Go backend structure."""
|
|
3229
|
+
|
|
3230
|
+
min_resources_required: int
|
|
3231
|
+
table_query: str = None
|
|
3232
|
+
relationship_query: str = None
|
|
3233
|
+
index_query: str = None
|
|
3234
|
+
constraint_query: str = None
|
|
3235
|
+
statistics_query: str = None
|
|
3236
|
+
size_query: str = None
|
|
3237
|
+
base_url: str = None
|
|
3238
|
+
resource_types: List["ResourceTypeConfig"] = None
|
|
3239
|
+
error_handling: Optional["ErrorHandlingConfig"] = None
|
|
3240
|
+
|
|
3241
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3242
|
+
"""Convert to dict format expected by backend."""
|
|
3243
|
+
result = {}
|
|
3244
|
+
result["min_resources_required"] = (
|
|
3245
|
+
self.min_resources_required.value
|
|
3246
|
+
if hasattr(self.min_resources_required, "value")
|
|
3247
|
+
else self.min_resources_required
|
|
3248
|
+
)
|
|
3249
|
+
if self.table_query is not None:
|
|
3250
|
+
result["table_query"] = (
|
|
3251
|
+
self.table_query.value
|
|
3252
|
+
if hasattr(self.table_query, "value")
|
|
3253
|
+
else self.table_query
|
|
3254
|
+
)
|
|
3255
|
+
if self.relationship_query is not None:
|
|
3256
|
+
result["relationship_query"] = (
|
|
3257
|
+
self.relationship_query.value
|
|
3258
|
+
if hasattr(self.relationship_query, "value")
|
|
3259
|
+
else self.relationship_query
|
|
3260
|
+
)
|
|
3261
|
+
if self.index_query is not None:
|
|
3262
|
+
result["index_query"] = (
|
|
3263
|
+
self.index_query.value
|
|
3264
|
+
if hasattr(self.index_query, "value")
|
|
3265
|
+
else self.index_query
|
|
3266
|
+
)
|
|
3267
|
+
if self.constraint_query is not None:
|
|
3268
|
+
result["constraint_query"] = (
|
|
3269
|
+
self.constraint_query.value
|
|
3270
|
+
if hasattr(self.constraint_query, "value")
|
|
3271
|
+
else self.constraint_query
|
|
3272
|
+
)
|
|
3273
|
+
if self.statistics_query is not None:
|
|
3274
|
+
result["statistics_query"] = (
|
|
3275
|
+
self.statistics_query.value
|
|
3276
|
+
if hasattr(self.statistics_query, "value")
|
|
3277
|
+
else self.statistics_query
|
|
3278
|
+
)
|
|
3279
|
+
if self.size_query is not None:
|
|
3280
|
+
result["size_query"] = (
|
|
3281
|
+
self.size_query.value
|
|
3282
|
+
if hasattr(self.size_query, "value")
|
|
3283
|
+
else self.size_query
|
|
3284
|
+
)
|
|
3285
|
+
if self.base_url is not None:
|
|
3286
|
+
result["base_url"] = (
|
|
3287
|
+
self.base_url.value
|
|
3288
|
+
if hasattr(self.base_url, "value")
|
|
3289
|
+
else self.base_url
|
|
3290
|
+
)
|
|
3291
|
+
if self.resource_types is not None:
|
|
3292
|
+
result["resource_types"] = (
|
|
3293
|
+
self.resource_types.value
|
|
3294
|
+
if hasattr(self.resource_types, "value")
|
|
3295
|
+
else self.resource_types
|
|
3296
|
+
)
|
|
3297
|
+
if self.error_handling is not None:
|
|
3298
|
+
result["error_handling"] = (
|
|
3299
|
+
self.error_handling.value
|
|
3300
|
+
if hasattr(self.error_handling, "value")
|
|
3301
|
+
else self.error_handling
|
|
3302
|
+
)
|
|
3303
|
+
return result
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
@dataclass
|
|
3307
|
+
class ExpiryConfig:
|
|
3308
|
+
"""ExpiryConfig matching Go backend structure."""
|
|
3309
|
+
|
|
3310
|
+
type: Any
|
|
3311
|
+
duration: Any = None
|
|
3312
|
+
field_name: str = None
|
|
3313
|
+
refresh_token_duration: Optional[Any] = None
|
|
3314
|
+
|
|
3315
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3316
|
+
"""Convert to dict format expected by backend."""
|
|
3317
|
+
result = {}
|
|
3318
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
3319
|
+
if self.duration is not None:
|
|
3320
|
+
result["duration"] = (
|
|
3321
|
+
self.duration.value
|
|
3322
|
+
if hasattr(self.duration, "value")
|
|
3323
|
+
else self.duration
|
|
3324
|
+
)
|
|
3325
|
+
if self.field_name is not None:
|
|
3326
|
+
result["field_name"] = (
|
|
3327
|
+
self.field_name.value
|
|
3328
|
+
if hasattr(self.field_name, "value")
|
|
3329
|
+
else self.field_name
|
|
3330
|
+
)
|
|
3331
|
+
if self.refresh_token_duration is not None:
|
|
3332
|
+
result["refresh_token_duration"] = (
|
|
3333
|
+
self.refresh_token_duration.value
|
|
3334
|
+
if hasattr(self.refresh_token_duration, "value")
|
|
3335
|
+
else self.refresh_token_duration
|
|
3336
|
+
)
|
|
3337
|
+
return result
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
@dataclass
|
|
3341
|
+
class SegmentOption:
|
|
3342
|
+
"""SegmentOption matching Go backend structure."""
|
|
3343
|
+
|
|
3344
|
+
id: str
|
|
3345
|
+
name: str
|
|
3346
|
+
type: str
|
|
3347
|
+
metadata: Dict[str, str]
|
|
3348
|
+
children: List["SegmentOption"]
|
|
3349
|
+
parent_id: Optional[str] = None
|
|
3350
|
+
|
|
3351
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3352
|
+
"""Convert to dict format expected by backend."""
|
|
3353
|
+
result = {}
|
|
3354
|
+
result["id"] = self.id.value if hasattr(self.id, "value") else self.id
|
|
3355
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
3356
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
3357
|
+
if self.parent_id is not None:
|
|
3358
|
+
result["parent_id"] = (
|
|
3359
|
+
self.parent_id.value
|
|
3360
|
+
if hasattr(self.parent_id, "value")
|
|
3361
|
+
else self.parent_id
|
|
3362
|
+
)
|
|
3363
|
+
result["metadata"] = (
|
|
3364
|
+
self.metadata.value if hasattr(self.metadata, "value") else self.metadata
|
|
3365
|
+
)
|
|
3366
|
+
result["children"] = (
|
|
3367
|
+
self.children.value if hasattr(self.children, "value") else self.children
|
|
3368
|
+
)
|
|
3369
|
+
return result
|
|
3370
|
+
|
|
3371
|
+
|
|
3372
|
+
@dataclass
|
|
3373
|
+
class IntegrationDefinition:
|
|
3374
|
+
"""IntegrationDefinition matching Go backend structure."""
|
|
3375
|
+
|
|
3376
|
+
name: str
|
|
3377
|
+
key: str
|
|
3378
|
+
type: Any
|
|
3379
|
+
auth_types: List[Any]
|
|
3380
|
+
status: Any
|
|
3381
|
+
description: Optional[str] = None
|
|
3382
|
+
provider_name: Optional[str] = None
|
|
3383
|
+
documentation_url: Optional[str] = None
|
|
3384
|
+
openapi_documentation_url: Optional[str] = None
|
|
3385
|
+
llms_txt_url: Optional[str] = None
|
|
3386
|
+
healthcheck_url: Optional[str] = None
|
|
3387
|
+
auth_url: Optional[str] = None
|
|
3388
|
+
token_url: Optional[str] = None
|
|
3389
|
+
client_id: Optional[str] = None
|
|
3390
|
+
client_secret: Optional[str] = None
|
|
3391
|
+
available_scopes: List[str] = None
|
|
3392
|
+
optional_scopes: List[str] = None
|
|
3393
|
+
scope_separator: Optional[str] = None
|
|
3394
|
+
api_version: Optional[str] = None
|
|
3395
|
+
api_version_description: Optional[str] = None
|
|
3396
|
+
credential_schema: Dict[str, Any] = None
|
|
3397
|
+
ui_config: Optional["UIConfig"] = None
|
|
3398
|
+
codegen_details: Optional[CodegenDetails] = None
|
|
3399
|
+
analysis_details: Optional[AnalysisDetails] = None
|
|
3400
|
+
segment_config: Optional["SegmentConfig"] = None
|
|
3401
|
+
dataset_resource_discovery_config: Optional["DatasetResourceDiscoveryConfig"] = None
|
|
3402
|
+
expiry_config: Optional["ExpiryConfig"] = None
|
|
3403
|
+
provider_credentials: Dict[str, Any] = None
|
|
3404
|
+
default_resource_attach_type: Optional[str] = None
|
|
3405
|
+
|
|
3406
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3407
|
+
"""Convert to dict format expected by backend."""
|
|
3408
|
+
result = {}
|
|
3409
|
+
result["name"] = self.name.value if hasattr(self.name, "value") else self.name
|
|
3410
|
+
result["key"] = self.key.value if hasattr(self.key, "value") else self.key
|
|
3411
|
+
result["type"] = self.type.value if hasattr(self.type, "value") else self.type
|
|
3412
|
+
result["auth_types"] = (
|
|
3413
|
+
self.auth_types.value
|
|
3414
|
+
if hasattr(self.auth_types, "value")
|
|
3415
|
+
else self.auth_types
|
|
3416
|
+
)
|
|
3417
|
+
result["status"] = (
|
|
3418
|
+
self.status.value if hasattr(self.status, "value") else self.status
|
|
3419
|
+
)
|
|
3420
|
+
if self.description is not None:
|
|
3421
|
+
result["description"] = (
|
|
3422
|
+
self.description.value
|
|
3423
|
+
if hasattr(self.description, "value")
|
|
3424
|
+
else self.description
|
|
3425
|
+
)
|
|
3426
|
+
if self.provider_name is not None:
|
|
3427
|
+
result["provider_name"] = (
|
|
3428
|
+
self.provider_name.value
|
|
3429
|
+
if hasattr(self.provider_name, "value")
|
|
3430
|
+
else self.provider_name
|
|
3431
|
+
)
|
|
3432
|
+
if self.documentation_url is not None:
|
|
3433
|
+
result["documentation_url"] = (
|
|
3434
|
+
self.documentation_url.value
|
|
3435
|
+
if hasattr(self.documentation_url, "value")
|
|
3436
|
+
else self.documentation_url
|
|
3437
|
+
)
|
|
3438
|
+
if self.openapi_documentation_url is not None:
|
|
3439
|
+
result["openapi_documentation_url"] = (
|
|
3440
|
+
self.openapi_documentation_url.value
|
|
3441
|
+
if hasattr(self.openapi_documentation_url, "value")
|
|
3442
|
+
else self.openapi_documentation_url
|
|
3443
|
+
)
|
|
3444
|
+
if self.llms_txt_url is not None:
|
|
3445
|
+
result["llms_txt_url"] = (
|
|
3446
|
+
self.llms_txt_url.value
|
|
3447
|
+
if hasattr(self.llms_txt_url, "value")
|
|
3448
|
+
else self.llms_txt_url
|
|
3449
|
+
)
|
|
3450
|
+
if self.healthcheck_url is not None:
|
|
3451
|
+
result["healthcheck_url"] = (
|
|
3452
|
+
self.healthcheck_url.value
|
|
3453
|
+
if hasattr(self.healthcheck_url, "value")
|
|
3454
|
+
else self.healthcheck_url
|
|
3455
|
+
)
|
|
3456
|
+
if self.auth_url is not None:
|
|
3457
|
+
result["auth_url"] = (
|
|
3458
|
+
self.auth_url.value
|
|
3459
|
+
if hasattr(self.auth_url, "value")
|
|
3460
|
+
else self.auth_url
|
|
3461
|
+
)
|
|
3462
|
+
if self.token_url is not None:
|
|
3463
|
+
result["token_url"] = (
|
|
3464
|
+
self.token_url.value
|
|
3465
|
+
if hasattr(self.token_url, "value")
|
|
3466
|
+
else self.token_url
|
|
3467
|
+
)
|
|
3468
|
+
if self.client_id is not None:
|
|
3469
|
+
result["client_id"] = (
|
|
3470
|
+
self.client_id.value
|
|
3471
|
+
if hasattr(self.client_id, "value")
|
|
3472
|
+
else self.client_id
|
|
3473
|
+
)
|
|
3474
|
+
if self.client_secret is not None:
|
|
3475
|
+
result["client_secret"] = (
|
|
3476
|
+
self.client_secret.value
|
|
3477
|
+
if hasattr(self.client_secret, "value")
|
|
3478
|
+
else self.client_secret
|
|
3479
|
+
)
|
|
3480
|
+
if self.available_scopes is not None:
|
|
3481
|
+
result["available_scopes"] = (
|
|
3482
|
+
self.available_scopes.value
|
|
3483
|
+
if hasattr(self.available_scopes, "value")
|
|
3484
|
+
else self.available_scopes
|
|
3485
|
+
)
|
|
3486
|
+
if self.optional_scopes is not None:
|
|
3487
|
+
result["optional_scopes"] = (
|
|
3488
|
+
self.optional_scopes.value
|
|
3489
|
+
if hasattr(self.optional_scopes, "value")
|
|
3490
|
+
else self.optional_scopes
|
|
3491
|
+
)
|
|
3492
|
+
if self.scope_separator is not None:
|
|
3493
|
+
result["scope_separator"] = (
|
|
3494
|
+
self.scope_separator.value
|
|
3495
|
+
if hasattr(self.scope_separator, "value")
|
|
3496
|
+
else self.scope_separator
|
|
3497
|
+
)
|
|
3498
|
+
if self.api_version is not None:
|
|
3499
|
+
result["api_version"] = (
|
|
3500
|
+
self.api_version.value
|
|
3501
|
+
if hasattr(self.api_version, "value")
|
|
3502
|
+
else self.api_version
|
|
3503
|
+
)
|
|
3504
|
+
if self.api_version_description is not None:
|
|
3505
|
+
result["api_version_description"] = (
|
|
3506
|
+
self.api_version_description.value
|
|
3507
|
+
if hasattr(self.api_version_description, "value")
|
|
3508
|
+
else self.api_version_description
|
|
3509
|
+
)
|
|
3510
|
+
if self.credential_schema is not None:
|
|
3511
|
+
result["credential_schema"] = (
|
|
3512
|
+
self.credential_schema.value
|
|
3513
|
+
if hasattr(self.credential_schema, "value")
|
|
3514
|
+
else self.credential_schema
|
|
3515
|
+
)
|
|
3516
|
+
if self.ui_config is not None:
|
|
3517
|
+
result["ui_config"] = (
|
|
3518
|
+
self.ui_config.value
|
|
3519
|
+
if hasattr(self.ui_config, "value")
|
|
3520
|
+
else self.ui_config
|
|
3521
|
+
)
|
|
3522
|
+
if self.codegen_details is not None:
|
|
3523
|
+
result["codegen_details"] = (
|
|
3524
|
+
self.codegen_details.value
|
|
3525
|
+
if hasattr(self.codegen_details, "value")
|
|
3526
|
+
else self.codegen_details
|
|
3527
|
+
)
|
|
3528
|
+
if self.analysis_details is not None:
|
|
3529
|
+
result["analysis_details"] = (
|
|
3530
|
+
self.analysis_details.value
|
|
3531
|
+
if hasattr(self.analysis_details, "value")
|
|
3532
|
+
else self.analysis_details
|
|
3533
|
+
)
|
|
3534
|
+
if self.segment_config is not None:
|
|
3535
|
+
result["segment_config"] = (
|
|
3536
|
+
self.segment_config.value
|
|
3537
|
+
if hasattr(self.segment_config, "value")
|
|
3538
|
+
else self.segment_config
|
|
3539
|
+
)
|
|
3540
|
+
if self.dataset_resource_discovery_config is not None:
|
|
3541
|
+
result["dataset_resource_discovery_config"] = (
|
|
3542
|
+
self.dataset_resource_discovery_config.value
|
|
3543
|
+
if hasattr(self.dataset_resource_discovery_config, "value")
|
|
3544
|
+
else self.dataset_resource_discovery_config
|
|
3545
|
+
)
|
|
3546
|
+
if self.expiry_config is not None:
|
|
3547
|
+
result["expiry_config"] = (
|
|
3548
|
+
self.expiry_config.value
|
|
3549
|
+
if hasattr(self.expiry_config, "value")
|
|
3550
|
+
else self.expiry_config
|
|
3551
|
+
)
|
|
3552
|
+
if self.provider_credentials is not None:
|
|
3553
|
+
result["provider_credentials"] = (
|
|
3554
|
+
self.provider_credentials.value
|
|
3555
|
+
if hasattr(self.provider_credentials, "value")
|
|
3556
|
+
else self.provider_credentials
|
|
3557
|
+
)
|
|
3558
|
+
if self.default_resource_attach_type is not None:
|
|
3559
|
+
result["default_resource_attach_type"] = (
|
|
3560
|
+
self.default_resource_attach_type.value
|
|
3561
|
+
if hasattr(self.default_resource_attach_type, "value")
|
|
3562
|
+
else self.default_resource_attach_type
|
|
3563
|
+
)
|
|
3564
|
+
return result
|
|
3565
|
+
|
|
3566
|
+
|
|
3567
|
+
@dataclass
|
|
3568
|
+
class IntegrationConfig:
|
|
3569
|
+
"""IntegrationConfig matching Go backend structure."""
|
|
3570
|
+
|
|
3571
|
+
definition: "IntegrationDefinition"
|
|
3572
|
+
source: str
|
|
3573
|
+
file_path: str = None
|
|
3574
|
+
|
|
3575
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3576
|
+
"""Convert to dict format expected by backend."""
|
|
3577
|
+
result = {}
|
|
3578
|
+
result["definition"] = (
|
|
3579
|
+
self.definition.value
|
|
3580
|
+
if hasattr(self.definition, "value")
|
|
3581
|
+
else self.definition
|
|
3582
|
+
)
|
|
3583
|
+
result["source"] = (
|
|
3584
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
3585
|
+
)
|
|
3586
|
+
if self.file_path is not None:
|
|
3587
|
+
result["file_path"] = (
|
|
3588
|
+
self.file_path.value
|
|
3589
|
+
if hasattr(self.file_path, "value")
|
|
3590
|
+
else self.file_path
|
|
3591
|
+
)
|
|
3592
|
+
return result
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
@dataclass
|
|
3596
|
+
class PythonIntegrationInstance:
|
|
3597
|
+
"""PythonIntegrationInstance matching Go backend structure."""
|
|
3598
|
+
|
|
3599
|
+
config: IntegrationConfig
|
|
3600
|
+
credentials: Dict[str, Any]
|
|
3601
|
+
methods: List[str] = None
|
|
3602
|
+
|
|
3603
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3604
|
+
"""Convert to dict format expected by backend."""
|
|
3605
|
+
result = {}
|
|
3606
|
+
result["config"] = (
|
|
3607
|
+
self.config.value if hasattr(self.config, "value") else self.config
|
|
3608
|
+
)
|
|
3609
|
+
result["credentials"] = (
|
|
3610
|
+
self.credentials.value
|
|
3611
|
+
if hasattr(self.credentials, "value")
|
|
3612
|
+
else self.credentials
|
|
3613
|
+
)
|
|
3614
|
+
if self.methods is not None:
|
|
3615
|
+
result["methods"] = (
|
|
3616
|
+
self.methods.value if hasattr(self.methods, "value") else self.methods
|
|
3617
|
+
)
|
|
3618
|
+
return result
|
|
3619
|
+
|
|
3620
|
+
|
|
3621
|
+
@dataclass
|
|
3622
|
+
class IntegrationDiscovery:
|
|
3623
|
+
"""IntegrationDiscovery matching Go backend structure."""
|
|
3624
|
+
|
|
3625
|
+
config: IntegrationConfig
|
|
3626
|
+
file_path: str
|
|
3627
|
+
source_code: str
|
|
3628
|
+
instance: Optional["PythonIntegrationInstance"] = None
|
|
3629
|
+
|
|
3630
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3631
|
+
"""Convert to dict format expected by backend."""
|
|
3632
|
+
result = {}
|
|
3633
|
+
result["config"] = (
|
|
3634
|
+
self.config.value if hasattr(self.config, "value") else self.config
|
|
3635
|
+
)
|
|
3636
|
+
if self.instance is not None:
|
|
3637
|
+
result["instance"] = (
|
|
3638
|
+
self.instance.value
|
|
3639
|
+
if hasattr(self.instance, "value")
|
|
3640
|
+
else self.instance
|
|
3641
|
+
)
|
|
3642
|
+
result["file_path"] = (
|
|
3643
|
+
self.file_path.value if hasattr(self.file_path, "value") else self.file_path
|
|
3644
|
+
)
|
|
3645
|
+
result["source_code"] = (
|
|
3646
|
+
self.source_code.value
|
|
3647
|
+
if hasattr(self.source_code, "value")
|
|
3648
|
+
else self.source_code
|
|
3649
|
+
)
|
|
3650
|
+
return result
|
|
3651
|
+
|
|
3652
|
+
|
|
3653
|
+
@dataclass
|
|
3654
|
+
class UpsertIntegrationRequest:
|
|
3655
|
+
"""UpsertIntegrationRequest matching Go backend structure."""
|
|
3656
|
+
|
|
3657
|
+
integration: "IntegrationDefinition"
|
|
3658
|
+
source: str
|
|
3659
|
+
|
|
3660
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3661
|
+
"""Convert to dict format expected by backend."""
|
|
3662
|
+
result = {}
|
|
3663
|
+
result["integration"] = (
|
|
3664
|
+
self.integration.value
|
|
3665
|
+
if hasattr(self.integration, "value")
|
|
3666
|
+
else self.integration
|
|
3667
|
+
)
|
|
3668
|
+
result["source"] = (
|
|
3669
|
+
self.source.value if hasattr(self.source, "value") else self.source
|
|
3670
|
+
)
|
|
3671
|
+
return result
|
|
3672
|
+
|
|
3673
|
+
|
|
3674
|
+
@dataclass
|
|
3675
|
+
class UpsertIntegrationResponse:
|
|
3676
|
+
"""UpsertIntegrationResponse matching Go backend structure."""
|
|
3677
|
+
|
|
3678
|
+
integration_id: str
|
|
3679
|
+
status: str
|
|
3680
|
+
|
|
3681
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3682
|
+
"""Convert to dict format expected by backend."""
|
|
3683
|
+
result = {}
|
|
3684
|
+
result["integration_id"] = (
|
|
3685
|
+
self.integration_id.value
|
|
3686
|
+
if hasattr(self.integration_id, "value")
|
|
3687
|
+
else self.integration_id
|
|
3688
|
+
)
|
|
3689
|
+
result["status"] = (
|
|
3690
|
+
self.status.value if hasattr(self.status, "value") else self.status
|
|
3691
|
+
)
|
|
3692
|
+
return result
|
|
3693
|
+
|
|
3694
|
+
|
|
3695
|
+
@dataclass
|
|
3696
|
+
class ListIntegrationsResponse:
|
|
3697
|
+
"""ListIntegrationsResponse matching Go backend structure."""
|
|
3698
|
+
|
|
3699
|
+
integrations: List["IntegrationDefinition"]
|
|
3700
|
+
|
|
3701
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3702
|
+
"""Convert to dict format expected by backend."""
|
|
3703
|
+
result = {}
|
|
3704
|
+
result["integrations"] = (
|
|
3705
|
+
self.integrations.value
|
|
3706
|
+
if hasattr(self.integrations, "value")
|
|
3707
|
+
else self.integrations
|
|
3708
|
+
)
|
|
3709
|
+
return result
|
|
3710
|
+
|
|
3711
|
+
|
|
3712
|
+
@dataclass
|
|
3713
|
+
class ExportIntegrationsResponse:
|
|
3714
|
+
"""ExportIntegrationsResponse matching Go backend structure."""
|
|
3715
|
+
|
|
3716
|
+
integrations: Dict[str, Any]
|
|
3717
|
+
|
|
3718
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
3719
|
+
"""Convert to dict format expected by backend."""
|
|
3720
|
+
result = {}
|
|
3721
|
+
result["integrations"] = (
|
|
3722
|
+
self.integrations.value
|
|
3723
|
+
if hasattr(self.integrations, "value")
|
|
3724
|
+
else self.integrations
|
|
3725
|
+
)
|
|
3726
|
+
return result
|
|
3727
|
+
|
|
3728
|
+
|
|
3729
|
+
# Auto-generated __all__ list for import *
|
|
3730
|
+
__all__ = [
|
|
3731
|
+
"APIConditionDefinition",
|
|
3732
|
+
"APIExecutionMode",
|
|
3733
|
+
"APIParameterDefinition",
|
|
3734
|
+
"APIParameterInterpreter",
|
|
3735
|
+
"APIParameterValueSource",
|
|
3736
|
+
"APIParameterValueSourceHandler",
|
|
3737
|
+
"APIResultHandler",
|
|
3738
|
+
"APIStep",
|
|
3739
|
+
"APIStepWithHandlers",
|
|
3740
|
+
"APITool",
|
|
3741
|
+
"ActionDefinition",
|
|
3742
|
+
"AnalysisDetails",
|
|
3743
|
+
"AuthType",
|
|
3744
|
+
"Bot",
|
|
3745
|
+
"BotResource",
|
|
3746
|
+
"BotsResponse",
|
|
3747
|
+
"CodegenDetails",
|
|
3748
|
+
"ConditionDefinition",
|
|
3749
|
+
"CredentialSchema",
|
|
3750
|
+
"CredentialSource",
|
|
3751
|
+
"Dataset",
|
|
3752
|
+
"DatasetResourceDiscoveryConfig",
|
|
3753
|
+
"DatasetType",
|
|
3754
|
+
"Error",
|
|
3755
|
+
"ErrorHandlingConfig",
|
|
3756
|
+
"ExecutionModeType",
|
|
3757
|
+
"ExpiryConfig",
|
|
3758
|
+
"ExpiryType",
|
|
3759
|
+
"ExportActionsResponse",
|
|
3760
|
+
"ExportIntegrationsResponse",
|
|
3761
|
+
"HandlerType",
|
|
3762
|
+
"IntegrationConfig",
|
|
3763
|
+
"IntegrationDefinition",
|
|
3764
|
+
"IntegrationDiscovery",
|
|
3765
|
+
"IntegrationSchema",
|
|
3766
|
+
"IntegrationStatus",
|
|
3767
|
+
"IntegrationType",
|
|
3768
|
+
"InvocationEventType",
|
|
3769
|
+
"JSONSchema",
|
|
3770
|
+
"JSONSchemaProperty",
|
|
3771
|
+
"JSONSchemaType",
|
|
3772
|
+
"ListIntegrationsResponse",
|
|
3773
|
+
"LlmModel",
|
|
3774
|
+
"Memory",
|
|
3775
|
+
"Message",
|
|
3776
|
+
"OutputBehaviorType",
|
|
3777
|
+
"OutputContentType",
|
|
3778
|
+
"OutputVisibility",
|
|
3779
|
+
"ParameterDefinition",
|
|
3780
|
+
"ParameterHydrationBehaviour",
|
|
3781
|
+
"ParameterInterpreter",
|
|
3782
|
+
"ParameterType",
|
|
3783
|
+
"ParameterValueSource",
|
|
3784
|
+
"ParameterValueSourceHandler",
|
|
3785
|
+
"PropertySchema",
|
|
3786
|
+
"PythonIntegrationInstance",
|
|
3787
|
+
"Resource",
|
|
3788
|
+
"ResourceAnalysis",
|
|
3789
|
+
"ResourceAttachType",
|
|
3790
|
+
"ResourceRelationshipType",
|
|
3791
|
+
"ResourceState",
|
|
3792
|
+
"ResourceType",
|
|
3793
|
+
"ResourceTypeConfig",
|
|
3794
|
+
"Result",
|
|
3795
|
+
"ResultSchema",
|
|
3796
|
+
"SegmentConfig",
|
|
3797
|
+
"SegmentLevel",
|
|
3798
|
+
"SegmentOption",
|
|
3799
|
+
"SegmentSelectionType",
|
|
3800
|
+
"SensitivityLevel",
|
|
3801
|
+
"ServiceDefinition",
|
|
3802
|
+
"Status",
|
|
3803
|
+
"StepsResponse",
|
|
3804
|
+
"SystemParameters",
|
|
3805
|
+
"TempCondition",
|
|
3806
|
+
"Tool",
|
|
3807
|
+
"UIConfig",
|
|
3808
|
+
"UIConfigIcon",
|
|
3809
|
+
"UpsertBotRequest",
|
|
3810
|
+
"UpsertIntegrationRequest",
|
|
3811
|
+
"UpsertIntegrationResponse",
|
|
3812
|
+
]
|
|
3813
|
+
|
|
3814
|
+
|
|
3815
|
+
# Helper functions for creating bot definitions
|
|
3816
|
+
def create_step(
|
|
3817
|
+
key: str,
|
|
3818
|
+
action_type: str,
|
|
3819
|
+
parameters: Dict[str, Any] = None,
|
|
3820
|
+
depends_on: List[str] = None,
|
|
3821
|
+
**kwargs,
|
|
3822
|
+
) -> Dict[str, Any]:
|
|
3823
|
+
"""Create a step definition dictionary."""
|
|
3824
|
+
step = {
|
|
3825
|
+
"key": key,
|
|
3826
|
+
"action_type": action_type,
|
|
3827
|
+
"parameters": parameters or {},
|
|
3828
|
+
"output_content_type": kwargs.get("output_content_type", "text"),
|
|
3829
|
+
"user_output_visibility": kwargs.get("user_output_visibility", "visible"),
|
|
3830
|
+
"bot_output_visibility": kwargs.get("bot_output_visibility", "hidden"),
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
# Add optional fields if provided
|
|
3834
|
+
for field in [
|
|
3835
|
+
"history_content_type",
|
|
3836
|
+
"ui_content_type",
|
|
3837
|
+
"running_status",
|
|
3838
|
+
"finished_status",
|
|
3839
|
+
]:
|
|
3840
|
+
if field in kwargs:
|
|
3841
|
+
step[field] = kwargs[field]
|
|
3842
|
+
|
|
3843
|
+
return {
|
|
3844
|
+
"step": step,
|
|
3845
|
+
"depends_on": depends_on,
|
|
3846
|
+
"result_handlers": [],
|
|
3847
|
+
"output_channels": [],
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
|
|
3851
|
+
def create_result_handler(
|
|
3852
|
+
condition: Dict[str, Any],
|
|
3853
|
+
action_type: str = None,
|
|
3854
|
+
parameters: Dict[str, Any] = None,
|
|
3855
|
+
steps: List[Dict[str, Any]] = None,
|
|
3856
|
+
**kwargs,
|
|
3857
|
+
) -> Dict[str, Any]:
|
|
3858
|
+
"""Create a result handler definition dictionary."""
|
|
3859
|
+
handler = {
|
|
3860
|
+
"type": kwargs.get("type", "final"),
|
|
3861
|
+
"if_conditions": condition,
|
|
3862
|
+
"output_content_type": kwargs.get("output_content_type", "text"),
|
|
3863
|
+
"steps": steps or [],
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
# Add optional fields
|
|
3867
|
+
for field in ["history_content_type", "ui_content_type"]:
|
|
3868
|
+
if field in kwargs:
|
|
3869
|
+
handler[field] = kwargs[field]
|
|
3870
|
+
|
|
3871
|
+
# If action_type is provided, create a step for it
|
|
3872
|
+
if action_type:
|
|
3873
|
+
step = {
|
|
3874
|
+
"key": f"handler_step_{len(handler['steps'])}",
|
|
3875
|
+
"action_type": action_type,
|
|
3876
|
+
"parameters": parameters or {},
|
|
3877
|
+
"output_content_type": "text",
|
|
3878
|
+
"user_output_visibility": "visible",
|
|
3879
|
+
"bot_output_visibility": "hidden",
|
|
3880
|
+
}
|
|
3881
|
+
handler["steps"].append(step)
|
|
3882
|
+
|
|
3883
|
+
return handler
|
|
3884
|
+
|
|
3885
|
+
|
|
3886
|
+
def create_bot(
|
|
3887
|
+
name: str, description: str = "", visibility: str = "private", **kwargs
|
|
3888
|
+
) -> Dict[str, Any]:
|
|
3889
|
+
"""Create a bot definition dictionary."""
|
|
3890
|
+
return {
|
|
3891
|
+
"Name": name,
|
|
3892
|
+
"Description": description,
|
|
3893
|
+
"Visibility": visibility,
|
|
3894
|
+
"RunningMessage": {
|
|
3895
|
+
"String": kwargs.get("running_status", ""),
|
|
3896
|
+
"Valid": bool(kwargs.get("running_status")),
|
|
3897
|
+
},
|
|
3898
|
+
"FinishedMessage": {
|
|
3899
|
+
"String": kwargs.get("finished_status", ""),
|
|
3900
|
+
"Valid": bool(kwargs.get("finished_status")),
|
|
3901
|
+
},
|
|
3902
|
+
"Persona": {
|
|
3903
|
+
"String": kwargs.get("persona", ""),
|
|
3904
|
+
"Valid": bool(kwargs.get("persona")),
|
|
3905
|
+
},
|
|
3906
|
+
"Source": "python",
|
|
3907
|
+
}
|