@@ -534,6 +534,131 @@ def find(self, include: Optional[str | list[Any]] = None, **conditions) -> List[
534534 for result in response .json ()
535535 ]
536536
537+ @overload
538+ def find_by (
539+ self ,
540+ * ,
541+ # Required
542+ name : str ,
543+ # Content Metadata
544+ title : Optional [str ] = None ,
545+ description : Optional [str ] = None ,
546+ access_type : Literal ["all" , "acl" , "logged_in" ] = "acl" ,
547+ owner_guid : Optional [str ] = None ,
548+ # Timeout Settings
549+ connection_timeout : Optional [int ] = None ,
550+ read_timeout : Optional [int ] = None ,
551+ init_timeout : Optional [int ] = None ,
552+ idle_timeout : Optional [int ] = None ,
553+ # Process and Resource Limits
554+ max_processes : Optional [int ] = None ,
555+ min_processes : Optional [int ] = None ,
556+ max_conns_per_process : Optional [int ] = None ,
557+ load_factor : Optional [float ] = None ,
558+ cpu_request : Optional [float ] = None ,
559+ cpu_limit : Optional [float ] = None ,
560+ memory_request : Optional [int ] = None ,
561+ memory_limit : Optional [int ] = None ,
562+ amd_gpu_limit : Optional [int ] = None ,
563+ nvidia_gpu_limit : Optional [int ] = None ,
564+ # Execution Settings
565+ run_as : Optional [str ] = None ,
566+ run_as_current_user : Optional [bool ] = False ,
567+ default_image_name : Optional [str ] = None ,
568+ default_r_environment_management : Optional [bool ] = None ,
569+ default_py_environment_management : Optional [bool ] = None ,
570+ service_account_name : Optional [str ] = None ,
571+ ) -> Optional [ContentItem ]:
572+ """Find the first content record matching the specified attributes. There is no implied ordering so if order matters, you should find it yourself.
573+
574+ Parameters
575+ ----------
576+ name : str, optional
577+ URL-friendly identifier. Allows alphanumeric characters, hyphens ("-"), and underscores ("_").
578+ title : str, optional
579+ Content title. Default is None
580+ description : str, optional
581+ Content description.
582+ access_type : Literal['all', 'acl', 'logged_in'], optional
583+ How content manages viewers.
584+ owner_guid : str, optional
585+ The unique identifier of the user who owns this content item.
586+ connection_timeout : int, optional
587+ Max seconds without data exchange.
588+ read_timeout : int, optional
589+ Max seconds without data received.
590+ init_timeout : int, optional
591+ Max startup time for interactive apps.
592+ idle_timeout : int, optional
593+ Max idle time before process termination.
594+ max_processes : int, optional
595+ Max concurrent processes allowed.
596+ min_processes : int, optional
597+ Min concurrent processes required.
598+ max_conns_per_process : int, optional
599+ Max client connections per process.
600+ load_factor : float, optional
601+ Aggressiveness in spawning new processes (0.0 - 1.0).
602+ cpu_request : float, optional
603+ Min CPU units required (1 unit = 1 core).
604+ cpu_limit : float, optional
605+ Max CPU units allowed.
606+ memory_request : int, optional
607+ Min memory (bytes) required.
608+ memory_limit : int, optional
609+ Max memory (bytes) allowed.
610+ amd_gpu_limit : int, optional
611+ Number of AMD GPUs allocated.
612+ nvidia_gpu_limit : int, optional
613+ Number of NVIDIA GPUs allocated.
614+ run_as : str, optional
615+ UNIX user to execute the content.
616+ run_as_current_user : bool, optional
617+ Run process as the visiting user (for app content). Default is False.
618+ default_image_name : str, optional
619+ Default image for execution if not defined in the bundle.
620+ default_r_environment_management : bool, optional
621+ Manage R environment for the content.
622+ default_py_environment_management : bool, optional
623+ Manage Python environment for the content.
624+ service_account_name : str, optional
625+ Kubernetes service account name for running content.
626+
627+ Returns
628+ -------
629+ Optional[ContentItem]
630+ """
631+ ...
632+
633+ @overload
634+ def find_by (self , ** attributes ) -> Optional [ContentItem ]:
635+ """Find the first content record matching the specified attributes. There is no implied ordering so if order matters, you should find it yourself.
636+
637+ Returns
638+ -------
639+ Optional[ContentItem]
640+ """
641+ ...
642+
643+ def find_by (self , ** attributes ) -> Optional [ContentItem ]:
644+ """Find the first content record matching the specified attributes. There is no implied ordering so if order matters, you should find it yourself.
645+
646+ Returns
647+ -------
648+ Optional[ContentItem]
649+
650+ Example
651+ -------
652+ >>> find_by(name="example-content-name")
653+ """
654+ results = self .find ()
655+ results = (
656+ result
657+ for result in results
658+ if all (item in result .items () for item in attributes .items ())
659+ )
660+ return next (results , None )
661+
537662 @overload
538663 def find_one (
539664 self ,
0 commit comments