Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ from courier.types import (
NotificationMetricsResponse,
NotificationTemplateAlias,
NotificationTemplateCreateRequest,
NotificationTemplateEmail,
NotificationTemplatePayload,
NotificationTemplatePublishRequest,
NotificationTemplateResponse,
Expand Down
2 changes: 2 additions & 0 deletions src/courier/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
from .notification_publish_params import NotificationPublishParams as NotificationPublishParams
from .notification_replace_params import NotificationReplaceParams as NotificationReplaceParams
from .notification_template_alias import NotificationTemplateAlias as NotificationTemplateAlias
from .notification_template_email import NotificationTemplateEmail as NotificationTemplateEmail
from .notification_template_state import NotificationTemplateState as NotificationTemplateState
from .preference_change_log_entry import PreferenceChangeLogEntry as PreferenceChangeLogEntry
from .preference_change_log_value import PreferenceChangeLogValue as PreferenceChangeLogValue
Expand Down Expand Up @@ -333,6 +334,7 @@
from .journey_fetch_post_put_node_param import JourneyFetchPostPutNodeParam as JourneyFetchPostPutNodeParam
from .notification_content_get_response import NotificationContentGetResponse as NotificationContentGetResponse
from .notification_list_versions_params import NotificationListVersionsParams as NotificationListVersionsParams
from .notification_template_email_param import NotificationTemplateEmailParam as NotificationTemplateEmailParam
from .put_subscriptions_recipient_param import PutSubscriptionsRecipientParam as PutSubscriptionsRecipientParam
from .workspace_preference_get_response import WorkspacePreferenceGetResponse as WorkspacePreferenceGetResponse
from .journey_segment_trigger_node_param import JourneySegmentTriggerNodeParam as JourneySegmentTriggerNodeParam
Expand Down
29 changes: 29 additions & 0 deletions src/courier/types/notification_template_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional

from pydantic import Field as FieldInfo

from .._models import BaseModel

__all__ = ["NotificationTemplateEmail"]


class NotificationTemplateEmail(BaseModel):
"""
Email header fields for the template's email channel: the From, Reply-to, CC and BCC values set in the Studio email channel settings. Each value may use template variables, such as `{{data.cc}}`, which are resolved at send time.
Reads omit `email` when no header is set, and omit each unset field.
Writes treat it as optional, with three meanings. Omit it to keep the stored headers. Send null to clear all four. Send an object to replace all four: a field the object leaves out is cleared. Other email channel settings, such as the subject, are kept either way. Headers only apply while `content` has an email channel; with no email channel they are not stored.
"""

bcc: Optional[List[str]] = None
"""BCC addresses."""

cc: Optional[List[str]] = None
"""CC addresses."""

from_: Optional[str] = FieldInfo(alias="from", default=None)
"""The From address."""

reply_to: Optional[str] = None
"""The Reply-to address."""
34 changes: 34 additions & 0 deletions src/courier/types/notification_template_email_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

from .._types import SequenceNotStr

__all__ = ["NotificationTemplateEmailParam"]

_NotificationTemplateEmailParamReservedKeywords = TypedDict(
"_NotificationTemplateEmailParamReservedKeywords",
{
"from": str,
},
total=False,
)


class NotificationTemplateEmailParam(_NotificationTemplateEmailParamReservedKeywords, total=False):
"""
Email header fields for the template's email channel: the From, Reply-to, CC and BCC values set in the Studio email channel settings. Each value may use template variables, such as `{{data.cc}}`, which are resolved at send time.
Reads omit `email` when no header is set, and omit each unset field.
Writes treat it as optional, with three meanings. Omit it to keep the stored headers. Send null to clear all four. Send an object to replace all four: a field the object leaves out is cleared. Other email channel settings, such as the subject, are kept either way. Headers only apply while `content` has an email channel; with no email channel they are not stored.
"""

bcc: SequenceNotStr[str]
"""BCC addresses."""

cc: SequenceNotStr[str]
"""CC addresses."""

reply_to: str
"""The Reply-to address."""
14 changes: 14 additions & 0 deletions src/courier/types/notification_template_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .._models import BaseModel
from .shared.elemental_content import ElementalContent
from .notification_template_email import NotificationTemplateEmail

__all__ = ["NotificationTemplatePayload", "Brand", "Routing", "Subscription"]

Expand Down Expand Up @@ -48,3 +49,16 @@ class NotificationTemplatePayload(BaseModel):

tags: List[str]
"""Tags for categorization. Send empty array for none."""

email: Optional[NotificationTemplateEmail] = None
"""
Email header fields for the template's email channel: the From, Reply-to, CC and
BCC values set in the Studio email channel settings. Each value may use template
variables, such as `{{data.cc}}`, which are resolved at send time. Reads omit
`email` when no header is set, and omit each unset field. Writes treat it as
optional, with three meanings. Omit it to keep the stored headers. Send null to
clear all four. Send an object to replace all four: a field the object leaves
out is cleared. Other email channel settings, such as the subject, are kept
either way. Headers only apply while `content` has an email channel; with no
email channel they are not stored.
"""
14 changes: 14 additions & 0 deletions src/courier/types/notification_template_payload_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .._types import SequenceNotStr
from .shared_params.elemental_content import ElementalContent
from .notification_template_email_param import NotificationTemplateEmailParam

__all__ = ["NotificationTemplatePayloadParam", "Brand", "Routing", "Subscription"]

Expand Down Expand Up @@ -51,3 +52,16 @@ class NotificationTemplatePayloadParam(TypedDict, total=False):

tags: Required[SequenceNotStr[str]]
"""Tags for categorization. Send empty array for none."""

email: Optional[NotificationTemplateEmailParam]
"""
Email header fields for the template's email channel: the From, Reply-to, CC and
BCC values set in the Studio email channel settings. Each value may use template
variables, such as `{{data.cc}}`, which are resolved at send time. Reads omit
`email` when no header is set, and omit each unset field. Writes treat it as
optional, with three meanings. Omit it to keep the stored headers. Send null to
clear all four. Send an object to replace all four: a field the object leaves
out is cleared. Other email channel settings, such as the subject, are kept
either way. Headers only apply while `content` has an email channel; with no
email channel they are not stored.
"""
24 changes: 24 additions & 0 deletions tests/api_resources/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def test_method_create_with_all_params(self, client: Courier) -> None:
"routing": {"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"},
"subscription": {"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"},
"tags": ["onboarding", "welcome"],
"email": {
"bcc": ["string"],
"cc": ["string"],
"from": "from",
"reply_to": "reply_to",
},
"alias": "welcome",
},
state="DRAFT",
Expand Down Expand Up @@ -636,6 +642,12 @@ def test_method_replace_with_all_params(self, client: Courier) -> None:
"routing": {"strategy_id": "strategy_id"},
"subscription": {"topic_id": "topic_id"},
"tags": ["updated"],
"email": {
"bcc": ["string"],
"cc": ["string"],
"from": "from",
"reply_to": "reply_to",
},
"alias": "alias",
},
state="PUBLISHED",
Expand Down Expand Up @@ -798,6 +810,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncCourier) -
"routing": {"strategy_id": "rs_01kx4h2jdafq8bk9amzvy6hbv0"},
"subscription": {"topic_id": "pt_01kx4h2jdafq8bk9a26x0kvd1t"},
"tags": ["onboarding", "welcome"],
"email": {
"bcc": ["string"],
"cc": ["string"],
"from": "from",
"reply_to": "reply_to",
},
"alias": "welcome",
},
state="DRAFT",
Expand Down Expand Up @@ -1377,6 +1395,12 @@ async def test_method_replace_with_all_params(self, async_client: AsyncCourier)
"routing": {"strategy_id": "strategy_id"},
"subscription": {"topic_id": "topic_id"},
"tags": ["updated"],
"email": {
"bcc": ["string"],
"cc": ["string"],
"from": "from",
"reply_to": "reply_to",
},
"alias": "alias",
},
state="PUBLISHED",
Expand Down
Loading