iii-sdk 0.21.6.dev1__tar.gz → 0.21.7.dev1__tar.gz

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.
Files changed (73) hide show
  1. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/PKG-INFO +2 -2
  2. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/pyproject.toml +2 -2
  3. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/iii.py +31 -21
  4. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/iii_constants.py +11 -6
  5. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/iii_types.py +40 -25
  6. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/state.py +58 -9
  7. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/triggers.py +10 -1
  8. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/types.py +5 -2
  9. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/.gitignore +0 -0
  10. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/README.md +0 -0
  11. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/__init__.py +0 -0
  12. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/channel.py +0 -0
  13. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/channels.py +0 -0
  14. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/engine.py +0 -0
  15. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/errors.py +0 -0
  16. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/format_utils.py +0 -0
  17. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/helpers.py +0 -0
  18. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/internal.py +0 -0
  19. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/otel_worker_gauges.py +0 -0
  20. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/protocol.py +0 -0
  21. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/runtime.py +0 -0
  22. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/stream.py +0 -0
  23. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/trigger.py +0 -0
  24. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/utils.py +0 -0
  25. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/src/iii/worker_metrics.py +0 -0
  26. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/conftest.py +0 -0
  27. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_api_triggers.py +0 -0
  28. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_async_api.py +0 -0
  29. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_baggage_span_processor.py +0 -0
  30. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_bridge.py +0 -0
  31. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_channel_close_delay.py +0 -0
  32. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_channel_submodule.py +0 -0
  33. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_context_propagation.py +0 -0
  34. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_data_channels.py +0 -0
  35. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_engine_constants.py +0 -0
  36. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_errors.py +0 -0
  37. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_format_utils.py +0 -0
  38. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_healthcheck.py +0 -0
  39. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_helpers.py +0 -0
  40. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_hold_process.py +0 -0
  41. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_http_external_functions_integration.py +0 -0
  42. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_iii_registration_dedup.py +0 -0
  43. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_init_api.py +0 -0
  44. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_invocation_exception.py +0 -0
  45. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_invocation_metadata.py +0 -0
  46. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_logger_function_ids.py +0 -0
  47. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_logger_otel.py +0 -0
  48. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_middleware.py +0 -0
  49. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_payload.py +0 -0
  50. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_pubsub.py +0 -0
  51. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_rbac_workers.py +0 -0
  52. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_register_function_args.py +0 -0
  53. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_runtime_submodule.py +0 -0
  54. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_span_ops.py +0 -0
  55. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_state.py +0 -0
  56. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_stream_models.py +0 -0
  57. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_stream_types.py +0 -0
  58. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_streams.py +0 -0
  59. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_streams_runtime_annotations.py +0 -0
  60. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_sync_api.py +0 -0
  61. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_telemetry.py +0 -0
  62. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_telemetry_exporters.py +0 -0
  63. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_telemetry_types.py +0 -0
  64. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trace_helpers.py +0 -0
  65. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trigger_action.py +0 -0
  66. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trigger_metadata.py +0 -0
  67. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trigger_registration_error.py +0 -0
  68. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trigger_submodule.py +0 -0
  69. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_trigger_type_lifecycle.py +0 -0
  70. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_utils.py +0 -0
  71. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_worker_metadata.py +0 -0
  72. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/tests/test_worker_metrics.py +0 -0
  73. {iii_sdk-0.21.6.dev1 → iii_sdk-0.21.7.dev1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iii-sdk
3
- Version: 0.21.6.dev1
3
+ Version: 0.21.7.dev1
4
4
  Summary: III SDK for Python
5
5
  Project-URL: Homepage, https://github.com/iii-hq/iii
6
6
  Project-URL: Repository, https://github.com/iii-hq/iii
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Python: >=3.10
17
- Requires-Dist: iii-helpers==0.21.6.dev1
17
+ Requires-Dist: iii-helpers==0.21.7.dev1
18
18
  Requires-Dist: opentelemetry-api>=1.25
19
19
  Requires-Dist: pydantic>=2.0
20
20
  Requires-Dist: websockets>=12.0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "iii-sdk"
7
- version = "0.21.6.dev1"
7
+ version = "0.21.7.dev1"
8
8
  description = "III SDK for Python"
9
9
  authors = [{ name = "III" }]
10
10
  license = { text = "Apache-2.0" }
@@ -23,7 +23,7 @@ dependencies = [
23
23
  "websockets>=12.0",
24
24
  "pydantic>=2.0",
25
25
  "opentelemetry-api>=1.25",
26
- "iii-helpers==0.21.6.dev1",
26
+ "iii-helpers==0.21.7.dev1",
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -70,15 +70,15 @@ def _metadata_passing_mode(handler: Callable[..., Any]) -> str:
70
70
 
71
71
  Only handlers that explicitly declare a parameter named ``metadata``
72
72
  receive the sidecar; every other signature keeps its exact pre-metadata
73
- call shape (``handler(data)``), so existing handlers -- including ones
74
- with unrelated optional parameters, ``*args``, or ``**kwargs`` -- keep
73
+ call shape (``handler(data)``), so existing handlers, including ones
74
+ with unrelated optional parameters, ``*args``, or ``**kwargs``, keep
75
75
  working unchanged. Returns one of:
76
76
 
77
77
  - ``"positional"``: ``metadata`` is the second positional parameter
78
78
  (e.g. ``def handler(data, metadata=None)``).
79
79
  - ``"keyword"``: ``metadata`` is keyword-only
80
80
  (e.g. ``def handler(data, *, metadata=None)``).
81
- - ``"none"``: no ``metadata`` parameter -- omit metadata.
81
+ - ``"none"``: no ``metadata`` parameter; omit metadata.
82
82
 
83
83
  If the signature cannot be introspected (some builtins/C callables),
84
84
  falls back to ``"none"`` to preserve back-compat.
@@ -260,7 +260,7 @@ class III:
260
260
 
261
261
  Initializes OpenTelemetry (if configured), attaches the event loop,
262
262
  and establishes the WebSocket connection. This is called automatically
263
- during construction -- use it only if you need to reconnect manually
263
+ during construction; use it only if you need to reconnect manually
264
264
  from an async context.
265
265
  """
266
266
  self._running = True
@@ -814,6 +814,11 @@ class III:
814
814
  Returns:
815
815
  One of ``"disconnected"``, ``"connecting"``, ``"connected"``,
816
816
  ``"reconnecting"``, or ``"failed"``.
817
+
818
+ Examples:
819
+ >>> worker = register_worker("ws://localhost:49134")
820
+ >>> if worker.get_connection_state() != "connected":
821
+ ... print("engine not reachable yet")
817
822
  """
818
823
  return self._connection_state
819
824
 
@@ -912,6 +917,8 @@ class III:
912
917
  ) -> Trigger:
913
918
  """Bind a trigger configuration to a registered function.
914
919
 
920
+ <!-- docs:expand-params -->
921
+
915
922
  Args:
916
923
  trigger: A ``RegisterTriggerInput`` or dict with ``type``,
917
924
  ``function_id``, and optional ``config``.
@@ -977,15 +984,15 @@ class III:
977
984
  ``def handler(data, metadata=None)`` or ``def handler(data, *,
978
985
  metadata=None)``). Metadata is only forwarded to handlers that
979
986
  declare a parameter literally named ``metadata``, so existing
980
- handlers -- including ones with unrelated extra parameters,
981
- ``*args``, or ``**kwargs`` -- keep working unchanged.
987
+ handlers, including ones with unrelated extra parameters,
988
+ ``*args``, or ``**kwargs``, keep working unchanged.
982
989
 
983
990
  ``request_format`` and ``response_format`` are auto-extracted
984
991
  from the handler's type hints when omitted or passed as ``None``
985
992
  (the default). To opt out of auto-extraction, pass an explicit
986
993
  schema (``RegisterFunctionFormat`` or ``dict``). This behavior
987
- is Python-specific -- the Node SDK does not auto-extract from TS
988
- types, because TypeScript types are erased at runtime.
994
+ is Python-specific; the Node SDK relies on explicit schemas because
995
+ TypeScript types are erased at runtime.
989
996
 
990
997
  Args:
991
998
  function_id: Unique string identifier for the function.
@@ -994,8 +1001,8 @@ class III:
994
1001
  ``data`` (the trigger payload) as the first argument and
995
1002
  may optionally accept ``metadata`` (per-invocation
996
1003
  metadata) as a second argument; they may return a value.
997
- description: Human-readable description.
998
- metadata: Arbitrary metadata.
1004
+ description: Human-readable description of what the function does.
1005
+ metadata: Arbitrary metadata attached to the function.
999
1006
  request_format: Schema describing expected input. When
1000
1007
  ``None`` (default), auto-extracted from the handler's
1001
1008
  first-parameter type hint. Pass an explicit schema to
@@ -1127,12 +1134,14 @@ class III:
1127
1134
  def trigger(self, request: "dict[str, Any] | TriggerRequest") -> Any:
1128
1135
  """Invoke a remote function.
1129
1136
 
1137
+ <!-- docs:expand-params -->
1138
+
1130
1139
  The routing behavior and return type depend on the ``action`` field:
1131
1140
 
1132
- - No action: synchronous -- waits for the function to return.
1133
- - ``TriggerAction.Enqueue(...)``: async via named queue -- returns a dict
1141
+ - No action: synchronous, waits for the function to return.
1142
+ - ``TriggerAction.Enqueue(...)``: async via named queue, returns a dict
1134
1143
  with ``messageReceiptId``.
1135
- - ``TriggerAction.Void()``: fire-and-forget -- returns ``None``.
1144
+ - ``TriggerAction.Void()``: fire-and-forget, returns ``None``.
1136
1145
 
1137
1146
  Args:
1138
1147
  request: A ``TriggerRequest`` or dict with ``function_id``,
@@ -1159,10 +1168,10 @@ class III:
1159
1168
 
1160
1169
  The routing behavior and return type depend on the ``action`` field:
1161
1170
 
1162
- - No action: synchronous -- waits for the function to return.
1163
- - ``TriggerAction.Enqueue(...)``: async via named queue -- returns a dict
1171
+ - No action: synchronous, waits for the function to return.
1172
+ - ``TriggerAction.Enqueue(...)``: async via named queue, returns a dict
1164
1173
  with ``messageReceiptId``.
1165
- - ``TriggerAction.Void()``: fire-and-forget -- returns ``None``.
1174
+ - ``TriggerAction.Void()``: fire-and-forget, returns ``None``.
1166
1175
 
1167
1176
  Args:
1168
1177
  request: A ``TriggerRequest`` or dict with ``function_id``, ``payload``,
@@ -1179,8 +1188,8 @@ class III:
1179
1188
  RBAC denied it.
1180
1189
 
1181
1190
  Examples:
1182
- >>> result = await iii.trigger_async({'function_id': 'greet', 'payload': {'name': 'World'}})
1183
- >>> await iii.trigger_async({'function_id': 'notify', 'payload': {}, 'action': TriggerAction.Void()})
1191
+ >>> result = await worker.trigger_async({'function_id': 'greet', 'payload': {'name': 'World'}})
1192
+ >>> await worker.trigger_async({'function_id': 'notify', 'payload': {}, 'action': TriggerAction.Void()})
1184
1193
  """
1185
1194
  req = request if isinstance(request, dict) else request.model_dump()
1186
1195
  function_id = req["function_id"]
@@ -1342,8 +1351,8 @@ class III:
1342
1351
 
1343
1352
  Public callers must use the free function from ``iii.helpers``.
1344
1353
  Registers 5 of the 6 ``IStream`` methods (``get``, ``set``, ``delete``,
1345
- ``list``, ``list_groups``). The ``update`` method is **not** registered
1346
- -- atomic updates are handled by the engine's built-in stream update
1354
+ ``list``, ``list_groups``). The ``update`` method is **not** registered;
1355
+ atomic updates are handled by the engine's built-in stream update
1347
1356
  logic.
1348
1357
  """
1349
1358
 
@@ -1385,6 +1394,7 @@ class TriggerAction:
1385
1394
 
1386
1395
  Examples:
1387
1396
  >>> from iii import TriggerAction
1397
+ >>> # The queue must be declared in the iii-queue worker's queue_configs.
1388
1398
  >>> worker.trigger({'function_id': 'process', 'payload': {}, 'action': TriggerAction.Enqueue(queue='jobs')})
1389
1399
  >>> worker.trigger({'function_id': 'notify', 'payload': {}, 'action': TriggerAction.Void()})
1390
1400
  """
@@ -1405,7 +1415,7 @@ class TriggerAction:
1405
1415
 
1406
1416
 
1407
1417
  def register_worker(address: str, options: InitOptions | None = None) -> III:
1408
- """Create an III client and connect to the engine.
1418
+ """Register the worker with a iii instance, returns a connected worker client.
1409
1419
 
1410
1420
  Blocks until the WebSocket connection is established and ready.
1411
1421
 
@@ -18,7 +18,12 @@ DEFAULT_RECONNECTION_CONFIG = ReconnectionConfig()
18
18
 
19
19
  @dataclass
20
20
  class FunctionRef:
21
- """Reference to a registered function, allowing programmatic unregistration."""
21
+ """Reference to a registered function, allowing programmatic unregistration.
22
+
23
+ Attributes:
24
+ id: The unique function identifier.
25
+ unregister: Removes this function from the engine.
26
+ """
22
27
 
23
28
  id: str
24
29
  unregister: Callable[[], None]
@@ -26,12 +31,12 @@ class FunctionRef:
26
31
 
27
32
  @dataclass
28
33
  class TelemetryOptions:
29
- """Worker metadata reported to the engine.
34
+ """Worker metadata reported to the engine (language, framework, project).
30
35
 
31
36
  Attributes:
32
- language: Programming language of the worker (e.g. ``python``).
37
+ language: Programming language of the worker.
33
38
  project_name: Name of the project this worker belongs to.
34
- framework: Framework name (e.g. ``motia``) if applicable.
39
+ framework: Framework name, if applicable.
35
40
  amplitude_api_key: Amplitude API key for product analytics.
36
41
  """
37
42
 
@@ -43,14 +48,14 @@ class TelemetryOptions:
43
48
 
44
49
  @dataclass
45
50
  class InitOptions:
46
- """Options for configuring the III SDK.
51
+ """Configuration options passed to ``register_worker``.
47
52
 
48
53
  Attributes:
49
54
  worker_name: Display name for this worker. Defaults to ``hostname:pid``.
50
55
  worker_description: One-line, human/LLM-readable summary of what this
51
56
  worker does. Surfaces in ``engine::workers::list`` / ``engine::workers::info``.
52
57
  enable_metrics_reporting: Enable worker metrics via OpenTelemetry. Default ``True``.
53
- invocation_timeout_ms: Default timeout for ``trigger()`` in milliseconds. Default ``30000``.
58
+ invocation_timeout_ms: Default timeout for ``worker.trigger()`` invocations in milliseconds. Default ``30000``.
54
59
  reconnection_config: WebSocket reconnection behavior.
55
60
  otel: OpenTelemetry configuration. Enabled by default.
56
61
  Set ``{'enabled': False}`` or env ``OTEL_ENABLED=false`` to disable.
@@ -63,14 +63,14 @@ class RegisterTriggerTypeInput(BaseModel):
63
63
  """Input for registering a trigger type.
64
64
 
65
65
  Attributes:
66
- id: Unique identifier for the trigger type.
67
- description: Human-readable description of the trigger type.
66
+ id: Unique identifier for the trigger type (e.g. ``state``, ``durable:subscriber``).
67
+ description: Human-readable description of what this trigger type does.
68
68
  trigger_request_format: JSON Schema describing the expected trigger config.
69
69
  call_request_format: JSON Schema describing the payload sent to functions.
70
70
  """
71
71
 
72
- id: str = Field(description="Unique identifier for the trigger type.")
73
- description: str = Field(description="Human-readable description of the trigger type.")
72
+ id: str = Field(description="Unique identifier for the trigger type (e.g. ``state``, ``durable:subscriber``).")
73
+ description: str = Field(description="Human-readable description of what this trigger type does.")
74
74
  trigger_request_format: Any | None = Field(
75
75
  default=None, description="JSON Schema for trigger configuration."
76
76
  )
@@ -83,17 +83,27 @@ class RegisterTriggerInput(BaseModel):
83
83
  """Input for registering a trigger (matches Node SDK's RegisterTriggerInput).
84
84
 
85
85
  Attributes:
86
- type: Trigger type identifier (e.g. ``http``, ``queue``, ``cron``).
87
- function_id: ID of the function this trigger invokes.
88
- config: Trigger-type-specific configuration.
89
- metadata: Arbitrary metadata attached to the trigger.
86
+ type: Identifier of the registered trigger type this trigger uses (e.g. ``storage::object-created``, ``http``).
87
+ function_id: ID of the function this trigger invokes when it fires.
88
+ config: Trigger-type-specific configuration, matching the shape the trigger type expects.
89
+ metadata: Arbitrary user-specifiable metadata supplied to the triggered handler function on every invocation.
90
90
  """
91
91
 
92
- type: str = Field(description="Trigger type identifier.")
93
- function_id: str = Field(description="ID of the function this trigger invokes.")
94
- config: Any = Field(default=None, description="Trigger-type-specific configuration.")
92
+ type: str = Field(
93
+ description=(
94
+ "Identifier of the registered trigger type this trigger uses "
95
+ "(e.g. ``storage::object-created``, ``http``)."
96
+ )
97
+ )
98
+ function_id: str = Field(description="ID of the function this trigger invokes when it fires.")
99
+ config: Any = Field(
100
+ default=None, description="Trigger-type-specific configuration, matching the shape the trigger type expects."
101
+ )
95
102
  metadata: Any | None = Field(
96
- default=None, description="Arbitrary metadata attached to the trigger."
103
+ default=None,
104
+ description=(
105
+ "Arbitrary user-specifiable metadata supplied to the triggered handler function on every invocation."
106
+ ),
97
107
  )
98
108
 
99
109
 
@@ -170,7 +180,7 @@ class RegisterFunctionMessage(BaseModel):
170
180
  class TriggerActionEnqueue(BaseModel):
171
181
  """Routes the invocation through a named queue for async processing.
172
182
 
173
- Requires a queue worker in the project run ``iii worker add queue``.
183
+ Requires a queue worker in the project. Run ``iii worker add queue``.
174
184
  Without it the trigger rejects with ``enqueue_error`` (no queue provider).
175
185
 
176
186
  Attributes:
@@ -222,28 +232,33 @@ class TriggerRequest(BaseModel):
222
232
 
223
233
  Attributes:
224
234
  function_id: ID of the function to invoke.
225
- payload: Data to pass to the function.
226
- action: Routing action, ``None`` for sync, ``TriggerAction.Enqueue(...)``
227
- for queue, ``TriggerAction.Void()`` for fire-and-forget.
228
- timeout_ms: Override the default invocation timeout.
229
- metadata: Arbitrary per-invocation metadata delivered to the handler
230
- as a separate channel (not folded into ``payload``).
235
+ payload: Input data passed to the function.
236
+ action: Sets how the trigger is routed. Omit for a synchronous
237
+ request/response. Specify for a specific routing scheme (e.g.
238
+ ``TriggerAction.Enqueue(...)``, ``TriggerAction.Void()``).
239
+ timeout_ms: Override the default invocation timeout, in milliseconds.
240
+ metadata: Arbitrary user-specifiable metadata supplied to the triggered
241
+ handler function on every invocation.
231
242
  """
232
243
 
233
244
  function_id: str = Field(description="ID of the function to invoke.")
234
- payload: Any = Field(default=None, description="Data to pass to the function.")
245
+ payload: Any = Field(default=None, description="Input data passed to the function.")
235
246
  action: TriggerActionEnqueue | TriggerActionVoid | None = Field(
236
247
  default=None,
237
248
  description=(
238
- "Routing action: ``None`` for sync, "
239
- "``TriggerAction.Enqueue(...)`` for queue, "
240
- "``TriggerAction.Void()`` for fire-and-forget."
249
+ "Sets how the trigger is routed. Omit for a synchronous request/response. "
250
+ "Specify for a specific routing scheme (e.g. ``TriggerAction.Enqueue(...)``, "
251
+ "``TriggerAction.Void()``)."
241
252
  ),
242
253
  )
243
- timeout_ms: int | None = Field(default=None, description="Override the default invocation timeout.")
254
+ timeout_ms: int | None = Field(
255
+ default=None, description="Override the default invocation timeout, in milliseconds."
256
+ )
244
257
  metadata: Any | None = Field(
245
258
  default=None,
246
- description="Arbitrary per-invocation metadata delivered to the handler.",
259
+ description=(
260
+ "Arbitrary user-specifiable metadata supplied to the triggered handler function on every invocation."
261
+ ),
247
262
  )
248
263
 
249
264
 
@@ -16,14 +16,25 @@ TData = TypeVar("TData")
16
16
 
17
17
 
18
18
  class StateGetInput(BaseModel):
19
- """Input for retrieving a state value."""
19
+ """Input for retrieving a state value.
20
+
21
+ Attributes:
22
+ scope: State scope (namespace).
23
+ key: Key within the scope.
24
+ """
20
25
 
21
26
  scope: str
22
27
  key: str
23
28
 
24
29
 
25
30
  class StateSetInput(BaseModel):
26
- """Input for setting a state value."""
31
+ """Input for setting a state value.
32
+
33
+ Attributes:
34
+ scope: State scope (namespace).
35
+ key: Key within the scope.
36
+ value: Value to store.
37
+ """
27
38
 
28
39
  scope: str
29
40
  key: str
@@ -31,20 +42,35 @@ class StateSetInput(BaseModel):
31
42
 
32
43
 
33
44
  class StateDeleteInput(BaseModel):
34
- """Input for deleting a state value."""
45
+ """Input for deleting a state value.
46
+
47
+ Attributes:
48
+ scope: State scope (namespace).
49
+ key: Key within the scope.
50
+ """
35
51
 
36
52
  scope: str
37
53
  key: str
38
54
 
39
55
 
40
56
  class StateListInput(BaseModel):
41
- """Input for listing all values in a state scope."""
57
+ """Input for listing all values in a state scope.
58
+
59
+ Attributes:
60
+ scope: State scope (namespace).
61
+ """
42
62
 
43
63
  scope: str
44
64
 
45
65
 
46
66
  class StateUpdateInput(BaseModel):
47
- """Input for atomically updating a state value."""
67
+ """Input for atomically updating a state value.
68
+
69
+ Attributes:
70
+ scope: State scope (namespace).
71
+ key: Key within the scope.
72
+ ops: Ordered list of update operations to apply atomically.
73
+ """
48
74
 
49
75
  scope: str
50
76
  key: str
@@ -52,21 +78,35 @@ class StateUpdateInput(BaseModel):
52
78
 
53
79
 
54
80
  class StateSetResult(BaseModel, Generic[TData]):
55
- """Result of a state set operation."""
81
+ """Result of a state set operation.
82
+
83
+ Attributes:
84
+ old_value: Previous value (if it existed).
85
+ new_value: New value that was stored.
86
+ """
56
87
 
57
88
  old_value: TData | None = None
58
89
  new_value: TData
59
90
 
60
91
 
61
92
  class StateUpdateResult(BaseModel, Generic[TData]):
62
- """Result of a state update operation."""
93
+ """Result of a state update operation.
94
+
95
+ Attributes:
96
+ old_value: Previous value (if it existed).
97
+ new_value: New value after the update.
98
+ """
63
99
 
64
100
  old_value: TData | None = None
65
101
  new_value: TData
66
102
 
67
103
 
68
104
  class StateDeleteResult(BaseModel):
69
- """Result of a state delete operation."""
105
+ """Result of a state delete operation.
106
+
107
+ Attributes:
108
+ old_value: Previous value (if it existed).
109
+ """
70
110
 
71
111
  old_value: Any | None = None
72
112
 
@@ -80,7 +120,16 @@ class StateEventType(str, Enum):
80
120
 
81
121
 
82
122
  class StateEventData(BaseModel, Generic[TData]):
83
- """Payload for state change events."""
123
+ """Payload for state change events.
124
+
125
+ Attributes:
126
+ type: Event category (always ``state``).
127
+ event_type: Type of state change.
128
+ scope: State scope (namespace).
129
+ key: Key within the scope.
130
+ old_value: Previous value (for update/delete events).
131
+ new_value: New value (for create/update events).
132
+ """
84
133
 
85
134
  type: str = "state"
86
135
  event_type: StateEventType
@@ -16,7 +16,16 @@ R = TypeVar("R")
16
16
 
17
17
 
18
18
  class TriggerConfig(BaseModel, Generic[TConfig]):
19
- """Configuration for a trigger."""
19
+ """Configuration passed to a trigger handler when a trigger instance is
20
+ registered or unregistered.
21
+
22
+ Attributes:
23
+ id: Trigger instance ID.
24
+ function_id: Function to invoke when the trigger fires.
25
+ config: Trigger-specific configuration.
26
+ metadata: Arbitrary user-specifiable metadata supplied to the triggered
27
+ handler function on every invocation.
28
+ """
20
29
 
21
30
  model_config = ConfigDict(arbitrary_types_allowed=True)
22
31
 
@@ -126,7 +126,10 @@ class Channel:
126
126
 
127
127
  @dataclass
128
128
  class InternalHttpRequest:
129
- """HTTP request with embedded channel references for streaming."""
129
+ """HTTP request with embedded channel references for streaming.
130
+
131
+ <!-- docs:internal -->
132
+ """
130
133
 
131
134
  path_params: dict[str, str]
132
135
  query_params: dict[str, str | list[str]]
@@ -163,7 +166,7 @@ class StreamResponse:
163
166
 
164
167
  @dataclass
165
168
  class StreamRequest:
166
- """Streaming request without the response writer."""
169
+ """Incoming streaming request received by a function registered with a stream trigger."""
167
170
 
168
171
  path_params: dict[str, str]
169
172
  query_params: dict[str, str | list[str]]
File without changes
File without changes
File without changes