(self)
return aggregation_block
Returns a dict with the block data.

        Raises:
            ValueError: if the block has not been fed with data.
            TypeError: if the data that was fed is of the wrong type.

        Returns:
            A dict with the block data.
Returns a dict with the block data.
Returns a dict with the block data .
def to_dict(self):
        """Returns a dict with the block data.

        Raises:
            ValueError: if the block has not been fed with data.
            TypeError: if the data that was fed is of the wrong type.

        Returns:
            A dict with the block data.
        """
        if not (self._data or self._agg_dict):
            raise ValueError('No data has been fed to the block.')

        aggregation_obj = self._data
        if aggregation_obj:
            if not hasattr(aggregation_obj, 'id'):
                raise TypeError('Aggregation object is not correctly formed.')

            if not hasattr(aggregation_obj, 'name'):
                raise TypeError('Aggregation object is not correctly formed.')

            name = aggregation_obj.name
            description = aggregation_obj.description
            agg_id = aggregation_obj.id
            agg_type = aggregation_obj.aggregator_name
            created_at = aggregation_obj.created_at
            updated_at = aggregation_obj.updated_at
            parameters = json.dumps(aggregation_obj.parameters)
            user = aggregation_obj.user
        else:
            name = self._agg_name
            description = self._agg_dict.get('description', '')
            agg_id = self._agg_id
            agg_type = self._agg_dict.get('agg_type')
            created_at = self._agg_dict.get('created_at')
            updated_at = self._agg_dict.get('updated_at')
            parameters = self._agg_dict.get('parameters', '{}')
            user = self._agg_dict.get('user', {})

        aggregation_block = self._get_base()
        aggregation_block['componentName'] = 'TsAggregationCompact'
        aggregation_block['componentProps']['aggregation'] = {
            'id': agg_id,
            'name': name,
            'chart_type': self.chart_type,
            'agg_type': agg_type,
            'description': description,
            'created_at': created_at,
            'updated_at': updated_at,
            'parameters': parameters,
            'user': user,
        }

        return aggregation_block
def to_dict ( self ) : if not ( self . _data or self . _agg_dict ) : raise ValueError ( 'No data has been fed to the block.' ) aggregation_obj = self . _data if aggregation_obj : if not hasattr ( aggregation_obj , 'id' ) : raise TypeError ( 'Aggregation object is not correctly formed.' ) if not hasattr ( aggregation_obj , 'name' ) : raise TypeError ( 'Aggregation object is not correctly formed.' ) name = aggregation_obj . name description = aggregation_obj . description agg_id = aggregation_obj . id agg_type = aggregation_obj . aggregator_name created_at = aggregation_obj . created_at updated_at = aggregation_obj . updated_at parameters = json . dumps ( aggregation_obj . parameters ) user = aggregation_obj . user else : name = self . _agg_name description = self . _agg_dict . get ( 'description' , '' ) agg_id = self . _agg_id agg_type = self . _agg_dict . get ( 'agg_type' ) created_at = self . _agg_dict . get ( 'created_at' ) updated_at = self . _agg_dict . get ( 'updated_at' ) parameters = self . _agg_dict . get ( 'parameters' , '{}' ) user = self . _agg_dict . get ( 'user' , { } ) aggregation_block = self . _get_base ( ) aggregation_block [ 'componentName' ] = 'TsAggregationCompact' aggregation_block [ 'componentProps' ] [ 'aggregation' ] = { 'id' : agg_id , 'name' : name , 'chart_type' : self . chart_type , 'agg_type' : agg_type , 'description' : description , 'created_at' : created_at , 'updated_at' : updated_at , 'parameters' : parameters , 'user' : user , } return aggregation_block