I think it would be useful to have methods that wrap OP.item_get() and return a specific op item type.
This would have at least two benefits:
- It would help type-aware environments by returning concrete types rather than
OPAbstractItem
- It could perform validation and raise an exception if the returned type isn't what the caller was expecting
I'm picturing something like:
def item_get_login(self, item_identifier, vault=None, ...) -> OPLoginItem:
item = self.item_get(item_identifier, vault=vault, ...)
if not isinstance(item, OPLoginItem):
# ValueError or maybe something more specific
raise ValueError(f"Unexpected item type for item {item_identifier}. Expected OPLoginItem")
return item
I think it would be useful to have methods that wrap
OP.item_get()and return a specific op item type.This would have at least two benefits:
OPAbstractItemI'm picturing something like: