"""Logic for Timeseries Endpoints """ from owsresponse import response from socials.connectors import snowflake from socials.models import timeseries as timeseries_model from socials.models import pending as pending_model from socials.utils.pending import merge_pending_social_accounts SQLLoader = snowflake.SQLLoader(__file__) def get_timeseries(account_url, timestamp_gte, timestamp_lte=None): """Logic handlers. Args: name (str): the name to display alongside the Hello. Returns: Response: the hello message. """ return response.Response(timeseries_model.get_timeseries( account_url, timestamp_gte, timestamp_lte)) def get_timeseries_by_account_id( account_id, identity_id, timestamp_gte, timestamp_lte=None): """Logic handlers. Args: name (str): the name to display alongside the Hello. Returns: Response: the hello message. """ pending_accounts = pending_model.get_pending_social_accounts(account_id, identity_id) timeseries = timeseries_model.get_timeseries_by_account_id( account_id, timestamp_gte, timestamp_lte) return response.Response(merge_pending_social_accounts(timeseries, pending_accounts))