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.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -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/associated_notification_list_response.rb +24 -0
  7. data/lib/courier/models/channel.rb +75 -0
  8. data/lib/courier/models/channel_metadata.rb +15 -0
  9. data/lib/courier/models/element_with_checksums.rb +60 -0
  10. data/lib/courier/models/elemental_content.rb +2 -2
  11. data/lib/courier/models/elemental_html_node_with_type.rb +24 -0
  12. data/lib/courier/models/elemental_node.rb +3 -1
  13. data/lib/courier/models/message_channels.rb +8 -0
  14. data/lib/courier/models/message_providers.rb +8 -0
  15. data/lib/courier/models/message_providers_type.rb +38 -0
  16. data/lib/courier/models/metadata.rb +15 -0
  17. data/lib/courier/models/notification_archive_params.rb +20 -0
  18. data/lib/courier/models/notification_content_get_response.rb +26 -0
  19. data/lib/courier/models/notification_content_mutation_response.rb +61 -0
  20. data/lib/courier/models/notification_content_put_request.rb +51 -0
  21. data/lib/courier/models/notification_create_params.rb +14 -0
  22. data/lib/courier/models/notification_element_put_request.rb +62 -0
  23. data/lib/courier/models/notification_get_content.rb +0 -1
  24. data/lib/courier/models/notification_list_params.rb +13 -4
  25. data/lib/courier/models/notification_list_response.rb +108 -93
  26. data/lib/courier/models/notification_list_versions_params.rb +37 -0
  27. data/lib/courier/models/notification_locale_put_request.rb +39 -0
  28. data/lib/courier/models/notification_publish_params.rb +20 -0
  29. data/lib/courier/models/notification_put_content_params.rb +20 -0
  30. data/lib/courier/models/notification_put_element_params.rb +26 -0
  31. data/lib/courier/models/notification_put_locale_params.rb +26 -0
  32. data/lib/courier/models/notification_replace_params.rb +20 -0
  33. data/lib/courier/models/notification_retrieve_content_params.rb +14 -1
  34. data/lib/courier/models/notification_retrieve_content_response.rb +21 -0
  35. data/lib/courier/models/notification_retrieve_params.rb +33 -0
  36. data/lib/courier/models/notification_template_create_request.rb +45 -0
  37. data/lib/courier/models/notification_template_get_response.rb +92 -0
  38. data/lib/courier/models/notification_template_mutation_response.rb +51 -0
  39. data/lib/courier/models/notification_template_payload.rb +98 -0
  40. data/lib/courier/models/notification_template_publish_request.rb +19 -0
  41. data/lib/courier/models/notification_template_state.rb +16 -0
  42. data/lib/courier/models/notification_template_summary.rb +81 -0
  43. data/lib/courier/models/notification_template_update_request.rb +46 -0
  44. data/lib/courier/models/notification_template_version_list_response.rb +22 -0
  45. data/lib/courier/models/provider.rb +67 -0
  46. data/lib/courier/models/provider_create_params.rb +52 -0
  47. data/lib/courier/models/provider_delete_params.rb +20 -0
  48. data/lib/courier/models/provider_list_params.rb +22 -0
  49. data/lib/courier/models/provider_list_response.rb +24 -0
  50. data/lib/courier/models/provider_retrieve_params.rb +20 -0
  51. data/lib/courier/models/provider_update_params.rb +58 -0
  52. data/lib/courier/models/providers/catalog_list_params.rb +44 -0
  53. data/lib/courier/models/providers/catalog_list_response.rb +26 -0
  54. data/lib/courier/models/providers_catalog_entry.rb +86 -0
  55. data/lib/courier/models/routing_strategy_archive_params.rb +20 -0
  56. data/lib/courier/models/routing_strategy_create_params.rb +14 -0
  57. data/lib/courier/models/routing_strategy_create_request.rb +58 -0
  58. data/lib/courier/models/routing_strategy_get_response.rb +99 -0
  59. data/lib/courier/models/routing_strategy_list_notifications_params.rb +37 -0
  60. data/lib/courier/models/routing_strategy_list_params.rb +30 -0
  61. data/lib/courier/models/routing_strategy_list_response.rb +24 -0
  62. data/lib/courier/models/routing_strategy_mutation_response.rb +19 -0
  63. data/lib/courier/models/routing_strategy_replace_params.rb +20 -0
  64. data/lib/courier/models/routing_strategy_replace_request.rb +59 -0
  65. data/lib/courier/models/routing_strategy_retrieve_params.rb +20 -0
  66. data/lib/courier/models/routing_strategy_summary.rb +75 -0
  67. data/lib/courier/models/send_message_params.rb +6 -154
  68. data/lib/courier/models/tenant_template_input.rb +6 -152
  69. data/lib/courier/models/timeouts.rb +21 -0
  70. data/lib/courier/models/version_node.rb +46 -0
  71. data/lib/courier/models.rb +110 -0
  72. data/lib/courier/resources/notifications.rb +289 -12
  73. data/lib/courier/resources/providers/catalog.rb +49 -0
  74. data/lib/courier/resources/providers.rb +150 -0
  75. data/lib/courier/resources/routing_strategies.rb +179 -0
  76. data/lib/courier/version.rb +1 -1
  77. data/lib/courier.rb +60 -2
  78. data/rbi/courier/client.rbi +6 -0
  79. data/rbi/courier/internal/util.rbi +8 -0
  80. data/rbi/courier/models/associated_notification_list_response.rbi +45 -0
  81. data/rbi/courier/models/channel.rbi +106 -0
  82. data/rbi/courier/models/channel_metadata.rbi +28 -0
  83. data/rbi/courier/models/element_with_checksums.rbi +109 -0
  84. data/rbi/courier/models/elemental_content.rbi +6 -3
  85. data/rbi/courier/models/elemental_html_node_with_type.rbi +59 -0
  86. data/rbi/courier/models/elemental_node.rbi +2 -1
  87. data/rbi/courier/models/message_channels.rbi +11 -0
  88. data/rbi/courier/models/message_providers.rbi +11 -0
  89. data/rbi/courier/models/message_providers_type.rbi +60 -0
  90. data/rbi/courier/models/metadata.rbi +26 -0
  91. data/rbi/courier/models/notification_archive_params.rbi +35 -0
  92. data/rbi/courier/models/notification_content_get_response.rbi +45 -0
  93. data/rbi/courier/models/notification_content_mutation_response.rbi +95 -0
  94. data/rbi/courier/models/notification_content_put_request.rbi +145 -0
  95. data/rbi/courier/models/notification_create_params.rbi +27 -0
  96. data/rbi/courier/models/notification_element_put_request.rbi +98 -0
  97. data/rbi/courier/models/notification_list_params.rbi +15 -2
  98. data/rbi/courier/models/notification_list_response.rbi +159 -119
  99. data/rbi/courier/models/notification_list_versions_params.rbi +66 -0
  100. data/rbi/courier/models/notification_locale_put_request.rbi +79 -0
  101. data/rbi/courier/models/notification_publish_params.rbi +35 -0
  102. data/rbi/courier/models/notification_put_content_params.rbi +38 -0
  103. data/rbi/courier/models/notification_put_element_params.rbi +46 -0
  104. data/rbi/courier/models/notification_put_locale_params.rbi +46 -0
  105. data/rbi/courier/models/notification_replace_params.rbi +35 -0
  106. data/rbi/courier/models/notification_retrieve_content_params.rbi +21 -2
  107. data/rbi/courier/models/notification_retrieve_content_response.rbi +29 -0
  108. data/rbi/courier/models/notification_retrieve_params.rbi +54 -0
  109. data/rbi/courier/models/notification_template_create_request.rbi +102 -0
  110. data/rbi/courier/models/notification_template_get_response.rbi +162 -0
  111. data/rbi/courier/models/notification_template_mutation_response.rbi +121 -0
  112. data/rbi/courier/models/notification_template_payload.rbi +183 -0
  113. data/rbi/courier/models/notification_template_publish_request.rbi +35 -0
  114. data/rbi/courier/models/notification_template_state.rbi +26 -0
  115. data/rbi/courier/models/notification_template_summary.rbi +124 -0
  116. data/rbi/courier/models/notification_template_update_request.rbi +103 -0
  117. data/rbi/courier/models/notification_template_version_list_response.rbi +41 -0
  118. data/rbi/courier/models/provider.rbi +87 -0
  119. data/rbi/courier/models/provider_create_params.rbi +82 -0
  120. data/rbi/courier/models/provider_delete_params.rbi +35 -0
  121. data/rbi/courier/models/provider_list_params.rbi +43 -0
  122. data/rbi/courier/models/provider_list_response.rbi +42 -0
  123. data/rbi/courier/models/provider_retrieve_params.rbi +35 -0
  124. data/rbi/courier/models/provider_update_params.rbi +86 -0
  125. data/rbi/courier/models/providers/catalog_list_params.rbi +75 -0
  126. data/rbi/courier/models/providers/catalog_list_response.rbi +47 -0
  127. data/rbi/courier/models/providers_catalog_entry.rbi +129 -0
  128. data/rbi/courier/models/routing_strategy_archive_params.rbi +38 -0
  129. data/rbi/courier/models/routing_strategy_create_params.rbi +30 -0
  130. data/rbi/courier/models/routing_strategy_create_request.rbi +86 -0
  131. data/rbi/courier/models/routing_strategy_get_response.rbi +121 -0
  132. data/rbi/courier/models/routing_strategy_list_notifications_params.rbi +63 -0
  133. data/rbi/courier/models/routing_strategy_list_params.rbi +54 -0
  134. data/rbi/courier/models/routing_strategy_list_response.rbi +45 -0
  135. data/rbi/courier/models/routing_strategy_mutation_response.rbi +31 -0
  136. data/rbi/courier/models/routing_strategy_replace_params.rbi +38 -0
  137. data/rbi/courier/models/routing_strategy_replace_request.rbi +87 -0
  138. data/rbi/courier/models/routing_strategy_retrieve_params.rbi +38 -0
  139. data/rbi/courier/models/routing_strategy_summary.rbi +95 -0
  140. data/rbi/courier/models/send_message_params.rbi +6 -362
  141. data/rbi/courier/models/tenant_template_input.rbi +8 -336
  142. data/rbi/courier/models/timeouts.rbi +33 -0
  143. data/rbi/courier/models/version_node.rbi +65 -0
  144. data/rbi/courier/models.rbi +122 -0
  145. data/rbi/courier/resources/notifications.rbi +222 -6
  146. data/rbi/courier/resources/providers/catalog.rbi +38 -0
  147. data/rbi/courier/resources/providers.rbi +116 -0
  148. data/rbi/courier/resources/routing_strategies.rbi +147 -0
  149. data/sig/courier/client.rbs +4 -0
  150. data/sig/courier/internal/util.rbs +4 -0
  151. data/sig/courier/models/associated_notification_list_response.rbs +25 -0
  152. data/sig/courier/models/channel.rbs +61 -0
  153. data/sig/courier/models/channel_metadata.rbs +13 -0
  154. data/sig/courier/models/element_with_checksums.rbs +60 -0
  155. data/sig/courier/models/elemental_html_node_with_type.rbs +32 -0
  156. data/sig/courier/models/elemental_node.rbs +1 -0
  157. data/sig/courier/models/message_channels.rbs +7 -0
  158. data/sig/courier/models/message_providers.rbs +7 -0
  159. data/sig/courier/models/message_providers_type.rbs +35 -0
  160. data/sig/courier/models/metadata.rbs +13 -0
  161. data/sig/courier/models/notification_archive_params.rbs +20 -0
  162. data/sig/courier/models/notification_content_get_response.rbs +22 -0
  163. data/sig/courier/models/notification_content_mutation_response.rbs +47 -0
  164. data/sig/courier/models/notification_content_put_request.rbs +50 -0
  165. data/sig/courier/models/notification_create_params.rbs +15 -0
  166. data/sig/courier/models/notification_element_put_request.rbs +64 -0
  167. data/sig/courier/models/notification_list_params.rbs +7 -1
  168. data/sig/courier/models/notification_list_response.rbs +81 -71
  169. data/sig/courier/models/notification_list_versions_params.rbs +36 -0
  170. data/sig/courier/models/notification_locale_put_request.rbs +39 -0
  171. data/sig/courier/models/notification_publish_params.rbs +22 -0
  172. data/sig/courier/models/notification_put_content_params.rbs +22 -0
  173. data/sig/courier/models/notification_put_element_params.rbs +32 -0
  174. data/sig/courier/models/notification_put_locale_params.rbs +32 -0
  175. data/sig/courier/models/notification_replace_params.rbs +22 -0
  176. data/sig/courier/models/notification_retrieve_content_params.rbs +12 -2
  177. data/sig/courier/models/notification_retrieve_content_response.rbs +12 -0
  178. data/sig/courier/models/notification_retrieve_params.rbs +30 -0
  179. data/sig/courier/models/notification_template_create_request.rbs +40 -0
  180. data/sig/courier/models/notification_template_get_response.rbs +72 -0
  181. data/sig/courier/models/notification_template_mutation_response.rbs +46 -0
  182. data/sig/courier/models/notification_template_payload.rbs +75 -0
  183. data/sig/courier/models/notification_template_publish_request.rbs +15 -0
  184. data/sig/courier/models/notification_template_state.rbs +14 -0
  185. data/sig/courier/models/notification_template_summary.rbs +70 -0
  186. data/sig/courier/models/notification_template_update_request.rbs +40 -0
  187. data/sig/courier/models/notification_template_version_list_response.rbs +22 -0
  188. data/sig/courier/models/provider.rbs +52 -0
  189. data/sig/courier/models/provider_create_params.rbs +47 -0
  190. data/sig/courier/models/provider_delete_params.rbs +20 -0
  191. data/sig/courier/models/provider_list_params.rbs +25 -0
  192. data/sig/courier/models/provider_list_response.rbs +22 -0
  193. data/sig/courier/models/provider_retrieve_params.rbs +20 -0
  194. data/sig/courier/models/provider_update_params.rbs +52 -0
  195. data/sig/courier/models/providers/catalog_list_params.rbs +40 -0
  196. data/sig/courier/models/providers/catalog_list_response.rbs +27 -0
  197. data/sig/courier/models/providers_catalog_entry.rbs +64 -0
  198. data/sig/courier/models/routing_strategy_archive_params.rbs +20 -0
  199. data/sig/courier/models/routing_strategy_create_params.rbs +15 -0
  200. data/sig/courier/models/routing_strategy_create_request.rbs +45 -0
  201. data/sig/courier/models/routing_strategy_get_response.rbs +70 -0
  202. data/sig/courier/models/routing_strategy_list_notifications_params.rbs +34 -0
  203. data/sig/courier/models/routing_strategy_list_params.rbs +30 -0
  204. data/sig/courier/models/routing_strategy_list_response.rbs +25 -0
  205. data/sig/courier/models/routing_strategy_mutation_response.rbs +13 -0
  206. data/sig/courier/models/routing_strategy_replace_params.rbs +22 -0
  207. data/sig/courier/models/routing_strategy_replace_request.rbs +45 -0
  208. data/sig/courier/models/routing_strategy_retrieve_params.rbs +20 -0
  209. data/sig/courier/models/routing_strategy_summary.rbs +55 -0
  210. data/sig/courier/models/send_message_params.rbs +8 -130
  211. data/sig/courier/models/tenant_template_input.rbs +12 -134
  212. data/sig/courier/models/timeouts.rbs +15 -0
  213. data/sig/courier/models/version_node.rbs +32 -0
  214. data/sig/courier/models.rbs +108 -0
  215. data/sig/courier/resources/notifications.rbs +65 -3
  216. data/sig/courier/resources/providers/catalog.rbs +16 -0
  217. data/sig/courier/resources/providers.rbs +38 -0
  218. data/sig/courier/resources/routing_strategies.rbs +48 -0
  219. metadata +182 -8
  220. data/lib/courier/models/notifications/draft_retrieve_content_params.rb +0 -22
  221. data/lib/courier/resources/notifications/draft.rb +0 -33
  222. data/rbi/courier/models/notifications/draft_retrieve_content_params.rbi +0 -40
  223. data/rbi/courier/resources/notifications/draft.rbi +0 -23
  224. data/sig/courier/models/notifications/draft_retrieve_content_params.rbs +0 -22
  225. data/sig/courier/resources/notifications/draft.rbs +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 453a5c5183a4ecfeebab4f86e963ac204c115741c2fedb0f32156b1a6aff23f0
