Skip to content

Commit

Permalink
implement generic response types that return Manifest types
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham4401 committed Jul 16, 2024
1 parent 42cc2e8 commit 52a5bcc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions emanifest-py/src/emanifest/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
AgencyCode,
CorrectionRevertResponse,
CorrectionVersionSearchArgs,
Manifest,
ManifestOperationResponse,
ManifestSignatureResponse,
MtnSearchArgs,
Expand Down Expand Up @@ -540,7 +541,7 @@ def search_bill(self, **kwargs: Unpack[SearchBillArgs]) -> RcrainfoResponse:
endpoint = f"{self.base_url}v1/emanifest/billing/bill-search"
return self.__rcra_request("POST", endpoint, **kwargs)

def get_manifest_attachments(self, mtn: str, reg: bool = False) -> RcrainfoResponse:
def get_manifest_attachments(self, mtn: str, reg: bool = False) -> RcrainfoResponse[Manifest]:
"""
Retrieve manifest data (JSON) and attachments
Expand Down Expand Up @@ -574,7 +575,7 @@ def search_mtn(
endpoint = f"{self.base_url}v1/emanifest/search"
return self.__rcra_request("POST", endpoint, **kwargs)

def get_correction(self, mtn: str, reg: bool = False) -> RcrainfoResponse:
def get_correction(self, mtn: str, reg: bool = False) -> RcrainfoResponse[Manifest]:
"""
Retrieve manifest correction version details by manifest tracking number (MTN)
Expand All @@ -589,7 +590,7 @@ def get_correction(self, mtn: str, reg: bool = False) -> RcrainfoResponse:

def get_correction_version(
self, reg: bool = False, **kwargs: Unpack[CorrectionVersionSearchArgs]
) -> RcrainfoResponse: # ToDo: return type is manifest
) -> RcrainfoResponse[Manifest]:
"""
Retrieve details of manifest correction version based the provided search criteria
Expand All @@ -602,7 +603,7 @@ def get_correction_version(
endpoint = f"{self.base_url}v1/emanifest/manifest/correction-version"
return self.__rcra_request("POST", endpoint, **kwargs)

def get_correction_attachments(self, **kwargs) -> RcrainfoResponse:
def get_correction_attachments(self, **kwargs) -> RcrainfoResponse[Manifest]:
"""
Retrieve corrected manifests attachment by search criteria.
See also **get_correction** and **get_correction_version**
Expand Down Expand Up @@ -633,9 +634,7 @@ def get_site_mtn(self, site_id: str, reg: bool = False) -> RcrainfoResponse[List
endpoint = f"{self.base_url}v1/emanifest/manifest-tracking-numbers/{site_id}"
return self.__rcra_request("GET", endpoint)

def get_manifest(
self, mtn: str, reg: bool = False
) -> RcrainfoResponse: # ToDO: return type is manifest
def get_manifest(self, mtn: str, reg: bool = False) -> RcrainfoResponse[Manifest]:
"""Retrieve e-Manifest details by Manifest Tracking Number (MTN)"""
if reg:
endpoint = f"{self.base_url}v1/state/emanifest/manifest/{mtn}"
Expand All @@ -662,7 +661,7 @@ def get_sites(

def correct_manifest(
self, manifest_json: dict, zip_file: bytes | None = None
) -> RcrainfoResponse:
) -> RcrainfoResponse[ManifestOperationResponse]:
"""
Correct Manifest by providing e-Manifest JSON and optional Zip attachment
Expand Down Expand Up @@ -728,7 +727,7 @@ def patch_correct_manifest(

def update_manifest(
self, manifest_json: dict, zip_file: bytes | None = None
) -> RcrainfoResponse:
) -> RcrainfoResponse[ManifestOperationResponse]:
"""
Update Manifest by providing e-Manifest JSON and optional Zip attachment
Expand Down Expand Up @@ -790,7 +789,7 @@ def get_available_manifests(self, mtn: str) -> RcrainfoResponse:

def save_manifest(
self, manifest_json: dict, zip_file: bytes | None = None
) -> RcrainfoResponse:
) -> RcrainfoResponse[ManifestOperationResponse]:
"""
Save Manifest by providing e-Manifest JSON and optional Zip attachment
Expand Down

0 comments on commit 52a5bcc

Please sign in to comment.