trycourier 4.8.0 → 4.9.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.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/README.md +1 -1
  4. data/lib/courier/client.rb +8 -0
  5. data/lib/courier/internal/util.rb +19 -6
  6. data/lib/courier/models/channel.rb +75 -0
  7. data/lib/courier/models/channel_metadata.rb +15 -0
  8. data/lib/courier/models/elemental_content.rb +2 -2
  9. data/lib/courier/models/elemental_html_node_with_type.rb +24 -0
  10. data/lib/courier/models/elemental_node.rb +3 -1
  11. data/lib/courier/models/message_channels.rb +8 -0
  12. data/lib/courier/models/message_providers.rb +8 -0
  13. data/lib/courier/models/message_providers_type.rb +38 -0
  14. data/lib/courier/models/metadata.rb +15 -0
  15. data/lib/courier/models/notification_archive_params.rb +20 -0
  16. data/lib/courier/models/notification_create_params.rb +14 -0
  17. data/lib/courier/models/notification_list_params.rb +13 -4
  18. data/lib/courier/models/notification_list_response.rb +108 -93
  19. data/lib/courier/models/notification_list_versions_params.rb +37 -0
  20. data/lib/courier/models/notification_publish_params.rb +20 -0
  21. data/lib/courier/models/notification_replace_params.rb +20 -0
  22. data/lib/courier/models/notification_retrieve_params.rb +33 -0
  23. data/lib/courier/models/notification_template_create_request.rb +45 -0
  24. data/lib/courier/models/notification_template_get_response.rb +92 -0
  25. data/lib/courier/models/notification_template_mutation_response.rb +51 -0
  26. data/lib/courier/models/notification_template_payload.rb +98 -0
  27. data/lib/courier/models/notification_template_publish_request.rb +19 -0
  28. data/lib/courier/models/notification_template_summary.rb +81 -0
  29. data/lib/courier/models/notification_template_update_request.rb +46 -0
  30. data/lib/courier/models/notification_template_version_list_response.rb +22 -0
  31. data/lib/courier/models/provider.rb +67 -0
  32. data/lib/courier/models/provider_create_params.rb +52 -0
  33. data/lib/courier/models/provider_delete_params.rb +20 -0
  34. data/lib/courier/models/provider_list_params.rb +22 -0
  35. data/lib/courier/models/provider_list_response.rb +24 -0
  36. data/lib/courier/models/provider_retrieve_params.rb +20 -0
  37. data/lib/courier/models/provider_update_params.rb +58 -0
  38. data/lib/courier/models/providers/catalog_list_params.rb +44 -0
  39. data/lib/courier/models/providers/catalog_list_response.rb +26 -0
  40. data/lib/courier/models/providers_catalog_entry.rb +86 -0
  41. data/lib/courier/models/routing_strategy_archive_params.rb +20 -0
  42. data/lib/courier/models/routing_strategy_create_params.rb +14 -0
  43. data/lib/courier/models/routing_strategy_create_request.rb +58 -0
  44. data/lib/courier/models/routing_strategy_get_response.rb +99 -0
  45. data/lib/courier/models/routing_strategy_list_params.rb +30 -0
  46. data/lib/courier/models/routing_strategy_list_response.rb +24 -0
  47. data/lib/courier/models/routing_strategy_mutation_response.rb +19 -0
  48. data/lib/courier/models/routing_strategy_replace_params.rb +20 -0
  49. data/lib/courier/models/routing_strategy_replace_request.rb +59 -0
  50. data/lib/courier/models/routing_strategy_retrieve_params.rb +20 -0
  51. data/lib/courier/models/routing_strategy_summary.rb +75 -0
  52. data/lib/courier/models/send_message_params.rb +6 -154
  53. data/lib/courier/models/tenant_template_input.rb +6 -152
  54. data/lib/courier/models/timeouts.rb +21 -0
  55. data/lib/courier/models/version_node.rb +46 -0
  56. data/lib/courier/models.rb +86 -0
  57. data/lib/courier/resources/notifications.rb +165 -3
  58. data/lib/courier/resources/providers/catalog.rb +49 -0
  59. data/lib/courier/resources/providers.rb +150 -0
  60. data/lib/courier/resources/routing_strategies.rb +151 -0
  61. data/lib/courier/version.rb +1 -1
  62. data/lib/courier.rb +47 -0
  63. data/rbi/courier/client.rbi +6 -0
  64. data/rbi/courier/internal/util.rbi +8 -0
  65. data/rbi/courier/models/channel.rbi +106 -0
  66. data/rbi/courier/models/channel_metadata.rbi +28 -0
  67. data/rbi/courier/models/elemental_content.rbi +6 -3
  68. data/rbi/courier/models/elemental_html_node_with_type.rbi +59 -0
  69. data/rbi/courier/models/elemental_node.rbi +2 -1
  70. data/rbi/courier/models/message_channels.rbi +11 -0
  71. data/rbi/courier/models/message_providers.rbi +11 -0
  72. data/rbi/courier/models/message_providers_type.rbi +60 -0
  73. data/rbi/courier/models/metadata.rbi +26 -0
  74. data/rbi/courier/models/notification_archive_params.rbi +35 -0
  75. data/rbi/courier/models/notification_create_params.rbi +27 -0
  76. data/rbi/courier/models/notification_list_params.rbi +15 -2
  77. data/rbi/courier/models/notification_list_response.rbi +159 -119
  78. data/rbi/courier/models/notification_list_versions_params.rbi +66 -0
  79. data/rbi/courier/models/notification_publish_params.rbi +35 -0
  80. data/rbi/courier/models/notification_replace_params.rbi +35 -0
  81. data/rbi/courier/models/notification_retrieve_params.rbi +54 -0
  82. data/rbi/courier/models/notification_template_create_request.rbi +102 -0
  83. data/rbi/courier/models/notification_template_get_response.rbi +162 -0
  84. data/rbi/courier/models/notification_template_mutation_response.rbi +121 -0
  85. data/rbi/courier/models/notification_template_payload.rbi +183 -0
  86. data/rbi/courier/models/notification_template_publish_request.rbi +35 -0
  87. data/rbi/courier/models/notification_template_summary.rbi +124 -0
  88. data/rbi/courier/models/notification_template_update_request.rbi +103 -0
  89. data/rbi/courier/models/notification_template_version_list_response.rbi +41 -0
  90. data/rbi/courier/models/provider.rbi +87 -0
  91. data/rbi/courier/models/provider_create_params.rbi +82 -0
  92. data/rbi/courier/models/provider_delete_params.rbi +35 -0
  93. data/rbi/courier/models/provider_list_params.rbi +43 -0
  94. data/rbi/courier/models/provider_list_response.rbi +42 -0
  95. data/rbi/courier/models/provider_retrieve_params.rbi +35 -0
  96. data/rbi/courier/models/provider_update_params.rbi +86 -0
  97. data/rbi/courier/models/providers/catalog_list_params.rbi +75 -0
  98. data/rbi/courier/models/providers/catalog_list_response.rbi +47 -0
  99. data/rbi/courier/models/providers_catalog_entry.rbi +129 -0
  100. data/rbi/courier/models/routing_strategy_archive_params.rbi +38 -0
  101. data/rbi/courier/models/routing_strategy_create_params.rbi +30 -0
  102. data/rbi/courier/models/routing_strategy_create_request.rbi +86 -0
  103. data/rbi/courier/models/routing_strategy_get_response.rbi +121 -0
  104. data/rbi/courier/models/routing_strategy_list_params.rbi +54 -0
  105. data/rbi/courier/models/routing_strategy_list_response.rbi +45 -0
  106. data/rbi/courier/models/routing_strategy_mutation_response.rbi +31 -0
  107. data/rbi/courier/models/routing_strategy_replace_params.rbi +38 -0
  108. data/rbi/courier/models/routing_strategy_replace_request.rbi +87 -0
  109. data/rbi/courier/models/routing_strategy_retrieve_params.rbi +38 -0
  110. data/rbi/courier/models/routing_strategy_summary.rbi +95 -0
  111. data/rbi/courier/models/send_message_params.rbi +6 -362
  112. data/rbi/courier/models/tenant_template_input.rbi +8 -336
  113. data/rbi/courier/models/timeouts.rbi +33 -0
  114. data/rbi/courier/models/version_node.rbi +65 -0
  115. data/rbi/courier/models.rbi +94 -0
  116. data/rbi/courier/resources/notifications.rbi +119 -1
  117. data/rbi/courier/resources/providers/catalog.rbi +38 -0
  118. data/rbi/courier/resources/providers.rbi +116 -0
  119. data/rbi/courier/resources/routing_strategies.rbi +126 -0
  120. data/sig/courier/client.rbs +4 -0
  121. data/sig/courier/internal/util.rbs +4 -0
  122. data/sig/courier/models/channel.rbs +61 -0
  123. data/sig/courier/models/channel_metadata.rbs +13 -0
  124. data/sig/courier/models/elemental_html_node_with_type.rbs +32 -0
  125. data/sig/courier/models/elemental_node.rbs +1 -0
  126. data/sig/courier/models/message_channels.rbs +7 -0
  127. data/sig/courier/models/message_providers.rbs +7 -0
  128. data/sig/courier/models/message_providers_type.rbs +35 -0
  129. data/sig/courier/models/metadata.rbs +13 -0
  130. data/sig/courier/models/notification_archive_params.rbs +20 -0
  131. data/sig/courier/models/notification_create_params.rbs +15 -0
  132. data/sig/courier/models/notification_list_params.rbs +7 -1
  133. data/sig/courier/models/notification_list_response.rbs +81 -71
  134. data/sig/courier/models/notification_list_versions_params.rbs +36 -0
  135. data/sig/courier/models/notification_publish_params.rbs +22 -0
  136. data/sig/courier/models/notification_replace_params.rbs +22 -0
  137. data/sig/courier/models/notification_retrieve_params.rbs +30 -0
  138. data/sig/courier/models/notification_template_create_request.rbs +40 -0
  139. data/sig/courier/models/notification_template_get_response.rbs +72 -0
  140. data/sig/courier/models/notification_template_mutation_response.rbs +46 -0
  141. data/sig/courier/models/notification_template_payload.rbs +75 -0
  142. data/sig/courier/models/notification_template_publish_request.rbs +15 -0
  143. data/sig/courier/models/notification_template_summary.rbs +70 -0
  144. data/sig/courier/models/notification_template_update_request.rbs +40 -0
  145. data/sig/courier/models/notification_template_version_list_response.rbs +22 -0
  146. data/sig/courier/models/provider.rbs +52 -0
  147. data/sig/courier/models/provider_create_params.rbs +47 -0
  148. data/sig/courier/models/provider_delete_params.rbs +20 -0
  149. data/sig/courier/models/provider_list_params.rbs +25 -0
  150. data/sig/courier/models/provider_list_response.rbs +22 -0
  151. data/sig/courier/models/provider_retrieve_params.rbs +20 -0
  152. data/sig/courier/models/provider_update_params.rbs +52 -0
  153. data/sig/courier/models/providers/catalog_list_params.rbs +40 -0
  154. data/sig/courier/models/providers/catalog_list_response.rbs +27 -0
  155. data/sig/courier/models/providers_catalog_entry.rbs +64 -0
  156. data/sig/courier/models/routing_strategy_archive_params.rbs +20 -0
  157. data/sig/courier/models/routing_strategy_create_params.rbs +15 -0
  158. data/sig/courier/models/routing_strategy_create_request.rbs +45 -0
  159. data/sig/courier/models/routing_strategy_get_response.rbs +70 -0
  160. data/sig/courier/models/routing_strategy_list_params.rbs +30 -0
  161. data/sig/courier/models/routing_strategy_list_response.rbs +25 -0
  162. data/sig/courier/models/routing_strategy_mutation_response.rbs +13 -0
  163. data/sig/courier/models/routing_strategy_replace_params.rbs +22 -0
  164. data/sig/courier/models/routing_strategy_replace_request.rbs +45 -0
  165. data/sig/courier/models/routing_strategy_retrieve_params.rbs +20 -0
  166. data/sig/courier/models/routing_strategy_summary.rbs +55 -0
  167. data/sig/courier/models/send_message_params.rbs +8 -130
  168. data/sig/courier/models/tenant_template_input.rbs +12 -134
  169. data/sig/courier/models/timeouts.rbs +15 -0
  170. data/sig/courier/models/version_node.rbs +32 -0
  171. data/sig/courier/models.rbs +84 -0
  172. data/sig/courier/resources/notifications.rbs +35 -0
  173. data/sig/courier/resources/providers/catalog.rbs +16 -0
  174. data/sig/courier/resources/providers.rbs +38 -0
  175. data/sig/courier/resources/routing_strategies.rbs +41 -0
  176. metadata +143 -2