4
- data.tar.gz: 4db69717cb3bdcd63d2eae022325c4ae14fe8a1203cec1a7212628c3804242ce
3
+ metadata.gz: d71ef55224ae3a498561c16171a3a2f4d7043cdd17d9c505ef34e70179a6c35b
4
+ data.tar.gz: da26b63925075f65d3d953a4a810ea535431e65274528b902000121d928c7fcb
5
5
  SHA512:
6
- metadata.gz: 7931be3dcf151f5e26313fcfd94b25995f416bd17147e40d99dec981991ebaa2b9a2d0ac3534f2d3888c60d969ec32cea8b8e07a2e6656fbf2e33526a3a041e4
7
- data.tar.gz: 4d57d68375783ca713d41844d364c04e5f234834509fbd465822ca89aa9f0044e558055d730cbacaf50ed5d96d4839aa7087a4436c497c401d985658e08a3bd1
6
+ metadata.gz: 237604be72c50aa572c525addf58d4e3f723142ffbd5863c9dfb301882bf9efa4c77e4eae7a143cafc3ed1981fb0602be0bb7a1046d4be8e5587c2c15988fd52
7
+ data.tar.gz: cfdb4b9bcf90da1d34e9aabbe994404f49e6df75d4d56368509034b60ceb55eb0461d492cbaf2d2cb7a4b92e17f54a6050f7b605a0f2c00a8b9788c6142255d1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.10.0 (2026-04-08)
4
+
5
+ Full Changelog: [v4.9.0...v4.10.0](https://github.com/trycourier/courier-ruby/compare/v4.9.0...v4.10.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add list_notifications method to routing_strategies ([ce8f121](https://github.com/trycourier/courier-ruby/commit/ce8f1217d52377144e053e51497310e71fef1dea))
10
+ * **api:** add put_content/put_element/put_locale, remove draft resource, update retrieve_content ([ecb21e4](https://github.com/trycourier/courier-ruby/commit/ecb21e4913ec80513471153abab2e75d80afffb5))
11
+
12
+ ## 4.9.0 (2026-04-01)
13
+
14
+ Full Changelog: [v4.8.0...v4.9.0](https://github.com/trycourier/courier-ruby/compare/v4.8.0...v4.9.0)
15
+
16
+ ### Features
17
+
18
+ * **api:** add html variant to elemental_node union ([a5a5a5d](https://github.com/trycourier/courier-ruby/commit/a5a5a5d025d5ddb27a79872b15efaaa08785b032))
19
+ * **api:** add notification template CRUD methods, update list params/types ([4861f87](https://github.com/trycourier/courier-ruby/commit/4861f87ead15aba7b148dc8d2790fe2d018157c9))
20
+ * **api:** add providers resource with create/retrieve/update/list/delete and catalog ([5191261](https://github.com/trycourier/courier-ruby/commit/519126120e84dea8276094325e49d350eff3f7bc))
21
+ * **api:** add routing_strategies resource with create/retrieve/list/replace/archive ([6c64599](https://github.com/trycourier/courier-ruby/commit/6c645999dd54ac75bdb777745363d662f7d9da64))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * align path encoding with RFC 3986 section 3.3 ([916afaa](https://github.com/trycourier/courier-ruby/commit/916afaafd525d4d77a42a0739e892c4d4cf5d933))
27
+ * **internal:** correct multipart form field name encoding ([7925b72](https://github.com/trycourier/courier-ruby/commit/7925b72544622783dd17527da1729f6f48ddb744))
28
+ * variable name typo ([1f59fd2](https://github.com/trycourier/courier-ruby/commit/1f59fd2c73459908b337b98135efbd79bf0bfb9a))
29
+
30
+
31
+ ### Chores
32
+
33
+ * **ci:** skip lint on metadata-only changes ([22a3e8d](https://github.com/trycourier/courier-ruby/commit/22a3e8d5bbfe6953bca20ba54b7bb2007f4f37c0))
34
+ * **ci:** support opting out of skipping builds on metadata-only commits ([a6c047e](https://github.com/trycourier/courier-ruby/commit/a6c047eaa9730f8c398082cd422bf0bc1087e882))
35
+ * **internal:** tweak CI branches ([08eccfe](https://github.com/trycourier/courier-ruby/commit/08eccfe4c37358304a97686df7248dc02f6ea0f4))
36
+ * **internal:** update gitignore ([95860ac](https://github.com/trycourier/courier-ruby/commit/95860acf54c665132e957913d0fc6187cadaf64c))
37
+
38
+
39
+ ### Documentation
40
+
41
+ * add AGENTS.md for AI coding assistants ([#81](https://github.com/trycourier/courier-ruby/issues/81)) ([ff1b8c2](https://github.com/trycourier/courier-ruby/commit/ff1b8c2e58007e1ccd5e631e07f28daf2027cef2))
42
+ * sync README from mintlify-docs (2026-03-23 19:54 UTC) ([#79](https://github.com/trycourier/courier-ruby/issues/79)) ([4b83d99](https://github.com/trycourier/courier-ruby/commit/4b83d99126c8ddedf8e137cfc683bc6be998cc35))
43
+
3
44
  ## 4.8.0 (2026-03-12)
4
45
 
5
46
  Full Changelog: [v4.7.1...v4.8.0](https://github.com/trycourier/courier-ruby/compare/v4.7.1...v4.8.0)
data/README.md CHANGED
@@ -8,7 +8,7 @@ The Courier Ruby SDK provides typed access to the Courier REST API from any Ruby
8
8
  Add to your `Gemfile`:
9
9
 
10
10
  ```ruby
11
- gem "trycourier", "~> 4.7"
11
+ gem "trycourier"
12
12
  ```
13
13
 
14
14
  Then run `bundle install`.
@@ -24,6 +24,9 @@ module Courier
24
24
  # @return [Courier::Resources::Audiences]
25
25
  attr_reader :audiences
26
26
 
27
+ # @return [Courier::Resources::Providers]
28
+ attr_reader :providers
29
+
27
30
  # @return [Courier::Resources::AuditEvents]
28
31
  attr_reader :audit_events
29
32
 
@@ -57,6 +60,9 @@ module Courier
57
60
  # @return [Courier::Resources::Notifications]
58
61
  attr_reader :notifications
59
62
 
63
+ # @return [Courier::Resources::RoutingStrategies]
64
+ attr_reader :routing_strategies
65
+
60
66
  # @return [Courier::Resources::Profiles]
61
67
  attr_reader :profiles
62
68
 
@@ -118,6 +124,7 @@ module Courier
118
124
 
119
125
  @send_ = Courier::Resources::Send.new(client: self)
120
126
  @audiences = Courier::Resources::Audiences.new(client: self)
127
+ @providers = Courier::Resources::Providers.new(client: self)
121
128
  @audit_events = Courier::Resources::AuditEvents.new(client: self)
122
129
  @auth = Courier::Resources::Auth.new(client: self)
123
130
  @automations = Courier::Resources::Automations.new(client: self)
@@ -129,6 +136,7 @@ module Courier
129
136
  @messages = Courier::Resources::Messages.new(client: self)
130
137
  @requests = Courier::Resources::Requests.new(client: self)
131
138
  @notifications = Courier::Resources::Notifications.new(client: self)
139
+ @routing_strategies = Courier::Resources::RoutingStrategies.new(client: self)
132
140
  @profiles = Courier::Resources::Profiles.new(client: self)
133
141
  @tenants = Courier::Resources::Tenants.new(client: self)
134
142
  @translations = Courier::Resources::Translations.new(client: self)
@@ -157,7 +157,7 @@ module Courier
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Courier::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Courier::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module Courier
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module Courier
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(Courier::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module Courier
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -571,16 +585,15 @@ module Courier
571
585
  y << "Content-Disposition: form-data"
572
586
 
573
587
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
576
589
  end
577
590
 
578
591
  case val
579
592
  in Courier::FilePart unless val.filename.nil?
580
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
581
594
  y << "; filename=\"#{filename}\""
582
595
  in Pathname | IO
583
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
584
597
  y << "; filename=\"#{filename}\""
585
598
  else
586
599
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::RoutingStrategies#list_notifications
6
+ class AssociatedNotificationListResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute paging
8
+ #
9
+ # @return [Courier::Models::Paging]
10
+ required :paging, -> { Courier::Paging }
11
+
12
+ # @!attribute results
13
+ #
14
+ # @return [Array<Courier::Models::NotificationTemplateSummary>]
15
+ required :results, -> { Courier::Internal::Type::ArrayOf[Courier::NotificationTemplateSummary] }
16
+
17
+ # @!method initialize(paging:, results:)
18
+ # Paginated list of notification templates associated with a routing strategy.
19
+ #
20
+ # @param paging [Courier::Models::Paging]
21
+ # @param results [Array<Courier::Models::NotificationTemplateSummary>]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class Channel < Courier::Internal::Type::BaseModel
6
+ # @!attribute brand_id
7
+ # Brand id used for rendering.
8
+ #
9
+ # @return [String, nil]
10
+ optional :brand_id, String, nil?: true
11
+
12
+ # @!attribute if_
13
+ # JS conditional with access to data/profile.
14
+ #
15
+ # @return [String, nil]
16
+ optional :if_, String, api_name: :if, nil?: true
17
+
18
+ # @!attribute metadata
19
+ #
20
+ # @return [Courier::Models::ChannelMetadata, nil]
21
+ optional :metadata, -> { Courier::ChannelMetadata }, nil?: true
22
+
23
+ # @!attribute override
24
+ # Channel specific overrides.
25
+ #
26
+ # @return [Hash{Symbol=>Object}, nil]
27
+ optional :override, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
28
+
29
+ # @!attribute providers
30
+ # Providers enabled for this channel.
31
+ #
32
+ # @return [Array<String>, nil]
33
+ optional :providers, Courier::Internal::Type::ArrayOf[String], nil?: true
34
+
35
+ # @!attribute routing_method
36
+ # Defaults to `single`.
37
+ #
38
+ # @return [Symbol, Courier::Models::Channel::RoutingMethod, nil]
39
+ optional :routing_method, enum: -> { Courier::Channel::RoutingMethod }, nil?: true
40
+
41
+ # @!attribute timeouts
42
+ #
43
+ # @return [Courier::Models::Timeouts, nil]
44
+ optional :timeouts, -> { Courier::Timeouts }, nil?: true
45
+
46
+ # @!method initialize(brand_id: nil, if_: nil, metadata: nil, override: nil, providers: nil, routing_method: nil, timeouts: nil)
47
+ # @param brand_id [String, nil] Brand id used for rendering.
48
+ #
49
+ # @param if_ [String, nil] JS conditional with access to data/profile.
50
+ #
51
+ # @param metadata [Courier::Models::ChannelMetadata, nil]
52
+ #
53
+ # @param override [Hash{Symbol=>Object}, nil] Channel specific overrides.
54
+ #
55
+ # @param providers [Array<String>, nil] Providers enabled for this channel.
56
+ #
57
+ # @param routing_method [Symbol, Courier::Models::Channel::RoutingMethod, nil] Defaults to `single`.
58
+ #
59
+ # @param timeouts [Courier::Models::Timeouts, nil]
60
+
61
+ # Defaults to `single`.
62
+ #
63
+ # @see Courier::Models::Channel#routing_method
64
+ module RoutingMethod
65
+ extend Courier::Internal::Type::Enum
66
+
67
+ ALL = :all
68
+ SINGLE = :single
69
+
70
+ # @!method self.values
71
+ # @return [Array<Symbol>]
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class ChannelMetadata < Courier::Internal::Type::BaseModel
6
+ # @!attribute utm
7
+ #
8
+ # @return [Courier::Models::Utm, nil]
9
+ optional :utm, -> { Courier::Utm }, nil?: true
10
+
11
+ # @!method initialize(utm: nil)
12
+ # @param utm [Courier::Models::Utm, nil]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementWithChecksums < Courier::Internal::Type::BaseModel
6
+ # @!attribute checksum
7
+ # MD5 hash of translatable content.
8
+ #
9
+ # @return [String]
10
+ required :checksum, String
11
+
12
+ # @!attribute type
13
+ # Element type (text, meta, action, etc.).
14
+ #
15
+ # @return [String]
16
+ required :type, String
17
+
18
+ # @!attribute id
19
+ #
20
+ # @return [String, nil]
21
+ optional :id, String
22
+
23
+ # @!attribute elements
24
+ # Nested child elements (for group-type elements).
25
+ #
26
+ # @return [Array<Courier::Models::ElementWithChecksums>, nil]
27
+ optional :elements, -> { Courier::Internal::Type::ArrayOf[Courier::ElementWithChecksums] }
28
+
29
+ # @!attribute locales
30
+ # Locale-specific content with checksums.
31
+ #
32
+ # @return [Hash{Symbol=>Courier::Models::ElementWithChecksums::Locale}, nil]
33
+ optional :locales, -> { Courier::Internal::Type::HashOf[Courier::ElementWithChecksums::Locale] }
34
+
35
+ # @!method initialize(checksum:, type:, id: nil, elements: nil, locales: nil)
36
+ # An element with its content checksum and optional nested elements and locale
37
+ # checksums.
38
+ #
39
+ # @param checksum [String] MD5 hash of translatable content.
40
+ #
41
+ # @param type [String] Element type (text, meta, action, etc.).
42
+ #
43
+ # @param id [String]
44
+ #
45
+ # @param elements [Array<Courier::Models::ElementWithChecksums>] Nested child elements (for group-type elements).
46
+ #
47
+ # @param locales [Hash{Symbol=>Courier::Models::ElementWithChecksums::Locale}] Locale-specific content with checksums.
48
+
49
+ class Locale < Courier::Internal::Type::BaseModel
50
+ # @!attribute checksum
51
+ #
52
+ # @return [String]
53
+ required :checksum, String
54
+
55
+ # @!method initialize(checksum:)
56
+ # @param checksum [String]
57
+ end
58
+ end
59
+ end
60
+ end
@@ -5,7 +5,7 @@ module Courier
5
5
  class ElementalContent < Courier::Internal::Type::BaseModel
6
6
  # @!attribute elements
7
7
  #
8
- # @return [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType>]
8
+ # @return [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
9
9
  required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] }
10
10
 
11
11
  # @!attribute version
@@ -15,7 +15,7 @@ module Courier
15
15
  required :version, String
16
16
 
17
17
  # @!method initialize(elements:, version:)
18
- # @param elements [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType>]
18
+ # @param elements [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
19
19
  #
20
20
  # @param version [String] For example, "2022-01-01"
21
21
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalHTMLNodeWithType < Courier::Models::ElementalBaseNode
6
+ # @!attribute type
7
+ #
8
+ # @return [Symbol, Courier::Models::ElementalHTMLNodeWithType::Type, nil]
9
+ optional :type, enum: -> { Courier::ElementalHTMLNodeWithType::Type }
10
+
11
+ # @!method initialize(type: nil)
12
+ # @param type [Symbol, Courier::Models::ElementalHTMLNodeWithType::Type]
13
+
14
+ module Type
15
+ extend Courier::Internal::Type::Enum
16
+
17
+ HTML = :html
18
+
19
+ # @!method self.values
20
+ # @return [Array<Symbol>]
21
+ end
22
+ end
23
+ end
24
+ end
@@ -37,8 +37,10 @@ module Courier
37
37
 
38
38
  variant -> { Courier::ElementalQuoteNodeWithType }
39
39
 
40
+ variant -> { Courier::ElementalHTMLNodeWithType }
41
+
40
42
  # @!method self.variants
41
- # @return [Array(Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType)]
43
+ # @return [Array(Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType)]
42
44
  end
43
45
  end
44
46
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @type [Courier::Internal::Type::Converter]
6
+ MessageChannels = Courier::Internal::Type::HashOf[-> { Courier::Channel }]
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @type [Courier::Internal::Type::Converter]
6
+ MessageProviders = Courier::Internal::Type::HashOf[-> { Courier::MessageProvidersType }]
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class MessageProvidersType < Courier::Internal::Type::BaseModel
6
+ # @!attribute if_
7
+ # JS conditional with access to data/profile.
8
+ #
9
+ # @return [String, nil]
10
+ optional :if_, String, api_name: :if, nil?: true
11
+
12
+ # @!attribute metadata
13
+ #
14
+ # @return [Courier::Models::Metadata, nil]
15
+ optional :metadata, -> { Courier::Metadata }, nil?: true
16
+
17
+ # @!attribute override
18
+ # Provider-specific overrides.
19
+ #
20
+ # @return [Hash{Symbol=>Object}, nil]
21
+ optional :override, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
22
+
23
+ # @!attribute timeouts
24
+ #
25
+ # @return [Integer, nil]
26
+ optional :timeouts, Integer, nil?: true
27
+
28
+ # @!method initialize(if_: nil, metadata: nil, override: nil, timeouts: nil)
29
+ # @param if_ [String, nil] JS conditional with access to data/profile.
30
+ #
31
+ # @param metadata [Courier::Models::Metadata, nil]
32
+ #
33
+ # @param override [Hash{Symbol=>Object}, nil] Provider-specific overrides.
34
+ #
35
+ # @param timeouts [Integer, nil]
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class Metadata < Courier::Internal::Type::BaseModel
6
+ # @!attribute utm
7
+ #
8
+ # @return [Courier::Models::Utm, nil]
9
+ optional :utm, -> { Courier::Utm }, nil?: true
10
+
11
+ # @!method initialize(utm: nil)
12
+ # @param utm [Courier::Models::Utm, nil]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Notifications#archive
6
+ class NotificationArchiveParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!method initialize(id:, request_options: {})
16
+ # @param id [String]
17
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class NotificationContentGetResponse < Courier::Internal::Type::BaseModel
6
+ # @!attribute elements
7
+ #
8
+ # @return [Array<Courier::Models::ElementWithChecksums>]
9
+ required :elements, -> { Courier::Internal::Type::ArrayOf[Courier::ElementWithChecksums] }
10
+
11
+ # @!attribute version
12
+ # Content version identifier.
13
+ #
14
+ # @return [String]
15
+ required :version, String
16
+
17
+ # @!method initialize(elements:, version:)
18
+ # Elemental content response for V2 templates. Contains versioned elements with
19
+ # content checksums.
20
+ #
21
+ # @param elements [Array<Courier::Models::ElementWithChecksums>]
22
+ #
23
+ # @param version [String] Content version identifier.
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Notifications#put_content
6
+ class NotificationContentMutationResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Template ID.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute elements
14
+ #
15
+ # @return [Array<Courier::Models::NotificationContentMutationResponse::Element>]
16
+ required :elements,
17
+ -> { Courier::Internal::Type::ArrayOf[Courier::NotificationContentMutationResponse::Element] }
18
+
19
+ # @!attribute state
20
+ # Template state. Defaults to `DRAFT`.
21
+ #
22
+ # @return [Symbol, Courier::Models::NotificationTemplateState]
23
+ required :state, enum: -> { Courier::NotificationTemplateState }
24
+
25
+ # @!attribute version
26
+ # Content version identifier.
27
+ #
28
+ # @return [String]
29
+ required :version, String
30
+
31
+ # @!method initialize(id:, elements:, state:, version:)
32
+ # Shared mutation response for `PUT` content, `PUT` element, and `PUT` locale
33
+ # operations. Contains the template ID, content version, per-element checksums,
34
+ # and resulting state.
35
+ #
36
+ # @param id [String] Template ID.
37
+ #
38
+ # @param elements [Array<Courier::Models::NotificationContentMutationResponse::Element>]
39
+ #
40
+ # @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
41
+ #
42
+ # @param version [String] Content version identifier.
43
+
44
+ class Element < Courier::Internal::Type::BaseModel
45
+ # @!attribute id
46
+ #
47
+ # @return [String]
48
+ required :id, String
49
+
50
+ # @!attribute checksum
51
+ #
52
+ # @return [String]
53
+ required :checksum, String
54
+
55
+ # @!method initialize(id:, checksum:)
56
+ # @param id [String]
57
+ # @param checksum [String]
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class NotificationContentPutRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute content
7
+ # Elemental content payload. The server defaults `version` when omitted.
8
+ #
9
+ # @return [Courier::Models::NotificationContentPutRequest::Content]
10
+ required :content, -> { Courier::NotificationContentPutRequest::Content }
11
+
12
+ # @!attribute state
13
+ # Template state. Defaults to `DRAFT`.
14
+ #
15
+ # @return [Symbol, Courier::Models::NotificationTemplateState, nil]
16
+ optional :state, enum: -> { Courier::NotificationTemplateState }
17
+
18
+ # @!method initialize(content:, state: nil)
19
+ # Request body for replacing the elemental content of a notification template.
20
+ #
21
+ # @param content [Courier::Models::NotificationContentPutRequest::Content] Elemental content payload. The server defaults `version` when omitted.
22
+ #
23
+ # @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
24
+
25
+ # @see Courier::Models::NotificationContentPutRequest#content
26
+ class Content < Courier::Internal::Type::BaseModel
27
+ # @!attribute elements
28
+ #
29
+ # @return [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
30
+ required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] }
31
+
32
+ # @!attribute version
33
+ # Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
34
+ # omitted.
35
+ #
36
+ # @return [String, nil]
37
+ optional :version, String
38
+
39
+ # @!method initialize(elements:, version: nil)
40
+ # Some parameter documentations has been truncated, see
41
+ # {Courier::Models::NotificationContentPutRequest::Content} for more details.
42
+ #
43
+ # Elemental content payload. The server defaults `version` when omitted.
44
+ #
45
+ # @param elements [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
46
+ #
47
+ # @param version [String] Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Notifications#create
6
+ class NotificationCreateParams < Courier::Models::NotificationTemplateCreateRequest
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end