Skip to content

Commit

Permalink
feat: add dataclass to represent ContentItem owner (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooklynbagel committed May 3, 2024
1 parent 62ff359 commit 467f715
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/posit/connect/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from dataclasses import dataclass
from typing import List, Optional, overload


Expand All @@ -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."""

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 467f715

Please sign in to comment.