@@ -121,8 +121,12 @@ module Courier
121
121
 
122
122
  BulkRunJobParams = Courier::Models::BulkRunJobParams
123
123
 
124
+ Channel = Courier::Models::Channel
125
+
124
126
  ChannelClassification = Courier::Models::ChannelClassification
125
127
 
128
+ ChannelMetadata = Courier::Models::ChannelMetadata
129
+
126
130
  ChannelPreference = Courier::Models::ChannelPreference
127
131
 
128
132
  Check = Courier::Models::Check
@@ -147,6 +151,8 @@ module Courier
147
151
 
148
152
  ElementalDividerNodeWithType = Courier::Models::ElementalDividerNodeWithType
149
153
 
154
+ ElementalHTMLNodeWithType = Courier::Models::ElementalHTMLNodeWithType
155
+
150
156
  ElementalImageNodeWithType = Courier::Models::ElementalImageNodeWithType
151
157
 
152
158
  ElementalMetaNodeWithType = Courier::Models::ElementalMetaNodeWithType
@@ -213,6 +219,9 @@ module Courier
213
219
 
214
220
  MessageCancelParams = Courier::Models::MessageCancelParams
215
221
 
222
+ # @type [Courier::Internal::Type::Converter]
223
+ MessageChannels = Courier::Models::MessageChannels
224
+
216
225
  MessageContentParams = Courier::Models::MessageContentParams
217
226
 
218
227
  MessageContext = Courier::Models::MessageContext
@@ -223,12 +232,19 @@ module Courier
223
232
 
224
233
  MessageListParams = Courier::Models::MessageListParams
225
234
 
235
+ # @type [Courier::Internal::Type::Converter]
236
+ MessageProviders = Courier::Models::MessageProviders
237
+
238
+ MessageProvidersType = Courier::Models::MessageProvidersType
239
+
226
240
  MessageRetrieveParams = Courier::Models::MessageRetrieveParams
227
241
 
228
242
  MessageRouting = Courier::Models::MessageRouting
229
243
 
230
244
  MessageRoutingChannel = Courier::Models::MessageRoutingChannel
231
245
 
246
+ Metadata = Courier::Models::Metadata
247
+
232
248
  MsTeams = Courier::Models::MsTeams
233
249
 
234
250
  MsTeamsBaseProperties = Courier::Models::MsTeamsBaseProperties
@@ -237,16 +253,44 @@ module Courier
237
253
 
238
254
  MultipleTokens = Courier::Models::MultipleTokens
239
255
 
256
+ NotificationArchiveParams = Courier::Models::NotificationArchiveParams
257
+
258
+ NotificationCreateParams = Courier::Models::NotificationCreateParams
259
+
240
260
  NotificationGetContent = Courier::Models::NotificationGetContent
241
261
 
242
262
  NotificationListParams = Courier::Models::NotificationListParams
243
263
 
264
+ NotificationListVersionsParams = Courier::Models::NotificationListVersionsParams
265
+
244
266
  NotificationPreferenceDetails = Courier::Models::NotificationPreferenceDetails
245
267
 
268
+ NotificationPublishParams = Courier::Models::NotificationPublishParams
269
+
270
+ NotificationReplaceParams = Courier::Models::NotificationReplaceParams
271
+
246
272
  NotificationRetrieveContentParams = Courier::Models::NotificationRetrieveContentParams
247
273
 
274
+ NotificationRetrieveParams = Courier::Models::NotificationRetrieveParams
275
+
248
276
  Notifications = Courier::Models::Notifications
249
277
 
278
+ NotificationTemplateCreateRequest = Courier::Models::NotificationTemplateCreateRequest
279
+
280
+ NotificationTemplateGetResponse = Courier::Models::NotificationTemplateGetResponse
281
+
282
+ NotificationTemplateMutationResponse = Courier::Models::NotificationTemplateMutationResponse
283
+
284
+ NotificationTemplatePayload = Courier::Models::NotificationTemplatePayload
285
+
286
+ NotificationTemplatePublishRequest = Courier::Models::NotificationTemplatePublishRequest
287
+
288
+ NotificationTemplateSummary = Courier::Models::NotificationTemplateSummary
289
+
290
+ NotificationTemplateUpdateRequest = Courier::Models::NotificationTemplateUpdateRequest
291
+
292
+ NotificationTemplateVersionListResponse = Courier::Models::NotificationTemplateVersionListResponse
293
+
250
294
  Pagerduty = Courier::Models::Pagerduty
251
295
 
252
296
  PagerdutyRecipient = Courier::Models::PagerdutyRecipient
@@ -273,6 +317,22 @@ module Courier
273
317
 
274
318
  ProfileUpdateParams = Courier::Models::ProfileUpdateParams
275
319
 
320
+ Provider = Courier::Models::Provider
321
+
322
+ ProviderCreateParams = Courier::Models::ProviderCreateParams
323
+
324
+ ProviderDeleteParams = Courier::Models::ProviderDeleteParams
325
+
326
+ ProviderListParams = Courier::Models::ProviderListParams
327
+
328
+ ProviderRetrieveParams = Courier::Models::ProviderRetrieveParams
329
+
330
+ Providers = Courier::Models::Providers
331
+
332
+ ProvidersCatalogEntry = Courier::Models::ProvidersCatalogEntry
333
+
334
+ ProviderUpdateParams = Courier::Models::ProviderUpdateParams
335
+
276
336
  PutSubscriptionsRecipient = Courier::Models::PutSubscriptionsRecipient
277
337
 
278
338
  PutTenantTemplateRequest = Courier::Models::PutTenantTemplateRequest
@@ -283,6 +343,28 @@ module Courier
283
343
 
284
344
  RequestArchiveParams = Courier::Models::RequestArchiveParams
285
345
 
346
+ RoutingStrategyArchiveParams = Courier::Models::RoutingStrategyArchiveParams
347
+
348
+ RoutingStrategyCreateParams = Courier::Models::RoutingStrategyCreateParams
349
+
350
+ RoutingStrategyCreateRequest = Courier::Models::RoutingStrategyCreateRequest
351
+
352
+ RoutingStrategyGetResponse = Courier::Models::RoutingStrategyGetResponse
353
+
354
+ RoutingStrategyListParams = Courier::Models::RoutingStrategyListParams
355
+
356
+ RoutingStrategyListResponse = Courier::Models::RoutingStrategyListResponse
357
+
358
+ RoutingStrategyMutationResponse = Courier::Models::RoutingStrategyMutationResponse
359
+
360
+ RoutingStrategyReplaceParams = Courier::Models::RoutingStrategyReplaceParams
361
+
362
+ RoutingStrategyReplaceRequest = Courier::Models::RoutingStrategyReplaceRequest
363
+
364
+ RoutingStrategyRetrieveParams = Courier::Models::RoutingStrategyRetrieveParams
365
+
366
+ RoutingStrategySummary = Courier::Models::RoutingStrategySummary
367
+
286
368
  Rule = Courier::Models::Rule
287
369
 
288
370
  SendDirectMessage = Courier::Models::SendDirectMessage
@@ -339,6 +421,8 @@ module Courier
339
421
 
