Skip to content
Merged
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
1 change: 1 addition & 0 deletions doc/changelog.d/2397.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
V1 unsupported stub
51 changes: 47 additions & 4 deletions src/ansys/geometry/core/_grpc/_services/v1/unsupported.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
# SOFTWARE.
"""Module containing the unsupported service implementation for v1."""

from ansys.api.discovery.v1.commands.unsupported_pb2 import SetExportIdData
import grpc

from ansys.geometry.core.errors import protect_grpc

from ..base.unsupported import GRPCUnsupportedService
from .conversions import build_grpc_id


class GRPCUnsupportedServiceV1(GRPCUnsupportedService): # pragma: no cover
Expand All @@ -38,18 +40,59 @@ class GRPCUnsupportedServiceV1(GRPCUnsupportedService): # pragma: no cover
"""

def __init__(self, channel: grpc.Channel): # noqa: D102
from ansys.api.geometry.v1.unsupported_pb2_grpc import UnsupportedStub
from ansys.api.discovery.v1.commands.unsupported_pb2_grpc import UnsupportedStub

self.stub = UnsupportedStub(channel)

@protect_grpc
def get_import_id_map(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.commands.unsupported_pb2 import GetImportIdMapRequest

# Create the request - assumes all inputs are valid and of the proper type
request = GetImportIdMapRequest(type=kwargs["id_type"].value)

# Call the gRPC service
response = self.stub.GetImportIdMap(request)

# Return the response - formatted as a dictionary
return {
"id_map": {k: v.id for k, v in response.id_map.items()}, # dict[str, str]
"id_type": kwargs["id_type"],
}

@protect_grpc
def set_export_ids(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.commands.unsupported_pb2 import SetExportIdRequest

# Create the request - assumes all inputs are valid and of the proper type
request = SetExportIdRequest(
export_data=[
SetExportIdData(
moniker=build_grpc_id(data.moniker),
id=data.value,
type=data.id_type.value,
)
for data in kwargs["export_data"]
]
)

# Call the gRPC service
_ = self.stub.SetExportIds(request)

# Return the response - formatted as a dictionary
return {}

@protect_grpc
def set_single_export_id(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
# Create the request - assumes all inputs are valid and of the proper type
request = SetExportIdData(
moniker=build_grpc_id(kwargs["export_data"].moniker),
id=kwargs["export_data"].value,
type=kwargs["export_data"].id_type.value,
)

# Call the gRPC service
_ = self.stub.SetExportId(request)

# Return the response - formatted as a dictionary
return {}
Loading