Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

[Feature Request] Improve service_entry.get #45

Open
michaeldcanady opened this issue May 8, 2023 · 0 comments
Open

[Feature Request] Improve service_entry.get #45

michaeldcanady opened this issue May 8, 2023 · 0 comments

Comments

@michaeldcanady
Copy link
Owner

Example code:

def get(self, key: str, _type: Optional[Type[R]] = None) -> Union[R, datetime, str, None]:
        
        if _type is None:
            _type = ServiceNowEntry
        
        raw_value = self[key]
        if isinstance(raw_value, ServiceNowProperty):
           if _type == datetime:
              return self.parse_servicenow_datetime(raw_value.actual_value)
           return self._get_value(raw_value, _type)
         if issubclass(_type, ServiceNowPropertyCollection):
            return _type(self.Client).import_servicenow_property_collection(raw_value)
        raise ValueError(f"value: {raw_value} of type: {type(raw_value)} is unexpected")
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant