diff --git a/src/pyadonis/classes/adonis.py b/src/pyadonis/classes/adonis.py index 3686814..dd46e5a 100644 --- a/src/pyadonis/classes/adonis.py +++ b/src/pyadonis/classes/adonis.py @@ -82,7 +82,7 @@ class Adonis: "Pin": pin } - result = self.requestCrewPortal("DG_PersonalInformationRead", data) + result = self.requestCrewPortal("DG_GeneralDetailsRead", data) return result @@ -91,13 +91,13 @@ class Adonis: "Pin": pin } - result = self.requestCrewPortal("DG_ProfilePictureRead", data) - try: - return result["FileBase64"] + result = self.requestCrewPortal("DG_ProfilePictureRead", data) except AdonisError: return None + return result["FileBase64"] + def getCrew(self, pin, personal_data=True, profile_picture=True): crew = Crew(pin) @@ -109,5 +109,35 @@ class Adonis: return crew - def getRequirements(): - pass + def getCrewListView(self, view, filters="", pagination="", paginate_by="", page=""): + data = { + "View": view, + "Filter": filters, + "Ragination": pagination or "None", + "RowsByPage": paginate_by, + "Page": page + } + + try: + result = self.requestIntegration("GNL_APMCrewListViews", data) + except AdonisError: + result = None + + return result + + def getRequirements(self, view): + requirements = [] + pnum = 1 + + while True: + page = self.getCrewListView(view, pagination="True", paginate_by="100", page=str(pnum)) + + for record in json.loads(page["Result"]): + requirements.append((record["PIN"], record["Document code"])) + + if page["CurrentPage"] == page["TotalPages"]: + break + + pnum += 1 + + return requirements \ No newline at end of file diff --git a/src/pyadonis/classes/crew.py b/src/pyadonis/classes/crew.py index 5fd0909..5085dfe 100644 --- a/src/pyadonis/classes/crew.py +++ b/src/pyadonis/classes/crew.py @@ -6,19 +6,23 @@ class Crew: @property def firstName(self): - return self._personal_data["DetailsAll"]["Details"]["FirstName"] + return self._personal_data["Details"]["FirstName"] @property def middleName(self): - return self._personal_data["DetailsAll"]["Details"]["MiddleName"] + return self._personal_data["Details"]["MiddleName"] @property def lastName(self): - return self._personal_data["DetailsAll"]["Details"]["LastName"] + return self._personal_data["Details"]["LastName"] @property def birthDate(self): - return self._personal_data["DetailsAll"]["Details"]["BirthDate"] + return self._personal_data["Details"]["BirthDate"] + + @property + def email(self): + return self._personal_data["Emails"][0]["Email"] if self._personal_data["Emails"] else "" @property def profilePicture(self): diff --git a/src/pyadonis/const.py b/src/pyadonis/const.py index bb7f04b..6bf444d 100644 --- a/src/pyadonis/const.py +++ b/src/pyadonis/const.py @@ -1 +1 @@ -USER_AGENT = "PyAdonis/dev (https://kumi.systems)" \ No newline at end of file +USER_AGENT = "PyAdonis/dev (https://kumi.systems)" diff --git a/src/pyadonis/pindata.py b/src/pyadonis/pindata.py index 2dfd3f3..136249c 100644 --- a/src/pyadonis/pindata.py +++ b/src/pyadonis/pindata.py @@ -25,6 +25,7 @@ if __name__ == "__main__": crewdata["lastName"] = crew.lastName crewdata["dob"] = crew.birthDate crewdata["password"] = crew.birthDate.replace("-","") + crewdata["email"] = crew.email crewdata["profilePicture"] = crew.profilePicture data[pin] = crewdata