diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4c4f7f2..337d15d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.2" + ".": "2.0.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7db4699..65302ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 2.0.3 (2025-12-09) + +Full Changelog: [v2.0.2...v2.0.3](https://github.com/postgrid/postgrid-python/compare/v2.0.2...v2.0.3) + +### Bug Fixes + +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([da4eda9](https://github.com/postgrid/postgrid-python/commit/da4eda9cfa2f8713841e9668e01efc7e2e09a420)) + + +### Chores + +* add missing docstrings ([3b3c572](https://github.com/postgrid/postgrid-python/commit/3b3c5722c15adddc6b388b05007cbc277559dc33)) + ## 2.0.2 (2025-12-03) Full Changelog: [v2.0.1...v2.0.2](https://github.com/postgrid/postgrid-python/compare/v2.0.1...v2.0.2) diff --git a/pyproject.toml b/pyproject.toml index 0aab7e9..b2bcfdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "postgrid-python" -version = "2.0.2" +version = "2.0.3" description = "The official Python library for the PostGrid API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/postgrid/_types.py b/src/postgrid/_types.py index 225e017..7be3f6a 100644 --- a/src/postgrid/_types.py +++ b/src/postgrid/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case diff --git a/src/postgrid/_version.py b/src/postgrid/_version.py index 20c07a9..0544c30 100644 --- a/src/postgrid/_version.py +++ b/src/postgrid/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "postgrid" -__version__ = "2.0.2" # x-release-please-version +__version__ = "2.0.3" # x-release-please-version diff --git a/src/postgrid/types/address_verification_verify_response.py b/src/postgrid/types/address_verification_verify_response.py index 47bdd2a..f7dfd5a 100644 --- a/src/postgrid/types/address_verification_verify_response.py +++ b/src/postgrid/types/address_verification_verify_response.py @@ -13,6 +13,10 @@ class DataDetails(BaseModel): + """ + If you supply `includeDetails=true` as a query parameter, we will also populate an additional `details` field that follows the [Address Details](https://avdocs.postgrid.com/#address-details) schema. + """ + box_id: Optional[str] = FieldInfo(alias="boxID", default=None) """PO Box ID""" @@ -158,12 +162,22 @@ class DataDetails(BaseModel): class DataGeocodeResultLocation(BaseModel): + """Object that contains `lat`, `lng` properties with number values""" + lat: float lng: float class DataGeocodeResult(BaseModel): + """ + If the `geocode=true` query parameter is supplied, the response will include a geocodeResult + which follows the [Geocoding](https://avdocs.postgrid.com/#geocoding) schema. You can request + this feature be enabled by emailing `support@postgrid.com`. This includes our verification, batch + verification, suggestions, and POST /completions endpoint. Note that you must supply country when + geocoding to get the result successfully. + """ + accuracy: float """ A real number from 0.00 to 1.00 which represents an diff --git a/src/postgrid/types/errors.py b/src/postgrid/types/errors.py index b6e5e81..0eb9921 100644 --- a/src/postgrid/types/errors.py +++ b/src/postgrid/types/errors.py @@ -10,6 +10,8 @@ class Errors(BaseModel): + """Errors encountered during address verification.""" + city: Optional[List[str]] = None """Errors related to the city.""" diff --git a/src/postgrid/types/intl_address_verification_verify_response.py b/src/postgrid/types/intl_address_verification_verify_response.py index 150172e..d397c28 100644 --- a/src/postgrid/types/intl_address_verification_verify_response.py +++ b/src/postgrid/types/intl_address_verification_verify_response.py @@ -13,6 +13,10 @@ class DataDetails(BaseModel): + """ + Additional details about the verified address, such as premise, thoroughfare, and locality. + """ + building: Optional[str] = None """The building name or number.""" @@ -114,6 +118,8 @@ class DataDetails(BaseModel): class DataGeoData(BaseModel): + """Geocoding result for the verified address.""" + geo_accuracy: Optional[str] = FieldInfo(alias="geoAccuracy", default=None) """The geocode accuracy.""" @@ -125,6 +131,8 @@ class DataGeoData(BaseModel): class DataSummary(BaseModel): + """A summary of the verification process and match levels.""" + context_identification_match_level: Optional[str] = FieldInfo(alias="contextIdentificationMatchLevel", default=None) """Context identification match level.""" @@ -158,6 +166,8 @@ class DataSummary(BaseModel): class Data(BaseModel): + """The result of a verified international address.""" + city: str """The city or locality.""" diff --git a/src/postgrid/types/print_mail/attached_pdf.py b/src/postgrid/types/print_mail/attached_pdf.py index 4f3090a..03a7e71 100644 --- a/src/postgrid/types/print_mail/attached_pdf.py +++ b/src/postgrid/types/print_mail/attached_pdf.py @@ -8,6 +8,8 @@ class AttachedPdf(BaseModel): + """Model representing an attached PDF.""" + file: str """The file (multipart form upload) or URL pointing to a PDF for the attached PDF.""" diff --git a/src/postgrid/types/print_mail/attached_pdf_param.py b/src/postgrid/types/print_mail/attached_pdf_param.py index ddd40b2..3f23c1d 100644 --- a/src/postgrid/types/print_mail/attached_pdf_param.py +++ b/src/postgrid/types/print_mail/attached_pdf_param.py @@ -8,6 +8,8 @@ class AttachedPdfParam(TypedDict, total=False): + """Model representing an attached PDF.""" + file: Required[str] """The file (multipart form upload) or URL pointing to a PDF for the attached PDF.""" diff --git a/src/postgrid/types/print_mail/campaign.py b/src/postgrid/types/print_mail/campaign.py index 311c1f0..6d3cf92 100644 --- a/src/postgrid/types/print_mail/campaign.py +++ b/src/postgrid/types/print_mail/campaign.py @@ -12,6 +12,8 @@ class Error(BaseModel): + """Details of a specific error encountered during campaign processing.""" + message: str """A human-readable message describing the error.""" @@ -20,6 +22,8 @@ class Error(BaseModel): class Campaign(BaseModel): + """Represents a bulk mail campaign.""" + id: str """A unique ID prefixed with campaign\\__""" diff --git a/src/postgrid/types/print_mail/cheque.py b/src/postgrid/types/print_mail/cheque.py index 01f4bcd..cc68ef9 100644 --- a/src/postgrid/types/print_mail/cheque.py +++ b/src/postgrid/types/print_mail/cheque.py @@ -16,6 +16,11 @@ class Cancellation(BaseModel): + """The cancellation details of this order. + + Populated if the order has been cancelled. + """ + reason: Literal["user_initiated", "invalid_content", "invalid_order_mailing_class"] """The reason for the cancellation.""" diff --git a/src/postgrid/types/print_mail/deleted_response.py b/src/postgrid/types/print_mail/deleted_response.py index b222c9e..de064f3 100644 --- a/src/postgrid/types/print_mail/deleted_response.py +++ b/src/postgrid/types/print_mail/deleted_response.py @@ -8,6 +8,8 @@ class DeletedResponse(BaseModel): + """Generic response for delete operations.""" + id: str """The ID of the deleted resource.""" diff --git a/src/postgrid/types/print_mail/email_preferences.py b/src/postgrid/types/print_mail/email_preferences.py index c5c90d0..c4cb838 100644 --- a/src/postgrid/types/print_mail/email_preferences.py +++ b/src/postgrid/types/print_mail/email_preferences.py @@ -11,6 +11,8 @@ class EmailPreferences(BaseModel): + """A set of preferences for how a user should receive emails.""" + order_preview_send_preference: Optional[Literal["do_not_send", "send_live_only", "send_live_and_test"]] = FieldInfo( alias="orderPreviewSendPreference", default=None ) diff --git a/src/postgrid/types/print_mail/letter.py b/src/postgrid/types/print_mail/letter.py index 3d8daf6..bf432f6 100644 --- a/src/postgrid/types/print_mail/letter.py +++ b/src/postgrid/types/print_mail/letter.py @@ -18,6 +18,11 @@ class Cancellation(BaseModel): + """The cancellation details of this order. + + Populated if the order has been cancelled. + """ + reason: Literal["user_initiated", "invalid_content", "invalid_order_mailing_class"] """The reason for the cancellation.""" diff --git a/src/postgrid/types/print_mail/mailing_list.py b/src/postgrid/types/print_mail/mailing_list.py index f64044f..071fbe9 100644 --- a/src/postgrid/types/print_mail/mailing_list.py +++ b/src/postgrid/types/print_mail/mailing_list.py @@ -12,6 +12,8 @@ class Error(BaseModel): + """Details of a specific error encountered during processing.""" + message: str """A human-readable message describing the error.""" @@ -22,6 +24,8 @@ class Error(BaseModel): class MailingList(BaseModel): + """Represents a mailing list.""" + id: str """A unique ID prefixed with mailing*list*""" diff --git a/src/postgrid/types/print_mail/mailing_list_import_response.py b/src/postgrid/types/print_mail/mailing_list_import_response.py index d3b889e..5f499b3 100644 --- a/src/postgrid/types/print_mail/mailing_list_import_response.py +++ b/src/postgrid/types/print_mail/mailing_list_import_response.py @@ -14,6 +14,8 @@ class Error(BaseModel): + """Details of a specific error encountered during import processing.""" + message: str """A human-readable message describing the error.""" @@ -24,6 +26,8 @@ class Error(BaseModel): class File(BaseModel): + """The file object your controller returns: all the mappings plus a signed URL.""" + file_type: FileType = FieldInfo(alias="fileType") """Type of file supported for mailing list imports.""" @@ -65,6 +69,8 @@ class File(BaseModel): class Note(BaseModel): + """Details about a note in the import process.""" + message: str """A human-readable message describing the note.""" @@ -73,6 +79,8 @@ class Note(BaseModel): class MailingListImportResponse(BaseModel): + """Read-only view of a MailingListImport""" + id: str """A unique ID prefixed with mailing*list_import*""" diff --git a/src/postgrid/types/print_mail/mailing_list_update.py b/src/postgrid/types/print_mail/mailing_list_update.py index 6aaa358..ce2d9ca 100644 --- a/src/postgrid/types/print_mail/mailing_list_update.py +++ b/src/postgrid/types/print_mail/mailing_list_update.py @@ -8,6 +8,8 @@ class MailingListUpdate(BaseModel): + """Parameters for updating an existing mailing list.""" + description: Optional[str] = None """An optional string describing this resource. diff --git a/src/postgrid/types/print_mail/order_profiles/self_mailer_profile.py b/src/postgrid/types/print_mail/order_profiles/self_mailer_profile.py index 4656ce8..ea6810c 100644 --- a/src/postgrid/types/print_mail/order_profiles/self_mailer_profile.py +++ b/src/postgrid/types/print_mail/order_profiles/self_mailer_profile.py @@ -14,6 +14,8 @@ class SelfMailerProfile(BaseModel): + """Represents a Self-Mailer Profile resource.""" + id: str """Unique identifier for the order profile.""" diff --git a/src/postgrid/types/print_mail/plastic_card.py b/src/postgrid/types/print_mail/plastic_card.py index 1ba4f09..a064411 100644 --- a/src/postgrid/types/print_mail/plastic_card.py +++ b/src/postgrid/types/print_mail/plastic_card.py @@ -11,6 +11,8 @@ class DoubleSided(BaseModel): + """Model representing a double-sided plastic card.""" + back_html: Optional[str] = FieldInfo(alias="backHTML", default=None) """The HTML content for the back side of the double-sided plastic card.""" @@ -31,6 +33,8 @@ class DoubleSided(BaseModel): class SingleSided(BaseModel): + """Model representing a single-sided plastic card.""" + html: Optional[str] = None """The HTML content for the single-sided plastic card. @@ -48,6 +52,8 @@ class SingleSided(BaseModel): class PlasticCard(BaseModel): + """Model representing a plastic card.""" + size: Literal["standard"] """Enum representing the size of the plastic card.""" diff --git a/src/postgrid/types/print_mail/plastic_card_param.py b/src/postgrid/types/print_mail/plastic_card_param.py index 4ae554e..22f457b 100644 --- a/src/postgrid/types/print_mail/plastic_card_param.py +++ b/src/postgrid/types/print_mail/plastic_card_param.py @@ -10,6 +10,8 @@ class DoubleSided(TypedDict, total=False): + """Model representing a double-sided plastic card.""" + back_html: Annotated[str, PropertyInfo(alias="backHTML")] """The HTML content for the back side of the double-sided plastic card.""" @@ -30,6 +32,8 @@ class DoubleSided(TypedDict, total=False): class SingleSided(TypedDict, total=False): + """Model representing a single-sided plastic card.""" + html: str """The HTML content for the single-sided plastic card. @@ -47,6 +51,8 @@ class SingleSided(TypedDict, total=False): class PlasticCardParam(TypedDict, total=False): + """Model representing a plastic card.""" + size: Required[Literal["standard"]] """Enum representing the size of the plastic card.""" diff --git a/src/postgrid/types/print_mail/postcard.py b/src/postgrid/types/print_mail/postcard.py index c153dc6..b624534 100644 --- a/src/postgrid/types/print_mail/postcard.py +++ b/src/postgrid/types/print_mail/postcard.py @@ -15,6 +15,11 @@ class Cancellation(BaseModel): + """The cancellation details of this order. + + Populated if the order has been cancelled. + """ + reason: Literal["user_initiated", "invalid_content", "invalid_order_mailing_class"] """The reason for the cancellation.""" diff --git a/src/postgrid/types/print_mail/report.py b/src/postgrid/types/print_mail/report.py index 958fe18..49de3b1 100644 --- a/src/postgrid/types/print_mail/report.py +++ b/src/postgrid/types/print_mail/report.py @@ -12,6 +12,8 @@ class Report(BaseModel): + """Represents a saved Report definition.""" + id: str """Unique identifier for the report.""" diff --git a/src/postgrid/types/print_mail/reports/report_export.py b/src/postgrid/types/print_mail/reports/report_export.py index b36cec3..768e1f2 100644 --- a/src/postgrid/types/print_mail/reports/report_export.py +++ b/src/postgrid/types/print_mail/reports/report_export.py @@ -12,6 +12,8 @@ class Report(BaseModel): + """Details of the report this export was generated from.""" + id: str """The ID of the report.""" @@ -20,6 +22,8 @@ class Report(BaseModel): class ReportExport(BaseModel): + """Represents a report export job and its results.""" + id: str """Unique identifier for the report export.""" diff --git a/src/postgrid/types/print_mail/reports/report_sample.py b/src/postgrid/types/print_mail/reports/report_sample.py index b0b617c..cb64924 100644 --- a/src/postgrid/types/print_mail/reports/report_sample.py +++ b/src/postgrid/types/print_mail/reports/report_sample.py @@ -8,6 +8,8 @@ class ReportSample(BaseModel): + """Represents the result of a report sample query.""" + id: str """Unique identifier for the sample query result.""" diff --git a/src/postgrid/types/print_mail/self_mailer.py b/src/postgrid/types/print_mail/self_mailer.py index d8f88f9..47fd82e 100644 --- a/src/postgrid/types/print_mail/self_mailer.py +++ b/src/postgrid/types/print_mail/self_mailer.py @@ -15,6 +15,11 @@ class Cancellation(BaseModel): + """The cancellation details of this order. + + Populated if the order has been cancelled. + """ + reason: Literal["user_initiated", "invalid_content", "invalid_order_mailing_class"] """The reason for the cancellation.""" diff --git a/src/postgrid/types/print_mail/sub_organization.py b/src/postgrid/types/print_mail/sub_organization.py index ebf3b1a..8f2faed 100644 --- a/src/postgrid/types/print_mail/sub_organization.py +++ b/src/postgrid/types/print_mail/sub_organization.py @@ -11,6 +11,8 @@ class SubOrganization(BaseModel): + """The Sub-Organization object.""" + id: str """A unique ID prefixed with `sub_org_`.""" diff --git a/src/postgrid/types/print_mail/sub_organization_retrieve_users_response.py b/src/postgrid/types/print_mail/sub_organization_retrieve_users_response.py index e6b8e5b..028b1d3 100644 --- a/src/postgrid/types/print_mail/sub_organization_retrieve_users_response.py +++ b/src/postgrid/types/print_mail/sub_organization_retrieve_users_response.py @@ -13,6 +13,8 @@ class SubOrganizationRetrieveUsersResponseItem(BaseModel): + """The user object.""" + id: str """A unique ID prefixed with `user_`.""" diff --git a/src/postgrid/types/print_mail/sub_organization_update_response.py b/src/postgrid/types/print_mail/sub_organization_update_response.py index 0fb225a..bf20be1 100644 --- a/src/postgrid/types/print_mail/sub_organization_update_response.py +++ b/src/postgrid/types/print_mail/sub_organization_update_response.py @@ -13,6 +13,8 @@ class UserAPIKey(BaseModel): + """An API key.""" + value: str """The value of the API key.""" @@ -24,6 +26,8 @@ class UserAPIKey(BaseModel): class User(BaseModel): + """The user object.""" + id: str """A unique ID prefixed with `user_`.""" diff --git a/src/postgrid/types/print_mail/verification_status_count.py b/src/postgrid/types/print_mail/verification_status_count.py index f43afb5..8cda114 100644 --- a/src/postgrid/types/print_mail/verification_status_count.py +++ b/src/postgrid/types/print_mail/verification_status_count.py @@ -8,6 +8,8 @@ class VerificationStatusCount(BaseModel): + """Count of contact verification statuses.""" + corrected_count: int = FieldInfo(alias="correctedCount") """Number of contacts that were corrected during verification."""