Skip to content

Commit 0b9627e

Browse files
authored
- manually patch the OpenAPI specification for POST /nadag/innmelding/v1/GeotekniskBorehull with content type from */* (unsupported content type) to application/json. (#10)
- manually compile new package
1 parent a023b72 commit 0b9627e

File tree

6 files changed

+292
-16
lines changed

6 files changed

+292
-16
lines changed

nadag-innmelding-python-client/nadag_innmelding_python_client/api/default/delete_nadag_innmelding_v_1_geoteknisk_unders_geoteknisk_unders_id_unders_pkt_geoteknisk_borehull_id.py

Lines changed: 99 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,50 @@
55

66
from ... import errors
77
from ...client import AuthenticatedClient, Client
8-
from ...types import Response
8+
from ...models.epsg_code import EpsgCode
9+
from ...models.validated_geoteknisk_unders import ValidatedGeotekniskUnders
10+
from ...types import UNSET, Response
911

1012

1113
def _get_kwargs(
1214
geoteknisk_unders_id: str,
1315
geoteknisk_borehull_id: str,
16+
*,
17+
epsg_code: EpsgCode,
1418
) -> dict[str, Any]:
19+
params: dict[str, Any] = {}
20+
21+
json_epsg_code = epsg_code.value
22+
params["epsgCode"] = json_epsg_code
23+
24+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25+
1526
_kwargs: dict[str, Any] = {
1627
"method": "delete",
1728
"url": f"/nadag/innmelding/v1/GeotekniskUnders/{geoteknisk_unders_id}/undersPkt/{geoteknisk_borehull_id}",
29+
"params": params,
1830
}
1931

2032
return _kwargs
2133

2234

23-
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
24-
if response.status_code == 204:
25-
return None
35+
def _parse_response(
36+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
37+
) -> Optional[ValidatedGeotekniskUnders]:
38+
if response.status_code == 200:
39+
response_200 = ValidatedGeotekniskUnders.from_dict(response.json())
40+
41+
return response_200
2642

2743
if client.raise_on_unexpected_status:
2844
raise errors.UnexpectedStatus(response.status_code, response.content)
2945
else:
3046
return None
3147

3248

33-
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
49+
def _build_response(
50+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
51+
) -> Response[ValidatedGeotekniskUnders]:
3452
return Response(
3553
status_code=HTTPStatus(response.status_code),
3654
content=response.content,
@@ -44,26 +62,29 @@ def sync_detailed(
4462
geoteknisk_borehull_id: str,
4563
*,
4664
client: AuthenticatedClient,
47-
) -> Response[Any]:
65+
epsg_code: EpsgCode,
66+
) -> Response[ValidatedGeotekniskUnders]:
4867
"""Deletes a GeotekniskBorehull.
4968
5069
Deletes a GeotekniskBorehull.
5170
5271
Args:
5372
geoteknisk_unders_id (str):
5473
geoteknisk_borehull_id (str):
74+
epsg_code (EpsgCode):
5575
5676
Raises:
5777
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
5878
httpx.TimeoutException: If the request takes longer than Client.timeout.
5979
6080
Returns:
61-
Response[Any]
81+
Response[ValidatedGeotekniskUnders]
6282
"""
6383

6484
kwargs = _get_kwargs(
6585
geoteknisk_unders_id=geoteknisk_unders_id,
6686
geoteknisk_borehull_id=geoteknisk_borehull_id,
87+
epsg_code=epsg_code,
6788
)
6889

6990
response = client.get_httpx_client().request(
@@ -73,33 +94,102 @@ def sync_detailed(
7394
return _build_response(client=client, response=response)
7495

7596

97+
def sync(
98+
geoteknisk_unders_id: str,
99+
geoteknisk_borehull_id: str,
100+
*,
101+
client: AuthenticatedClient,
102+
epsg_code: EpsgCode,
103+
) -> Optional[ValidatedGeotekniskUnders]:
104+
"""Deletes a GeotekniskBorehull.
105+
106+
Deletes a GeotekniskBorehull.
107+
108+
Args:
109+
geoteknisk_unders_id (str):
110+
geoteknisk_borehull_id (str):
111+
epsg_code (EpsgCode):
112+
113+
Raises:
114+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115+
httpx.TimeoutException: If the request takes longer than Client.timeout.
116+
117+
Returns:
118+
ValidatedGeotekniskUnders
119+
"""
120+
121+
return sync_detailed(
122+
geoteknisk_unders_id=geoteknisk_unders_id,
123+
geoteknisk_borehull_id=geoteknisk_borehull_id,
124+
client=client,
125+
epsg_code=epsg_code,
126+
).parsed
127+
128+
76129
async def asyncio_detailed(
77130
geoteknisk_unders_id: str,
78131
geoteknisk_borehull_id: str,
79132
*,
80133
client: AuthenticatedClient,
81-
) -> Response[Any]:
134+
epsg_code: EpsgCode,
135+
) -> Response[ValidatedGeotekniskUnders]:
82136
"""Deletes a GeotekniskBorehull.
83137
84138
Deletes a GeotekniskBorehull.
85139
86140
Args:
87141
geoteknisk_unders_id (str):
88142
geoteknisk_borehull_id (str):
143+
epsg_code (EpsgCode):
89144
90145
Raises:
91146
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92147
httpx.TimeoutException: If the request takes longer than Client.timeout.
93148
94149
Returns:
95-
Response[Any]
150+
Response[ValidatedGeotekniskUnders]
96151
"""
97152

98153
kwargs = _get_kwargs(
99154
geoteknisk_unders_id=geoteknisk_unders_id,
100155
geoteknisk_borehull_id=geoteknisk_borehull_id,
156+
epsg_code=epsg_code,
101157
)
102158

103159
response = await client.get_async_httpx_client().request(**kwargs)
104160

105161
return _build_response(client=client, response=response)
162+
163+
164+
async def asyncio(
165+
geoteknisk_unders_id: str,
166+
geoteknisk_borehull_id: str,
167+
*,
168+
client: AuthenticatedClient,
169+
epsg_code: EpsgCode,
170+
) -> Optional[ValidatedGeotekniskUnders]:
171+
"""Deletes a GeotekniskBorehull.
172+
173+
Deletes a GeotekniskBorehull.
174+
175+
Args:
176+
geoteknisk_unders_id (str):
177+
geoteknisk_borehull_id (str):
178+
epsg_code (EpsgCode):
179+
180+
Raises:
181+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
182+
httpx.TimeoutException: If the request takes longer than Client.timeout.
183+
184+
Returns:
185+
ValidatedGeotekniskUnders
186+
"""
187+
188+
return (
189+
await asyncio_detailed(
190+
geoteknisk_unders_id=geoteknisk_unders_id,
191+
geoteknisk_borehull_id=geoteknisk_borehull_id,
192+
client=client,
193+
epsg_code=epsg_code,
194+
)
195+
).parsed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
from http import HTTPStatus
2+
from typing import Any, Optional, Union, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.ekstern_identifikasjon import EksternIdentifikasjon
9+
from ...models.geoteknisk_borehull import GeotekniskBorehull
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
*,
15+
body: EksternIdentifikasjon,
16+
) -> dict[str, Any]:
17+
headers: dict[str, Any] = {}
18+
19+
_kwargs: dict[str, Any] = {
20+
"method": "post",
21+
"url": "/nadag/innmelding/v1/GeotekniskBorehull",
22+
}
23+
24+
_kwargs["json"] = body.to_dict()
25+
26+
headers["Content-Type"] = "application/json"
27+
28+
_kwargs["headers"] = headers
29+
return _kwargs
30+
31+
32+
def _parse_response(
33+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
34+
) -> Optional[Union[Any, GeotekniskBorehull]]:
35+
if response.status_code == 200:
36+
response_200 = GeotekniskBorehull.from_dict(response.json())
37+
38+
return response_200
39+
40+
if response.status_code == 401:
41+
response_401 = cast(Any, None)
42+
return response_401
43+
44+
if response.status_code == 404:
45+
response_404 = cast(Any, None)
46+
return response_404
47+
48+
if client.raise_on_unexpected_status:
49+
raise errors.UnexpectedStatus(response.status_code, response.content)
50+
else:
51+
return None
52+
53+
54+
def _build_response(
55+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
56+
) -> Response[Union[Any, GeotekniskBorehull]]:
57+
return Response(
58+
status_code=HTTPStatus(response.status_code),
59+
content=response.content,
60+
headers=response.headers,
61+
parsed=_parse_response(client=client, response=response),
62+
)
63+
64+
65+
def sync_detailed(
66+
*,
67+
client: Union[AuthenticatedClient, Client],
68+
body: EksternIdentifikasjon,
69+
) -> Response[Union[Any, GeotekniskBorehull]]:
70+
"""Fetches a GeotekniskBorehull by external id.
71+
72+
Fetches a GeotekniskBorehull by external id. Returns the most recent one.
73+
74+
Args:
75+
body (EksternIdentifikasjon): Identifikasjon av et objekt, ivaretatt av den ansvarlige
76+
leverandør inn til NADAG.
77+
78+
Raises:
79+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
80+
httpx.TimeoutException: If the request takes longer than Client.timeout.
81+
82+
Returns:
83+
Response[Union[Any, GeotekniskBorehull]]
84+
"""
85+
86+
kwargs = _get_kwargs(
87+
body=body,
88+
)
89+
90+
response = client.get_httpx_client().request(
91+
**kwargs,
92+
)
93+
94+
return _build_response(client=client, response=response)
95+
96+
97+
def sync(
98+
*,
99+
client: Union[AuthenticatedClient, Client],
100+
body: EksternIdentifikasjon,
101+
) -> Optional[Union[Any, GeotekniskBorehull]]:
102+
"""Fetches a GeotekniskBorehull by external id.
103+
104+
Fetches a GeotekniskBorehull by external id. Returns the most recent one.
105+
106+
Args:
107+
body (EksternIdentifikasjon): Identifikasjon av et objekt, ivaretatt av den ansvarlige
108+
leverandør inn til NADAG.
109+
110+
Raises:
111+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112+
httpx.TimeoutException: If the request takes longer than Client.timeout.
113+
114+
Returns:
115+
Union[Any, GeotekniskBorehull]
116+
"""
117+
118+
return sync_detailed(
119+
client=client,
120+
body=body,
121+
).parsed
122+
123+
124+
async def asyncio_detailed(
125+
*,
126+
client: Union[AuthenticatedClient, Client],
127+
body: EksternIdentifikasjon,
128+
) -> Response[Union[Any, GeotekniskBorehull]]:
129+
"""Fetches a GeotekniskBorehull by external id.
130+
131+
Fetches a GeotekniskBorehull by external id. Returns the most recent one.
132+
133+
Args:
134+
body (EksternIdentifikasjon): Identifikasjon av et objekt, ivaretatt av den ansvarlige
135+
leverandør inn til NADAG.
136+
137+
Raises:
138+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
139+
httpx.TimeoutException: If the request takes longer than Client.timeout.
140+
141+
Returns:
142+
Response[Union[Any, GeotekniskBorehull]]
143+
"""
144+
145+
kwargs = _get_kwargs(
146+
body=body,
147+
)
148+
149+
response = await client.get_async_httpx_client().request(**kwargs)
150+
151+
return _build_response(client=client, response=response)
152+
153+
154+
async def asyncio(
155+
*,
156+
client: Union[AuthenticatedClient, Client],
157+
body: EksternIdentifikasjon,
158+
) -> Optional[Union[Any, GeotekniskBorehull]]:
159+
"""Fetches a GeotekniskBorehull by external id.
160+
161+
Fetches a GeotekniskBorehull by external id. Returns the most recent one.
162+
163+
Args:
164+
body (EksternIdentifikasjon): Identifikasjon av et objekt, ivaretatt av den ansvarlige
165+
leverandør inn til NADAG.
166+
167+
Raises:
168+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
169+
httpx.TimeoutException: If the request takes longer than Client.timeout.
170+
171+
Returns:
172+
Union[Any, GeotekniskBorehull]
173+
"""
174+
175+
return (
176+
await asyncio_detailed(
177+
client=client,
178+
body=body,
179+
)
180+
).parsed

nadag-innmelding-python-client/nadag_innmelding_python_client/api/default/put_nadag_innmelding_v_1_geoteknisk_unders_geoteknisk_unders_id.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def _parse_response(
5252
response_401 = cast(Any, None)
5353
return response_401
5454

55+
if response.status_code == 404:
56+
response_404 = cast(Any, None)
57+
return response_404
58+
5559
if client.raise_on_unexpected_status:
5660
raise errors.UnexpectedStatus(response.status_code, response.content)
5761
else:

0 commit comments

Comments
 (0)