Skip to content

Commit a8a254b

Browse files
committed
Bump version to 2.5.0
1 parent e9f81ab commit a8a254b

5 files changed

Lines changed: 41 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
## [Unreleased]
2-
* Add StatsApi with get, by_domains, by_categories, by_email_service_providers, by_date endpoints
3-
* Add api_query_params to RequestParams for automatic [] serialization of list query params
1+
## [2.5.0] - 2026-03-06
2+
3+
- Add StatsApi with get, by_domains, by_categories, by_email_service_providers, by_date endpoints
4+
- Add api_query_params to RequestParams for automatic [] serialization of list query params
45

56
## [2.4.0] - 2025-12-04
6-
* Fix issue #52: Update README.md using new guideline by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/55
7-
* Fix issue #53: Add full usage in all examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/56
8-
* Merge functionality and examples in Readme by @yanchuk in https://github.com/mailtrap/mailtrap-python/pull/57
9-
* Fix issue #54: Add SendingDomainsApi, related models, tests, examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/58
7+
8+
- Fix issue #52: Update README.md using new guideline by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/55
9+
- Fix issue #53: Add full usage in all examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/56
10+
- Merge functionality and examples in Readme by @yanchuk in https://github.com/mailtrap/mailtrap-python/pull/57
11+
- Fix issue #54: Add SendingDomainsApi, related models, tests, examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/58
1012

1113
## [2.3.0] - 2025-10-24
12-
* Fix issue #24: Add batch_send method to SendingApi, add models by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/47
13-
* Fix issue #42: Add GeneralApi, related models, examples, tests. by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/48
14-
* Fix issue #41: Add ContactExportsApi, related models, tests and examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/49
15-
* Fix issue #45: Add ContactEventsApi, related models, tests and examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/51
14+
15+
- Fix issue #24: Add batch_send method to SendingApi, add models by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/47
16+
- Fix issue #42: Add GeneralApi, related models, examples, tests. by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/48
17+
- Fix issue #41: Add ContactExportsApi, related models, tests and examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/49
18+
- Fix issue #45: Add ContactEventsApi, related models, tests and examples by @Ihor-Bilous in https://github.com/mailtrap/mailtrap-python/pull/51
1619

1720
## [2.2.0] - 2025-09-18
21+
1822
- Potential fix for code scanning alert no. 1: Workflow does not contain permissions by @mklocek in https://github.com/railsware/mailtrap-python/pull/15
1923
- Fix issue #29. Add support of Emails Sandbox (Testing) API: Projects by @Ihor-Bilous in https://github.com/railsware/mailtrap-python/pull/31
2024
- Issue 25 by @Ihor-Bilous in https://github.com/railsware/mailtrap-python/pull/33
@@ -29,13 +33,15 @@
2933
- Fix issue #28: Add AttachmentsApi, related models, tests, examples by @Ihor-Bilous in https://github.com/railsware/mailtrap-python/pull/44
3034

3135
## [2.1.0] - 2025-05-12
36+
3237
- Add sandbox mode support in MailtrapClient
3338
- It requires inbox_id parameter to be set
3439
- Add bulk mode support in MailtrapClient
3540
- Drop support python 3.6 - 3.8
3641
- Add support for python 3.12 - 3.13
3742

3843
## [2.0.1] - 2023-05-18
44+
3945
- Add User-Agent header to all requests
4046

4147
## [2.0.0] - 2023-03-11

mailtrap/api/resources/stats.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ def __init__(self, client: HttpClient) -> None:
1717

1818
def get(self, account_id: int, params: StatsFilterParams) -> SendingStats:
1919
"""Get aggregated sending stats."""
20-
response = self._client.get(self._base_path(account_id), params=params.api_query_params)
20+
response = self._client.get(
21+
self._base_path(account_id),
22+
params=params.api_query_params,
23+
)
2124
return SendingStats(**response)
2225

23-
def by_domains(self, account_id: int, params: StatsFilterParams) -> list[SendingStatGroup]:
26+
def by_domains(
27+
self, account_id: int, params: StatsFilterParams
28+
) -> list[SendingStatGroup]:
2429
"""Get sending stats grouped by domains."""
2530
return self._grouped_stats(account_id, "domains", params)
2631

27-
def by_categories(self, account_id: int, params: StatsFilterParams) -> list[SendingStatGroup]:
32+
def by_categories(
33+
self, account_id: int, params: StatsFilterParams
34+
) -> list[SendingStatGroup]:
2835
"""Get sending stats grouped by categories."""
2936
return self._grouped_stats(account_id, "categories", params)
3037

@@ -34,7 +41,9 @@ def by_email_service_providers(
3441
"""Get sending stats grouped by email service providers."""
3542
return self._grouped_stats(account_id, "email_service_providers", params)
3643

37-
def by_date(self, account_id: int, params: StatsFilterParams) -> list[SendingStatGroup]:
44+
def by_date(
45+
self, account_id: int, params: StatsFilterParams
46+
) -> list[SendingStatGroup]:
3847
"""Get sending stats grouped by date."""
3948
return self._grouped_stats(account_id, "date", params)
4049

mailtrap/models/stats.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class SendingStatGroup:
2929

3030
@dataclass
3131
class StatsFilterParams(RequestParams):
32-
start_date: str = ""
33-
end_date: str = ""
34-
sending_domain_ids: Optional[list] = None
35-
sending_streams: Optional[list] = None
36-
categories: Optional[list] = None
37-
email_service_providers: Optional[list] = None
32+
start_date: Optional[str] = None
33+
end_date: Optional[str] = None
34+
sending_domain_ids: Optional[list[int]] = None
35+
sending_streams: Optional[list[str]] = None
36+
categories: Optional[list[str]] = None
37+
email_service_providers: Optional[list[str]] = None

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mailtrap"
3-
version = "2.4.0"
3+
version = "2.5.0"
44
description = "Official mailtrap.io API client"
55
readme = "README.md"
66
license = {file = "LICENSE.txt"}
@@ -23,7 +23,7 @@ dynamic = ["dependencies"]
2323
Homepage = "https://mailtrap.io/"
2424
Documentation = "https://github.com/railsware/mailtrap-python"
2525
Repository = "https://github.com/railsware/mailtrap-python.git"
26-
"API documentation" = "https://api-docs.mailtrap.io/"
26+
"API documentation" = "https://docs.mailtrap.io/developers"
2727

2828
[build-system]
2929
requires = ["setuptools"]

tests/unit/api/general/test_stats.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ def test_get_should_return_sending_stats(
143143
assert stats.spam_rate == 0.013
144144

145145
@responses.activate
146-
def test_get_with_filter_params(self, client: StatsApi, sample_stats_dict: dict) -> None:
146+
def test_get_with_filter_params(
147+
self, client: StatsApi, sample_stats_dict: dict
148+
) -> None:
147149
responses.get(
148150
BASE_STATS_URL,
149151
json=sample_stats_dict,

0 commit comments

Comments
 (0)