Skip to content

Commit 8b7be91

Browse files
mikemillacodegen
andauthored
feat(api): cross-client previews endpoints (#208)
Co-authored-by: courier-codegen <codegen@users.noreply.github.com>
1 parent d441b72 commit 8b7be91

33 files changed

Lines changed: 2693 additions & 3 deletions

‎.stats.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 158
1+
configured_endpoints: 167

‎api.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,29 @@ Methods:
337337
- <code title="post /broadcasts/{broadcastId}/schedule">client.broadcasts.<a href="./src/courier/resources/broadcasts.py">schedule</a>(broadcast_id, \*\*<a href="src/courier/types/broadcast_schedule_params.py">params</a>) -> <a href="./src/courier/types/broadcast.py">Broadcast</a></code>
338338
- <code title="post /broadcasts/{broadcastId}/send">client.broadcasts.<a href="./src/courier/resources/broadcasts.py">send</a>(broadcast_id, \*\*<a href="src/courier/types/broadcast_send_params.py">params</a>) -> <a href="./src/courier/types/broadcast.py">Broadcast</a></code>
339339

340+
# Previews
341+
342+
Types:
343+
344+
```python
345+
from courier.types import (
346+
CreateDeviceSetRequest,
347+
DeviceSet,
348+
DeviceSetListResponse,
349+
PreviewDevice,
350+
PreviewDeviceListResponse,
351+
)
352+
```
353+
354+
Methods:
355+
356+
- <code title="delete /previews/device-sets/{deviceSetId}">client.previews.<a href="./src/courier/resources/previews.py">archive_device_set</a>(device_set_id) -> <a href="./src/courier/types/device_set.py">DeviceSet</a></code>
357+
- <code title="post /previews/device-sets">client.previews.<a href="./src/courier/resources/previews.py">create_device_set</a>(\*\*<a href="src/courier/types/preview_create_device_set_params.py">params</a>) -> <a href="./src/courier/types/device_set.py">DeviceSet</a></code>
358+
- <code title="get /previews/device-sets">client.previews.<a href="./src/courier/resources/previews.py">list_device_sets</a>() -> <a href="./src/courier/types/device_set_list_response.py">DeviceSetListResponse</a></code>
359+
- <code title="get /previews/devices">client.previews.<a href="./src/courier/resources/previews.py">list_devices</a>() -> <a href="./src/courier/types/preview_device_list_response.py">PreviewDeviceListResponse</a></code>
360+
- <code title="get /previews/device-sets/{deviceSetId}">client.previews.<a href="./src/courier/resources/previews.py">retrieve_device_set</a>(device_set_id) -> <a href="./src/courier/types/device_set.py">DeviceSet</a></code>
361+
- <code title="put /previews/device-sets/{deviceSetId}">client.previews.<a href="./src/courier/resources/previews.py">update_device_set</a>(device_set_id, \*\*<a href="src/courier/types/preview_update_device_set_params.py">params</a>) -> <a href="./src/courier/types/device_set.py">DeviceSet</a></code>
362+
340363
# Bulk
341364

342365
Types:
@@ -548,6 +571,32 @@ Methods:
548571
- <code title="get /notifications/{id}/{submissionId}/checks">client.notifications.checks.<a href="./src/courier/resources/notifications/checks.py">list</a>(submission_id, \*, id) -> <a href="./src/courier/types/notifications/check_list_response.py">CheckListResponse</a></code>
549572
- <code title="delete /notifications/{id}/{submissionId}/checks">client.notifications.checks.<a href="./src/courier/resources/notifications/checks.py">delete</a>(submission_id, \*, id) -> None</code>
550573

574+
## Previews
575+
576+
### Runs
577+
578+
Types:
579+
580+
```python
581+
from courier.types.notifications.previews import (
582+
CreatePreviewRunRequest,
583+
PreviewResult,
584+
PreviewResultFailureReason,
585+
PreviewResultStatus,
586+
PreviewRun,
587+
PreviewRunDetail,
588+
PreviewRunFailureReason,
589+
PreviewRunListResponse,
590+
PreviewRunStatus,
591+
)
592+
```
593+
594+
Methods:
595+
596+
- <code title="post /notifications/{id}/previews/runs">client.notifications.previews.runs.<a href="./src/courier/resources/notifications/previews/runs.py">create</a>(id, \*\*<a href="src/courier/types/notifications/previews/run_create_params.py">params</a>) -> <a href="./src/courier/types/notifications/previews/preview_run.py">PreviewRun</a></code>
597+
- <code title="get /notifications/{id}/previews/runs/{previewRunId}">client.notifications.previews.runs.<a href="./src/courier/resources/notifications/previews/runs.py">retrieve</a>(preview_run_id, \*, id) -> <a href="./src/courier/types/notifications/previews/preview_run_detail.py">PreviewRunDetail</a></code>
598+
- <code title="get /notifications/{id}/previews/runs">client.notifications.previews.runs.<a href="./src/courier/resources/notifications/previews/runs.py">list</a>(id, \*\*<a href="src/courier/types/notifications/previews/run_list_params.py">params</a>) -> <a href="./src/courier/types/notifications/previews/preview_run_list_response.py">PreviewRunListResponse</a></code>
599+
551600
# RoutingStrategies
552601

553602
Types:

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "trycourier"
3-
version = "9.10.0"
3+
version = "9.9.0"
44
description = "The official Python library for the Courier API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

‎src/courier/_client.py‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
tenants,
4848
journeys,
4949
messages,
50+
previews,
5051
profiles,
5152
requests,
5253
audiences,
@@ -65,6 +66,7 @@
6566
from .resources.brands import BrandsResource, AsyncBrandsResource
6667
from .resources.inbound import InboundResource, AsyncInboundResource
6768
from .resources.messages import MessagesResource, AsyncMessagesResource
69+
from .resources.previews import PreviewsResource, AsyncPreviewsResource
6870
from .resources.requests import RequestsResource, AsyncRequestsResource
6971
from .resources.audiences import AudiencesResource, AsyncAudiencesResource
7072
from .resources.broadcasts import BroadcastsResource, AsyncBroadcastsResource
@@ -222,6 +224,15 @@ def broadcasts(self) -> BroadcastsResource:
222224

223225
return BroadcastsResource(self)
224226

227+
@cached_property
228+
def previews(self) -> PreviewsResource:
229+
"""
230+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
231+
"""
232+
from .resources.previews import PreviewsResource
233+
234+
return PreviewsResource(self)
235+
225236
@cached_property
226237
def bulk(self) -> BulkResource:
227238
from .resources.bulk import BulkResource
@@ -586,6 +597,15 @@ def broadcasts(self) -> AsyncBroadcastsResource:
586597

587598
return AsyncBroadcastsResource(self)
588599

600+
@cached_property
601+
def previews(self) -> AsyncPreviewsResource:
602+
"""
603+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
604+
"""
605+
from .resources.previews import AsyncPreviewsResource
606+
607+
return AsyncPreviewsResource(self)
608+
589609
@cached_property
590610
def bulk(self) -> AsyncBulkResource:
591611
from .resources.bulk import AsyncBulkResource
@@ -892,6 +912,15 @@ def broadcasts(self) -> broadcasts.BroadcastsResourceWithRawResponse:
892912

893913
return BroadcastsResourceWithRawResponse(self._client.broadcasts)
894914

915+
@cached_property
916+
def previews(self) -> previews.PreviewsResourceWithRawResponse:
917+
"""
918+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
919+
"""
920+
from .resources.previews import PreviewsResourceWithRawResponse
921+
922+
return PreviewsResourceWithRawResponse(self._client.previews)
923+
895924
@cached_property
896925
def bulk(self) -> bulk.BulkResourceWithRawResponse:
897926
from .resources.bulk import BulkResourceWithRawResponse
@@ -1086,6 +1115,15 @@ def broadcasts(self) -> broadcasts.AsyncBroadcastsResourceWithRawResponse:
10861115

10871116
return AsyncBroadcastsResourceWithRawResponse(self._client.broadcasts)
10881117

1118+
@cached_property
1119+
def previews(self) -> previews.AsyncPreviewsResourceWithRawResponse:
1120+
"""
1121+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
1122+
"""
1123+
from .resources.previews import AsyncPreviewsResourceWithRawResponse
1124+
1125+
return AsyncPreviewsResourceWithRawResponse(self._client.previews)
1126+
10891127
@cached_property
10901128
def bulk(self) -> bulk.AsyncBulkResourceWithRawResponse:
10911129
from .resources.bulk import AsyncBulkResourceWithRawResponse
@@ -1280,6 +1318,15 @@ def broadcasts(self) -> broadcasts.BroadcastsResourceWithStreamingResponse:
12801318

12811319
return BroadcastsResourceWithStreamingResponse(self._client.broadcasts)
12821320

1321+
@cached_property
1322+
def previews(self) -> previews.PreviewsResourceWithStreamingResponse:
1323+
"""
1324+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
1325+
"""
1326+
from .resources.previews import PreviewsResourceWithStreamingResponse
1327+
1328+
return PreviewsResourceWithStreamingResponse(self._client.previews)
1329+
12831330
@cached_property
12841331
def bulk(self) -> bulk.BulkResourceWithStreamingResponse:
12851332
from .resources.bulk import BulkResourceWithStreamingResponse
@@ -1474,6 +1521,15 @@ def broadcasts(self) -> broadcasts.AsyncBroadcastsResourceWithStreamingResponse:
14741521

14751522
return AsyncBroadcastsResourceWithStreamingResponse(self._client.broadcasts)
14761523

1524+
@cached_property
1525+
def previews(self) -> previews.AsyncPreviewsResourceWithStreamingResponse:
1526+
"""
1527+
Render a template's email content on real email clients and read back the screenshots, so you can check how it looks before you send it.
1528+
"""
1529+
from .resources.previews import AsyncPreviewsResourceWithStreamingResponse
1530+
1531+
return AsyncPreviewsResourceWithStreamingResponse(self._client.previews)
1532+
14771533
@cached_property
14781534
def bulk(self) -> bulk.AsyncBulkResourceWithStreamingResponse:
14791535
from .resources.bulk import AsyncBulkResourceWithStreamingResponse

‎src/courier/_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "courier"
4-
__version__ = "9.10.0" # x-release-please-version
4+
__version__ = "9.9.0" # x-release-please-version

‎src/courier/resources/__init__.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
MessagesResourceWithStreamingResponse,
8989
AsyncMessagesResourceWithStreamingResponse,
9090
)
91+
from .previews import (
92+
PreviewsResource,
93+
AsyncPreviewsResource,
94+
PreviewsResourceWithRawResponse,
95+
AsyncPreviewsResourceWithRawResponse,
96+
PreviewsResourceWithStreamingResponse,
97+
AsyncPreviewsResourceWithStreamingResponse,
98+
)
9199
from .profiles import (
92100
ProfilesResource,
93101
AsyncProfilesResource,
@@ -226,6 +234,12 @@
226234
"AsyncBroadcastsResourceWithRawResponse",
227235
"BroadcastsResourceWithStreamingResponse",
228236
"AsyncBroadcastsResourceWithStreamingResponse",
237+
"PreviewsResource",
238+
"AsyncPreviewsResource",
239+
"PreviewsResourceWithRawResponse",
240+
"AsyncPreviewsResourceWithRawResponse",
241+
"PreviewsResourceWithStreamingResponse",
242+
"AsyncPreviewsResourceWithStreamingResponse",
229243
"BulkResource",
230244
"AsyncBulkResource",
231245
"BulkResourceWithRawResponse",

‎src/courier/resources/notifications/__init__.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
ChecksResourceWithStreamingResponse,
99
AsyncChecksResourceWithStreamingResponse,
1010
)
11+
from .previews import (
12+
PreviewsResource,
13+
AsyncPreviewsResource,
14+
PreviewsResourceWithRawResponse,
15+
AsyncPreviewsResourceWithRawResponse,
16+
PreviewsResourceWithStreamingResponse,
17+
AsyncPreviewsResourceWithStreamingResponse,
18+
)
1119
from .notifications import (
1220
NotificationsResource,
1321
AsyncNotificationsResource,
@@ -24,6 +32,12 @@
2432
"AsyncChecksResourceWithRawResponse",
2533
"ChecksResourceWithStreamingResponse",
2634
"AsyncChecksResourceWithStreamingResponse",
35+
"PreviewsResource",
36+
"AsyncPreviewsResource",
37+
"PreviewsResourceWithRawResponse",
38+
"AsyncPreviewsResourceWithRawResponse",
39+
"PreviewsResourceWithStreamingResponse",
40+
"AsyncPreviewsResourceWithStreamingResponse",
2741
"NotificationsResource",
2842
"AsyncNotificationsResource",
2943
"NotificationsResourceWithRawResponse",

‎src/courier/resources/notifications/notifications.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
async_to_streamed_response_wrapper,
4242
)
4343
from ..._base_client import make_request_options
44+
from .previews.previews import (
45+
PreviewsResource,
46+
AsyncPreviewsResource,
47+
PreviewsResourceWithRawResponse,
48+
AsyncPreviewsResourceWithRawResponse,
49+
PreviewsResourceWithStreamingResponse,
50+
AsyncPreviewsResourceWithStreamingResponse,
51+
)
4452
from ...types.notification_list_response import NotificationListResponse
4553
from ...types.notification_template_state import NotificationTemplateState
4654
from ...types.notification_metrics_response import NotificationMetricsResponse
@@ -65,6 +73,10 @@ def checks(self) -> ChecksResource:
6573
"""
6674
return ChecksResource(self._client)
6775

76+
@cached_property
77+
def previews(self) -> PreviewsResource:
78+
return PreviewsResource(self._client)
79+
6880
@cached_property
6981
def with_raw_response(self) -> NotificationsResourceWithRawResponse:
7082
"""
@@ -747,6 +759,10 @@ def checks(self) -> AsyncChecksResource:
747759
"""
748760
return AsyncChecksResource(self._client)
749761

762+
@cached_property
763+
def previews(self) -> AsyncPreviewsResource:
764+
return AsyncPreviewsResource(self._client)
765+
750766
@cached_property
751767
def with_raw_response(self) -> AsyncNotificationsResourceWithRawResponse:
752768
"""
@@ -1469,6 +1485,10 @@ def checks(self) -> ChecksResourceWithRawResponse:
14691485
"""
14701486
return ChecksResourceWithRawResponse(self._notifications.checks)
14711487

1488+
@cached_property
1489+
def previews(self) -> PreviewsResourceWithRawResponse:
1490+
return PreviewsResourceWithRawResponse(self._notifications.previews)
1491+
14721492

14731493
class AsyncNotificationsResourceWithRawResponse:
14741494
def __init__(self, notifications: AsyncNotificationsResource) -> None:
@@ -1518,6 +1538,10 @@ def checks(self) -> AsyncChecksResourceWithRawResponse:
15181538
"""
15191539
return AsyncChecksResourceWithRawResponse(self._notifications.checks)
15201540

