Skip to content

Commit 9fbadd6

Browse files
fix workflow result parsing
1 parent 011edab commit 9fbadd6

6 files changed

Lines changed: 8 additions & 17 deletions

File tree

‎linkedapi/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
from linkedapi.types import __all__ as _types_all
8282
from linkedapi.webhooks import parse_webhook_event
8383

84-
__version__ = "1.3.11"
84+
__version__ = "1.4.2"
8585
PredefinedOperation = Operation
8686

8787
__all__ = [

‎linkedapi/types/workflow.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class WorkflowCancelResponse(LinkedApiModel):
4444

4545

4646
class WorkflowResponse(LinkedApiModel):
47-
workflow_id: str
47+
# GET /workflows/{id} never returns workflowId; only the start response carries it.
48+
workflow_id: str | None = None
4849
workflow_status: WorkflowStatus
4950
message: str | None = None
5051
pending_reason: WorkflowPendingReason | None = None

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "linkedapi"
7-
version = "1.4.1"
7+
version = "1.4.2"
88
description = "Official synchronous Python SDK for Linked API."
99
readme = "README.md"
1010
requires-python = ">=3.10"

‎tests/test_operations.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ def test_execute_and_result_flow_returns_pydantic_data(
370370
fake_http_client.queue_response(result={"workflowId": "wf1", "workflowStatus": "pending"})
371371
fake_http_client.queue_response(
372372
result={
373-
"workflowId": "wf1",
374373
"workflowStatus": "completed",
375374
"completion": {
376375
"actionType": "st.openPersonPage",

‎tests/test_polling.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@
1717

1818

1919
def test_operation_result_polls_until_completion(fake_http_client: FakeHttpClient) -> None:
20-
fake_http_client.queue_response(
21-
result={"workflowId": "wf1", "workflowStatus": "pending", "message": "queued"}
22-
)
23-
fake_http_client.queue_response(
24-
result={"workflowId": "wf1", "workflowStatus": "running", "message": "running"}
25-
)
20+
fake_http_client.queue_response(result={"workflowStatus": "pending", "message": "queued"})
21+
fake_http_client.queue_response(result={"workflowStatus": "running", "message": "running"})
2622
fake_http_client.queue_response(
2723
result={
28-
"workflowId": "wf1",
2924
"workflowStatus": "completed",
3025
"completion": {
3126
"actionType": "st.retrieveSSI",
@@ -52,7 +47,6 @@ def test_operation_result_wraps_response_validation_error(
5247
) -> None:
5348
fake_http_client.queue_response(
5449
result={
55-
"workflowId": "wf1",
5650
"workflowStatus": "completed",
5751
"completion": {
5852
"actionType": "st.openPersonPage",

‎tests/test_working_hours_contract.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class TestStatusCarriesPendingReason:
7272
def test_carries_the_outside_working_hours_reason(self) -> None:
7373
operation = _operation(
7474
{
75-
"workflowId": "wf-1",
7675
"workflowStatus": "pending",
7776
"pendingReason": "outsideWorkingHours",
7877
}
@@ -84,17 +83,15 @@ def test_carries_the_outside_working_hours_reason(self) -> None:
8483
assert result.pending_reason == "outsideWorkingHours"
8584

8685
def test_carries_the_queued_reason(self) -> None:
87-
operation = _operation(
88-
{"workflowId": "wf-1", "workflowStatus": "pending", "pendingReason": "queued"}
89-
)
86+
operation = _operation({"workflowStatus": "pending", "pendingReason": "queued"})
9087

9188
result = operation.status("wf-1")
9289

9390
assert isinstance(result, WorkflowInProgressResponse)
9491
assert result.pending_reason == "queued"
9592

9693
def test_keeps_none_when_the_api_sends_nothing(self) -> None:
97-
operation = _operation({"workflowId": "wf-1", "workflowStatus": "running"})
94+
operation = _operation({"workflowStatus": "running"})
9895

9996
result = operation.status("wf-1")
10097

0 commit comments

Comments
 (0)