added new api for month, by year, previous 7 day stats

This commit is contained in:
Beverly Nguyen
2024-05-29 12:13:09 -07:00
parent 93d7ca4052
commit 758c1cd8a0
2 changed files with 46 additions and 6 deletions

View File

@@ -43,6 +43,24 @@ class ServiceAPIClient(NotifyAdminAPIClient):
params={"limit_days": limit_days},
)["data"]
def get_service_notification_statistics_by_day(self, service_id, start_date=None, days=None):
if start_date is None:
start_date = datetime.now().strftime('%Y-%m-%d')
return self.get(
"/service/{0}/statistics/{1}/{2}".format(service_id, start_date, days),
)["data"]
def get_single_month_notification_stats(self, service_id, year, month):
return self.get(
"/service/{0}/notifications/month?year={1}&month={2}".format(service_id, year, month),
)
# def get_single_month_notification_stats(self, service_id, user_id, year, month):
# return self.get(
# "/service/{0}/notifications/<uuid:user_id>/month?year={1}&month={2}".format(service_id, user_id, year, month),
# )
def get_services(self, params_dict=None):
"""
Retrieve a list of services.