1541+
@cached_property
1542+
def previews(self) -> AsyncPreviewsResourceWithRawResponse:
1543+
return AsyncPreviewsResourceWithRawResponse(self._notifications.previews)
1544+
15211545

15221546
class NotificationsResourceWithStreamingResponse:
15231547
def __init__(self, notifications: NotificationsResource) -> None:
@@ -1567,6 +1591,10 @@ def checks(self) -> ChecksResourceWithStreamingResponse:
15671591
"""
15681592
return ChecksResourceWithStreamingResponse(self._notifications.checks)
15691593

1594+
@cached_property
1595+
def previews(self) -> PreviewsResourceWithStreamingResponse:
1596+
return PreviewsResourceWithStreamingResponse(self._notifications.previews)
1597+
15701598

15711599
class AsyncNotificationsResourceWithStreamingResponse:
15721600
def __init__(self, notifications: AsyncNotificationsResource) -> None:
@@ -1615,3 +1643,7 @@ def checks(self) -> AsyncChecksResourceWithStreamingResponse:
16151643
Create, update, version, publish, and localize notification templates and their content.
16161644
"""
16171645
return AsyncChecksResourceWithStreamingResponse(self._notifications.checks)
1646+
1647+
@cached_property
1648+
def previews(self) -> AsyncPreviewsResourceWithStreamingResponse:
1649+
return AsyncPreviewsResourceWithStreamingResponse(self._notifications.previews)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .runs import (
4+
RunsResource,
5+
AsyncRunsResource,
6+
RunsResourceWithRawResponse,
7+
AsyncRunsResourceWithRawResponse,
8+
RunsResourceWithStreamingResponse,
9+
AsyncRunsResourceWithStreamingResponse,
10+
)
11+
from .previews import (
12+
PreviewsResource,
13+
AsyncPreviewsResource,
14+
PreviewsResourceWithRawResponse,
15+
AsyncPreviewsResourceWithRawResponse,
16+
PreviewsResourceWithStreamingResponse,
17+
AsyncPreviewsResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"RunsResource",
22+
"AsyncRunsResource",
23+
"RunsResourceWithRawResponse",
24+
"AsyncRunsResourceWithRawResponse",
25+
"RunsResourceWithStreamingResponse",
26+
"AsyncRunsResourceWithStreamingResponse",
27+
"PreviewsResource",
28+
"AsyncPreviewsResource",
29+
"PreviewsResourceWithRawResponse",
30+
"AsyncPreviewsResourceWithRawResponse",
31+
"PreviewsResourceWithStreamingResponse",
32+
"AsyncPreviewsResourceWithStreamingResponse",
33+
]

0 commit comments

Comments
 (0)