@@ -329,6 +329,14 @@ def ensure_return_image_urls_support(self) -> bool:
329329 {"version" : (3 , 3 , 0 ), "label" : "return thumbnail URLs" }, False
330330 )
331331
332+ def ensure_custom_entity_config_support (self ) -> None :
333+ """
334+ Ensures server has support for the custom entity config API (read, enable, update, disable), added in v8.88.0.
335+ """
336+ self ._ensure_support (
337+ {"version" : (8 , 88 , 0 ), "label" : "custom entity config API" }
338+ )
339+
332340 def __str__ (self ) -> str :
333341 return "ServerCapabilities: host %s, version %s, is_dev %s" % (
334342 self .host ,
@@ -3671,6 +3679,155 @@ def user_subscriptions_create(
36713679
36723680 return response .get ("status" ) == "success"
36733681
3682+ def custom_entity_read (self , entity_type : str ) -> Dict [str , Any ]:
3683+ """
3684+ Read the current configuration of a Custom Entity.
3685+
3686+ >>> sg.custom_entity_read("CustomEntity08")
3687+ {
3688+ "entity_type": "CustomEntity08",
3689+ "enabled": True,
3690+ "display_name": "My Shots",
3691+ "entity_config": {"enable_tasks": True, ...}
3692+ }
3693+
3694+ :param str entity_type: The Custom Entity type to read, in its singular
3695+ CamelCase form (e.g. ``"CustomEntity08"``). Required.
3696+ :returns: The entity config snapshot dict with ``entity_type``, ``enabled``,
3697+ ``display_name``, and ``entity_config``.
3698+ :rtype: dict
3699+ :raises shotgun_api3.ShotgunError: if the entity type is invalid (fault code 104).
3700+ """
3701+ self .server_caps .ensure_custom_entity_config_support ()
3702+
3703+ return self ._call_rpc ("custom_entity_read" , {"entity_type" : entity_type })
3704+
3705+ def custom_entity_enable (
3706+ self ,
3707+ entity_type : str ,
3708+ display_name : Optional [str ] = None ,
3709+ entity_config : Optional [Dict [str , bool ]] = None ,
3710+ ) -> Dict [str , Any ]:
3711+ """
3712+ Enable a Custom Entity.
3713+
3714+ >>> sg.custom_entity_enable(
3715+ ... "CustomEntity08",
3716+ ... display_name="My Shots",
3717+ ... entity_config={"enable_tasks": True},
3718+ ... )
3719+ {
3720+ "entity_type": "CustomEntity08",
3721+ "enabled": True,
3722+ "display_name": "My Shots",
3723+ "entity_config": {"enable_tasks": True, ...}
3724+ }
3725+
3726+ :param str entity_type: The Custom Entity type to enable, in its singular
3727+ CamelCase form (e.g. ``"CustomEntity08"``). Required.
3728+ :param str display_name: Optional display name for the entity.
3729+ :param dict entity_config: Optional dict of feature flag booleans. Only the
3730+ flags present are mutated; omitted flags are left unchanged.
3731+ Keys and boolean values are passed through as-is. Recognized flags:
3732+ - ``enable_tasks`` (default: ``False``)
3733+ - ``enable_versions`` (default: ``False``)
3734+ - ``enable_publishes`` (default: ``False``)
3735+ - ``enable_detail_page`` (default: ``True``)
3736+ - ``include_in_search`` (default: ``False``)
3737+ - ``include_in_global_menu`` (default: ``True``)
3738+ :returns: The entity config snapshot dict with ``entity_type``, ``enabled``,
3739+ ``display_name``, and ``entity_config``.
3740+ :rtype: dict
3741+ :raises shotgun_api3.ShotgunError: if the entity type is invalid or already
3742+ enabled (fault code 104).
3743+ """
3744+ self .server_caps .ensure_custom_entity_config_support ()
3745+
3746+ params = {"entity_type" : entity_type }
3747+ if display_name is not None :
3748+ params ["display_name" ] = display_name
3749+ if entity_config is not None :
3750+ params ["entity_config" ] = entity_config
3751+
3752+ return self ._call_rpc ("custom_entity_enable" , params )
3753+
3754+ def custom_entity_update (
3755+ self ,
3756+ entity_type : str ,
3757+ display_name : Optional [str ] = None ,
3758+ entity_config : Optional [Dict [str , bool ]] = None ,
3759+ ) -> Dict [str , Any ]:
3760+ """
3761+ Update an already-enabled Custom Entity's display name and/or feature flags.
3762+
3763+ >>> sg.custom_entity_update("CustomEntity08", display_name="Episode")
3764+ {
3765+ "entity_type": "CustomEntity08",
3766+ "enabled": True,
3767+ "display_name": "Renamed",
3768+ "entity_config": {...}
3769+ }
3770+
3771+ :param str entity_type: The Custom Entity type to update, in its singular
3772+ CamelCase form. The entity must already be enabled. Required.
3773+ :param str display_name: Optional new display name for the entity.
3774+ :param dict entity_config: Optional dict of feature flag booleans. Only the
3775+ flags present are mutated; omitted flags are left unchanged. Keys and
3776+ boolean values are passed through as-is.
3777+ :returns: The updated entity config snapshot dict.
3778+ :rtype: dict
3779+ :raises shotgun_api3.ShotgunError: if the entity type is invalid or not
3780+ enabled (fault code 104).
3781+ """
3782+ self .server_caps .ensure_custom_entity_config_support ()
3783+
3784+ params = {"entity_type" : entity_type }
3785+ if display_name is not None :
3786+ params ["display_name" ] = display_name
3787+ if entity_config is not None :
3788+ params ["entity_config" ] = entity_config
3789+
3790+ return self ._call_rpc ("custom_entity_update" , params )
3791+
3792+ def custom_entity_disable (
3793+ self , entity_type : str , force : bool = False
3794+ ) -> Dict [str , Any ]:
3795+ """
3796+ Disable an enabled Custom Entity, clearing its feature flags.
3797+
3798+ Disabling a Custom Entity that has existing records does **not** delete the
3799+ data, but it does make the data inaccessible: the records will not appear in
3800+ the UI, will not be returned via the API, and any fields on other entities
3801+ that link to it become broken references. Because this is destructive in
3802+ effect, the server refuses to disable an entity that still has records unless
3803+ ``force`` is set, and the error reports how many records were found.
3804+
3805+ >>> sg.custom_entity_disable("CustomEntity08")
3806+ {
3807+ "entity_type": "CustomEntity08",
3808+ "enabled": False,
3809+ "display_name": "My Shots"
3810+ }
3811+
3812+ :param str entity_type: The Custom Entity type to disable, in its singular
3813+ CamelCase form. The entity must already be enabled. Required.
3814+ :param bool force: Disable the entity even though it still has records.
3815+ Defaults to ``False``, which makes the call fail rather than render
3816+ existing data unreachable.
3817+ :returns: The entity config snapshot dict with ``enabled`` set to ``False``.
3818+ :rtype: dict
3819+ :raises shotgun_api3.ShotgunError: if the entity type is invalid or not
3820+ enabled (fault code 104), or if the entity still has records and
3821+ ``force`` was not set (fault code 104).
3822+ """
3823+ self .server_caps .ensure_custom_entity_config_support ()
3824+
3825+ params = {"entity_type" : entity_type }
3826+ if force :
3827+ params ["force" ] = True
3828+
3829+ return self ._call_rpc ("custom_entity_disable" , params )
3830+
36743831 def _build_opener (self , handler ) -> urllib .request .OpenerDirector :
36753832 """
36763833 Build urllib2 opener with appropriate proxy handler.
0 commit comments