From 467f715f4774e33f46296b51cad6ddcd7ba50d4e Mon Sep 17 00:00:00 2001 From: Michael Beigelmacher Date: Thu, 2 May 2024 16:47:39 -0400 Subject: [PATCH] feat: add dataclass to represent ContentItem owner (#165) --- src/posit/connect/content.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/posit/connect/content.py b/src/posit/connect/content.py index 4213b426..8d3bc723 100644 --- a/src/posit/connect/content.py +++ b/src/posit/connect/content.py @@ -2,6 +2,7 @@ from __future__ import annotations +from dataclasses import dataclass from typing import List, Optional, overload @@ -15,6 +16,14 @@ from .resources import Resources, Resource +@dataclass +class ContentItemOwner: + guid: str + username: str + first_name: Optional[str] + last_name: Optional[str] + + class ContentItem(Resource): """A piece of content.""" @@ -191,7 +200,7 @@ def owner_guid(self) -> str: return self.get("owner_guid") # type: ignore @property - def owner(self) -> str: + def owner(self) -> ContentItemOwner: return self.get("owner", {}) # type: ignore @property