2727_content_guid_pattern = r"([^,]*),?(.*)"
2828
2929
30- class BuildStatus ( object ) :
30+ class BuildStatus :
3131 NEEDS_BUILD = "NEEDS_BUILD" # marked for build
3232 RUNNING = "RUNNING" # running now
3333 ABORTED = "ABORTED" # cancelled while running
@@ -37,7 +37,7 @@ class BuildStatus(object):
3737 _all = [NEEDS_BUILD , RUNNING , ABORTED , COMPLETE , ERROR ]
3838
3939
40- class AppMode ( object ) :
40+ class AppMode :
4141 """
4242 Data class defining an "app mode" as understood by Posit
4343 Connect
@@ -51,14 +51,14 @@ def __init__(
5151 ext : Optional [str ] = None ,
5252 ):
5353 self ._ordinal = ordinal
54- self ._name = name
54+ self ._name : AppModes . Modes = name
5555 self ._text = text
5656 self ._ext = ext
5757
5858 def ordinal (self ):
5959 return self ._ordinal
6060
61- def name (self ):
61+ def name (self ) -> AppModes . Modes :
6262 return self ._name
6363
6464 def desc (self ):
@@ -74,7 +74,7 @@ def __repr__(self):
7474 return self .desc ()
7575
7676
77- class AppModes ( object ) :
77+ class AppModes :
7878 """
7979 Enumeration-like collection of known `AppMode`s with lookup
8080 functions
@@ -151,7 +151,7 @@ class AppModes(object):
151151 }
152152
153153 @classmethod
154- def get_by_ordinal (cls , ordinal : int , return_unknown : bool = False ):
154+ def get_by_ordinal (cls , ordinal : int , return_unknown : bool = False ) -> AppMode :
155155 """Get an AppMode by its associated ordinal (integer)"""
156156 return cls ._find_by (
157157 lambda mode : mode .ordinal () == ordinal ,
@@ -160,12 +160,12 @@ def get_by_ordinal(cls, ordinal: int, return_unknown: bool = False):
160160 )
161161
162162 @classmethod
163- def get_by_name (cls , name : str , return_unknown : bool = False ):
163+ def get_by_name (cls , name : str , return_unknown : bool = False ) -> AppMode :
164164 """Get an AppMode by name"""
165165 return cls ._find_by (lambda mode : mode .name () == name , "named %s" % name , return_unknown )
166166
167167 @classmethod
168- def get_by_extension (cls , extension : Optional [str ], return_unknown : bool = False ):
168+ def get_by_extension (cls , extension : Optional [str ], return_unknown : bool = False ) -> AppMode :
169169 """Get an app mode by its associated extension"""
170170 # We can't allow a lookup by None since some modes have that for an extension.
171171 if extension is None :
@@ -180,11 +180,11 @@ def get_by_extension(cls, extension: Optional[str], return_unknown: bool = False
180180 )
181181
182182 @classmethod
183- def get_by_cloud_name (cls , name : str ):
183+ def get_by_cloud_name (cls , name : str ) -> AppMode :
184184 return cls ._cloud_to_connect_modes .get (name , cls .UNKNOWN )
185185
186186 @classmethod
187- def _find_by (cls , predicate : Callable [[AppMode ], bool ], message : str , return_unknown : bool ):
187+ def _find_by (cls , predicate : Callable [[AppMode ], bool ], message : str , return_unknown : bool ) -> AppMode :
188188 for mode in cls ._modes :
189189 if predicate (mode ):
190190 return mode
@@ -369,11 +369,11 @@ class ContentItemV0(TypedDict):
369369 amd_gpu_limit : int | None
370370 nvidia_gpu_limit : int | None
371371 url : str
372- vanity_url : str
372+ vanity_url : bool
373373 name : str
374374 title : str | None
375375 bundle_id : int | None
376- app_mode : AppModes . Modes
376+ app_mode : int
377377 content_category : str
378378 has_parameters : bool
379379 created_time : str
@@ -393,10 +393,20 @@ class ContentItemV0(TypedDict):
393393 run_as : str | None
394394 run_as_current_user : bool
395395 description : str
396- # Note: the next one is listed as "environment_json" in the AppRecord type, but
397- # in practice it comes in as "EnvironmentJson" from the API, so it's commented out
398- # here.
399- # environment_json: object
396+ EnvironmentJson : str | None
397+ app_role : AppRole
398+ owner_first_name : str
399+ owner_last_name : str
400+ owner_username : str
401+ owner_guid : str
402+ owner_email : str
403+ owner_locked : bool
404+ is_scheduled : bool
405+ # Not sure how the following 4 fields are structured, so just use object for now.
406+ git : object | None
407+ users : object | None
408+ groups : object | None
409+ vanities : object | None
400410
401411
402412# Also known as V1 ContentOutputDTO in Connect (note: this is not V1 experimental).
0 commit comments