wflow-api 0.1.0__tar.gz → 0.2.0__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.
- {wflow_api-0.1.0 → wflow_api-0.2.0}/PKG-INFO +1 -1
- {wflow_api-0.1.0 → wflow_api-0.2.0}/pyproject.toml +1 -1
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/client.py +22 -3
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/__init__.py +2 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/account.py +25 -1
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/common.py +8 -1
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/documents.py +71 -6
- wflow_api-0.2.0/src/wflow_api/models/peppol.py +122 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/registers.py +4 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/requests.py +13 -4
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/document_files.py +3 -2
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/documents.py +137 -33
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/organization.py +7 -0
- wflow_api-0.2.0/src/wflow_api/operations/peppol.py +343 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/registers.py +8 -2
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/storage_files.py +9 -11
- {wflow_api-0.1.0 → wflow_api-0.2.0}/LICENSE +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/README.md +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/__init__.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/auth.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/errors.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/guards.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/admin.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/models/storage.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operation.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/__init__.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/account.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/admin.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/approvals.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/document_properties.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/document_tags.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/integrations.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/storage_folders.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/operations/webhooks.py +0 -0
- {wflow_api-0.1.0 → wflow_api-0.2.0}/src/wflow_api/py.typed +0 -0
|
@@ -80,19 +80,38 @@ class WflowClient:
|
|
|
80
80
|
content: bytes,
|
|
81
81
|
params: dict[str, object] | None = None,
|
|
82
82
|
field: str = "file",
|
|
83
|
+
) -> Any:
|
|
84
|
+
return await self.upload_files(method, path, [(filename, content)], params, field)
|
|
85
|
+
|
|
86
|
+
async def upload_files(
|
|
87
|
+
self,
|
|
88
|
+
method: str,
|
|
89
|
+
path: str,
|
|
90
|
+
files: list[tuple[str, bytes]],
|
|
91
|
+
params: dict[str, object] | None = None,
|
|
92
|
+
field: str = "file",
|
|
83
93
|
) -> Any:
|
|
84
94
|
return await self.request(
|
|
85
|
-
method,
|
|
95
|
+
method,
|
|
96
|
+
path,
|
|
97
|
+
params=params or {},
|
|
98
|
+
files=[(field, (name, content)) for name, content in files],
|
|
99
|
+
timeout=UPLOAD_TIMEOUT,
|
|
86
100
|
)
|
|
87
101
|
|
|
88
102
|
async def download(
|
|
89
|
-
self,
|
|
103
|
+
self,
|
|
104
|
+
path: str,
|
|
105
|
+
method: str = "GET",
|
|
106
|
+
json: Any = None,
|
|
107
|
+
max_bytes: int | None = None,
|
|
108
|
+
params: dict[str, Any] | None = None,
|
|
90
109
|
) -> FileContent:
|
|
91
110
|
headers = await self._signed()
|
|
92
111
|
try:
|
|
93
112
|
async with (
|
|
94
113
|
self._http(DOWNLOAD_TIMEOUT) as http,
|
|
95
|
-
http.stream(method, path, headers=headers, json=json) as response,
|
|
114
|
+
http.stream(method, path, headers=headers, json=json, params=params) as response,
|
|
96
115
|
):
|
|
97
116
|
if response.is_error:
|
|
98
117
|
await response.aread()
|
|
@@ -6,6 +6,7 @@ from wflow_api.models.account import (
|
|
|
6
6
|
Identity,
|
|
7
7
|
Organization,
|
|
8
8
|
OrganizationDomain,
|
|
9
|
+
OrganizationLimit,
|
|
9
10
|
OrganizationSettings,
|
|
10
11
|
RoleBase,
|
|
11
12
|
TeamBase,
|
|
@@ -88,6 +89,7 @@ __all__ = [
|
|
|
88
89
|
"OrgSlug",
|
|
89
90
|
"Organization",
|
|
90
91
|
"OrganizationDomain",
|
|
92
|
+
"OrganizationLimit",
|
|
91
93
|
"OrganizationPerson",
|
|
92
94
|
"OrganizationSettings",
|
|
93
95
|
"Page",
|
|
@@ -46,7 +46,10 @@ class TeamBase(WflowModel):
|
|
|
46
46
|
class DocumentTypeBase(WflowModel):
|
|
47
47
|
id: str | None = None
|
|
48
48
|
name: str | None = None
|
|
49
|
-
kind: str | None = Field(
|
|
49
|
+
kind: str | None = Field(
|
|
50
|
+
default=None,
|
|
51
|
+
description="One of: IncomingInvoice, OutgoingInvoice, ExpenditureCashSlip, SupplierOrder, CustomerOrder, Other, Contract, IncomeCashReceipt",
|
|
52
|
+
)
|
|
50
53
|
default: bool | None = None
|
|
51
54
|
|
|
52
55
|
|
|
@@ -71,6 +74,17 @@ class UserFull(WflowModel):
|
|
|
71
74
|
Account = UserFull
|
|
72
75
|
|
|
73
76
|
|
|
77
|
+
class OrganizationLimit(WflowModel):
|
|
78
|
+
"""The workspace's document limit"""
|
|
79
|
+
|
|
80
|
+
documentsPerMonth: int | None = Field(default=None, description="Documents allowed per month of the window")
|
|
81
|
+
period: int | None = Field(default=None, description="Length of one limit window, in months")
|
|
82
|
+
validFrom: WflowTimestamp | None = Field(
|
|
83
|
+
default=None,
|
|
84
|
+
description="The limit applies from this date; its windows run back to back from the first day of this date's month",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
74
88
|
class Organization(WflowModel):
|
|
75
89
|
"""The workspace's own identity, as returned by get_organization."""
|
|
76
90
|
|
|
@@ -92,6 +106,11 @@ class Organization(WflowModel):
|
|
|
92
106
|
biDashboardTrialExpires: WflowTimestamp | None = Field(
|
|
93
107
|
default=None, description="Gets or sets the bi dashboard trial expires."
|
|
94
108
|
)
|
|
109
|
+
limit: OrganizationLimit | None = Field(
|
|
110
|
+
default=None,
|
|
111
|
+
description="Null means unlimited. Otherwise documentsPerMonth times period documents per window of period months",
|
|
112
|
+
)
|
|
113
|
+
peppolVerified: bool | None = Field(default=None, description="wflow has verified the workspace for Peppol")
|
|
95
114
|
|
|
96
115
|
|
|
97
116
|
class OrganizationSettings(WflowModel):
|
|
@@ -125,3 +144,8 @@ class OrganizationSettings(WflowModel):
|
|
|
125
144
|
vatInclusiveBudgets: bool | None = None
|
|
126
145
|
trialExpiration: WflowTimestamp | None = Field(default=None, description="Gets or sets the trial expiration date.")
|
|
127
146
|
fiscalYearStart: int | None = None
|
|
147
|
+
printThemeId: str | None = Field(
|
|
148
|
+
default=None,
|
|
149
|
+
description="Theme the PDF engine renders the workspace's documents with (max 20 characters). Null keeps them on the legacy print",
|
|
150
|
+
)
|
|
151
|
+
printColor: str | None = Field(default=None, description="Accent colour of the printed documents, as #RRGGBB")
|
|
@@ -12,7 +12,7 @@ from dataclasses import dataclass
|
|
|
12
12
|
from datetime import datetime
|
|
13
13
|
from typing import Annotated
|
|
14
14
|
|
|
15
|
-
from pydantic import AfterValidator, BaseModel, ConfigDict, Field, WithJsonSchema, field_validator
|
|
15
|
+
from pydantic import AfterValidator, BaseModel, ConfigDict, Field, Strict, WithJsonSchema, field_validator
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class WflowModel(BaseModel):
|
|
@@ -93,6 +93,13 @@ Query = Annotated[
|
|
|
93
93
|
]
|
|
94
94
|
PageSize = Annotated[int | None, Field(default=None, description="Records per page")]
|
|
95
95
|
Page = Annotated[int | None, Field(default=None, description="Page number, zero-based")]
|
|
96
|
+
UploadFiles = Annotated[
|
|
97
|
+
list[tuple[Annotated[str, Field(min_length=1)], Annotated[bytes, Strict()]]],
|
|
98
|
+
Field(
|
|
99
|
+
min_length=1,
|
|
100
|
+
description="Files as (filename, bytes) pairs, in order: the first becomes the main file, the rest attachments",
|
|
101
|
+
),
|
|
102
|
+
]
|
|
96
103
|
|
|
97
104
|
|
|
98
105
|
class WriteResult(WflowModel):
|
|
@@ -4,7 +4,7 @@ Regenerate with:
|
|
|
4
4
|
|
|
5
5
|
uv run scripts/wflow_spec.py --models Document DocumentBase DocumentTypeFull DocumentEvent DocumentFile Comment Property PropertyDefinition ApprovalProcess
|
|
6
6
|
|
|
7
|
-
then review the diff. That command's dependency closure emits
|
|
7
|
+
then review the diff. That command's dependency closure emits 32 classes, not the 22
|
|
8
8
|
below: the other 10 are schemas this codebase already models elsewhere, so delete them
|
|
9
9
|
from the regenerated output and import them instead of duplicating them —
|
|
10
10
|
|
|
@@ -13,7 +13,10 @@ from the regenerated output and import them instead of duplicating them —
|
|
|
13
13
|
Register, Serie, VATReturnLine
|
|
14
14
|
|
|
15
15
|
Also delete `Property._value` from the regenerated output: the spec marks it
|
|
16
|
-
`writeOnly: true`, so wflow never sends it back and there is nothing here to read.
|
|
16
|
+
`writeOnly: true`, so wflow never sends it back and there is nothing here to read.
|
|
17
|
+
|
|
18
|
+
`CreateDocumentWithFilesResult` at the end is written by hand: the spec names it but
|
|
19
|
+
defines no schema for it, so regeneration does not emit it. Keep it."""
|
|
17
20
|
|
|
18
21
|
from typing import Any
|
|
19
22
|
|
|
@@ -43,6 +46,29 @@ class DocumentPayment(WflowModel):
|
|
|
43
46
|
)
|
|
44
47
|
|
|
45
48
|
|
|
49
|
+
class DocumentPrintSettings(WflowModel):
|
|
50
|
+
"""Print and PDF settings of a single document"""
|
|
51
|
+
|
|
52
|
+
textAboveLines: str | None = Field(
|
|
53
|
+
default=None, description="Text printed above the document lines on the generated PDF (max 500 characters)"
|
|
54
|
+
)
|
|
55
|
+
textBelowLines: str | None = Field(
|
|
56
|
+
default=None, description="Text printed below the document lines on the generated PDF (max 500 characters)"
|
|
57
|
+
)
|
|
58
|
+
footerText: str | None = Field(
|
|
59
|
+
default=None, description="Text printed in the footer of the generated PDF (max 500 characters)"
|
|
60
|
+
)
|
|
61
|
+
paymentMethod: str | None = Field(default=None, description="One of: BankTransfer, Card, Cash")
|
|
62
|
+
language: str | None = Field(
|
|
63
|
+
default=None,
|
|
64
|
+
description="Language the PDF is printed in, a 2-letter code. Null uses the partner's language, then the workspace default",
|
|
65
|
+
)
|
|
66
|
+
templateId: int | None = Field(
|
|
67
|
+
default=None,
|
|
68
|
+
description="Legacy print template id. It cannot be discovered through the API: send back the value a read returned, never one of your own. A printSettings object without it clears the template",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
46
72
|
class DocumentBase(WflowModel):
|
|
47
73
|
id: str | None = Field(default=None, description="Id")
|
|
48
74
|
serie: Serie | None = None
|
|
@@ -111,6 +137,10 @@ class DocumentBase(WflowModel):
|
|
|
111
137
|
exchangeRateUnits: int | None = Field(default=None, description="Exchange rate units")
|
|
112
138
|
tag: str | None = Field(default=None, description="Special document identification")
|
|
113
139
|
orderNo: str | None = Field(default=None, description="Linked order number")
|
|
140
|
+
buyerReference: str | None = Field(
|
|
141
|
+
default=None,
|
|
142
|
+
description="Buyer reference: an identifier the buyer assigns for internal routing, e.g. a department or cost centre code (max 100 characters)",
|
|
143
|
+
)
|
|
114
144
|
description: str | None = Field(default=None, description="Document description")
|
|
115
145
|
contactPersonName: str | None = Field(default=None, description="Contact person name")
|
|
116
146
|
contactPersonEmail: str | None = Field(default=None, description="Contact person email")
|
|
@@ -139,6 +169,13 @@ class DocumentBase(WflowModel):
|
|
|
139
169
|
dataSource: str | None = Field(default=None, description="One of: ISDOC, ROSSUM, EKASA, API, WFLOWAI, ZUGFERD, UBL")
|
|
140
170
|
source: str | None = Field(default=None, description="One of: Email, Api, MobileApp, WebApp, Rossum, Peppol")
|
|
141
171
|
createdBy: str | None = Field(default=None, description="Name or login of user, who created the document")
|
|
172
|
+
removedBy: str | None = Field(
|
|
173
|
+
default=None, description="Name or login of user, who moved the document to the recycle bin"
|
|
174
|
+
)
|
|
175
|
+
isBlockedByLimit: bool | None = Field(
|
|
176
|
+
default=None,
|
|
177
|
+
description="The workspace's document limit was used up when the document was created; until it is released, only reading, deleting and setting payments are allowed",
|
|
178
|
+
)
|
|
142
179
|
series: str | None = Field(default=None, description="Serie code - Deprecated")
|
|
143
180
|
type: DocumentTypeBase | None = None
|
|
144
181
|
tags: list[str] | None = Field(default=None, description="Array of tags added to the document")
|
|
@@ -178,12 +215,12 @@ class Partner(WflowModel):
|
|
|
178
215
|
|
|
179
216
|
id: str | None = Field(default=None, description="Id")
|
|
180
217
|
externalId: str | None = Field(default=None, description="External Id")
|
|
181
|
-
ic: str | None = Field(default=None, description="Tax ID. (max
|
|
182
|
-
vat: str | None = Field(default=None, description="VAT ID.
|
|
218
|
+
ic: str | None = Field(default=None, description="Tax ID. (max 20 characters)")
|
|
219
|
+
vat: str | None = Field(default=None, description="VAT ID. (max 20 characters)")
|
|
183
220
|
name: str | None = Field(default=None, description="Name")
|
|
184
221
|
address: str | None = Field(default=None, description="Address (street, post code, town, country,...)")
|
|
185
222
|
mainAddress: AddressType | None = None
|
|
186
|
-
localVAT: str | None = Field(default=None, description="Local VAT ID")
|
|
223
|
+
localVAT: str | None = Field(default=None, description="Local VAT ID. (max 20 characters)")
|
|
187
224
|
note: str | None = Field(default=None, description="Notes")
|
|
188
225
|
phoneNo: str | None = Field(default=None, description="Phone No")
|
|
189
226
|
mailAddress: str | None = Field(default=None, description="E-mail address")
|
|
@@ -195,6 +232,10 @@ class Partner(WflowModel):
|
|
|
195
232
|
)
|
|
196
233
|
isValid: bool | None = Field(default=None, description="Validity attribute")
|
|
197
234
|
businessRegisterRegistration: str | None = Field(default=None, description="Business register registration text")
|
|
235
|
+
buyerReference: str | None = Field(
|
|
236
|
+
default=None,
|
|
237
|
+
description="Buyer reference the partner wants on documents issued to them, e.g. a department or cost centre code (max 100 characters)",
|
|
238
|
+
)
|
|
198
239
|
customer: bool | None = Field(default=None, description="Customer attribute")
|
|
199
240
|
supplier: bool | None = Field(default=None, description="Supplier attribute")
|
|
200
241
|
|
|
@@ -351,6 +392,10 @@ class Document(WflowModel):
|
|
|
351
392
|
exchangeRateUnits: int | None = Field(default=None, description="Exchange rate units")
|
|
352
393
|
tag: str | None = Field(default=None, description="Special document identification")
|
|
353
394
|
orderNo: str | None = Field(default=None, description="Linked order number")
|
|
395
|
+
buyerReference: str | None = Field(
|
|
396
|
+
default=None,
|
|
397
|
+
description="Buyer reference: an identifier the buyer assigns for internal routing, e.g. a department or cost centre code (max 100 characters)",
|
|
398
|
+
)
|
|
354
399
|
description: str | None = Field(default=None, description="Document description")
|
|
355
400
|
contactPersonName: str | None = Field(default=None, description="Contact person name")
|
|
356
401
|
contactPersonEmail: str | None = Field(default=None, description="Contact person email")
|
|
@@ -379,6 +424,13 @@ class Document(WflowModel):
|
|
|
379
424
|
dataSource: str | None = Field(default=None, description="One of: ISDOC, ROSSUM, EKASA, API, WFLOWAI, ZUGFERD, UBL")
|
|
380
425
|
source: str | None = Field(default=None, description="One of: Email, Api, MobileApp, WebApp, Rossum, Peppol")
|
|
381
426
|
createdBy: str | None = Field(default=None, description="Name or login of user, who created the document")
|
|
427
|
+
removedBy: str | None = Field(
|
|
428
|
+
default=None, description="Name or login of user, who moved the document to the recycle bin"
|
|
429
|
+
)
|
|
430
|
+
isBlockedByLimit: bool | None = Field(
|
|
431
|
+
default=None,
|
|
432
|
+
description="The workspace's document limit was used up when the document was created; until it is released, only reading, deleting and setting payments are allowed",
|
|
433
|
+
)
|
|
382
434
|
series: str | None = Field(default=None, description="Serie code - Deprecated")
|
|
383
435
|
type: DocumentType | None = None
|
|
384
436
|
partner: Partner | None = None
|
|
@@ -386,6 +438,7 @@ class Document(WflowModel):
|
|
|
386
438
|
accounting: Accounting | None = None
|
|
387
439
|
vaTs: list[DocumentVAT] | None = Field(default=None, description="VAT subtotals")
|
|
388
440
|
lines: list[DocumentLine] | None = Field(default=None, description="Lines list")
|
|
441
|
+
printSettings: DocumentPrintSettings | None = None
|
|
389
442
|
transactionId: str | None = Field(default=None, description="Transaction id")
|
|
390
443
|
expenseCardId: str | None = Field(default=None, description="Card id")
|
|
391
444
|
peppolMessageId: str | None = Field(
|
|
@@ -431,7 +484,7 @@ class DocumentEvent(WflowModel):
|
|
|
431
484
|
id: str | None = None
|
|
432
485
|
type: str | None = Field(
|
|
433
486
|
default=None,
|
|
434
|
-
description="One of: Create, Update, Delete, Restore, Approved, Unapproved, Locked, Unlocked, Rejected, Returned, FileAdded, FileDeleted, TaskAdded, TaskProcessed, SetDocumentRights, SetDocumentApprovals, DeleteDocumentApprovals, AddDocumentPayment, UpdateDocumentPayment, ChangeProperty, TimeStamped, Signed, AddDocumentPaymentRequest, Delivered, DeliverCanceled, SentByEmail, ReturnedBack, ChangedFlowStatus, ChangedKind, SentForSigning, Confirmed, Unconfirmed, SentFiles, AddDocumentPaymentOrder, DeleteDocumentPayment, DeleteDocumentPaymentRequest, MovedFromOrganization, Split, ChangeDocumentApprovals, Merged, Linked, SetAccess, ExpenseTransactionPaired, ExpenseTransactionUnpaired, SetMainFile, BudgetUpdated, MovedToOtherOrganization, MovedFromOtherOrganization",
|
|
487
|
+
description="One of: Create, Update, Delete, Restore, Approved, Unapproved, Locked, Unlocked, Rejected, Returned, FileAdded, FileDeleted, TaskAdded, TaskProcessed, SetDocumentRights, SetDocumentApprovals, DeleteDocumentApprovals, AddDocumentPayment, UpdateDocumentPayment, ChangeProperty, TimeStamped, Signed, AddDocumentPaymentRequest, Delivered, DeliverCanceled, SentByEmail, ReturnedBack, ChangedFlowStatus, ChangedKind, SentForSigning, Confirmed, Unconfirmed, SentFiles, AddDocumentPaymentOrder, DeleteDocumentPayment, DeleteDocumentPaymentRequest, MovedFromOrganization, Split, ChangeDocumentApprovals, Merged, Linked, SetAccess, ExpenseTransactionPaired, ExpenseTransactionUnpaired, SetMainFile, BudgetUpdated, MovedToOtherOrganization, MovedFromOtherOrganization, SentViaPeppol, PaymentsSynchronized, ApprovalsTakenOverFromOrder, DeleteDocumentPaymentOrder",
|
|
435
488
|
)
|
|
436
489
|
identity: IdentityBase | None = None
|
|
437
490
|
info: str | None = None
|
|
@@ -512,3 +565,15 @@ class ApprovalProcess(WflowModel):
|
|
|
512
565
|
|
|
513
566
|
pathName: str | None = Field(default=None, description="Path name")
|
|
514
567
|
items: list[ApprovalProcessItem] | None = Field(default=None, description="Approval process item collection")
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
class CreateDocumentWithFilesResult(WflowModel):
|
|
571
|
+
"""The document create_document_with_files made, and where it ended up."""
|
|
572
|
+
|
|
573
|
+
documentId: str | None = Field(default=None, description="The new document's id")
|
|
574
|
+
newOrganization: str | None = Field(
|
|
575
|
+
default=None,
|
|
576
|
+
description=(
|
|
577
|
+
"Slug of the other workspace of the same customer the document was moved to; null when it was not moved"
|
|
578
|
+
),
|
|
579
|
+
)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Generated from the wflow OpenAPI spec.
|
|
2
|
+
|
|
3
|
+
Regenerate with:
|
|
4
|
+
|
|
5
|
+
uv run scripts/wflow_spec.py --models PeppolMessageDetail PeppolMessageRejectRequest SendDocumentViaPeppolRequest
|
|
6
|
+
|
|
7
|
+
then review the diff. That command's dependency closure emits 28 classes, not the 8
|
|
8
|
+
below: the other 20 are `Document`, `DocumentTypeBase` and the schemas `Document`
|
|
9
|
+
depends on, which this codebase already models elsewhere, so delete them from the
|
|
10
|
+
regenerated output and import them instead of duplicating them —
|
|
11
|
+
|
|
12
|
+
- from wflow_api.models.account: DocumentTypeBase
|
|
13
|
+
- from wflow_api.models.documents: Document
|
|
14
|
+
|
|
15
|
+
Also replace every `datetime` with `WflowTimestamp`, and keep the note on
|
|
16
|
+
`PeppolMessage.status` that AB and IP are not used."""
|
|
17
|
+
|
|
18
|
+
from pydantic import Field
|
|
19
|
+
|
|
20
|
+
from wflow_api.models.account import DocumentTypeBase
|
|
21
|
+
from wflow_api.models.common import WflowModel, WflowTimestamp
|
|
22
|
+
from wflow_api.models.documents import Document
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DocumentLink(WflowModel):
|
|
26
|
+
"""Represents a lightweight reference to a linked document."""
|
|
27
|
+
|
|
28
|
+
id: str | None = Field(default=None, description="Gets or sets the internal document ID.")
|
|
29
|
+
type: DocumentTypeBase | None = None
|
|
30
|
+
invoiceType: str | None = Field(
|
|
31
|
+
default=None, description="One of: TaxInvoice, CreditNote, DebitNote, Proforma, TaxInvoicePayment"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class PeppolMessage(WflowModel):
|
|
36
|
+
"""Represents a PEPPOL message with sender/receiver and document metadata."""
|
|
37
|
+
|
|
38
|
+
id: str | None = Field(default=None, description="Gets or sets the internal message ID.")
|
|
39
|
+
peppolMessageId: str | None = Field(default=None, description="Gets or sets the external PEPPOL message ID.")
|
|
40
|
+
peppolDocumentId: str | None = Field(default=None, description="Gets or sets the PEPPOL document ID.")
|
|
41
|
+
status: str | None = Field(
|
|
42
|
+
default=None,
|
|
43
|
+
description="One of: Queued, Sent, Delivered, Error, AB, IP, AP, PD, RE, CA, UQ. AB and IP are not used.",
|
|
44
|
+
)
|
|
45
|
+
statusChangedAt: WflowTimestamp | None = Field(
|
|
46
|
+
default=None, description="Gets or sets the date and time when status was last changed."
|
|
47
|
+
)
|
|
48
|
+
rejectReason: str | None = Field(
|
|
49
|
+
default=None,
|
|
50
|
+
description="One of: NoIssue, ReferencesIncorrect, LegalInformationIncorrect, ReceiverUnknown, ItemQualityInsufficient, DeliveryIssues, PricesIncorrect, QuantityIncorrect, ItemsIncorrect, PaymentTermsIncorrect, NotRecognized, FinanceIncorrect, PartiallyPaid, Other",
|
|
51
|
+
)
|
|
52
|
+
requiredAction: str | None = Field(
|
|
53
|
+
default=None,
|
|
54
|
+
description="One of: NoActionRequired, ProvideInformation, IssueNewInvoice, CreditFully, CreditPartially, CreditTheAmount, Other",
|
|
55
|
+
)
|
|
56
|
+
createdAt: WflowTimestamp | None = Field(
|
|
57
|
+
default=None, description="Gets or sets the date and time when the message was created."
|
|
58
|
+
)
|
|
59
|
+
documentType: str | None = Field(
|
|
60
|
+
default=None,
|
|
61
|
+
description="One of: ApplicationResponse, AttachedDocument, AwardedNotification, BillOfLading, CallForTenders, Catalogue, CatalogueDeletion, CatalogueItemSpecificationUpdate, CataloguePricingUpdate, CatalogueRequest, CertificateOfOrigin, ContractAwardNotice, ContractNotice, CreditNote, DebitNote, DespatchAdvice, DocumentStatus, DocumentStatusRequest, ExceptionCriteria, ExceptionNotification, Forecast, ForecastRevision, ForwardingInstructions, FreightInvoice, FulfilmentCancellation, GoodsItemItinerary, GuaranteeCertificate, InstructionForReturns, InventoryReport, Invoice, ItemInformationRequest, Order, OrderCancellation, OrderChange, OrderResponse, OrderResponseSimple, PackingList, PriorInformationNotice, ProductActivity, Quotation, ReceiptAdvice, Reminder, RemittanceAdvice, RequestForQuotation, RetailEvent, SelfBilledCreditNote, SelfBilledInvoice, Statement, StockAvailabilityReport, Tender, TenderReceipt, TendererQualification, TendererQualificationResponse, TradeItemLocationProfile, TransportExecutionPlan, TransportExecutionPlanRequest, TransportProgressStatus, TransportProgressStatusRequest, TransportServiceDescription, TransportServiceDescriptionRequest, TransportationStatus, TransportationStatusRequest, UnawardedNotification, UtilityStatement, Waybill",
|
|
62
|
+
)
|
|
63
|
+
senderId: str | None = Field(default=None, description="Gets or sets the sender PEPPOL participant ID.")
|
|
64
|
+
senderName: str | None = Field(default=None, description="Gets or sets the sender display name.")
|
|
65
|
+
receiverId: str | None = Field(default=None, description="Gets or sets the receiver PEPPOL participant ID.")
|
|
66
|
+
receiverName: str | None = Field(default=None, description="Gets or sets the receiver display name.")
|
|
67
|
+
message: str | None = Field(default=None, description="Gets or sets the human-readable message text.")
|
|
68
|
+
document: DocumentLink | None = None
|
|
69
|
+
archivedAt: WflowTimestamp | None = Field(
|
|
70
|
+
default=None, description="Gets or sets the date and time when the message was archived."
|
|
71
|
+
)
|
|
72
|
+
direction: str | None = Field(default=None, description="One of: Incoming, Outgoing")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class Attachment(WflowModel):
|
|
76
|
+
"""Represents a PEPPOL message attachment."""
|
|
77
|
+
|
|
78
|
+
content: str | None = Field(default=None, description="Gets or sets the attachment content.")
|
|
79
|
+
contentType: str | None = Field(default=None, description="Gets or sets the MIME content type.")
|
|
80
|
+
name: str | None = Field(default=None, description="Gets or sets the attachment file name.")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class MessageMetadata(WflowModel):
|
|
84
|
+
documentIdentifier: str | None = None
|
|
85
|
+
documentFormat: str | None = None
|
|
86
|
+
sentAt: WflowTimestamp | None = None
|
|
87
|
+
processIdentifier: str | None = None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class PeppolMessageDetail(WflowModel):
|
|
91
|
+
"""Represents detailed PEPPOL message data including document content and metadata."""
|
|
92
|
+
|
|
93
|
+
message: PeppolMessage | None = None
|
|
94
|
+
document: Document | None = None
|
|
95
|
+
attachments: list[Attachment] | None = Field(
|
|
96
|
+
default=None, description="Gets or sets the list of document attachments."
|
|
97
|
+
)
|
|
98
|
+
metadata: MessageMetadata | None = None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class PeppolMessageRejectRequest(WflowModel):
|
|
102
|
+
"""Represents a request to reject a PEPPOL message."""
|
|
103
|
+
|
|
104
|
+
reason: str | None = Field(
|
|
105
|
+
default=None,
|
|
106
|
+
description="One of: NoIssue, ReferencesIncorrect, LegalInformationIncorrect, ReceiverUnknown, ItemQualityInsufficient, DeliveryIssues, PricesIncorrect, QuantityIncorrect, ItemsIncorrect, PaymentTermsIncorrect, NotRecognized, FinanceIncorrect, PartiallyPaid, Other",
|
|
107
|
+
)
|
|
108
|
+
requiredAction: str | None = Field(
|
|
109
|
+
default=None,
|
|
110
|
+
description="One of: NoActionRequired, ProvideInformation, IssueNewInvoice, CreditFully, CreditPartially, CreditTheAmount, Other",
|
|
111
|
+
)
|
|
112
|
+
note: str | None = Field(default=None, description="Gets or sets an optional note with additional details.")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class SendDocumentViaPeppolRequestAttachment(WflowModel):
|
|
116
|
+
fileId: str | None = None
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class SendDocumentViaPeppolRequest(WflowModel):
|
|
120
|
+
recipientPeppolId: str | None = None
|
|
121
|
+
note: str | None = None
|
|
122
|
+
attachments: list[SendDocumentViaPeppolRequestAttachment] | None = None
|
|
@@ -134,6 +134,10 @@ class PartnerFull(WflowModel):
|
|
|
134
134
|
language: str | None = Field(default=None, description="ISO 639-1 code")
|
|
135
135
|
isValid: bool | None = None
|
|
136
136
|
businessRegisterRegistration: str | None = None
|
|
137
|
+
buyerReference: str | None = Field(
|
|
138
|
+
default=None,
|
|
139
|
+
description="Buyer reference the partner wants on documents issued to them, e.g. a department or cost centre code (max 100 characters)",
|
|
140
|
+
)
|
|
137
141
|
customer: bool | None = None
|
|
138
142
|
supplier: bool | None = None
|
|
139
143
|
accountNo: str | None = None
|
|
@@ -9,12 +9,12 @@ then review the diff; hand-written descriptions live here and must not be lost.
|
|
|
9
9
|
Every field is optional, and operations serialise with `model_dump(exclude_none=True)`: a whole-record
|
|
10
10
|
write that sent every unset optional as null would clear data the caller never mentioned.
|
|
11
11
|
|
|
12
|
-
That command's dependency closure emits
|
|
12
|
+
That command's dependency closure emits 33 classes, not the 23 below. The other 10 are schemas
|
|
13
13
|
this codebase already models elsewhere, so delete them from the regenerated output — one name
|
|
14
|
-
must mean one shape.
|
|
14
|
+
must mean one shape. Five are imported back, so that every write body is reachable from here:
|
|
15
15
|
|
|
16
16
|
- from wflow_api.models.admin: ApprovalsTemplatesTeam, WebHookRegistration
|
|
17
|
-
- from wflow_api.models.documents: DocumentTypeFull, PropertyDefinition
|
|
17
|
+
- from wflow_api.models.documents: DocumentPrintSettings, DocumentTypeFull, PropertyDefinition
|
|
18
18
|
|
|
19
19
|
The remaining five — `Identity`, `SequenceBase`, `UserBase` and `UserPermission` from
|
|
20
20
|
wflow_api.models.documents, `Serie` from wflow_api.models.registers — reach the closure only as
|
|
@@ -26,7 +26,11 @@ from pydantic import Field
|
|
|
26
26
|
|
|
27
27
|
from wflow_api.models.admin import ApprovalsTemplatesTeam, WebHookRegistration # noqa: F401 — re-exported
|
|
28
28
|
from wflow_api.models.common import WflowModel, WflowTimestamp
|
|
29
|
-
from wflow_api.models.documents import
|
|
29
|
+
from wflow_api.models.documents import ( # noqa: F401 — re-exported
|
|
30
|
+
DocumentPrintSettings,
|
|
31
|
+
DocumentTypeFull,
|
|
32
|
+
PropertyDefinition,
|
|
33
|
+
)
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
class DocumentUpdateType(WflowModel):
|
|
@@ -195,6 +199,10 @@ class DocumentUpdate(WflowModel):
|
|
|
195
199
|
exchangeRateUnits: int | None = Field(default=None, description="Exchange rate units")
|
|
196
200
|
tag: str | None = Field(default=None, description="Special document identification")
|
|
197
201
|
orderNo: str | None = Field(default=None, description="Linked order number")
|
|
202
|
+
buyerReference: str | None = Field(
|
|
203
|
+
default=None,
|
|
204
|
+
description="Buyer reference: an identifier the buyer assigns for internal routing, e.g. a department or cost centre code (max 100 characters)",
|
|
205
|
+
)
|
|
198
206
|
description: str | None = Field(default=None, description="Document description")
|
|
199
207
|
contactPersonName: str | None = Field(default=None, description="Contact person name")
|
|
200
208
|
contactPersonEmail: str | None = Field(default=None, description="Contact person email")
|
|
@@ -214,6 +222,7 @@ class DocumentUpdate(WflowModel):
|
|
|
214
222
|
vaTs: list[DocumentUpdateVat] | None = Field(default=None, description="VAT subtotals")
|
|
215
223
|
lines: list[DocumentUpdateLine] | None = Field(default=None, description="Lines list")
|
|
216
224
|
accounting: DocumentUpdateAccounting | None = None
|
|
225
|
+
printSettings: DocumentPrintSettings | None = None
|
|
217
226
|
taxExclusiveAmount: float | None = None
|
|
218
227
|
taxAmount: float | None = None
|
|
219
228
|
|
|
@@ -96,8 +96,9 @@ async def delete_document_file(client: WflowClient, organization: OrgSlug, fileI
|
|
|
96
96
|
async def stamp_document_file(client: WflowClient, organization: OrgSlug, documentId: str, fileId: str) -> WriteResult:
|
|
97
97
|
"""Apply wflow's time stamp to one file attached to a document.
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
PDF can be stamped; any other file is rejected as
|
|
99
|
+
Stamping overwrites the PDF in place: the unstamped original is gone, and nothing
|
|
100
|
+
takes the stamp off again. Only a PDF can be stamped; any other file is rejected as
|
|
101
|
+
an unsupported file type.
|
|
101
102
|
`list_document_files` reports which files already carry one as `stamped`, and a
|
|
102
103
|
document type can stamp automatically — `list_document_types` shows that as `autoStamp`.
|
|
103
104
|
|