Skip to content

Commit 756cf6c

Browse files
committed
Update package version to 1.0-rc.3 and generated from the latest API specifications
1 parent b6ce107 commit 756cf6c

15 files changed

+516
-362
lines changed

MAINTAINERS_GUIDE.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
# Maintainers Guide
22

3-
See the [Makefile](./Makefile) if you need to install and test locally. Just type `make` to get the help.
3+
See the [Makefile](./Makefile) if you need to install and test locally. Just type `make` to get the help.
4+
5+
Or just follow these steps:
6+
7+
## For new API version
8+
9+
1. Copy and rename the openapi.yaml the `openapi_specification/nadag-innmelding.yaml`
10+
2. Update the version number in the `config.yaml` file
11+
3. Run the following command to generate the client code:
12+
```bash
13+
uvx openapi-python-client generate --path openapi_specification/nadag-innmelding.yaml --overwrite --custom-template-path=templates --config config.yaml
14+
```
15+
4. Check in the changes to the repository (files updated, added, or removed).
16+
5. In the GitHub project, create a new release and the package should be published to PyPi.

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project_name_override: nadag-innmelding-python-client
22
package_name_override: nadag_innmelding_python_client
3-
package_version_override: 1.0-rc.2
3+
package_version_override: 1.0-rc.3
44
post_hooks:
55
# - "bash -c 'cd field-manager-python-client && poetry install'"

nadag-innmelding-python-client/nadag_innmelding_python_client/api/default/delete_nadag_innmelding_v_1_geoteknisk_unders_geoteknisk_unders_id_geoteknisk_borehull_geoteknisk_borehull_id.py renamed to 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def _get_kwargs(
1414
) -> dict[str, Any]:
1515
_kwargs: dict[str, Any] = {
1616
"method": "delete",
17-
"url": f"/nadag/innmelding/v1/GeotekniskUnders/{geoteknisk_unders_id}/GeotekniskBorehull/{geoteknisk_borehull_id}",
17+
"url": f"/nadag/innmelding/v1/GeotekniskUnders/{geoteknisk_unders_id}/undersPkt/{geoteknisk_borehull_id}",
1818
}
1919

