def find_by_id(self, object_type, field, value):
        """
        Find resource by a specific ID.

        Results are a dict in the format:
        {
            'id': <resource URI fragment>,
            'identifier': <resource identifier>,
            'title': <title of the resource>,
            'levelOfDescription': <level of description>,
        }

        :param str object_type: One of 'digital_object_components' or 'archival_objects'
        :param str field: Name of the field to search.  One of 'component_id' or 'ref_id'.
        :param value: Value of the field to search for
        :return: List of dicts containing results.
        """

        def format_record(record):
            resolved = record["_resolved"]
            identifier = (
                resolved["ref_id"]
                if "ref_id" in resolved
                else resolved.get("component_id", "")
            )
            return {
                "id": record["ref"],
                "type": self.resource_type(record["ref"]),
                "identifier": identifier,
                "title": resolved.get("title", ""),
                "levelOfDescription": resolved.get("level", ""),
                "fullrecord": resolved,
            }

        if object_type not in ("digital_object_components", "archival_objects"):
            raise ValueError(
                "object_type must be 'digital_object_components' or 'archival_objects'"
            )
        if field not in ("ref_id", "component_id"):
            raise ValueError("field must be 'component_id' or 'ref_id'")

        params = {field + "[]": value, "resolve[]": object_type}

        url = self.repository + "/find_by_id/" + object_type
        response = self._get(url, params=params)
        hits = response.json()
        return [format_record(r) for r in hits[object_type]]
def find_by_id ( self , object_type , field , value ) : def format_record ( record ) : resolved = record [ "_resolved" ] identifier = ( resolved [ "ref_id" ] if "ref_id" in resolved else resolved . get ( "component_id" , "" ) ) return { "id" : record [ "ref" ] , "type" : self . resource_type ( record [ "ref" ] ) , "identifier" : identifier , "title" : resolved . get ( "title" , "" ) , "levelOfDescription" : resolved . get ( "level" , "" ) , "fullrecord" : resolved , } if object_type not in ( "digital_object_components" , "archival_objects" ) : raise ValueError ( "object_type must be 'digital_object_components' or 'archival_objects'" ) if field not in ( "ref_id" , "component_id" ) : raise ValueError ( "field must be 'component_id' or 'ref_id'" ) params = { field + "[]" : value , "resolve[]" : object_type } url = self . repository + "/find_by_id/" + object_type response = self . _get ( url , params = params ) hits = response . json ( ) return [ format_record ( r ) for r in hits [ object_type ] ]
Find resource by a specific ID.

        Results are a dict in the format:
        {
            'id': <resource URI fragment>,
            'identifier': <resource identifier>,
            'title': <title of the resource>,
            'levelOfDescription': <level of description>,
        }

        :param str object_type: One of 'digital_object_components' or 'archival_objects'
        :param str field: Name of the field to search.  One of 'component_id' or 'ref_id'.
        :param value: Value of the field to search for
        :return: List of dicts containing results.