Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@
from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError
from ...models.method_plot_format import MethodPlotFormat
from ...types import Response
from ...types import UNSET, Response, Unset


def _get_kwargs(
project_id: str,
location_id: UUID,
method_id: UUID,
format_: MethodPlotFormat,
*,
cross_section: bool | Unset = False,
) -> dict[str, Any]:
params: dict[str, Any] = {}

params["cross_section"] = cross_section

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/projects/{project_id}/locations/{location_id}/methods/{method_id}/plots/{format_}",
"params": params,
}

return _kwargs
Expand Down Expand Up @@ -61,6 +70,7 @@ def sync_detailed(
format_: MethodPlotFormat,
*,
client: AuthenticatedClient,
cross_section: bool | Unset = False,
) -> Response[Any | HTTPValidationError]:
"""Get Plot

Expand All @@ -71,6 +81,7 @@ def sync_detailed(
location_id (UUID):
method_id (UUID):
format_ (MethodPlotFormat):
cross_section (bool | Unset): Default: False.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
Expand All @@ -85,6 +96,7 @@ def sync_detailed(
location_id=location_id,
method_id=method_id,
format_=format_,
cross_section=cross_section,
)

response = client.get_httpx_client().request(
Expand All @@ -101,6 +113,7 @@ def sync(
format_: MethodPlotFormat,
*,
client: AuthenticatedClient,
cross_section: bool | Unset = False,
) -> Any | HTTPValidationError | None:
"""Get Plot

Expand All @@ -111,6 +124,7 @@ def sync(
location_id (UUID):
method_id (UUID):
format_ (MethodPlotFormat):
cross_section (bool | Unset): Default: False.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
Expand All @@ -126,6 +140,7 @@ def sync(
method_id=method_id,
format_=format_,
client=client,
cross_section=cross_section,
).parsed


Expand All @@ -136,6 +151,7 @@ async def asyncio_detailed(
format_: MethodPlotFormat,
*,
client: AuthenticatedClient,
cross_section: bool | Unset = False,
) -> Response[Any | HTTPValidationError]:
"""Get Plot

Expand All @@ -146,6 +162,7 @@ async def asyncio_detailed(
location_id (UUID):
method_id (UUID):
format_ (MethodPlotFormat):
cross_section (bool | Unset): Default: False.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
Expand All @@ -160,6 +177,7 @@ async def asyncio_detailed(
location_id=location_id,
method_id=method_id,
format_=format_,
cross_section=cross_section,
)

response = await client.get_async_httpx_client().request(**kwargs)
Expand All @@ -174,6 +192,7 @@ async def asyncio(
format_: MethodPlotFormat,
*,
client: AuthenticatedClient,
cross_section: bool | Unset = False,
) -> Any | HTTPValidationError | None:
"""Get Plot

Expand All @@ -184,6 +203,7 @@ async def asyncio(
location_id (UUID):
method_id (UUID):
format_ (MethodPlotFormat):
cross_section (bool | Unset): Default: False.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
Expand All @@ -200,5 +220,6 @@ async def asyncio(
method_id=method_id,
format_=format_,
client=client,
cross_section=cross_section,
)
).parsed
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Mapping
from typing import Any, TypeVar
from typing import Any, TypeVar, cast

from attrs import define as _attrs_define
from attrs import field as _attrs_field
Expand All @@ -17,12 +17,14 @@ class CRSInfo:
srid (int): EPSG code
name (str):
unit (str): Unit of measurement for coordinate axes (e.g., meter, degree, foot)
wkt (None | str): Well-Known Text representation of the CRS
"""

auth_name: str
srid: int
name: str
unit: str
wkt: None | str
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
Expand All @@ -34,6 +36,9 @@ def to_dict(self) -> dict[str, Any]:

unit = self.unit

wkt: None | str
wkt = self.wkt

field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
Expand All @@ -42,6 +47,7 @@ def to_dict(self) -> dict[str, Any]:
"srid": srid,
"name": name,
"unit": unit,
"wkt": wkt,
}
)

Expand All @@ -58,11 +64,19 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:

unit = d.pop("unit")

def _parse_wkt(data: object) -> None | str:
if data is None:
return data
return cast(None | str, data)

wkt = _parse_wkt(d.pop("wkt"))

crs_info = cls(
auth_name=auth_name,
srid=srid,
name=name,
unit=unit,
wkt=wkt,
)

crs_info.additional_properties = d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from ..types import UNSET, Unset

if TYPE_CHECKING:
from ..models.crs_info import CRSInfo
from ..models.method_type import MethodType
from ..models.sampling_technique import SamplingTechnique

Expand All @@ -27,6 +28,7 @@ class Standard:
sort_order (int):
method_types (list[MethodType] | Unset):
sampling_techniques (list[SamplingTechnique] | Unset):
default_coordinate_reference_systems (list[CRSInfo] | Unset):
"""

standard_id: StandardType
Expand All @@ -35,6 +37,7 @@ class Standard:
sort_order: int
method_types: list[MethodType] | Unset = UNSET
sampling_techniques: list[SamplingTechnique] | Unset = UNSET
default_coordinate_reference_systems: list[CRSInfo] | Unset = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
Expand All @@ -60,6 +63,13 @@ def to_dict(self) -> dict[str, Any]:
sampling_techniques_item = sampling_techniques_item_data.to_dict()
sampling_techniques.append(sampling_techniques_item)

default_coordinate_reference_systems: list[dict[str, Any]] | Unset = UNSET
if not isinstance(self.default_coordinate_reference_systems, Unset):
default_coordinate_reference_systems = []
for default_coordinate_reference_systems_item_data in self.default_coordinate_reference_systems:
default_coordinate_reference_systems_item = default_coordinate_reference_systems_item_data.to_dict()
default_coordinate_reference_systems.append(default_coordinate_reference_systems_item)

field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
Expand All @@ -74,11 +84,14 @@ def to_dict(self) -> dict[str, Any]:
field_dict["method_types"] = method_types
if sampling_techniques is not UNSET:
field_dict["sampling_techniques"] = sampling_techniques
if default_coordinate_reference_systems is not UNSET:
field_dict["default_coordinate_reference_systems"] = default_coordinate_reference_systems

return field_dict

@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.crs_info import CRSInfo
from ..models.method_type import MethodType
from ..models.sampling_technique import SamplingTechnique

Expand Down Expand Up @@ -109,13 +122,25 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:

sampling_techniques.append(sampling_techniques_item)

_default_coordinate_reference_systems = d.pop("default_coordinate_reference_systems", UNSET)
default_coordinate_reference_systems: list[CRSInfo] | Unset = UNSET
if _default_coordinate_reference_systems is not UNSET:
default_coordinate_reference_systems = []
for default_coordinate_reference_systems_item_data in _default_coordinate_reference_systems:
default_coordinate_reference_systems_item = CRSInfo.from_dict(
default_coordinate_reference_systems_item_data
)

default_coordinate_reference_systems.append(default_coordinate_reference_systems_item)

standard = cls(
standard_id=standard_id,
name=name,
description=description,
sort_order=sort_order,
method_types=method_types,
sampling_techniques=sampling_techniques,
default_coordinate_reference_systems=default_coordinate_reference_systems,
)

standard.additional_properties = d
Expand Down
2 changes: 1 addition & 1 deletion field-manager-python-client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "field-manager-python-client"
version = "4.6.97"
version = "4.6.109"
description = "A client library for accessing Field Manager Data API"
authors = ["Jiyang Ye <[email protected]>"]
maintainers = ["Jiyang Ye <[email protected]>", "Jostein Leira <[email protected]>"]
Expand Down
Loading