jci-metasys / basic-services-dotnet

A simple client to access the most common services of the Metasys API (in the style of the old MSSDA)
https://jci-metasys.github.io/basic-services-dotnet/
BSD 3-Clause "New" or "Revised" License
3 stars 16 forks source link

Network Device Types returns an object structure with generic item1 and item2 properties #42

Closed buldrinie closed 5 years ago

buldrinie commented 5 years ago

Response object is expected to have Id and Description named properties. I suggest to create a structured object to be used as response type.

buldrinie commented 5 years ago

The generic Tuple object doesn't retain property names during serialization: Inkednetwork devices c_LI network devices

SavannahEvans commented 5 years ago

I will create a structure for ObjectType. This Type has an int for the id and a description that is the value of a resource enumeration. Below are the enumeration keys for the "JCI AV" description:

objectTypeEnumSet.avClass=JCI AV 00508.00165=JCI AV

Given the id=165, and knowing the EnumSet is 508=objectTypeEnumSet, it is possible to map 165=avClass. It would then be possible to provide the translated strings for ObjectType description.

My question is what values should ObjectType hold?

I don't think the member number (165) is very useful to the user unless they wanted to make a external call to the server, even then they cannot get the localized string from the server.

buldrinie commented 5 years ago

The Id is important, because consumers can use it to filter Network Devices types. In general I would put in the object the enumeration key as it is, then will be up to the user to translate it using our localization services. so far, also for other responses we never provided automatic translations (could be an enhancement of release 1). I don't think we can translate the descriptions since our resx files are associated only with enums.

SavannahEvans commented 5 years ago

I implemented automatic translation of enumerations in #36. This week I implemented a way to translate command en-US titles such as "Reset Field Device" to other cultures such as it-IT: "Reset Dispositivo di Campo". Here are my test times:

image

buldrinie commented 5 years ago

Good, so we'll put the translated strings also here to be consistent across the methods.

SavannahEvans commented 5 years ago

Addressed in #51.