340
422
  TextStyle = Courier::Models::TextStyle
341
423
 
424
+ Timeouts = Courier::Models::Timeouts
425
+
342
426
  Token = Courier::Models::Token
343
427
 
344
428
  TranslationRetrieveParams = Courier::Models::TranslationRetrieveParams
@@ -355,6 +439,8 @@ module Courier
355
439
 
356
440
  Utm = Courier::Models::Utm
357
441
 
442
+ VersionNode = Courier::Models::VersionNode
443
+
358
444
  WebhookAuthentication = Courier::Models::WebhookAuthentication
359
445
 
360
446
  WebhookAuthMode = Courier::Models::WebhookAuthMode
@@ -9,11 +9,72 @@ module Courier
9
9
  # @return [Courier::Resources::Notifications::Checks]
10
10
  attr_reader :checks
11
11
 
12
- # @overload list(cursor: nil, notes: nil, request_options: {})
12
+ # Some parameter documentations has been truncated, see
13
+ # {Courier::Models::NotificationCreateParams} for more details.
13
14
  #
14
- # @param cursor [String, nil]
15
+ # Create a notification template. Requires all fields in the notification object.
16
+ # Templates are created in draft state by default.
15
17
  #
16
- # @param notes [Boolean, nil] Retrieve the notes from the Notification template settings.
18
+ # @overload create(notification:, state: nil, request_options: {})
19
+ #
20
+ # @param notification [Courier::Models::NotificationTemplatePayload] Full document shape used in POST and PUT request bodies, and returned inside the
21
+ #
22
+ # @param state [Symbol, Courier::Models::NotificationTemplateCreateRequest::State] Template state after creation. Case-insensitive input, normalized to uppercase i
23
+ #
24
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
25
+ #
26
+ # @return [Courier::Models::NotificationTemplateMutationResponse]
27
+ #
28
+ # @see Courier::Models::NotificationCreateParams
29
+ def create(params)
30
+ parsed, options = Courier::NotificationCreateParams.dump_request(params)
31
+ @client.request(
32
+ method: :post,
33
+ path: "notifications",
34
+ body: parsed,
35
+ model: Courier::NotificationTemplateMutationResponse,
36
+ options: options
37
+ )
38
+ end
39
+
40
+ # Some parameter documentations has been truncated, see
41
+ # {Courier::Models::NotificationRetrieveParams} for more details.
42
+ #
43
+ # Retrieve a notification template by ID. Returns the published version by
44
+ # default. Pass version=draft to retrieve an unpublished template.
45
+ #
46
+ # @overload retrieve(id, version: nil, request_options: {})
47
+ #
48
+ # @param id [String] Template ID (nt\_ prefix).
49
+ #
50
+ # @param version [String] Version to retrieve. One of "draft", "published", or a version string like "v001
51
+ #
52
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
53
+ #
54
+ # @return [Courier::Models::NotificationTemplateGetResponse]
55
+ #
56
+ # @see Courier::Models::NotificationRetrieveParams
57
+ def retrieve(id, params = {})
58
+ parsed, options = Courier::NotificationRetrieveParams.dump_request(params)
59
+ query = Courier::Internal::Util.encode_query_params(parsed)
60
+ @client.request(
61
+ method: :get,
62
+ path: ["notifications/%1$s", id],
63
+ query: query,
64
+ model: Courier::NotificationTemplateGetResponse,
65
+ options: options
66
+ )
67
+ end
68
+
69
+ # List notification templates in your workspace.
70
+ #
71
+ # @overload list(cursor: nil, event_id: nil, notes: nil, request_options: {})
72
+ #
73
+ # @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
74
+ #
75
+ # @param event_id [String] Filter to templates linked to this event map ID.
76
+ #
77
+ # @param notes [Boolean, nil] Include template notes in the response. Only applies to legacy templates.
17
78
  #
18
79
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
19
80
  #
@@ -32,6 +93,107 @@ module Courier
32
93
  )
33
94
  end
34
95
 
