def get_by_ref(cls, ref, only_fields: Optional[List[str]] = None):
        """
        :param: only_field: Optional lists if fields to retrieve. If not specified, it defaults to
                            all fields.
        """
        if not ref:
            return None

        ref_obj = ResourceReference.from_string_reference(ref=ref)
        result = cls.query(
            name=ref_obj.name, pack=ref_obj.pack, only_fields=only_fields
        ).first()

        return result

        :param: only_field: Optional lists if fields to retrieve. If not specified, it defaults to
                            all fields.
        
st2common/st2common/persistence/base.py