diff --git a/memberPlumbing/MembershipWorks.py b/memberPlumbing/MembershipWorks.py index 02f928e..74bab99 100644 --- a/memberPlumbing/MembershipWorks.py +++ b/memberPlumbing/MembershipWorks.py @@ -2,6 +2,7 @@ import csv from io import StringIO import requests +import datetime BASE_URL = "https://api.membershipworks.com" @@ -236,3 +237,29 @@ class MembershipWorks: fields = self._all_fields() members = self.get_members(folders, ",".join(fields.keys())) return members + + def get_events_list(self, start_date: datetime.datetime): + """Retrive a list of events since start_date""" + r = self.sess.get( + BASE_URL + "/v2/events", + params={ + "sdp": start_date.strftime("%s"), + }, + ) + return r.json() + + def get_event_by_eid(self, eid: str): + """Retrieve a specific event by its event id (eid)""" + r = self.sess.get( + BASE_URL + "/v2/event", + params={"eid": eid}, + ) + return r.json() + + def get_event_by_url(self, url: str): + """Retrieve a specific event by its url""" + r = self.sess.get( + BASE_URL + "/v2/event", + params={"url": url}, + ) + return r.json()