invowerk 1.0.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.
Files changed (64) hide show
  1. invowerk-1.0.0/PKG-INFO +49 -0
  2. invowerk-1.0.0/README.md +40 -0
  3. invowerk-1.0.0/invowerk/__init__.py +8 -0
  4. invowerk-1.0.0/invowerk/api/__init__.py +1 -0
  5. invowerk-1.0.0/invowerk/api/account/__init__.py +1 -0
  6. invowerk-1.0.0/invowerk/api/account/get_me.py +176 -0
  7. invowerk-1.0.0/invowerk/api/generation/__init__.py +1 -0
  8. invowerk-1.0.0/invowerk/api/generation/generate_invoice.py +284 -0
  9. invowerk-1.0.0/invowerk/api/rendering/__init__.py +1 -0
  10. invowerk-1.0.0/invowerk/api/rendering/render_invoice.py +276 -0
  11. invowerk-1.0.0/invowerk/api/rules/__init__.py +1 -0
  12. invowerk-1.0.0/invowerk/api/rules/explain_codes.py +236 -0
  13. invowerk-1.0.0/invowerk/api/transform/__init__.py +1 -0
  14. invowerk-1.0.0/invowerk/api/transform/convert_invoice.py +304 -0
  15. invowerk-1.0.0/invowerk/api/transform/parse_invoice.py +212 -0
  16. invowerk-1.0.0/invowerk/api/validation/__init__.py +1 -0
  17. invowerk-1.0.0/invowerk/api/validation/validate_invoice.py +293 -0
  18. invowerk-1.0.0/invowerk/client.py +268 -0
  19. invowerk-1.0.0/invowerk/errors.py +16 -0
  20. invowerk-1.0.0/invowerk/models/__init__.py +85 -0
  21. invowerk-1.0.0/invowerk/models/body_render_invoice.py +100 -0
  22. invowerk-1.0.0/invowerk/models/buyer.py +101 -0
  23. invowerk-1.0.0/invowerk/models/content_class.py +77 -0
  24. invowerk-1.0.0/invowerk/models/convert_invoice_body.py +75 -0
  25. invowerk-1.0.0/invowerk/models/convert_response.py +95 -0
  26. invowerk-1.0.0/invowerk/models/convert_self_validation.py +73 -0
  27. invowerk-1.0.0/invowerk/models/credits_info.py +95 -0
  28. invowerk-1.0.0/invowerk/models/document_totals.py +113 -0
  29. invowerk-1.0.0/invowerk/models/e_rechnung_de.py +106 -0
  30. invowerk-1.0.0/invowerk/models/error_classes.py +143 -0
  31. invowerk-1.0.0/invowerk/models/evidence.py +93 -0
  32. invowerk-1.0.0/invowerk/models/explain_response.py +88 -0
  33. invowerk-1.0.0/invowerk/models/finding.py +174 -0
  34. invowerk-1.0.0/invowerk/models/finding_explain_type_0.py +45 -0
  35. invowerk-1.0.0/invowerk/models/flavor.py +9 -0
  36. invowerk-1.0.0/invowerk/models/generate_request.py +242 -0
  37. invowerk-1.0.0/invowerk/models/generate_response.py +95 -0
  38. invowerk-1.0.0/invowerk/models/hint_info.py +111 -0
  39. invowerk-1.0.0/invowerk/models/invoice_line.py +136 -0
  40. invowerk-1.0.0/invowerk/models/me_response.py +135 -0
  41. invowerk-1.0.0/invowerk/models/parse_detection.py +85 -0
  42. invowerk-1.0.0/invowerk/models/parse_invoice_body.py +75 -0
  43. invowerk-1.0.0/invowerk/models/parse_response.py +88 -0
  44. invowerk-1.0.0/invowerk/models/parse_response_model.py +50 -0
  45. invowerk-1.0.0/invowerk/models/postal_address.py +107 -0
  46. invowerk-1.0.0/invowerk/models/problem.py +190 -0
  47. invowerk-1.0.0/invowerk/models/problem_errors_type_0_item.py +45 -0
  48. invowerk-1.0.0/invowerk/models/rate_limit_info.py +118 -0
  49. invowerk-1.0.0/invowerk/models/render_response.py +86 -0
  50. invowerk-1.0.0/invowerk/models/rule_explanation.py +145 -0
  51. invowerk-1.0.0/invowerk/models/scenario_info.py +71 -0
  52. invowerk-1.0.0/invowerk/models/self_validation.py +81 -0
  53. invowerk-1.0.0/invowerk/models/seller.py +182 -0
  54. invowerk-1.0.0/invowerk/models/syntax.py +9 -0
  55. invowerk-1.0.0/invowerk/models/tax_breakdown.py +108 -0
  56. invowerk-1.0.0/invowerk/models/validate_invoice_body.py +75 -0
  57. invowerk-1.0.0/invowerk/models/validation_response.py +294 -0
  58. invowerk-1.0.0/invowerk/models/validation_response_detection.py +50 -0
  59. invowerk-1.0.0/invowerk/models/validation_response_rulesets.py +47 -0
  60. invowerk-1.0.0/invowerk/models/validator_versions.py +70 -0
  61. invowerk-1.0.0/invowerk/py.typed +1 -0
  62. invowerk-1.0.0/invowerk/types.py +54 -0
  63. invowerk-1.0.0/pyproject.toml +29 -0
  64. invowerk-1.0.0/pyproject.toml.orig +25 -0
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.3
2
+ Name: invowerk
3
+ Version: 1.0.0
4
+ Summary: A client library for accessing invowerk
5
+ Requires-Dist: httpx>=0.23.1,<0.29.0
6
+ Requires-Dist: attrs>=22.2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+
10
+ # invowerk — Python SDK
11
+
12
+ Python client for the invowerk API: validate XRechnung, ZUGFeRD, Factur-X and Peppol BIS e-invoices from your code or CI.
13
+
14
+ ```sh
15
+ pip install invowerk
16
+ ```
17
+
18
+ [Get an API key](https://invowerk.dev/go/pypi-sdk?to=/app/api-keys) and pass it to the client:
19
+
20
+ ```python
21
+ import os
22
+
23
+ from invowerk import AuthenticatedClient
24
+ from invowerk.api.account import get_me
25
+
26
+ client = AuthenticatedClient(
27
+ base_url="https://api.invowerk.dev",
28
+ token=os.environ["INVOWERK_API_KEY"],
29
+ auth_header_name="X-API-Key",
30
+ prefix="",
31
+ )
32
+ print(get_me.sync(client=client))
33
+ ```
34
+
35
+ Every operation is a module with `sync`, `sync_detailed`, `asyncio` and `asyncio_detailed`; file fields take a `invowerk.types.File(payload=..., file_name=..., mime_type=...)`.
36
+
37
+ ## Operations
38
+
39
+ | Operation | Module | What it does |
40
+ |---|---|---|
41
+ | `GET /v1/me` | `invowerk.api.account.get_me` | Your plan, remaining requests, and remaining credits |
42
+ | `POST /v1/parse` | `invowerk.api.transform.parse_invoice` | Read an e-invoice into JSON |
43
+ | `POST /v1/convert` | `invowerk.api.transform.convert_invoice` | Convert an e-invoice between UBL and CII |
44
+ | `POST /v1/generate` | `invowerk.api.generation.generate_invoice` | Create an e-invoice from JSON |
45
+ | `GET /v1/explain` | `invowerk.api.rules.explain_codes` | Explain an error code |
46
+ | `POST /v1/render` | `invowerk.api.rendering.render_invoice` | Render an e-invoice as HTML |
47
+ | `POST /v1/validate` | `invowerk.api.validation.validate_invoice` | Check an e-invoice |
48
+
49
+ Generated with openapi-python-client from [`openapi.sdk.json`](../openapi.sdk.json). API reference: https://invowerk.dev/docs · Support: https://invowerk.dev/support
@@ -0,0 +1,40 @@
1
+ # invowerk — Python SDK
2
+
3
+ Python client for the invowerk API: validate XRechnung, ZUGFeRD, Factur-X and Peppol BIS e-invoices from your code or CI.
4
+
5
+ ```sh
6
+ pip install invowerk
7
+ ```
8
+
9
+ [Get an API key](https://invowerk.dev/go/pypi-sdk?to=/app/api-keys) and pass it to the client:
10
+
11
+ ```python
12
+ import os
13
+
14
+ from invowerk import AuthenticatedClient
15
+ from invowerk.api.account import get_me
16
+
17
+ client = AuthenticatedClient(
18
+ base_url="https://api.invowerk.dev",
19
+ token=os.environ["INVOWERK_API_KEY"],
20
+ auth_header_name="X-API-Key",
21
+ prefix="",
22
+ )
23
+ print(get_me.sync(client=client))
24
+ ```
25
+
26
+ Every operation is a module with `sync`, `sync_detailed`, `asyncio` and `asyncio_detailed`; file fields take a `invowerk.types.File(payload=..., file_name=..., mime_type=...)`.
27
+
28
+ ## Operations
29
+
30
+ | Operation | Module | What it does |
31
+ |---|---|---|
32
+ | `GET /v1/me` | `invowerk.api.account.get_me` | Your plan, remaining requests, and remaining credits |
33
+ | `POST /v1/parse` | `invowerk.api.transform.parse_invoice` | Read an e-invoice into JSON |
34
+ | `POST /v1/convert` | `invowerk.api.transform.convert_invoice` | Convert an e-invoice between UBL and CII |
35
+ | `POST /v1/generate` | `invowerk.api.generation.generate_invoice` | Create an e-invoice from JSON |
36
+ | `GET /v1/explain` | `invowerk.api.rules.explain_codes` | Explain an error code |
37
+ | `POST /v1/render` | `invowerk.api.rendering.render_invoice` | Render an e-invoice as HTML |
38
+ | `POST /v1/validate` | `invowerk.api.validation.validate_invoice` | Check an e-invoice |
39
+
40
+ Generated with openapi-python-client from [`openapi.sdk.json`](../openapi.sdk.json). API reference: https://invowerk.dev/docs · Support: https://invowerk.dev/support
@@ -0,0 +1,8 @@
1
+ """A client library for accessing invowerk"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,176 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.me_response import MeResponse
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": "/v1/me",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> MeResponse | None:
23
+ if response.status_code == 200:
24
+ response_200 = MeResponse.from_dict(response.json())
25
+
26
+ return response_200
27
+
28
+ if client.raise_on_unexpected_status:
29
+ raise errors.UnexpectedStatus(response.status_code, response.content)
30
+ else:
31
+ return None
32
+
33
+
34
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[MeResponse]:
35
+ return Response(
36
+ status_code=HTTPStatus(response.status_code),
37
+ content=response.content,
38
+ headers=response.headers,
39
+ parsed=_parse_response(client=client, response=response),
40
+ )
41
+
42
+
43
+ def sync_detailed(
44
+ *,
45
+ client: AuthenticatedClient,
46
+ ) -> Response[MeResponse]:
47
+ """Your plan, remaining requests, and remaining credits
48
+
49
+ Check where you stand before a call fails.
50
+
51
+ Returns the plan this request runs on and whether your key was recognized.
52
+ Without an `X-API-Key`, the call runs anonymously at the rate limit for
53
+ calls without a key. It also returns the requests left in the current window
54
+ and the features your plan includes. On plans priced in credits, it returns
55
+ the credits left in the current billing period.
56
+
57
+ This call does not count against your rate limit, so the numbers it reports
58
+ are the numbers you have.
59
+
60
+ **Credits:** free. This endpoint is not metered.
61
+
62
+ Raises:
63
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
64
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
65
+
66
+ Returns:
67
+ Response[MeResponse]
68
+ """
69
+
70
+ kwargs = _get_kwargs()
71
+
72
+ response = client.get_httpx_client().request(
73
+ **kwargs,
74
+ )
75
+
76
+ return _build_response(client=client, response=response)
77
+
78
+
79
+ def sync(
80
+ *,
81
+ client: AuthenticatedClient,
82
+ ) -> MeResponse | None:
83
+ """Your plan, remaining requests, and remaining credits
84
+
85
+ Check where you stand before a call fails.
86
+
87
+ Returns the plan this request runs on and whether your key was recognized.
88
+ Without an `X-API-Key`, the call runs anonymously at the rate limit for
89
+ calls without a key. It also returns the requests left in the current window
90
+ and the features your plan includes. On plans priced in credits, it returns
91
+ the credits left in the current billing period.
92
+
93
+ This call does not count against your rate limit, so the numbers it reports
94
+ are the numbers you have.
95
+
96
+ **Credits:** free. This endpoint is not metered.
97
+
98
+ Raises:
99
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
101
+
102
+ Returns:
103
+ MeResponse
104
+ """
105
+
106
+ return sync_detailed(
107
+ client=client,
108
+ ).parsed
109
+
110
+
111
+ async def asyncio_detailed(
112
+ *,
113
+ client: AuthenticatedClient,
114
+ ) -> Response[MeResponse]:
115
+ """Your plan, remaining requests, and remaining credits
116
+
117
+ Check where you stand before a call fails.
118
+
119
+ Returns the plan this request runs on and whether your key was recognized.
120
+ Without an `X-API-Key`, the call runs anonymously at the rate limit for
121
+ calls without a key. It also returns the requests left in the current window
122
+ and the features your plan includes. On plans priced in credits, it returns
123
+ the credits left in the current billing period.
124
+
125
+ This call does not count against your rate limit, so the numbers it reports
126
+ are the numbers you have.
127
+
128
+ **Credits:** free. This endpoint is not metered.
129
+
130
+ Raises:
131
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
133
+
134
+ Returns:
135
+ Response[MeResponse]
136
+ """
137
+
138
+ kwargs = _get_kwargs()
139
+
140
+ response = await client.get_async_httpx_client().request(**kwargs)
141
+
142
+ return _build_response(client=client, response=response)
143
+
144
+
145
+ async def asyncio(
146
+ *,
147
+ client: AuthenticatedClient,
148
+ ) -> MeResponse | None:
149
+ """Your plan, remaining requests, and remaining credits
150
+
151
+ Check where you stand before a call fails.
152
+
153
+ Returns the plan this request runs on and whether your key was recognized.
154
+ Without an `X-API-Key`, the call runs anonymously at the rate limit for
155
+ calls without a key. It also returns the requests left in the current window
156
+ and the features your plan includes. On plans priced in credits, it returns
157
+ the credits left in the current billing period.
158
+
159
+ This call does not count against your rate limit, so the numbers it reports
160
+ are the numbers you have.
161
+
162
+ **Credits:** free. This endpoint is not metered.
163
+
164
+ Raises:
165
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
166
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
167
+
168
+ Returns:
169
+ MeResponse
170
+ """
171
+
172
+ return (
173
+ await asyncio_detailed(
174
+ client=client,
175
+ )
176
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,284 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.generate_request import GenerateRequest
9
+ from ...models.generate_response import GenerateResponse
10
+ from ...models.problem import Problem
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: GenerateRequest,
17
+ format_: None | str | Unset = "json",
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ params: dict[str, Any] = {}
22
+
23
+ json_format_: None | str | Unset
24
+ if isinstance(format_, Unset):
25
+ json_format_ = UNSET
26
+ else:
27
+ json_format_ = format_
28
+ params["format"] = json_format_
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "post",
34
+ "url": "/v1/generate",
35
+ "params": params,
36
+ }
37
+
38
+ _kwargs["json"] = body.to_dict()
39
+
40
+ headers["Content-Type"] = "application/json"
41
+
42
+ _kwargs["headers"] = headers
43
+ return _kwargs
44
+
45
+
46
+ def _parse_response(
47
+ *, client: AuthenticatedClient | Client, response: httpx.Response
48
+ ) -> GenerateResponse | Problem | None:
49
+ if response.status_code == 200:
50
+ response_200 = GenerateResponse.from_dict(response.json())
51
+
52
+ return response_200
53
+
54
+ if response.status_code == 422:
55
+ response_422 = Problem.from_dict(response.json())
56
+
57
+ return response_422
58
+
59
+ if response.status_code == 500:
60
+ response_500 = Problem.from_dict(response.json())
61
+
62
+ return response_500
63
+
64
+ if client.raise_on_unexpected_status:
65
+ raise errors.UnexpectedStatus(response.status_code, response.content)
66
+ else:
67
+ return None
68
+
69
+
70
+ def _build_response(
71
+ *, client: AuthenticatedClient | Client, response: httpx.Response
72
+ ) -> Response[GenerateResponse | Problem]:
73
+ return Response(
74
+ status_code=HTTPStatus(response.status_code),
75
+ content=response.content,
76
+ headers=response.headers,
77
+ parsed=_parse_response(client=client, response=response),
78
+ )
79
+
80
+
81
+ def sync_detailed(
82
+ *,
83
+ client: AuthenticatedClient,
84
+ body: GenerateRequest,
85
+ format_: None | str | Unset = "json",
86
+ ) -> Response[GenerateResponse | Problem]:
87
+ """Create an e-invoice from JSON
88
+
89
+ Create an EN 16931 e-invoice from JSON.
90
+
91
+ The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
92
+ (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
93
+ requires `buyer_reference` (BT-10, the Leitweg-ID). invowerk writes your
94
+ amounts as given. It does not compute or correct them. Before answering,
95
+ invowerk checks the generated XML and never returns an invalid document. The
96
+ answer is `application/xml`; `?format=json` returns
97
+ `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
98
+ details per field; 500 when the generated XML fails the check (the credits are
99
+ refunded); 429 when every slot is busy (callers without an API key share
100
+ one); 504 when it took longer than 20 s. Costs 5 credits.
101
+
102
+ **Credits:** 5 per call.
103
+
104
+ Args:
105
+ format_ (None | str | Unset): 'json' returns {xml, syntax, flavor, self_validation};
106
+ omitted returns raw application/xml. Default: 'json'.
107
+ body (GenerateRequest): The request body of POST /v1/generate: an EN 16931 invoice, keyed
108
+ on
109
+ Business Terms (BT-*).
110
+
111
+ All amounts are your own figures. invowerk writes them into the XML and
112
+ checks the result against EN 16931 (and XRechnung, if selected). It does not
113
+ compute or correct them.
114
+
115
+ Raises:
116
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
118
+
119
+ Returns:
120
+ Response[GenerateResponse | Problem]
121
+ """
122
+
123
+ kwargs = _get_kwargs(
124
+ body=body,
125
+ format_=format_,
126
+ )
127
+
128
+ response = client.get_httpx_client().request(
129
+ **kwargs,
130
+ )
131
+
132
+ return _build_response(client=client, response=response)
133
+
134
+
135
+ def sync(
136
+ *,
137
+ client: AuthenticatedClient,
138
+ body: GenerateRequest,
139
+ format_: None | str | Unset = "json",
140
+ ) -> GenerateResponse | Problem | None:
141
+ """Create an e-invoice from JSON
142
+
143
+ Create an EN 16931 e-invoice from JSON.
144
+
145
+ The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
146
+ (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
147
+ requires `buyer_reference` (BT-10, the Leitweg-ID). invowerk writes your
148
+ amounts as given. It does not compute or correct them. Before answering,
149
+ invowerk checks the generated XML and never returns an invalid document. The
150
+ answer is `application/xml`; `?format=json` returns
151
+ `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
152
+ details per field; 500 when the generated XML fails the check (the credits are
153
+ refunded); 429 when every slot is busy (callers without an API key share
154
+ one); 504 when it took longer than 20 s. Costs 5 credits.
155
+
156
+ **Credits:** 5 per call.
157
+
158
+ Args:
159
+ format_ (None | str | Unset): 'json' returns {xml, syntax, flavor, self_validation};
160
+ omitted returns raw application/xml. Default: 'json'.
161
+ body (GenerateRequest): The request body of POST /v1/generate: an EN 16931 invoice, keyed
162
+ on
163
+ Business Terms (BT-*).
164
+
165
+ All amounts are your own figures. invowerk writes them into the XML and
166
+ checks the result against EN 16931 (and XRechnung, if selected). It does not
167
+ compute or correct them.
168
+
169
+ Raises:
170
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
171
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
172
+
173
+ Returns:
174
+ GenerateResponse | Problem
175
+ """
176
+
177
+ return sync_detailed(
178
+ client=client,
179
+ body=body,
180
+ format_=format_,
181
+ ).parsed
182
+
183
+
184
+ async def asyncio_detailed(
185
+ *,
186
+ client: AuthenticatedClient,
187
+ body: GenerateRequest,
188
+ format_: None | str | Unset = "json",
189
+ ) -> Response[GenerateResponse | Problem]:
190
+ """Create an e-invoice from JSON
191
+
192
+ Create an EN 16931 e-invoice from JSON.
193
+
194
+ The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
195
+ (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
196
+ requires `buyer_reference` (BT-10, the Leitweg-ID). invowerk writes your
197
+ amounts as given. It does not compute or correct them. Before answering,
198
+ invowerk checks the generated XML and never returns an invalid document. The
199
+ answer is `application/xml`; `?format=json` returns
200
+ `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
201
+ details per field; 500 when the generated XML fails the check (the credits are
202
+ refunded); 429 when every slot is busy (callers without an API key share
203
+ one); 504 when it took longer than 20 s. Costs 5 credits.
204
+
205
+ **Credits:** 5 per call.
206
+
207
+ Args:
208
+ format_ (None | str | Unset): 'json' returns {xml, syntax, flavor, self_validation};
209
+ omitted returns raw application/xml. Default: 'json'.
210
+ body (GenerateRequest): The request body of POST /v1/generate: an EN 16931 invoice, keyed
211
+ on
212
+ Business Terms (BT-*).
213
+
214
+ All amounts are your own figures. invowerk writes them into the XML and
215
+ checks the result against EN 16931 (and XRechnung, if selected). It does not
216
+ compute or correct them.
217
+
218
+ Raises:
219
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
220
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
221
+
222
+ Returns:
223
+ Response[GenerateResponse | Problem]
224
+ """
225
+
226
+ kwargs = _get_kwargs(
227
+ body=body,
228
+ format_=format_,
229
+ )
230
+
231
+ response = await client.get_async_httpx_client().request(**kwargs)
232
+
233
+ return _build_response(client=client, response=response)
234
+
235
+
236
+ async def asyncio(
237
+ *,
238
+ client: AuthenticatedClient,
239
+ body: GenerateRequest,
240
+ format_: None | str | Unset = "json",
241
+ ) -> GenerateResponse | Problem | None:
242
+ """Create an e-invoice from JSON
243
+
244
+ Create an EN 16931 e-invoice from JSON.
245
+
246
+ The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
247
+ (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
248
+ requires `buyer_reference` (BT-10, the Leitweg-ID). invowerk writes your
249
+ amounts as given. It does not compute or correct them. Before answering,
250
+ invowerk checks the generated XML and never returns an invalid document. The
251
+ answer is `application/xml`; `?format=json` returns
252
+ `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
253
+ details per field; 500 when the generated XML fails the check (the credits are
254
+ refunded); 429 when every slot is busy (callers without an API key share
255
+ one); 504 when it took longer than 20 s. Costs 5 credits.
256
+
257
+ **Credits:** 5 per call.
258
+
259
+ Args:
260
+ format_ (None | str | Unset): 'json' returns {xml, syntax, flavor, self_validation};
261
+ omitted returns raw application/xml. Default: 'json'.
262
+ body (GenerateRequest): The request body of POST /v1/generate: an EN 16931 invoice, keyed
263
+ on
264
+ Business Terms (BT-*).
265
+
266
+ All amounts are your own figures. invowerk writes them into the XML and
267
+ checks the result against EN 16931 (and XRechnung, if selected). It does not
268
+ compute or correct them.
269
+
270
+ Raises:
271
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
272
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
273
+
274
+ Returns:
275
+ GenerateResponse | Problem
276
+ """
277
+
278
+ return (
279
+ await asyncio_detailed(
280
+ client=client,
281
+ body=body,
282
+ format_=format_,
283
+ )
284
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""