96
+ # Archive a notification template.
97
+ #
98
+ # @overload archive(id, request_options: {})
99
+ #
100
+ # @param id [String] Template ID (nt\_ prefix).
101
+ #
102
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
103
+ #
104
+ # @return [nil]
105
+ #
106
+ # @see Courier::Models::NotificationArchiveParams
107
+ def archive(id, params = {})
108
+ @client.request(
109
+ method: :delete,
110
+ path: ["notifications/%1$s", id],
111
+ model: NilClass,
112
+ options: params[:request_options]
113
+ )
114
+ end
115
+
116
+ # List versions of a notification template.
117
+ #
118
+ # @overload list_versions(id, cursor: nil, limit: nil, request_options: {})
119
+ #
120
+ # @param id [String] Template ID (nt\_ prefix).
121
+ #
122
+ # @param cursor [String] Opaque pagination cursor from a previous response. Omit for the first page.
123
+ #
124
+ # @param limit [Integer] Maximum number of versions to return per page. Default 10, max 10.
125
+ #
126
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
127
+ #
128
+ # @return [Courier::Models::NotificationTemplateVersionListResponse]
129
+ #
130
+ # @see Courier::Models::NotificationListVersionsParams
131
+ def list_versions(id, params = {})
132
+ parsed, options = Courier::NotificationListVersionsParams.dump_request(params)
133
+ query = Courier::Internal::Util.encode_query_params(parsed)
134
+ @client.request(
135
+ method: :get,
136
+ path: ["notifications/%1$s/versions", id],
137
+ query: query,
138
+ model: Courier::NotificationTemplateVersionListResponse,
139
+ options: options
140
+ )
141
+ end
142
+
143
+ # Publish a notification template. Publishes the current draft by default. Pass a
144
+ # version in the request body to publish a specific historical version.
145
+ #
146
+ # @overload publish(id, version: nil, request_options: {})
147
+ #
148
+ # @param id [String] Template ID (nt\_ prefix).
149
+ #
150
+ # @param version [String] Historical version to publish (e.g. "v001"). Omit to publish the current draft.
151
+ #
152
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
153
+ #
154
+ # @return [nil]
155
+ #
156
+ # @see Courier::Models::NotificationPublishParams
157
+ def publish(id, params = {})
158
+ parsed, options = Courier::NotificationPublishParams.dump_request(params)
159
+ @client.request(
160
+ method: :post,
161
+ path: ["notifications/%1$s/publish", id],
162
+ body: parsed,
163
+ model: NilClass,
164
+ options: options
165
+ )
166
+ end
167
+
168
+ # Some parameter documentations has been truncated, see
169
+ # {Courier::Models::NotificationReplaceParams} for more details.
170
+ #
171
+ # Replace a notification template. All fields are required.
172
+ #
173
+ # @overload replace(id, notification:, state: nil, request_options: {})
174
+ #
175
+ # @param id [String] Template ID (nt\_ prefix).
176
+ #
177
+ # @param notification [Courier::Models::NotificationTemplatePayload] Full document shape used in POST and PUT request bodies, and returned inside the
178
+ #
179
+ # @param state [Symbol, Courier::Models::NotificationTemplateUpdateRequest::State] Template state after update. Case-insensitive input, normalized to uppercase in
180
+ #
181
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
182
+ #
183
+ # @return [Courier::Models::NotificationTemplateMutationResponse]
184
+ #
185
+ # @see Courier::Models::NotificationReplaceParams
186
+ def replace(id, params)
187
+ parsed, options = Courier::NotificationReplaceParams.dump_request(params)
188
+ @client.request(
189
+ method: :put,
190
+ path: ["notifications/%1$s", id],
191
+ body: parsed,
192
+ model: Courier::NotificationTemplateMutationResponse,
193
+ options: options
194
+ )
195
+ end
196
+
35
197
  # @overload retrieve_content(id, request_options: {})
36
198
  #