2020
return _kwargs
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
from http import HTTPStatus
2+
from typing import Any, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.geoteknisk_borehull import GeotekniskBorehull
9+
from ...types import UNSET, Response
10+
11+
12+
def _get_kwargs(
13+
*,
14+
ekstern_id: str,
15+
ekstern_navnerom: str,
16+
) -> dict[str, Any]:
17+
params: dict[str, Any] = {}
18+
19+
params["eksternId"] = ekstern_id
20+
21+
params["eksternNavnerom"] = ekstern_navnerom
22+
23+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
24+
25+
_kwargs: dict[str, Any] = {
26+
"method": "get",
27+
"url": "/nadag/innmelding/v1/GeotekniskBorehull",
28+
"params": params,
29+
}
30+
31+
return _kwargs
32+
33+
34+
def _parse_response(
35+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
36+
) -> Optional[GeotekniskBorehull]:
37+
if response.status_code == 200:
38+
response_200 = GeotekniskBorehull.from_dict(response.json())
39+
40+
return response_200
41+
if client.raise_on_unexpected_status:
42+
raise errors.UnexpectedStatus(response.status_code, response.content)
43+
else:
44+
return None
45+
46+
47+
def _build_response(
48+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
49+
) -> Response[GeotekniskBorehull]:
50+
return Response(
51+
status_code=HTTPStatus(response.status_code),
52+
content=response.content,
53+
headers=response.headers,
54+
parsed=_parse_response(client=client, response=response),
55+
)
56+
57+
58+
def sync_detailed(
59+
*,
60+
client: Union[AuthenticatedClient, Client],
61+
ekstern_id: str,
62+
ekstern_navnerom: str,
63+
) -> Response[GeotekniskBorehull]:
64+
"""Fetches a GeotekniskUnders by external id.
65+
66+
Fetches a GeotekniskUnders by external id.
67+
68+
Args:
69+
ekstern_id (str):
70+
ekstern_navnerom (str):
71+
72+
Raises:
73+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74+
httpx.TimeoutException: If the request takes longer than Client.timeout.
75+
76+
Returns:
77+
Response[GeotekniskBorehull]
78+
"""
79+
80+
kwargs = _get_kwargs(
81+
ekstern_id=ekstern_id,
82+
ekstern_navnerom=ekstern_navnerom,
83+
)
84+
85+
response = client.get_httpx_client().request(
86+
**kwargs,
87+
)
88+
89+
return _build_response(client=client, response=response)
90+
91+
92+
def sync(
93+
*,
94+
client: Union[AuthenticatedClient, Client],
95+
ekstern_id: str,
96+
ekstern_navnerom: str,
97+
) -> Optional[GeotekniskBorehull]:
98+
"""Fetches a GeotekniskUnders by external id.
99+
100+
Fetches a GeotekniskUnders by external id.
101+
102+
Args:
103+
ekstern_id (str):
104+
ekstern_navnerom (str):
105+
106+
Raises:
107+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108+
httpx.TimeoutException: If the request takes longer than Client.timeout.
109+
110+
Returns:
111+
GeotekniskBorehull
112+
"""
113+
114+
return sync_detailed(
115+
client=client,
116+
ekstern_id=ekstern_id,
117+
ekstern_navnerom=ekstern_navnerom,
118+
).parsed
119+
120+
121+
async def asyncio_detailed(
122+
*,
123+
client: Union[AuthenticatedClient, Client],
124+
ekstern_id: str,
125+
ekstern_navnerom: str,
126+
) -> Response[GeotekniskBorehull]:
127+
"""Fetches a GeotekniskUnders by external id.
128+
129+
Fetches a GeotekniskUnders by external id.
130+
131+
Args:
132+
ekstern_id (str):
133+
ekstern_navnerom (str):
134+
135+
Raises:
136+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
137+
httpx.TimeoutException: If the request takes longer than Client.timeout.
138+
139+
Returns:
140+
Response[GeotekniskBorehull]
141+
"""
142+
143+
kwargs = _get_kwargs(
144+
ekstern_id=ekstern_id,
145+
ekstern_navnerom=ekstern_navnerom,
146+
)
147+
148+
response = await client.get_async_httpx_client().request(**kwargs)
149+
150+
return _build_response(client=client, response=response)
151+
152+
153+
async def asyncio(
154+
*,
155+
client: Union[AuthenticatedClient, Client],
156+
ekstern_id: str,
157+
ekstern_navnerom: str,
158+
) -> Optional[GeotekniskBorehull]:
159+
"""Fetches a GeotekniskUnders by external id.
160+
161+
Fetches a GeotekniskUnders by external id.
162+
163+
Args:
164+
ekstern_id (str):
165+
ekstern_navnerom (str):
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+
GeotekniskBorehull
173+
"""
174+
175+
return (
176+
await asyncio_detailed(
177+
client=client,
178+
ekstern_id=ekstern_id,
179+
ekstern_navnerom=ekstern_navnerom,
180+
)
181+
).parsed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
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.geoteknisk_borehull import GeotekniskBorehull
9+
from ...types import Response
10+
11+
12+
def _get_kwargs(
13+
gb_id: str,
14+
) -> dict[str, Any]:
15+
_kwargs: dict[str, Any] = {
16+
"method": "get",
17+
"url": f"/nadag/innmelding/v1/GeotekniskBorehull/{gb_id}",
18+
}
19+
20+
return _kwargs
21+
22+
23+
def _parse_response(
24+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
25+
) -> Optional[Union[Any, GeotekniskBorehull]]:
26+
if response.status_code == 401:
27+
response_401 = cast(Any, None)
28+
return response_401
29+
if response.status_code == 200:
30+
response_200 = GeotekniskBorehull.from_dict(response.json())
31+
32+
return response_200
33+
if client.raise_on_unexpected_status:
34+
raise errors.UnexpectedStatus(response.status_code, response.content)
35+
else:
36+
return None
37+
38+
39+
def _build_response(
40+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
41+
) -> Response[Union[Any, GeotekniskBorehull]]:
42+
return Response(
43+
status_code=HTTPStatus(response.status_code),
44+
content=response.content,
45+
headers=response.headers,
46+
parsed=_parse_response(client=client, response=response),
47+
)
48+
49+
50+
def sync_detailed(
51+
gb_id: str,
52+
*,
53+
client: Union[AuthenticatedClient, Client],
54+
) -> Response[Union[Any, GeotekniskBorehull]]:
55+
"""Fetches a GeotekniskBorehull by id.
56+
57+
Fetches a GeotekniskBorehull by id.
58+
59+
Args:
60+
gb_id (str):
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[Union[Any, GeotekniskBorehull]]
68+
"""
69+
70+
kwargs = _get_kwargs(
71+
gb_id=gb_id,
72+
)
73+
74+
response = client.get_httpx_client().request(
75+
**kwargs,
76+
)
77+
78+
return _build_response(client=client, response=response)
79+
80+
81+
def sync(
82+
gb_id: str,
83+
*,
84+
client: Union[AuthenticatedClient, Client],
85+
) -> Optional[Union[Any, GeotekniskBorehull]]:
86+
"""Fetches a GeotekniskBorehull by id.
87+
88+
Fetches a GeotekniskBorehull by id.
89+
90+
Args:
91+
gb_id (str):
92+
93+
Raises:
94+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95+
httpx.TimeoutException: If the request takes longer than Client.timeout.
96+
97+
Returns:
98+
Union[Any, GeotekniskBorehull]
99+
"""
100+
101+
return sync_detailed(
102+
gb_id=gb_id,
103+
client=client,
104+
).parsed
105+
106+
107+
async def asyncio_detailed(
108+
gb_id: str,
109+
*,
110+
client: Union[AuthenticatedClient, Client],
111+
) -> Response[Union[Any, GeotekniskBorehull]]:
112+
"""Fetches a GeotekniskBorehull by id.
113+
114+
Fetches a GeotekniskBorehull by id.
115+
116+
Args:
117+
gb_id (str):
118+
119+
Raises:
120+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
121+
httpx.TimeoutException: If the request takes longer than Client.timeout.
122+
123+
Returns:
124+
Response[Union[Any, GeotekniskBorehull]]
125+
"""
126+
127+
kwargs = _get_kwargs(
128+
gb_id=gb_id,
129+
)
130+
131+
response = await client.get_async_httpx_client().request(**kwargs)
132+
133+
return _build_response(client=client, response=response)
134+
135+
136+
async def asyncio(
137+
gb_id: str,
138+
*,
139+
client: Union[AuthenticatedClient, Client],
140+
) -> Optional[Union[Any, GeotekniskBorehull]]:
141+
"""Fetches a GeotekniskBorehull by id.
142+
143+
Fetches a GeotekniskBorehull by id.
144+
145+
Args:
146+
gb_id (str):
147+
148+
Raises:
149+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
150+
httpx.TimeoutException: If the request takes longer than Client.timeout.
151+
152+
Returns:
153+
Union[Any, GeotekniskBorehull]
154+
"""
155+
156+
return (
157+
await asyncio_detailed(
158+
gb_id=gb_id,
159+
client=client,
160+
)
161+
).parsed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ def _get_kwargs(
3131
"params": params,
3232
}
3333

34-
_body = body.to_dict()
34+
_kwargs["json"] = body.to_dict()
3535

36-
_kwargs["json"] = _body
3736
headers["Content-Type"] = "application/json"
3837

3938
_kwargs["headers"] = headers

0 commit comments

Comments
 (0)