44
55import posixpath
66import time
7- from posixpath import dirname
87from typing import (
98 TYPE_CHECKING ,
109 Any ,
2524from .errors import ClientError
2625from .oauth .associations import ContentItemAssociations
2726from .permissions import Permissions
28- from .resources import Active , Resource , ResourceParameters , Resources , _ResourceSequence
27+ from .resources import Active , Resource , Resources , _ResourceSequence
2928from .tags import ContentItemTags
3029from .vanities import VanityMixin
3130from .variants import Variants
@@ -162,13 +161,13 @@ def update(
162161
163162
164163class ContentItemOAuth (Resource ):
165- def __init__ (self , params : ResourceParameters , content_guid : str ) -> None :
166- super ().__init__ (params )
164+ def __init__ (self , ctx : Context , content_guid : str ) -> None :
165+ super ().__init__ (ctx )
167166 self ["content_guid" ] = content_guid
168167
169168 @property
170169 def associations (self ) -> ContentItemAssociations :
171- return ContentItemAssociations (self .params , content_guid = self ["content_guid" ])
170+ return ContentItemAssociations (self ._ctx , content_guid = self ["content_guid" ])
172171
173172
174173class ContentItemOwner (Resource ):
@@ -255,12 +254,12 @@ def __init__(
255254 def __getitem__ (self , key : Any ) -> Any :
256255 v = super ().__getitem__ (key )
257256 if key == "owner" and isinstance (v , dict ):
258- return ContentItemOwner (params = self .params , ** v )
257+ return ContentItemOwner (self ._ctx , ** v )
259258 return v
260259
261260 @property
262261 def oauth (self ) -> ContentItemOAuth :
263- return ContentItemOAuth (self .params , content_guid = self ["guid" ])
262+ return ContentItemOAuth (self ._ctx , content_guid = self ["guid" ])
264263
265264 @property
266265 def repository (self ) -> ContentItemRepository | None :
@@ -316,7 +315,7 @@ def deploy(self) -> tasks.Task:
316315 path = f"v1/content/{ self ['guid' ]} /deploy"
317316 response = self ._ctx .client .post (path , json = {"bundle_id" : None })
318317 result = response .json ()
319- ts = tasks .Tasks (self .params )
318+ ts = tasks .Tasks (self ._ctx )
320319 return ts .get (result ["task_id" ])
321320
322321 def render (self ) -> Task :
@@ -369,8 +368,8 @@ def restart(self) -> None:
369368 self .environment_variables .create (key , unix_epoch_in_seconds )
370369 self .environment_variables .delete (key )
371370 # GET via the base Connect URL to force create a new worker thread.
372- url = posixpath . join ( dirname ( self . _ctx . url ), f" content/{ self ['guid' ]} ")
373- self ._ctx .session .get (url )
371+ path = f"../ content/{ self ['guid' ]} "
372+ self ._ctx .client .get (path )
374373 return None
375374 else :
376375 raise ValueError (
@@ -447,15 +446,15 @@ def update(
447446
448447 @property
449448 def bundles (self ) -> Bundles :
450- return Bundles (self .params , self ["guid" ])
449+ return Bundles (self ._ctx , self ["guid" ])
451450
452451 @property
453452 def environment_variables (self ) -> EnvVars :
454- return EnvVars (self .params , self ["guid" ])
453+ return EnvVars (self ._ctx , self ["guid" ])
455454
456455 @property
457456 def permissions (self ) -> Permissions :
458- return Permissions (self .params , self ["guid" ])
457+ return Permissions (self ._ctx , self ["guid" ])
459458
460459 @property
461460 def owner (self ) -> dict :
@@ -472,7 +471,7 @@ def owner(self) -> dict:
472471
473472 @property
474473 def _variants (self ) -> Variants :
475- return Variants (self .params , self ["guid" ])
474+ return Variants (self ._ctx , self ["guid" ])
476475
477476 @property
478477 def is_interactive (self ) -> bool :
@@ -540,7 +539,7 @@ def __init__(
540539 * ,
541540 owner_guid : str | None = None ,
542541 ) -> None :
543- super ().__init__ (ctx . client . resource_params )
542+ super ().__init__ (ctx )
544543 self .owner_guid = owner_guid
545544 self ._ctx = ctx
546545
0 commit comments