37
199
  # @param id [String]
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Providers
6
+ class Catalog
7
+ # Some parameter documentations has been truncated, see
8
+ # {Courier::Models::Providers::CatalogListParams} for more details.
9
+ #
10
+ # Returns the catalog of available provider types with their display names,
11
+ # descriptions, and configuration schema fields (snake_case, with `type` and
12
+ # `required`). Providers with no configurable schema return only `provider`,
13
+ # `name`, and `description`.
14
+ #
15
+ # @overload list(channel: nil, keys: nil, name: nil, request_options: {})
16
+ #
17
+ # @param channel [String] Exact match (case-insensitive) against the provider channel taxonomy (e.g. `emai
18
+ #
19
+ # @param keys [String] Comma-separated provider keys to filter by (e.g. `sendgrid,twilio`).
20
+ #
21
+ # @param name [String] Case-insensitive substring match against the provider display name.
22
+ #
23
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
24
+ #
25
+ # @return [Courier::Models::Providers::CatalogListResponse]
26
+ #
27
+ # @see Courier::Models::Providers::CatalogListParams
28
+ def list(params = {})
29
+ parsed, options = Courier::Providers::CatalogListParams.dump_request(params)
30
+ query = Courier::Internal::Util.encode_query_params(parsed)
31
+ @client.request(
32
+ method: :get,
33
+ path: "providers/catalog",
34
+ query: query,
35
+ model: Courier::Models::Providers::CatalogListResponse,
36
+ options: options
37
+ )
38
+ end
39
+
40
+ # @api private
41
+ #
42
+ # @param client [Courier::Client]
43
+ def initialize(client:)
44
+ @client = client
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Providers
6
+ # @return [Courier::Resources::Providers::Catalog]
7
+ attr_reader :catalog
8
+
9
+ # Some parameter documentations has been truncated, see
10
+ # {Courier::Models::ProviderCreateParams} for more details.
11
+ #
12
+ # Create a new provider configuration. The `provider` field must be a known
13
+ # Courier provider key (see catalog).
14
+ #
15
+ # @overload create(provider:, alias_: nil, settings: nil, title: nil, request_options: {})
16
+ #
17
+ # @param provider [String] The provider key identifying the type (e.g. "sendgrid", "twilio"). Must be a kno
18
+ #
19
+ # @param alias_ [String] Optional alias for this configuration.
20
+ #
21
+ # @param settings [Hash{Symbol=>Object}] Provider-specific settings (snake_case keys). Defaults to an empty object when o
22
+ #
23
+ # @param title [String] Optional display title. Omit to use "Default Configuration".
24
+ #
25
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
26
+ #
27
+ # @return [Courier::Models::Provider]
28
+ #
29
+ # @see Courier::Models::ProviderCreateParams
30
+ def create(params)
31
+ parsed, options = Courier::ProviderCreateParams.dump_request(params)
32
+ @client.request(
33
+ method: :post,
34
+ path: "providers",
35
+ body: parsed,
36
+ model: Courier::Provider,
37
+ options: options
38
+ )
39
+ end
40
+
41
+ # Fetch a single provider configuration by ID.
42
+ #
43
+ # @overload retrieve(id, request_options: {})
44
+ #
45
+ # @param id [String] A unique identifier of the provider configuration.
46
+ #
47
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
48
+ #
49
+ # @return [Courier::Models::Provider]
50
+ #
51
+ # @see Courier::Models::ProviderRetrieveParams
52
+ def retrieve(id, params = {})
53
+ @client.request(
54
+ method: :get,
55
+ path: ["providers/%1$s", id],
56
+ model: Courier::Provider,
57
+ options: params[:request_options]
58
+ )
59
+ end
60
+
61
+ # Some parameter documentations has been truncated, see
62
+ # {Courier::Models::ProviderUpdateParams} for more details.
63
+ #
64
+ # Update an existing provider configuration. The `provider` key is required. All
65
+ # other fields are optional — omitted fields are cleared from the stored
66
+ # configuration (this is a full replacement, not a partial merge).
67
+ #
68
+ # @overload update(id, provider:, alias_: nil, settings: nil, title: nil, request_options: {})
69
+ #
70
+ # @param id [String] A unique identifier of the provider configuration to update.
71
+ #
72
+ # @param provider [String] The provider key identifying the type.
73
+ #
74
+ # @param alias_ [String] Updated alias. Omit to clear.
75
+ #
76
+ # @param settings [Hash{Symbol=>Object}] Provider-specific settings (snake_case keys). Replaces the full settings object
77
+ #
78
+ # @param title [String] Updated display title.
79
+ #
80
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
81
+ #
82
+ # @return [Courier::Models::Provider]
83
+ #
84
+ # @see Courier::Models::ProviderUpdateParams
85
+ def update(id, params)
86
+ parsed, options = Courier::ProviderUpdateParams.dump_request(params)
87
+ @client.request(
88
+ method: :post,
89
+ path: ["providers/%1$s", id],
90
+ body: parsed,
91
+ model: Courier::Provider,
92
+ options: options
93
+ )
94
+ end
95
+
96
+ # List configured provider integrations for the current workspace. Supports
97
+ # cursor-based pagination.
98
+ #
99
+ # @overload list(cursor: nil, request_options: {})
100
+ #
101
+ # @param cursor [String] Opaque cursor for fetching the next page.
102
+ #
103
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
104
+ #
105
+ # @return [Courier::Models::ProviderListResponse]
106
+ #
107
+ # @see Courier::Models::ProviderListParams
108
+ def list(params = {})
109
+ parsed, options = Courier::ProviderListParams.dump_request(params)
110
+ query = Courier::Internal::Util.encode_query_params(parsed)
111
+ @client.request(
112
+ method: :get,
113
+ path: "providers",
114
+ query: query,
115
+ model: Courier::Models::ProviderListResponse,
116
+ options: options
117
+ )
118
+ end
119
+
120
+ # Delete a provider configuration. Returns 409 if the provider is still referenced
121
+ # by routing or notifications.
122
+ #
123
+ # @overload delete(id, request_options: {})
124
+ #
125
+ # @param id [String] A unique identifier of the provider configuration to delete.
126
+ #
127
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
128
+ #
129
+ # @return [nil]
130
+ #
131
+ # @see Courier::Models::ProviderDeleteParams
132
+ def delete(id, params = {})
133
+ @client.request(
134
+ method: :delete,
135
+ path: ["providers/%1$s", id],
136
+ model: NilClass,
137
+ options: params[:request_options]
138
+ )
139
+ end
140
+
141
+ # @api private
142
+ #
143
+ # @param client [Courier::Client]
144
+ def initialize(client:)
145
+ @client = client
146
+ @catalog = Courier::Resources::Providers::Catalog.new(client: client)
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
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
+ #
9
+ # @overload create(name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {})
10
+ #
11
+ # @param name [String] Human-readable name for the routing strategy.
12
+ #
13
+ # @param routing [Courier::Models::MessageRouting] Routing tree defining channel selection method and order.
14
+ #
15
+ # @param channels [Hash{Symbol=>Courier::Models::Channel}, nil] Per-channel delivery configuration. Defaults to empty if omitted.
16
+ #
17
+ # @param description [String, nil] Optional description of the routing strategy.
18
+ #
19
+ # @param providers [Hash{Symbol=>Courier::Models::MessageProvidersType}, nil] Per-provider delivery configuration. Defaults to empty if omitted.
20
+ #
21
+ # @param tags [Array<String>, nil] Optional tags for categorization.
22
+ #
23
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
24
+ #
25
+ # @return [Courier::Models::RoutingStrategyMutationResponse]
26
+ #
27
+ # @see Courier::Models::RoutingStrategyCreateParams
28
+ def create(params)
29
+ parsed, options = Courier::RoutingStrategyCreateParams.dump_request(params)
30
+ @client.request(
31
+ method: :post,
32
+ path: "routing-strategies",
33
+ body: parsed,
34
+ model: Courier::RoutingStrategyMutationResponse,
35
+ options: options
36
+ )
37
+ end
38
+
39
+ # Retrieve a routing strategy by ID. Returns the full entity including routing
40
+ # content and metadata.
41
+ #
42
+ # @overload retrieve(id, request_options: {})
43
+ #
44
+ # @param id [String] Routing strategy ID (rs\_ prefix).
45
+ #
46
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
47
+ #
48
+ # @return [Courier::Models::RoutingStrategyGetResponse]
49
+ #
50
+ # @see Courier::Models::RoutingStrategyRetrieveParams
51
+ def retrieve(id, params = {})
52
+ @client.request(
53
+ method: :get,
54
+ path: ["routing-strategies/%1$s", id],
55
+ model: Courier::RoutingStrategyGetResponse,
56
+ options: params[:request_options]
57
+ )
58
+ end
59
+
60
+ # List routing strategies in your workspace. Returns metadata only (no
61
+ # routing/channels/providers content). Use GET /routing-strategies/{id} for full
62
+ # details.
63
+ #
64
+ # @overload list(cursor: nil, limit: nil, request_options: {})
65
+ #
66
+ # @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
67
+ #
68
+ # @param limit [Integer] Maximum number of results per page. Default 20, max 100.
69
+ #
70
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
71
+ #
72
+ # @return [Courier::Models::RoutingStrategyListResponse]
73
+ #
74
+ # @see Courier::Models::RoutingStrategyListParams
75
+ def list(params = {})
76
+ parsed, options = Courier::RoutingStrategyListParams.dump_request(params)
77
+ query = Courier::Internal::Util.encode_query_params(parsed)
78
+ @client.request(
79
+ method: :get,
80
+ path: "routing-strategies",
81
+ query: query,
82
+ model: Courier::RoutingStrategyListResponse,
83
+ options: options
84
+ )
85
+ end
86
+
87
+ # Archive a routing strategy. The strategy must not have associated notification
88
+ # templates. Unlink all templates before archiving.
89
+ #
90
+ # @overload archive(id, request_options: {})
91
+ #
92
+ # @param id [String] Routing strategy ID (rs\_ prefix).
93
+ #
94
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
95
+ #
96
+ # @return [nil]
97
+ #
98
+ # @see Courier::Models::RoutingStrategyArchiveParams
99
+ def archive(id, params = {})
100
+ @client.request(
101
+ method: :delete,
102
+ path: ["routing-strategies/%1$s", id],
103
+ model: NilClass,
104
+ options: params[:request_options]
105
+ )
106
+ end
107
+
108
+ # Replace a routing strategy. Full document replacement; the caller must send the
109
+ # complete desired state. Missing optional fields are cleared.
110
+ #
111
+ # @overload replace(id, name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {})
112
+ #
113
+ # @param id [String] Routing strategy ID (rs\_ prefix).
114
+ #
115
+ # @param name [String] Human-readable name for the routing strategy.
116
+ #
117
+ # @param routing [Courier::Models::MessageRouting] Routing tree defining channel selection method and order.
118
+ #
119
+ # @param channels [Hash{Symbol=>Courier::Models::Channel}, nil] Per-channel delivery configuration. Omit to clear.
120
+ #
121
+ # @param description [String, nil] Optional description. Omit or null to clear.
122
+ #
123
+ # @param providers [Hash{Symbol=>Courier::Models::MessageProvidersType}, nil] Per-provider delivery configuration. Omit to clear.
124
+ #
125
+ # @param tags [Array<String>, nil] Optional tags. Omit or null to clear.
126
+ #
127
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
128
+ #
129
+ # @return [Courier::Models::RoutingStrategyMutationResponse]
130
+ #
131
+ # @see Courier::Models::RoutingStrategyReplaceParams
132
+ def replace(id, params)
133
+ parsed, options = Courier::RoutingStrategyReplaceParams.dump_request(params)
134
+ @client.request(
135
+ method: :put,
136
+ path: ["routing-strategies/%1$s", id],
137
+ body: parsed,
138
+ model: Courier::RoutingStrategyMutationResponse,
139
+ options: options
140
+ )
141
+ end
142
+
143
+ # @api private
144
+ #
145
+ # @param client [Courier::Client]
146
+ def initialize(client:)
147
+ @client = client
148
+ end
149
+ end
150
+ end
151
+ end