55from .errors import ClientError
66from .resources import Resource , ResourceParameters , Resources
77
8- AfterDestroyCallback = Callable [[], None ]
9-
108
119class Vanity (Resource ):
1210 """A vanity resource.
@@ -44,17 +42,22 @@ class Vanity(Resource):
4442 - `/content`
4543 """
4644
47- _fuid : str = "content_guid"
48- """str : the foreign unique identifier field that points to the owner of this vanity, by default 'content_guid'"""
45+ AfterDestroyCallback = Callable [[], None ]
46+
47+ class VanityAttributes (TypedDict ):
48+ """Vanity attributes."""
49+
50+ path : str
51+ content_guid : Required [str ]
52+ created_time : str
4953
5054 def __init__ (
5155 self ,
5256 / ,
5357 params : ResourceParameters ,
5458 * ,
55- content_guid : str ,
5659 after_destroy : Optional [AfterDestroyCallback ] = None ,
57- ** kwargs ,
60+ ** kwargs : Unpack [ VanityAttributes ] ,
5861 ):
5962 """Initialize a Vanity.
6063
@@ -64,9 +67,13 @@ def __init__(
6467 after_destroy : AfterDestroyCallback, optional
6568 Called after the Vanity is successfully destroyed, by default None
6669 """
67- super ().__init__ (params , content_guid = content_guid , ** kwargs )
68- self ._endpoint = self .params .url + f"v1/content/{ content_guid } /vanity"
70+ super ().__init__ (params , ** kwargs )
6971 self ._after_destroy = after_destroy
72+ self ._content_guid = kwargs ["content_guid" ]
73+
74+ @property
75+ def _endpoint (self ):
76+ return self .params .url + f"v1/content/{ self ._content_guid } /vanity"
7077
7178 def destroy (self ) -> None :
7279 """Destroy the vanity.
@@ -120,12 +127,12 @@ class HasGuid(TypedDict):
120127
121128 def __init__ (self , / , params : ResourceParameters , ** kwargs : Unpack [HasGuid ]):
122129 super ().__init__ (params , ** kwargs )
123- self ._uid = kwargs [' guid' ]
130+ self ._content_guid = kwargs [" guid" ]
124131 self ._vanity : Optional [Vanity ] = None
125132
126133 @property
127134 def _endpoint (self ):
128- return self .params .url + f"v1/content/{ self ._uid } /vanity"
135+ return self .params .url + f"v1/content/{ self ._content_guid } /vanity"
129136
130137 @property
131138 def vanity (self ) -> Optional [Vanity ]:
0 commit comments