From 6eb51c44c2579f53b07a995d6b7289f77d9971ea Mon Sep 17 00:00:00 2001 From: Kenneth Yang <82800265+kjy5@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:37:13 -0700 Subject: [PATCH] 32 proxy connection data structure (#37) * Proxy model * Version bump * chore: Autoformat code --------- Co-authored-by: kjy5 --- models/csharp/ProxyModels.cs | 14 ++++++++++++++ models/schemas/proxy/PinpointIdResponse.json | 1 + src/vbl_aquarium/__about__.py | 2 +- src/vbl_aquarium/build.py | 6 +++--- src/vbl_aquarium/models/proxy.py | 16 ++++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 models/csharp/ProxyModels.cs create mode 100644 models/schemas/proxy/PinpointIdResponse.json create mode 100644 src/vbl_aquarium/models/proxy.py diff --git a/models/csharp/ProxyModels.cs b/models/csharp/ProxyModels.cs new file mode 100644 index 0000000..452413a --- /dev/null +++ b/models/csharp/ProxyModels.cs @@ -0,0 +1,14 @@ +using System; +[Serializable] +public struct PinpointIdResponse +{ + public string PinpointId; + public bool IsRequester; + + public PinpointIdResponse(string pinpointId, bool isRequester) + { + PinpointId = pinpointId; + IsRequester = isRequester; + } +} + diff --git a/models/schemas/proxy/PinpointIdResponse.json b/models/schemas/proxy/PinpointIdResponse.json new file mode 100644 index 0000000..a44fcc0 --- /dev/null +++ b/models/schemas/proxy/PinpointIdResponse.json @@ -0,0 +1 @@ +{"description": "Response format for a pinpoint ID request.\n\n:param pinpoint_id: ID of the service.\n:type pinpoint_id: str\n:param is_requester: Whether the service is a requester.\n:type is_requester: bool", "properties": {"PinpointId": {"maxLength": 8, "minLength": 8, "title": "Pinpointid", "type": "string"}, "IsRequester": {"title": "Isrequester", "type": "boolean"}}, "required": ["PinpointId", "IsRequester"], "title": "PinpointIdResponse", "type": "object"} \ No newline at end of file diff --git a/src/vbl_aquarium/__about__.py b/src/vbl_aquarium/__about__.py index 311f216..6561790 100644 --- a/src/vbl_aquarium/__about__.py +++ b/src/vbl_aquarium/__about__.py @@ -1 +1 @@ -__version__ = "0.0.14" +__version__ = "0.0.15" diff --git a/src/vbl_aquarium/build.py b/src/vbl_aquarium/build.py index 8a95de0..cb394b5 100644 --- a/src/vbl_aquarium/build.py +++ b/src/vbl_aquarium/build.py @@ -7,7 +7,7 @@ from pydantic.alias_generators import to_pascal from vbl_aquarium.generate_cs import pydantic_to_csharp -from vbl_aquarium.models import dock, ephys_link, generic, logging, pinpoint, unity, urchin +from vbl_aquarium.models import dock, ephys_link, generic, logging, pinpoint, proxy, unity, urchin from vbl_aquarium.utils.common import get_classes from vbl_aquarium.utils.vbl_base_model import VBLBaseModel @@ -21,8 +21,8 @@ def remove_ignored_classes(module): ignored_classes.append(VBLBaseModel) unity_class_names = [x.__name__ for x in get_classes(unity)] -module_list = [generic, urchin, logging, pinpoint, ephys_link, dock] -folder_prefix = ["generic", "urchin", "logging", "pinpoint", "ephys_link", "dock"] +module_list = [generic, urchin, logging, pinpoint, ephys_link, dock, proxy] +folder_prefix = ["generic", "urchin", "logging", "pinpoint", "ephys_link", "dock", "proxy"] cdir = dirname(abspath(__file__)) diff --git a/src/vbl_aquarium/models/proxy.py b/src/vbl_aquarium/models/proxy.py new file mode 100644 index 0000000..4f06a3f --- /dev/null +++ b/src/vbl_aquarium/models/proxy.py @@ -0,0 +1,16 @@ +from pydantic import Field + +from vbl_aquarium.utils.vbl_base_model import VBLBaseModel + + +class PinpointIdResponse(VBLBaseModel): + """Response format for a pinpoint ID request. + + :param pinpoint_id: ID of the service. + :type pinpoint_id: str + :param is_requester: Whether the service is a requester. + :type is_requester: bool + """ + + pinpoint_id: str = Field(min_length=8, max_length=8) + is_requester: bool