trycourier 4.8.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/README.md +1 -1
- data/lib/courier/client.rb +8 -0
- data/lib/courier/internal/util.rb +19 -6
- data/lib/courier/models/associated_notification_list_response.rb +24 -0
- data/lib/courier/models/channel.rb +75 -0
- data/lib/courier/models/channel_metadata.rb +15 -0
- data/lib/courier/models/element_with_checksums.rb +60 -0
- data/lib/courier/models/elemental_content.rb +2 -2
- data/lib/courier/models/elemental_html_node_with_type.rb +24 -0
- data/lib/courier/models/elemental_node.rb +3 -1
- data/lib/courier/models/message_channels.rb +8 -0
- data/lib/courier/models/message_providers.rb +8 -0
- data/lib/courier/models/message_providers_type.rb +38 -0
- data/lib/courier/models/metadata.rb +15 -0
- data/lib/courier/models/notification_archive_params.rb +20 -0
- data/lib/courier/models/notification_content_get_response.rb +26 -0
- data/lib/courier/models/notification_content_mutation_response.rb +61 -0
- data/lib/courier/models/notification_content_put_request.rb +51 -0
- data/lib/courier/models/notification_create_params.rb +14 -0
- data/lib/courier/models/notification_element_put_request.rb +62 -0
- data/lib/courier/models/notification_get_content.rb +0 -1
- data/lib/courier/models/notification_list_params.rb +13 -4
- data/lib/courier/models/notification_list_response.rb +108 -93
- data/lib/courier/models/notification_list_versions_params.rb +37 -0
- data/lib/courier/models/notification_locale_put_request.rb +39 -0
- data/lib/courier/models/notification_publish_params.rb +20 -0
- data/lib/courier/models/notification_put_content_params.rb +20 -0
- data/lib/courier/models/notification_put_element_params.rb +26 -0
- data/lib/courier/models/notification_put_locale_params.rb +26 -0
- data/lib/courier/models/notification_replace_params.rb +20 -0
- data/lib/courier/models/notification_retrieve_content_params.rb +14 -1
- data/lib/courier/models/notification_retrieve_content_response.rb +21 -0
- data/lib/courier/models/notification_retrieve_params.rb +33 -0
- data/lib/courier/models/notification_template_create_request.rb +45 -0
- data/lib/courier/models/notification_template_get_response.rb +92 -0
- data/lib/courier/models/notification_template_mutation_response.rb +51 -0
- data/lib/courier/models/notification_template_payload.rb +98 -0
- data/lib/courier/models/notification_template_publish_request.rb +19 -0
- data/lib/courier/models/notification_template_state.rb +16 -0
- data/lib/courier/models/notification_template_summary.rb +81 -0
- data/lib/courier/models/notification_template_update_request.rb +46 -0
- data/lib/courier/models/notification_template_version_list_response.rb +22 -0
- data/lib/courier/models/provider.rb +67 -0
- data/lib/courier/models/provider_create_params.rb +52 -0
- data/lib/courier/models/provider_delete_params.rb +20 -0
- data/lib/courier/models/provider_list_params.rb +22 -0
- data/lib/courier/models/provider_list_response.rb +24 -0
- data/lib/courier/models/provider_retrieve_params.rb +20 -0
- data/lib/courier/models/provider_update_params.rb +58 -0
- data/lib/courier/models/providers/catalog_list_params.rb +44 -0
- data/lib/courier/models/providers/catalog_list_response.rb +26 -0
- data/lib/courier/models/providers_catalog_entry.rb +86 -0
- data/lib/courier/models/routing_strategy_archive_params.rb +20 -0
- data/lib/courier/models/routing_strategy_create_params.rb +14 -0
- data/lib/courier/models/routing_strategy_create_request.rb +58 -0
- data/lib/courier/models/routing_strategy_get_response.rb +99 -0
- data/lib/courier/models/routing_strategy_list_notifications_params.rb +37 -0
- data/lib/courier/models/routing_strategy_list_params.rb +30 -0
- data/lib/courier/models/routing_strategy_list_response.rb +24 -0
- data/lib/courier/models/routing_strategy_mutation_response.rb +19 -0
- data/lib/courier/models/routing_strategy_replace_params.rb +20 -0
- data/lib/courier/models/routing_strategy_replace_request.rb +59 -0
- data/lib/courier/models/routing_strategy_retrieve_params.rb +20 -0
- data/lib/courier/models/routing_strategy_summary.rb +75 -0
- data/lib/courier/models/send_message_params.rb +6 -154
- data/lib/courier/models/tenant_template_input.rb +6 -152
- data/lib/courier/models/timeouts.rb +21 -0
- data/lib/courier/models/version_node.rb +46 -0
- data/lib/courier/models.rb +110 -0
- data/lib/courier/resources/notifications.rb +289 -12
- data/lib/courier/resources/providers/catalog.rb +49 -0
- data/lib/courier/resources/providers.rb +150 -0
- data/lib/courier/resources/routing_strategies.rb +179 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +60 -2
- data/rbi/courier/client.rbi +6 -0
- data/rbi/courier/internal/util.rbi +8 -0
- data/rbi/courier/models/associated_notification_list_response.rbi +45 -0
- data/rbi/courier/models/channel.rbi +106 -0
- data/rbi/courier/models/channel_metadata.rbi +28 -0
- data/rbi/courier/models/element_with_checksums.rbi +109 -0
- data/rbi/courier/models/elemental_content.rbi +6 -3
- data/rbi/courier/models/elemental_html_node_with_type.rbi +59 -0
- data/rbi/courier/models/elemental_node.rbi +2 -1
- data/rbi/courier/models/message_channels.rbi +11 -0
- data/rbi/courier/models/message_providers.rbi +11 -0
- data/rbi/courier/models/message_providers_type.rbi +60 -0
- data/rbi/courier/models/metadata.rbi +26 -0
- data/rbi/courier/models/notification_archive_params.rbi +35 -0
- data/rbi/courier/models/notification_content_get_response.rbi +45 -0
- data/rbi/courier/models/notification_content_mutation_response.rbi +95 -0
- data/rbi/courier/models/notification_content_put_request.rbi +145 -0
- data/rbi/courier/models/notification_create_params.rbi +27 -0
- data/rbi/courier/models/notification_element_put_request.rbi +98 -0
- data/rbi/courier/models/notification_list_params.rbi +15 -2
- data/rbi/courier/models/notification_list_response.rbi +159 -119
- data/rbi/courier/models/notification_list_versions_params.rbi +66 -0
- data/rbi/courier/models/notification_locale_put_request.rbi +79 -0
- data/rbi/courier/models/notification_publish_params.rbi +35 -0
- data/rbi/courier/models/notification_put_content_params.rbi +38 -0
- data/rbi/courier/models/notification_put_element_params.rbi +46 -0
- data/rbi/courier/models/notification_put_locale_params.rbi +46 -0
- data/rbi/courier/models/notification_replace_params.rbi +35 -0
- data/rbi/courier/models/notification_retrieve_content_params.rbi +21 -2
- data/rbi/courier/models/notification_retrieve_content_response.rbi +29 -0
- data/rbi/courier/models/notification_retrieve_params.rbi +54 -0
- data/rbi/courier/models/notification_template_create_request.rbi +102 -0
- data/rbi/courier/models/notification_template_get_response.rbi +162 -0
- data/rbi/courier/models/notification_template_mutation_response.rbi +121 -0
- data/rbi/courier/models/notification_template_payload.rbi +183 -0
- data/rbi/courier/models/notification_template_publish_request.rbi +35 -0
- data/rbi/courier/models/notification_template_state.rbi +26 -0
- data/rbi/courier/models/notification_template_summary.rbi +124 -0
- data/rbi/courier/models/notification_template_update_request.rbi +103 -0
- data/rbi/courier/models/notification_template_version_list_response.rbi +41 -0
- data/rbi/courier/models/provider.rbi +87 -0
- data/rbi/courier/models/provider_create_params.rbi +82 -0
- data/rbi/courier/models/provider_delete_params.rbi +35 -0
- data/rbi/courier/models/provider_list_params.rbi +43 -0
- data/rbi/courier/models/provider_list_response.rbi +42 -0
- data/rbi/courier/models/provider_retrieve_params.rbi +35 -0
- data/rbi/courier/models/provider_update_params.rbi +86 -0
- data/rbi/courier/models/providers/catalog_list_params.rbi +75 -0
- data/rbi/courier/models/providers/catalog_list_response.rbi +47 -0
- data/rbi/courier/models/providers_catalog_entry.rbi +129 -0
- data/rbi/courier/models/routing_strategy_archive_params.rbi +38 -0
- data/rbi/courier/models/routing_strategy_create_params.rbi +30 -0
- data/rbi/courier/models/routing_strategy_create_request.rbi +86 -0
- data/rbi/courier/models/routing_strategy_get_response.rbi +121 -0
- data/rbi/courier/models/routing_strategy_list_notifications_params.rbi +63 -0
- data/rbi/courier/models/routing_strategy_list_params.rbi +54 -0
- data/rbi/courier/models/routing_strategy_list_response.rbi +45 -0
- data/rbi/courier/models/routing_strategy_mutation_response.rbi +31 -0
- data/rbi/courier/models/routing_strategy_replace_params.rbi +38 -0
- data/rbi/courier/models/routing_strategy_replace_request.rbi +87 -0
- data/rbi/courier/models/routing_strategy_retrieve_params.rbi +38 -0
- data/rbi/courier/models/routing_strategy_summary.rbi +95 -0
- data/rbi/courier/models/send_message_params.rbi +6 -362
- data/rbi/courier/models/tenant_template_input.rbi +8 -336
- data/rbi/courier/models/timeouts.rbi +33 -0
- data/rbi/courier/models/version_node.rbi +65 -0
- data/rbi/courier/models.rbi +122 -0
- data/rbi/courier/resources/notifications.rbi +222 -6
- data/rbi/courier/resources/providers/catalog.rbi +38 -0
- data/rbi/courier/resources/providers.rbi +116 -0
- data/rbi/courier/resources/routing_strategies.rbi +147 -0
- data/sig/courier/client.rbs +4 -0
- data/sig/courier/internal/util.rbs +4 -0
- data/sig/courier/models/associated_notification_list_response.rbs +25 -0
- data/sig/courier/models/channel.rbs +61 -0
- data/sig/courier/models/channel_metadata.rbs +13 -0
- data/sig/courier/models/element_with_checksums.rbs +60 -0
- data/sig/courier/models/elemental_html_node_with_type.rbs +32 -0
- data/sig/courier/models/elemental_node.rbs +1 -0
- data/sig/courier/models/message_channels.rbs +7 -0
- data/sig/courier/models/message_providers.rbs +7 -0
- data/sig/courier/models/message_providers_type.rbs +35 -0
- data/sig/courier/models/metadata.rbs +13 -0
- data/sig/courier/models/notification_archive_params.rbs +20 -0
- data/sig/courier/models/notification_content_get_response.rbs +22 -0
- data/sig/courier/models/notification_content_mutation_response.rbs +47 -0
- data/sig/courier/models/notification_content_put_request.rbs +50 -0
- data/sig/courier/models/notification_create_params.rbs +15 -0
- data/sig/courier/models/notification_element_put_request.rbs +64 -0
- data/sig/courier/models/notification_list_params.rbs +7 -1
- data/sig/courier/models/notification_list_response.rbs +81 -71
- data/sig/courier/models/notification_list_versions_params.rbs +36 -0
- data/sig/courier/models/notification_locale_put_request.rbs +39 -0
- data/sig/courier/models/notification_publish_params.rbs +22 -0
- data/sig/courier/models/notification_put_content_params.rbs +22 -0
- data/sig/courier/models/notification_put_element_params.rbs +32 -0
- data/sig/courier/models/notification_put_locale_params.rbs +32 -0
- data/sig/courier/models/notification_replace_params.rbs +22 -0
- data/sig/courier/models/notification_retrieve_content_params.rbs +12 -2
- data/sig/courier/models/notification_retrieve_content_response.rbs +12 -0
- data/sig/courier/models/notification_retrieve_params.rbs +30 -0
- data/sig/courier/models/notification_template_create_request.rbs +40 -0
- data/sig/courier/models/notification_template_get_response.rbs +72 -0
- data/sig/courier/models/notification_template_mutation_response.rbs +46 -0
- data/sig/courier/models/notification_template_payload.rbs +75 -0
- data/sig/courier/models/notification_template_publish_request.rbs +15 -0
- data/sig/courier/models/notification_template_state.rbs +14 -0
- data/sig/courier/models/notification_template_summary.rbs +70 -0
- data/sig/courier/models/notification_template_update_request.rbs +40 -0
- data/sig/courier/models/notification_template_version_list_response.rbs +22 -0
- data/sig/courier/models/provider.rbs +52 -0
- data/sig/courier/models/provider_create_params.rbs +47 -0
- data/sig/courier/models/provider_delete_params.rbs +20 -0
- data/sig/courier/models/provider_list_params.rbs +25 -0
- data/sig/courier/models/provider_list_response.rbs +22 -0
- data/sig/courier/models/provider_retrieve_params.rbs +20 -0
- data/sig/courier/models/provider_update_params.rbs +52 -0
- data/sig/courier/models/providers/catalog_list_params.rbs +40 -0
- data/sig/courier/models/providers/catalog_list_response.rbs +27 -0
- data/sig/courier/models/providers_catalog_entry.rbs +64 -0
- data/sig/courier/models/routing_strategy_archive_params.rbs +20 -0
- data/sig/courier/models/routing_strategy_create_params.rbs +15 -0
- data/sig/courier/models/routing_strategy_create_request.rbs +45 -0
- data/sig/courier/models/routing_strategy_get_response.rbs +70 -0
- data/sig/courier/models/routing_strategy_list_notifications_params.rbs +34 -0
- data/sig/courier/models/routing_strategy_list_params.rbs +30 -0
- data/sig/courier/models/routing_strategy_list_response.rbs +25 -0
- data/sig/courier/models/routing_strategy_mutation_response.rbs +13 -0
- data/sig/courier/models/routing_strategy_replace_params.rbs +22 -0
- data/sig/courier/models/routing_strategy_replace_request.rbs +45 -0
- data/sig/courier/models/routing_strategy_retrieve_params.rbs +20 -0
- data/sig/courier/models/routing_strategy_summary.rbs +55 -0
- data/sig/courier/models/send_message_params.rbs +8 -130
- data/sig/courier/models/tenant_template_input.rbs +12 -134
- data/sig/courier/models/timeouts.rbs +15 -0
- data/sig/courier/models/version_node.rbs +32 -0
- data/sig/courier/models.rbs +108 -0
- data/sig/courier/resources/notifications.rbs +65 -3
- data/sig/courier/resources/providers/catalog.rbs +16 -0
- data/sig/courier/resources/providers.rbs +38 -0
- data/sig/courier/resources/routing_strategies.rbs +48 -0
- metadata +182 -8
- data/lib/courier/models/notifications/draft_retrieve_content_params.rb +0 -22
- data/lib/courier/resources/notifications/draft.rb +0 -33
- data/rbi/courier/models/notifications/draft_retrieve_content_params.rbi +0 -40
- data/rbi/courier/resources/notifications/draft.rbi +0 -23
- data/sig/courier/models/notifications/draft_retrieve_content_params.rbs +0 -22
- data/sig/courier/resources/notifications/draft.rbs +0 -14
|
@@ -3,34 +3,250 @@
|
|
|
3
3
|
module Courier
|
|
4
4
|
module Resources
|
|
5
5
|
class Notifications
|
|
6
|
-
sig { returns(Courier::Resources::Notifications::Draft) }
|
|
7
|
-
attr_reader :draft
|
|
8
|
-
|
|
9
6
|
sig { returns(Courier::Resources::Notifications::Checks) }
|
|
10
7
|
attr_reader :checks
|
|
11
8
|
|
|
9
|
+
# Create a notification template. Requires all fields in the notification object.
|
|
10
|
+
# Templates are created in draft state by default.
|
|
11
|
+
sig do
|
|
12
|
+
params(
|
|
13
|
+
notification: Courier::NotificationTemplatePayload::OrHash,
|
|
14
|
+
state: Courier::NotificationTemplateCreateRequest::State::OrSymbol,
|
|
15
|
+
request_options: Courier::RequestOptions::OrHash
|
|
16
|
+
).returns(Courier::NotificationTemplateMutationResponse)
|
|
17
|
+
end
|
|
18
|
+
def create(
|
|
19
|
+
# Full document shape used in POST and PUT request bodies, and returned inside the
|
|
20
|
+
# GET response envelope.
|
|
21
|
+
notification:,
|
|
22
|
+
# Template state after creation. Case-insensitive input, normalized to uppercase
|
|
23
|
+
# in the response. Defaults to "DRAFT".
|
|
24
|
+
state: nil,
|
|
25
|
+
request_options: {}
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Retrieve a notification template by ID. Returns the published version by
|
|
30
|
+
# default. Pass version=draft to retrieve an unpublished template.
|
|
31
|
+
sig do
|
|
32
|
+
params(
|
|
33
|
+
id: String,
|
|
34
|
+
version: String,
|
|
35
|
+
request_options: Courier::RequestOptions::OrHash
|
|
36
|
+
).returns(Courier::NotificationTemplateGetResponse)
|
|
37
|
+
end
|
|
38
|
+
def retrieve(
|
|
39
|
+
# Template ID (nt\_ prefix).
|
|
40
|
+
id,
|
|
41
|
+
# Version to retrieve. One of "draft", "published", or a version string like
|
|
42
|
+
# "v001". Defaults to "published".
|
|
43
|
+
version: nil,
|
|
44
|
+
request_options: {}
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# List notification templates in your workspace.
|
|
12
49
|
sig do
|
|
13
50
|
params(
|
|
14
51
|
cursor: T.nilable(String),
|
|
52
|
+
event_id: String,
|
|
15
53
|
notes: T.nilable(T::Boolean),
|
|
16
54
|
request_options: Courier::RequestOptions::OrHash
|
|
17
55
|
).returns(Courier::Models::NotificationListResponse)
|
|
18
56
|
end
|
|
19
57
|
def list(
|
|
58
|
+
# Opaque pagination cursor from a previous response. Omit for the first page.
|
|
20
59
|
cursor: nil,
|
|
21
|
-
#
|
|
60
|
+
# Filter to templates linked to this event map ID.
|
|
61
|
+
event_id: nil,
|
|
62
|
+
# Include template notes in the response. Only applies to legacy templates.
|
|
22
63
|
notes: nil,
|
|
23
64
|
request_options: {}
|
|
24
65
|
)
|
|
25
66
|
end
|
|
26
67
|
|
|
68
|
+
# Archive a notification template.
|
|
69
|
+
sig do
|
|
70
|
+
params(
|
|
71
|
+
id: String,
|
|
72
|
+
request_options: Courier::RequestOptions::OrHash
|
|
73
|
+
).void
|
|
74
|
+
end
|
|
75
|
+
def archive(
|
|
76
|
+
# Template ID (nt\_ prefix).
|
|
77
|
+
id,
|
|
78
|
+
request_options: {}
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# List versions of a notification template.
|
|
83
|
+
sig do
|
|
84
|
+
params(
|
|
85
|
+
id: String,
|
|
86
|
+
cursor: String,
|
|
87
|
+
limit: Integer,
|
|
88
|
+
request_options: Courier::RequestOptions::OrHash
|
|
89
|
+
).returns(Courier::NotificationTemplateVersionListResponse)
|
|
90
|
+
end
|
|
91
|
+
def list_versions(
|
|
92
|
+
# Template ID (nt\_ prefix).
|
|
93
|
+
id,
|
|
94
|
+
# Opaque pagination cursor from a previous response. Omit for the first page.
|
|
95
|
+
cursor: nil,
|
|
96
|
+
# Maximum number of versions to return per page. Default 10, max 10.
|
|
97
|
+
limit: nil,
|
|
98
|
+
request_options: {}
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Publish a notification template. Publishes the current draft by default. Pass a
|
|
103
|
+
# version in the request body to publish a specific historical version.
|
|
104
|
+
sig do
|
|
105
|
+
params(
|
|
106
|
+
id: String,
|
|
107
|
+
version: String,
|
|
108
|
+
request_options: Courier::RequestOptions::OrHash
|
|
109
|
+
).void
|
|
110
|
+
end
|
|
111
|
+
def publish(
|
|
112
|
+
# Template ID (nt\_ prefix).
|
|
113
|
+
id,
|
|
114
|
+
# Historical version to publish (e.g. "v001"). Omit to publish the current draft.
|
|
115
|
+
version: nil,
|
|
116
|
+
request_options: {}
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Replace the elemental content of a notification template. Overwrites all
|
|
121
|
+
# elements in the template with the provided content. Only supported for V2
|
|
122
|
+
# (elemental) templates.
|
|
123
|
+
sig do
|
|
124
|
+
params(
|
|
125
|
+
id: String,
|
|
126
|
+
content: Courier::NotificationContentPutRequest::Content::OrHash,
|
|
127
|
+
state: Courier::NotificationTemplateState::OrSymbol,
|
|
128
|
+
request_options: Courier::RequestOptions::OrHash
|
|
129
|
+
).returns(Courier::NotificationContentMutationResponse)
|
|
130
|
+
end
|
|
131
|
+
def put_content(
|
|
132
|
+
# Notification template ID (`nt_` prefix).
|
|
133
|
+
id,
|
|
134
|
+
# Elemental content payload. The server defaults `version` when omitted.
|
|
135
|
+
content:,
|
|
136
|
+
# Template state. Defaults to `DRAFT`.
|
|
137
|
+
state: nil,
|
|
138
|
+
request_options: {}
|
|
139
|
+
)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Update a single element within a notification template. Only supported for V2
|
|
143
|
+
# (elemental) templates.
|
|
144
|
+
sig do
|
|
145
|
+
params(
|
|
146
|
+
element_id: String,
|
|
147
|
+
id: String,
|
|
148
|
+
type: String,
|
|
149
|
+
channels: T::Array[String],
|
|
150
|
+
data: T::Hash[Symbol, T.anything],
|
|
151
|
+
if_: String,
|
|
152
|
+
loop_: String,
|
|
153
|
+
ref: String,
|
|
154
|
+
state: Courier::NotificationTemplateState::OrSymbol,
|
|
155
|
+
request_options: Courier::RequestOptions::OrHash
|
|
156
|
+
).returns(Courier::NotificationContentMutationResponse)
|
|
157
|
+
end
|
|
158
|
+
def put_element(
|
|
159
|
+
# Path param: Element ID within the template.
|
|
160
|
+
element_id,
|
|
161
|
+
# Path param: Notification template ID (`nt_` prefix).
|
|
162
|
+
id:,
|
|
163
|
+
# Body param: Element type (text, meta, action, image, etc.).
|
|
164
|
+
type:,
|
|
165
|
+
# Body param
|
|
166
|
+
channels: nil,
|
|
167
|
+
# Body param
|
|
168
|
+
data: nil,
|
|
169
|
+
# Body param
|
|
170
|
+
if_: nil,
|
|
171
|
+
# Body param
|
|
172
|
+
loop_: nil,
|
|
173
|
+
# Body param
|
|
174
|
+
ref: nil,
|
|
175
|
+
# Body param: Template state. Defaults to `DRAFT`.
|
|
176
|
+
state: nil,
|
|
177
|
+
request_options: {}
|
|
178
|
+
)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Set locale-specific content overrides for a notification template. Each element
|
|
182
|
+
# override must reference an existing element by ID. Only supported for V2
|
|
183
|
+
# (elemental) templates.
|
|
27
184
|
sig do
|
|
28
185
|
params(
|
|
186
|
+
locale_id: String,
|
|
29
187
|
id: String,
|
|
188
|
+
elements:
|
|
189
|
+
T::Array[Courier::NotificationLocalePutRequest::Element::OrHash],
|
|
190
|
+
state: Courier::NotificationTemplateState::OrSymbol,
|
|
30
191
|
request_options: Courier::RequestOptions::OrHash
|
|
31
|
-
).returns(Courier::
|
|
192
|
+
).returns(Courier::NotificationContentMutationResponse)
|
|
193
|
+
end
|
|
194
|
+
def put_locale(
|
|
195
|
+
# Path param: Locale code (e.g., `es`, `fr`, `pt-BR`).
|
|
196
|
+
locale_id,
|
|
197
|
+
# Path param: Notification template ID (`nt_` prefix).
|
|
198
|
+
id:,
|
|
199
|
+
# Body param: Elements with locale-specific content overrides.
|
|
200
|
+
elements:,
|
|
201
|
+
# Body param: Template state. Defaults to `DRAFT`.
|
|
202
|
+
state: nil,
|
|
203
|
+
request_options: {}
|
|
204
|
+
)
|
|
32
205
|
end
|
|
33
|
-
|
|
206
|
+
|
|
207
|
+
# Replace a notification template. All fields are required.
|
|
208
|
+
sig do
|
|
209
|
+
params(
|
|
210
|
+
id: String,
|
|
211
|
+
notification: Courier::NotificationTemplatePayload::OrHash,
|
|
212
|
+
state: Courier::NotificationTemplateUpdateRequest::State::OrSymbol,
|
|
213
|
+
request_options: Courier::RequestOptions::OrHash
|
|
214
|
+
).returns(Courier::NotificationTemplateMutationResponse)
|
|
215
|
+
end
|
|
216
|
+
def replace(
|
|
217
|
+
# Template ID (nt\_ prefix).
|
|
218
|
+
id,
|
|
219
|
+
# Full document shape used in POST and PUT request bodies, and returned inside the
|
|
220
|
+
# GET response envelope.
|
|
221
|
+
notification:,
|
|
222
|
+
# Template state after update. Case-insensitive input, normalized to uppercase in
|
|
223
|
+
# the response. Defaults to "DRAFT".
|
|
224
|
+
state: nil,
|
|
225
|
+
request_options: {}
|
|
226
|
+
)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Retrieve the content of a notification template. The response shape depends on
|
|
230
|
+
# whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
|
|
231
|
+
# the `version` query parameter to select draft, published, or a specific
|
|
232
|
+
# historical version.
|
|
233
|
+
sig do
|
|
234
|
+
params(
|
|
235
|
+
id: String,
|
|
236
|
+
version: String,
|
|
237
|
+
request_options: Courier::RequestOptions::OrHash
|
|
238
|
+
).returns(
|
|
239
|
+
Courier::Models::NotificationRetrieveContentResponse::Variants
|
|
240
|
+
)
|
|
241
|
+
end
|
|
242
|
+
def retrieve_content(
|
|
243
|
+
# Notification template ID (`nt_` prefix).
|
|
244
|
+
id,
|
|
245
|
+
# Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to
|
|
246
|
+
# `published`.
|
|
247
|
+
version: nil,
|
|
248
|
+
request_options: {}
|
|
249
|
+
)
|
|
34
250
|
end
|
|
35
251
|
|
|
36
252
|
# @api private
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class Providers
|
|
6
|
+
class Catalog
|
|
7
|
+
# Returns the catalog of available provider types with their display names,
|
|
8
|
+
# descriptions, and configuration schema fields (snake_case, with `type` and
|
|
9
|
+
# `required`). Providers with no configurable schema return only `provider`,
|
|
10
|
+
# `name`, and `description`.
|
|
11
|
+
sig do
|
|
12
|
+
params(
|
|
13
|
+
channel: String,
|
|
14
|
+
keys: String,
|
|
15
|
+
name: String,
|
|
16
|
+
request_options: Courier::RequestOptions::OrHash
|
|
17
|
+
).returns(Courier::Models::Providers::CatalogListResponse)
|
|
18
|
+
end
|
|
19
|
+
def list(
|
|
20
|
+
# Exact match (case-insensitive) against the provider channel taxonomy (e.g.
|
|
21
|
+
# `email`, `sms`, `push`).
|
|
22
|
+
channel: nil,
|
|
23
|
+
# Comma-separated provider keys to filter by (e.g. `sendgrid,twilio`).
|
|
24
|
+
keys: nil,
|
|
25
|
+
# Case-insensitive substring match against the provider display name.
|
|
26
|
+
name: nil,
|
|
27
|
+
request_options: {}
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @api private
|
|
32
|
+
sig { params(client: Courier::Client).returns(T.attached_class) }
|
|
33
|
+
def self.new(client:)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class Providers
|
|
6
|
+
sig { returns(Courier::Resources::Providers::Catalog) }
|
|
7
|
+
attr_reader :catalog
|
|
8
|
+
|
|
9
|
+
# Create a new provider configuration. The `provider` field must be a known
|
|
10
|
+
# Courier provider key (see catalog).
|
|
11
|
+
sig do
|
|
12
|
+
params(
|
|
13
|
+
provider: String,
|
|
14
|
+
alias_: String,
|
|
15
|
+
settings: T::Hash[Symbol, T.anything],
|
|
16
|
+
title: String,
|
|
17
|
+
request_options: Courier::RequestOptions::OrHash
|
|
18
|
+
).returns(Courier::Provider)
|
|
19
|
+
end
|
|
20
|
+
def create(
|
|
21
|
+
# The provider key identifying the type (e.g. "sendgrid", "twilio"). Must be a
|
|
22
|
+
# known Courier provider — see the catalog endpoint for valid keys.
|
|
23
|
+
provider:,
|
|
24
|
+
# Optional alias for this configuration.
|
|
25
|
+
alias_: nil,
|
|
26
|
+
# Provider-specific settings (snake_case keys). Defaults to an empty object when
|
|
27
|
+
# omitted. Use the catalog endpoint to discover required fields for a given
|
|
28
|
+
# provider — omitting a required field returns a 400 validation error.
|
|
29
|
+
settings: nil,
|
|
30
|
+
# Optional display title. Omit to use "Default Configuration".
|
|
31
|
+
title: nil,
|
|
32
|
+
request_options: {}
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Fetch a single provider configuration by ID.
|
|
37
|
+
sig do
|
|
38
|
+
params(
|
|
39
|
+
id: String,
|
|
40
|
+
request_options: Courier::RequestOptions::OrHash
|
|
41
|
+
).returns(Courier::Provider)
|
|
42
|
+
end
|
|
43
|
+
def retrieve(
|
|
44
|
+
# A unique identifier of the provider configuration.
|
|
45
|
+
id,
|
|
46
|
+
request_options: {}
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Update an existing provider configuration. The `provider` key is required. All
|
|
51
|
+
# other fields are optional — omitted fields are cleared from the stored
|
|
52
|
+
# configuration (this is a full replacement, not a partial merge).
|
|
53
|
+
sig do
|
|
54
|
+
params(
|
|
55
|
+
id: String,
|
|
56
|
+
provider: String,
|
|
57
|
+
alias_: String,
|
|
58
|
+
settings: T::Hash[Symbol, T.anything],
|
|
59
|
+
title: String,
|
|
60
|
+
request_options: Courier::RequestOptions::OrHash
|
|
61
|
+
).returns(Courier::Provider)
|
|
62
|
+
end
|
|
63
|
+
def update(
|
|
64
|
+
# A unique identifier of the provider configuration to update.
|
|
65
|
+
id,
|
|
66
|
+
# The provider key identifying the type.
|
|
67
|
+
provider:,
|
|
68
|
+
# Updated alias. Omit to clear.
|
|
69
|
+
alias_: nil,
|
|
70
|
+
# Provider-specific settings (snake_case keys). Replaces the full settings object
|
|
71
|
+
# — omitted settings fields are removed. Use the catalog endpoint to check
|
|
72
|
+
# required fields.
|
|
73
|
+
settings: nil,
|
|
74
|
+
# Updated display title.
|
|
75
|
+
title: nil,
|
|
76
|
+
request_options: {}
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# List configured provider integrations for the current workspace. Supports
|
|
81
|
+
# cursor-based pagination.
|
|
82
|
+
sig do
|
|
83
|
+
params(
|
|
84
|
+
cursor: String,
|
|
85
|
+
request_options: Courier::RequestOptions::OrHash
|
|
86
|
+
).returns(Courier::Models::ProviderListResponse)
|
|
87
|
+
end
|
|
88
|
+
def list(
|
|
89
|
+
# Opaque cursor for fetching the next page.
|
|
90
|
+
cursor: nil,
|
|
91
|
+
request_options: {}
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Delete a provider configuration. Returns 409 if the provider is still referenced
|
|
96
|
+
# by routing or notifications.
|
|
97
|
+
sig do
|
|
98
|
+
params(
|
|
99
|
+
id: String,
|
|
100
|
+
request_options: Courier::RequestOptions::OrHash
|
|
101
|
+
).void
|
|
102
|
+
end
|
|
103
|
+
def delete(
|
|
104
|
+
# A unique identifier of the provider configuration to delete.
|
|
105
|
+
id,
|
|
106
|
+
request_options: {}
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# @api private
|
|
111
|
+
sig { params(client: Courier::Client).returns(T.attached_class) }
|
|
112
|
+
def self.new(client:)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class RoutingStrategies
|
|
6
|
+
# Create a routing strategy. Requires a name and routing configuration at minimum.
|
|
7
|
+
# Channels and providers default to empty if omitted.
|
|
8
|
+
sig do
|
|
9
|
+
params(
|
|
10
|
+
name: String,
|
|
11
|
+
routing: Courier::MessageRouting::OrHash,
|
|
12
|
+
channels: T.nilable(T::Hash[Symbol, Courier::Channel::OrHash]),
|
|
13
|
+
description: T.nilable(String),
|
|
14
|
+
providers:
|
|
15
|
+
T.nilable(T::Hash[Symbol, Courier::MessageProvidersType::OrHash]),
|
|
16
|
+
tags: T.nilable(T::Array[String]),
|
|
17
|
+
request_options: Courier::RequestOptions::OrHash
|
|
18
|
+
).returns(Courier::RoutingStrategyMutationResponse)
|
|
19
|
+
end
|
|
20
|
+
def create(
|
|
21
|
+
# Human-readable name for the routing strategy.
|
|
22
|
+
name:,
|
|
23
|
+
# Routing tree defining channel selection method and order.
|
|
24
|
+
routing:,
|
|
25
|
+
# Per-channel delivery configuration. Defaults to empty if omitted.
|
|
26
|
+
channels: nil,
|
|
27
|
+
# Optional description of the routing strategy.
|
|
28
|
+
description: nil,
|
|
29
|
+
# Per-provider delivery configuration. Defaults to empty if omitted.
|
|
30
|
+
providers: nil,
|
|
31
|
+
# Optional tags for categorization.
|
|
32
|
+
tags: nil,
|
|
33
|
+
request_options: {}
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Retrieve a routing strategy by ID. Returns the full entity including routing
|
|
38
|
+
# content and metadata.
|
|
39
|
+
sig do
|
|
40
|
+
params(
|
|
41
|
+
id: String,
|
|
42
|
+
request_options: Courier::RequestOptions::OrHash
|
|
43
|
+
).returns(Courier::RoutingStrategyGetResponse)
|
|
44
|
+
end
|
|
45
|
+
def retrieve(
|
|
46
|
+
# Routing strategy ID (rs\_ prefix).
|
|
47
|
+
id,
|
|
48
|
+
request_options: {}
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# List routing strategies in your workspace. Returns metadata only (no
|
|
53
|
+
# routing/channels/providers content). Use GET /routing-strategies/{id} for full
|
|
54
|
+
# details.
|
|
55
|
+
sig do
|
|
56
|
+
params(
|
|
57
|
+
cursor: T.nilable(String),
|
|
58
|
+
limit: Integer,
|
|
59
|
+
request_options: Courier::RequestOptions::OrHash
|
|
60
|
+
).returns(Courier::RoutingStrategyListResponse)
|
|
61
|
+
end
|
|
62
|
+
def list(
|
|
63
|
+
# Opaque pagination cursor from a previous response. Omit for the first page.
|
|
64
|
+
cursor: nil,
|
|
65
|
+
# Maximum number of results per page. Default 20, max 100.
|
|
66
|
+
limit: nil,
|
|
67
|
+
request_options: {}
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Archive a routing strategy. The strategy must not have associated notification
|
|
72
|
+
# templates. Unlink all templates before archiving.
|
|
73
|
+
sig do
|
|
74
|
+
params(
|
|
75
|
+
id: String,
|
|
76
|
+
request_options: Courier::RequestOptions::OrHash
|
|
77
|
+
).void
|
|
78
|
+
end
|
|
79
|
+
def archive(
|
|
80
|
+
# Routing strategy ID (rs\_ prefix).
|
|
81
|
+
id,
|
|
82
|
+
request_options: {}
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List notification templates associated with a routing strategy. Includes
|
|
87
|
+
# template metadata only, not full content.
|
|
88
|
+
sig do
|
|
89
|
+
params(
|
|
90
|
+
id: String,
|
|
91
|
+
cursor: T.nilable(String),
|
|
92
|
+
limit: Integer,
|
|
93
|
+
request_options: Courier::RequestOptions::OrHash
|
|
94
|
+
).returns(Courier::AssociatedNotificationListResponse)
|
|
95
|
+
end
|
|
96
|
+
def list_notifications(
|
|
97
|
+
# Routing strategy ID (`rs_` prefix).
|
|
98
|
+
id,
|
|
99
|
+
# Opaque pagination cursor from a previous response. Omit for the first page.
|
|
100
|
+
cursor: nil,
|
|
101
|
+
# Maximum number of results per page. Default 20, max 100.
|
|
102
|
+
limit: nil,
|
|
103
|
+
request_options: {}
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Replace a routing strategy. Full document replacement; the caller must send the
|
|
108
|
+
# complete desired state. Missing optional fields are cleared.
|
|
109
|
+
sig do
|
|
110
|
+
params(
|
|
111
|
+
id: String,
|
|
112
|
+
name: String,
|
|
113
|
+
routing: Courier::MessageRouting::OrHash,
|
|
114
|
+
channels: T.nilable(T::Hash[Symbol, Courier::Channel::OrHash]),
|
|
115
|
+
description: T.nilable(String),
|
|
116
|
+
providers:
|
|
117
|
+
T.nilable(T::Hash[Symbol, Courier::MessageProvidersType::OrHash]),
|
|
118
|
+
tags: T.nilable(T::Array[String]),
|
|
119
|
+
request_options: Courier::RequestOptions::OrHash
|
|
120
|
+
).returns(Courier::RoutingStrategyMutationResponse)
|
|
121
|
+
end
|
|
122
|
+
def replace(
|
|
123
|
+
# Routing strategy ID (rs\_ prefix).
|
|
124
|
+
id,
|
|
125
|
+
# Human-readable name for the routing strategy.
|
|
126
|
+
name:,
|
|
127
|
+
# Routing tree defining channel selection method and order.
|
|
128
|
+
routing:,
|
|
129
|
+
# Per-channel delivery configuration. Omit to clear.
|
|
130
|
+
channels: nil,
|
|
131
|
+
# Optional description. Omit or null to clear.
|
|
132
|
+
description: nil,
|
|
133
|
+
# Per-provider delivery configuration. Omit to clear.
|
|
134
|
+
providers: nil,
|
|
135
|
+
# Optional tags. Omit or null to clear.
|
|
136
|
+
tags: nil,
|
|
137
|
+
request_options: {}
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# @api private
|
|
142
|
+
sig { params(client: Courier::Client).returns(T.attached_class) }
|
|
143
|
+
def self.new(client:)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
data/sig/courier/client.rbs
CHANGED
|
@@ -14,6 +14,8 @@ module Courier
|
|
|
14
14
|
|
|
15
15
|
attr_reader audiences: Courier::Resources::Audiences
|
|
16
16
|
|
|
17
|
+
attr_reader providers: Courier::Resources::Providers
|
|
18
|
+
|
|
17
19
|
attr_reader audit_events: Courier::Resources::AuditEvents
|
|
18
20
|
|
|
19
21
|
attr_reader auth: Courier::Resources::Auth
|
|
@@ -36,6 +38,8 @@ module Courier
|
|
|
36
38
|
|
|
37
39
|
attr_reader notifications: Courier::Resources::Notifications
|
|
38
40
|
|
|
41
|
+
attr_reader routing_strategies: Courier::Resources::RoutingStrategies
|
|
42
|
+
|
|
39
43
|
attr_reader profiles: Courier::Resources::Profiles
|
|
40
44
|
|
|
41
45
|
attr_reader tenants: Courier::Resources::Tenants
|
|
@@ -45,8 +45,12 @@ module Courier
|
|
|
45
45
|
-> top?
|
|
46
46
|
} -> top?
|
|
47
47
|
|
|
48
|
+
RFC_3986_NOT_PCHARS: Regexp
|
|
49
|
+
|
|
48
50
|
def self?.uri_origin: (URI::Generic uri) -> String
|
|
49
51
|
|
|
52
|
+
def self?.encode_path: (String | Integer path) -> String
|
|
53
|
+
|
|
50
54
|
def self?.interpolate_path: (String | ::Array[String] path) -> String
|
|
51
55
|
|
|
52
56
|
def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Courier
|
|
2
|
+
module Models
|
|
3
|
+
type associated_notification_list_response =
|
|
4
|
+
{
|
|
5
|
+
paging: Courier::Paging,
|
|
6
|
+
results: ::Array[Courier::NotificationTemplateSummary]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class AssociatedNotificationListResponse < Courier::Internal::Type::BaseModel
|
|
10
|
+
attr_accessor paging: Courier::Paging
|
|
11
|
+
|
|
12
|
+
attr_accessor results: ::Array[Courier::NotificationTemplateSummary]
|
|
13
|
+
|
|
14
|
+
def initialize: (
|
|
15
|
+
paging: Courier::Paging,
|
|
16
|
+
results: ::Array[Courier::NotificationTemplateSummary]
|
|
17
|
+
) -> void
|
|
18
|
+
|
|
19
|
+
def to_hash: -> {
|
|
20
|
+
paging: Courier::Paging,
|
|
21
|
+
results: ::Array[Courier::NotificationTemplateSummary]
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Courier
|
|
2
|
+
module Models
|
|
3
|
+
type channel =
|
|
4
|
+
{
|
|
5
|
+
brand_id: String?,
|
|
6
|
+
if_: String?,
|
|
7
|
+
metadata: Courier::ChannelMetadata?,
|
|
8
|
+
override: ::Hash[Symbol, top]?,
|
|
9
|
+
providers: ::Array[String]?,
|
|
10
|
+
routing_method: Courier::Models::Channel::routing_method?,
|
|
11
|
+
timeouts: Courier::Timeouts?
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class Channel < Courier::Internal::Type::BaseModel
|
|
15
|
+
attr_accessor brand_id: String?
|
|
16
|
+
|
|
17
|
+
attr_accessor if_: String?
|
|
18
|
+
|
|
19
|
+
attr_accessor metadata: Courier::ChannelMetadata?
|
|
20
|
+
|
|
21
|
+
attr_accessor override: ::Hash[Symbol, top]?
|
|
22
|
+
|
|
23
|
+
attr_accessor providers: ::Array[String]?
|
|
24
|
+
|
|
25
|
+
attr_accessor routing_method: Courier::Models::Channel::routing_method?
|
|
26
|
+
|
|
27
|
+
attr_accessor timeouts: Courier::Timeouts?
|
|
28
|
+
|
|
29
|
+
def initialize: (
|
|
30
|
+
?brand_id: String?,
|
|
31
|
+
?if_: String?,
|
|
32
|
+
?metadata: Courier::ChannelMetadata?,
|
|
33
|
+
?override: ::Hash[Symbol, top]?,
|
|
34
|
+
?providers: ::Array[String]?,
|
|
35
|
+
?routing_method: Courier::Models::Channel::routing_method?,
|
|
36
|
+
?timeouts: Courier::Timeouts?
|
|
37
|
+
) -> void
|
|
38
|
+
|
|
39
|
+
def to_hash: -> {
|
|
40
|
+
brand_id: String?,
|
|
41
|
+
if_: String?,
|
|
42
|
+
metadata: Courier::ChannelMetadata?,
|
|
43
|
+
override: ::Hash[Symbol, top]?,
|
|
44
|
+
providers: ::Array[String]?,
|
|
45
|
+
routing_method: Courier::Models::Channel::routing_method?,
|
|
46
|
+
timeouts: Courier::Timeouts?
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type routing_method = :all | :single
|
|
50
|
+
|
|
51
|
+
module RoutingMethod
|
|
52
|
+
extend Courier::Internal::Type::Enum
|
|
53
|
+
|
|
54
|
+
ALL: :all
|
|
55
|
+
SINGLE: :single
|
|
56
|
+
|
|
57
|
+
def self?.values: -> ::Array[Courier::Models::Channel::routing_method]
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Courier
|
|
2
|
+
module Models
|
|
3
|
+
type channel_metadata = { utm: Courier::Utm? }
|
|
4
|
+
|
|
5
|
+
class ChannelMetadata < Courier::Internal::Type::BaseModel
|
|
6
|
+
attr_accessor utm: Courier::Utm?
|
|
7
|
+
|
|
8
|
+
def initialize: (?utm: Courier::Utm?) -> void
|
|
9
|
+
|
|
10
|
+
def to_hash: -> { utm: Courier::Utm? }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|