wflow-api 0.1.0__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.
- wflow_api/__init__.py +20 -0
- wflow_api/auth.py +85 -0
- wflow_api/client.py +130 -0
- wflow_api/errors.py +13 -0
- wflow_api/guards.py +132 -0
- wflow_api/models/__init__.py +128 -0
- wflow_api/models/account.py +127 -0
- wflow_api/models/admin.py +98 -0
- wflow_api/models/common.py +117 -0
- wflow_api/models/documents.py +514 -0
- wflow_api/models/registers.py +165 -0
- wflow_api/models/requests.py +341 -0
- wflow_api/models/storage.py +38 -0
- wflow_api/operation.py +50 -0
- wflow_api/operations/__init__.py +21 -0
- wflow_api/operations/account.py +46 -0
- wflow_api/operations/admin.py +307 -0
- wflow_api/operations/approvals.py +235 -0
- wflow_api/operations/document_files.py +145 -0
- wflow_api/operations/document_properties.py +204 -0
- wflow_api/operations/document_tags.py +60 -0
- wflow_api/operations/documents.py +603 -0
- wflow_api/operations/integrations.py +63 -0
- wflow_api/operations/organization.py +51 -0
- wflow_api/operations/registers.py +2273 -0
- wflow_api/operations/storage_files.py +477 -0
- wflow_api/operations/storage_folders.py +132 -0
- wflow_api/operations/webhooks.py +67 -0
- wflow_api/py.typed +0 -0
- wflow_api-0.1.0.dist-info/METADATA +48 -0
- wflow_api-0.1.0.dist-info/RECORD +33 -0
- wflow_api-0.1.0.dist-info/WHEEL +4 -0
- wflow_api-0.1.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Generated from the wflow OpenAPI spec, then refined by hand.
|
|
2
|
+
|
|
3
|
+
Regenerate with:
|
|
4
|
+
|
|
5
|
+
uv run scripts/wflow_spec.py --models ApprovalsTemplate ApprovalsTemplatesTeam ApprovalsTemplateFull Role Team User WebHookRegistration
|
|
6
|
+
|
|
7
|
+
then review the diff; hand-written descriptions live here and must not be lost.
|
|
8
|
+
|
|
9
|
+
That command's dependency closure emits 9 classes, not the 7 below. Delete `Identity` and
|
|
10
|
+
`UserBase` from the regenerated output and import them instead — `Identity` from
|
|
11
|
+
wflow_api.models.account and `UserBase` from wflow_api.models.documents — because one name
|
|
12
|
+
must mean one shape. Re-emitting them here is what commit 106184d existed to undo.
|
|
13
|
+
|
|
14
|
+
The spec's four collection wrappers for these schemas — ApprovalsTemplateCollection,
|
|
15
|
+
RoleBaseCollection, TeamBaseCollection and UserCollection — are deliberately not generated:
|
|
16
|
+
the generic `Paged[T]` in wflow_api.models.common covers all four."""
|
|
17
|
+
|
|
18
|
+
from pydantic import Field
|
|
19
|
+
|
|
20
|
+
from wflow_api.models.account import Identity
|
|
21
|
+
from wflow_api.models.common import WflowModel, WflowTimestamp
|
|
22
|
+
from wflow_api.models.documents import UserBase
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ApprovalsTemplate(WflowModel):
|
|
26
|
+
"""Approvals template"""
|
|
27
|
+
|
|
28
|
+
id: str | None = Field(default=None, description="Id")
|
|
29
|
+
name: str | None = Field(default=None, description="Name")
|
|
30
|
+
isEmpty: bool | None = Field(default=None, description="Is empty")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ApprovalsTemplatesTeam(WflowModel):
|
|
34
|
+
"""Approvals templates team"""
|
|
35
|
+
|
|
36
|
+
teamId: str | None = Field(default=None, description="Team Id")
|
|
37
|
+
level: int | None = Field(default=None, description="Level in approval process")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ApprovalsTemplateFull(WflowModel):
|
|
41
|
+
"""Approvals template full"""
|
|
42
|
+
|
|
43
|
+
id: str | None = Field(default=None, description="Id")
|
|
44
|
+
name: str | None = Field(default=None, description="Name")
|
|
45
|
+
isEmpty: bool | None = Field(default=None, description="Is empty")
|
|
46
|
+
accessTeams: list[str] | None = Field(default=None, description="Teams collection for automatic set access")
|
|
47
|
+
teams: list[ApprovalsTemplatesTeam] | None = Field(default=None, description="Approvals teams collection")
|
|
48
|
+
conditionFolders: list[str] | None = Field(
|
|
49
|
+
default=None, description="Storage folder IDs collection for conditional assignment"
|
|
50
|
+
)
|
|
51
|
+
validationLockLevel: int | None = Field(default=None, description="Validation lock level")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Role(WflowModel):
|
|
55
|
+
"""Role"""
|
|
56
|
+
|
|
57
|
+
id: str | None = Field(default=None, description="Gets or sets the identifier.")
|
|
58
|
+
name: str | None = Field(default=None, description="Gets or sets the name.")
|
|
59
|
+
description: str | None = Field(default=None, description="Gets or sets the description.")
|
|
60
|
+
users: list[UserBase] | None = Field(default=None, description="Gets or sets the users collection.")
|
|
61
|
+
rights: list[str] | None = Field(
|
|
62
|
+
default=None,
|
|
63
|
+
description="Gets or sets the rights collection. One of: CanApprove, CanReview, CanManageApprovalPath, CanCreateDocument, CanDeleteDocument, CanManageAccess, CanChangeDocumentType, CanLock, CanManageAttachments, CanSendToExtraction, CanSendToReview, CanSendToErp, CanManageDocumentLinks, CanManageDocument, CanManageDocumentAccounting, CanManageCustomProperty, CanManageTags, CanManagePayments, CanMarkForPayment, CanExport, CanManageExternalSignature, CanStamp, CanManagePartners, CanManageBusinessItems, CanManageDocumentLinesTemplates, CanManageRegisters, CanManageSettings, CanManageFileStorage, CanManageExpenses, CanViewExpenses, CanViewReporting, CanManageBudgeting, CanManageDocumentBudgets, CanMoveDocumentToOtherOrganization, CanAccessInbox, CanRejectPeppolMessage",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Team(WflowModel):
|
|
68
|
+
"""Team"""
|
|
69
|
+
|
|
70
|
+
id: str | None = Field(default=None, description="Gets or sets the identifier.")
|
|
71
|
+
name: str | None = Field(default=None, description="Gets or sets the name.")
|
|
72
|
+
description: str | None = Field(default=None, description="Gets or sets the description.")
|
|
73
|
+
system: bool | None = Field(
|
|
74
|
+
default=None,
|
|
75
|
+
description="Gets or sets a value indicating whether this wflow.Core.Contracts.Teams.TeamBase is system.",
|
|
76
|
+
)
|
|
77
|
+
users: list[UserBase] | None = Field(default=None, description="Gets or sets the users collection.")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class User(WflowModel):
|
|
81
|
+
"""User"""
|
|
82
|
+
|
|
83
|
+
id: str | None = Field(default=None, description="Id")
|
|
84
|
+
identity: Identity | None = None
|
|
85
|
+
created: WflowTimestamp | None = Field(default=None, description="Date of creation")
|
|
86
|
+
hasFullAccess: bool | None = Field(default=None, description="Full access role indicator")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class WebHookRegistration(WflowModel):
|
|
90
|
+
"""web hook registration"""
|
|
91
|
+
|
|
92
|
+
id: str | None = Field(default=None, description="Id")
|
|
93
|
+
webHookUri: str | None = Field(default=None, description="Web hook URi")
|
|
94
|
+
description: str | None = Field(default=None, description="Description")
|
|
95
|
+
actions: list[str] | None = Field(
|
|
96
|
+
default=None,
|
|
97
|
+
description="Registered actions collection One of: All, DocumentReadyToExtract, DocumentReadyToExport, DocumentUpdated, DocumentApprovalProcessFinished, RegisterUpdated, DocumentDeleted, DocumentReadyToReview, DocumentCreated, DocumentReviewed",
|
|
98
|
+
)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Shared building blocks: the model base, the repeated operation arguments, and the outcome types writes and downloads return.
|
|
2
|
+
|
|
3
|
+
Field names are camelCase, exactly as wflow sends them, so a caller can read the
|
|
4
|
+
published wflow reference and this output side by side.
|
|
5
|
+
|
|
6
|
+
Every field read off the API is optional and unknown fields are kept: this is a trust
|
|
7
|
+
boundary against a live API, where a missing field must not turn a working call into an
|
|
8
|
+
opaque failure, and a newly added one should reach the caller rather than be dropped here.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from datetime import datetime
|
|
13
|
+
from typing import Annotated
|
|
14
|
+
|
|
15
|
+
from pydantic import AfterValidator, BaseModel, ConfigDict, Field, WithJsonSchema, field_validator
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class WflowModel(BaseModel):
|
|
19
|
+
model_config = ConfigDict(extra="allow")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
DOTNET_UNSET_DATE = datetime.min
|
|
23
|
+
"""What .NET serialises for a DateTime nobody set: "0001-01-01T00:00:00"."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _unset_date_is_none(value: datetime) -> datetime | None:
|
|
27
|
+
return None if value.replace(tzinfo=None) == DOTNET_UNSET_DATE else value
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
WflowTimestamp = Annotated[datetime, AfterValidator(_unset_date_is_none), WithJsonSchema({"type": "string"})]
|
|
31
|
+
"""A timestamp read off wflow, parsed but published without a `format`.
|
|
32
|
+
|
|
33
|
+
wflow sends these with no UTC offset — "2026-05-13T07:42:45.010" — which pydantic parses
|
|
34
|
+
into a naive datetime and re-serializes just as offsetless. That is not RFC 3339, so a
|
|
35
|
+
field declaring `format: "date-time"` makes a schema-validating client reject the whole response.
|
|
36
|
+
Attaching an offset here would make the schema true only if these are UTC, which wflow
|
|
37
|
+
does not state; publishing a plain string claims no more than wflow actually sends.
|
|
38
|
+
|
|
39
|
+
A date wflow never filled in arrives as .NET's default, "0001-01-01T00:00:00" — the
|
|
40
|
+
summaries `list_document_links` returns carry it as `created` and `updated`. It is
|
|
41
|
+
published as null, because a client reading a real year-one date would be misled, and
|
|
42
|
+
every field of this type is already nullable.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Paged[T](WflowModel):
|
|
47
|
+
"""One page of a collection. `totalItems` is the count across all pages, so it says
|
|
48
|
+
whether the page in hand is the whole register or only the start of it.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
items: list[T] = []
|
|
52
|
+
totalItems: int | None = None
|
|
53
|
+
pageSize: int | None = None
|
|
54
|
+
page: int | None = None
|
|
55
|
+
|
|
56
|
+
@field_validator("items", mode="before")
|
|
57
|
+
@classmethod
|
|
58
|
+
def _null_items_is_an_empty_page(cls, value: object) -> object:
|
|
59
|
+
"""wflow documents `items` as nullable; an empty page must not fail validation."""
|
|
60
|
+
return [] if value is None else value
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
OrgSlug = Annotated[
|
|
64
|
+
str,
|
|
65
|
+
Field(
|
|
66
|
+
pattern=r"^[A-Za-z0-9][A-Za-z0-9_-]*$",
|
|
67
|
+
description='Workspace slug, e.g. "produkt-testovaci" (`subdomain` from list_organizations)',
|
|
68
|
+
),
|
|
69
|
+
]
|
|
70
|
+
Search = Annotated[str | None, Field(default=None, description="Free-text search value")]
|
|
71
|
+
Sort = Annotated[
|
|
72
|
+
str | None,
|
|
73
|
+
Field(
|
|
74
|
+
default=None,
|
|
75
|
+
description=(
|
|
76
|
+
"Comma-separated sort keys, ascending unless a key carries the 'desc' modifier, "
|
|
77
|
+
'e.g. "created,totalAmount desc". Sort on the fields this operation documents.'
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
]
|
|
81
|
+
Query = Annotated[
|
|
82
|
+
str | None,
|
|
83
|
+
Field(
|
|
84
|
+
default=None,
|
|
85
|
+
description=(
|
|
86
|
+
"Filter expression `field operator value`, with one space around the operator: "
|
|
87
|
+
'`number = "A100"` is accepted, `number="A100"` is rejected as invalid syntax. '
|
|
88
|
+
"Operators are = != < <= > >=, and against null only = and !=. Quote text and dates "
|
|
89
|
+
'("2021-01-01"), leave numbers and null bare. Chain conditions with `and`, e.g. '
|
|
90
|
+
'`totalAmount > 1000 and created > "2021-01-01"`. Filter on the fields this operation documents.'
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
]
|
|
94
|
+
PageSize = Annotated[int | None, Field(default=None, description="Records per page")]
|
|
95
|
+
Page = Annotated[int | None, Field(default=None, description="Page number, zero-based")]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class WriteResult(WflowModel):
|
|
99
|
+
"""What an operation returns when wflow accepted a change.
|
|
100
|
+
|
|
101
|
+
Most write endpoints answer 200 with no body, so there is nothing to hand back but
|
|
102
|
+
a confirmation. Returning one shape for all of them means a caller never has to ask
|
|
103
|
+
whether silence meant success.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
action: str = Field(description="created, updated, patched or deleted")
|
|
107
|
+
resource: str = Field(description='What was changed, e.g. "registers/partners"')
|
|
108
|
+
id: str | None = Field(default=None, description="Set only where wflow returns an identifier")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@dataclass(frozen=True)
|
|
112
|
+
class FileContent:
|
|
113
|
+
"""A file as wflow sent it."""
|
|
114
|
+
|
|
115
|
+
filename: str | None
|
|
116
|
+
content_type: str | None
|
|
117
|
+
content: bytes
|