trycourier 4.4.0 → 4.6.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 (172) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +9 -9
  4. data/lib/trycourier/internal/transport/pooled_net_requester.rb +12 -10
  5. data/lib/trycourier/internal/type/base_model.rb +4 -3
  6. data/lib/trycourier/internal/type/union.rb +7 -9
  7. data/lib/trycourier/internal/util.rb +7 -2
  8. data/lib/trycourier/models/airship_profile.rb +21 -0
  9. data/lib/trycourier/models/airship_profile_audience.rb +15 -0
  10. data/lib/trycourier/models/audience.rb +3 -3
  11. data/lib/trycourier/models/audience_filter.rb +52 -0
  12. data/lib/trycourier/models/audience_recipient.rb +36 -0
  13. data/lib/trycourier/models/audience_update_params.rb +3 -3
  14. data/lib/trycourier/models/automation_list_params.rb +47 -0
  15. data/lib/trycourier/models/automation_template.rb +61 -0
  16. data/lib/trycourier/models/automation_template_list_response.rb +24 -0
  17. data/lib/trycourier/models/device_type.rb +7 -0
  18. data/lib/trycourier/models/discord.rb +16 -0
  19. data/lib/trycourier/models/expo.rb +16 -0
  20. data/lib/trycourier/models/filter.rb +8 -51
  21. data/lib/trycourier/models/filter_config.rb +8 -51
  22. data/lib/trycourier/models/intercom.rb +21 -0
  23. data/lib/trycourier/models/intercom_recipient.rb +15 -0
  24. data/lib/trycourier/models/list_filter.rb +52 -0
  25. data/lib/trycourier/models/list_pattern_recipient.rb +23 -0
  26. data/lib/trycourier/models/list_recipient.rb +29 -0
  27. data/lib/trycourier/models/ms_teams.rb +22 -0
  28. data/lib/trycourier/models/ms_teams_base_properties.rb +21 -0
  29. data/lib/trycourier/models/ms_teams_recipient.rb +17 -0
  30. data/lib/trycourier/models/multiple_tokens.rb +15 -0
  31. data/lib/trycourier/models/nested_filter_config.rb +49 -0
  32. data/lib/trycourier/models/pagerduty.rb +33 -0
  33. data/lib/trycourier/models/pagerduty_recipient.rb +17 -0
  34. data/lib/trycourier/models/send_direct_message.rb +15 -0
  35. data/lib/trycourier/models/send_message_params.rb +24 -7
  36. data/lib/trycourier/models/send_to_channel.rb +15 -0
  37. data/lib/trycourier/models/send_to_ms_teams_channel_id.rb +27 -0
  38. data/lib/trycourier/models/send_to_ms_teams_channel_name.rb +33 -0
  39. data/lib/trycourier/models/send_to_ms_teams_conversation_id.rb +27 -0
  40. data/lib/trycourier/models/send_to_ms_teams_email.rb +27 -0
  41. data/lib/trycourier/models/send_to_ms_teams_user_id.rb +27 -0
  42. data/lib/trycourier/models/send_to_slack_channel.rb +21 -0
  43. data/lib/trycourier/models/send_to_slack_email.rb +21 -0
  44. data/lib/trycourier/models/send_to_slack_user_id.rb +21 -0
  45. data/lib/trycourier/models/single_filter_config.rb +62 -0
  46. data/lib/trycourier/models/slack.rb +18 -0
  47. data/lib/trycourier/models/slack_base_properties.rb +15 -0
  48. data/lib/trycourier/models/slack_recipient.rb +17 -0
  49. data/lib/trycourier/models/token.rb +15 -0
  50. data/lib/trycourier/models/user_profile.rb +274 -0
  51. data/lib/trycourier/models/user_profile_firebase_token.rb +19 -0
  52. data/lib/trycourier/models/webhook_auth_mode.rb +16 -0
  53. data/lib/trycourier/models/webhook_authentication.rb +40 -0
  54. data/lib/trycourier/models/webhook_method.rb +15 -0
  55. data/lib/trycourier/models/webhook_profile.rb +53 -0
  56. data/lib/trycourier/models/webhook_profile_type.rb +15 -0
  57. data/lib/trycourier/models/webhook_recipient.rb +17 -0
  58. data/lib/trycourier/models.rb +90 -2
  59. data/lib/trycourier/resources/audiences.rb +1 -1
  60. data/lib/trycourier/resources/automations.rb +27 -0
  61. data/lib/trycourier/version.rb +1 -1
  62. data/lib/trycourier.rb +45 -1
  63. data/rbi/trycourier/models/airship_profile.rbi +41 -0
  64. data/rbi/trycourier/models/airship_profile_audience.rbi +26 -0
  65. data/rbi/trycourier/models/audience.rbi +8 -7
  66. data/rbi/trycourier/models/audience_filter.rbi +88 -0
  67. data/rbi/trycourier/models/audience_recipient.rbi +52 -0
  68. data/rbi/trycourier/models/audience_update_params.rbi +25 -7
  69. data/rbi/trycourier/models/automation_list_params.rbi +95 -0
  70. data/rbi/trycourier/models/automation_template.rbi +102 -0
  71. data/rbi/trycourier/models/automation_template_list_response.rbi +54 -0
  72. data/rbi/trycourier/models/device_type.rbi +7 -0
  73. data/rbi/trycourier/models/discord.rbi +18 -0
  74. data/rbi/trycourier/models/expo.rbi +16 -0
  75. data/rbi/trycourier/models/filter.rbi +8 -78
  76. data/rbi/trycourier/models/filter_config.rbi +8 -83
  77. data/rbi/trycourier/models/intercom.rbi +35 -0
  78. data/rbi/trycourier/models/intercom_recipient.rbi +23 -0
  79. data/rbi/trycourier/models/list_filter.rbi +86 -0
  80. data/rbi/trycourier/models/list_pattern_recipient.rbi +39 -0
  81. data/rbi/trycourier/models/list_recipient.rbi +44 -0
  82. data/rbi/trycourier/models/ms_teams.rbi +24 -0
  83. data/rbi/trycourier/models/ms_teams_base_properties.rbi +31 -0
  84. data/rbi/trycourier/models/ms_teams_recipient.rbi +58 -0
  85. data/rbi/trycourier/models/multiple_tokens.rbi +27 -0
  86. data/rbi/trycourier/models/nested_filter_config.rbi +104 -0
  87. data/rbi/trycourier/models/pagerduty.rbi +53 -0
  88. data/rbi/trycourier/models/pagerduty_recipient.rbi +31 -0
  89. data/rbi/trycourier/models/send_direct_message.rbi +23 -0
  90. data/rbi/trycourier/models/send_message_params.rbi +34 -10
  91. data/rbi/trycourier/models/send_to_channel.rbi +23 -0
  92. data/rbi/trycourier/models/send_to_ms_teams_channel_id.rbi +42 -0
  93. data/rbi/trycourier/models/send_to_ms_teams_channel_name.rbi +51 -0
  94. data/rbi/trycourier/models/send_to_ms_teams_conversation_id.rbi +42 -0
  95. data/rbi/trycourier/models/send_to_ms_teams_email.rbi +37 -0
  96. data/rbi/trycourier/models/send_to_ms_teams_user_id.rbi +37 -0
  97. data/rbi/trycourier/models/send_to_slack_channel.rbi +28 -0
  98. data/rbi/trycourier/models/send_to_slack_email.rbi +28 -0
  99. data/rbi/trycourier/models/send_to_slack_user_id.rbi +28 -0
  100. data/rbi/trycourier/models/single_filter_config.rbi +116 -0
  101. data/rbi/trycourier/models/slack.rbi +22 -0
  102. data/rbi/trycourier/models/slack_base_properties.rbi +23 -0
  103. data/rbi/trycourier/models/slack_recipient.rbi +52 -0
  104. data/rbi/trycourier/models/token.rbi +21 -0
  105. data/rbi/trycourier/models/user_profile.rbi +377 -0
  106. data/rbi/trycourier/models/user_profile_firebase_token.rbi +25 -0
  107. data/rbi/trycourier/models/webhook_auth_mode.rbi +22 -0
  108. data/rbi/trycourier/models/webhook_authentication.rbi +64 -0
  109. data/rbi/trycourier/models/webhook_method.rbi +21 -0
  110. data/rbi/trycourier/models/webhook_profile.rbi +80 -0
  111. data/rbi/trycourier/models/webhook_profile_type.rbi +22 -0
  112. data/rbi/trycourier/models/webhook_recipient.rbi +31 -0
  113. data/rbi/trycourier/models.rbi +91 -2
  114. data/rbi/trycourier/resources/audiences.rbi +7 -1
  115. data/rbi/trycourier/resources/automations.rbi +19 -0
  116. data/sig/trycourier/models/airship_profile.rbs +25 -0
  117. data/sig/trycourier/models/airship_profile_audience.rbs +13 -0
  118. data/sig/trycourier/models/audience.rbs +4 -4
  119. data/sig/trycourier/models/audience_filter.rbs +50 -0
  120. data/sig/trycourier/models/audience_recipient.rbs +30 -0
  121. data/sig/trycourier/models/audience_update_params.rbs +8 -4
  122. data/sig/trycourier/models/automation_list_params.rbs +48 -0
  123. data/sig/trycourier/models/automation_template.rbs +55 -0
  124. data/sig/trycourier/models/automation_template_list_response.rbs +28 -0
  125. data/sig/trycourier/models/device_type.rbs +5 -0
  126. data/sig/trycourier/models/discord.rbs +11 -0
  127. data/sig/trycourier/models/expo.rbs +11 -0
  128. data/sig/trycourier/models/filter.rbs +4 -61
  129. data/sig/trycourier/models/filter_config.rbs +4 -61
  130. data/sig/trycourier/models/intercom.rbs +15 -0
  131. data/sig/trycourier/models/intercom_recipient.rbs +13 -0
  132. data/sig/trycourier/models/list_filter.rbs +50 -0
  133. data/sig/trycourier/models/list_pattern_recipient.rbs +19 -0
  134. data/sig/trycourier/models/list_recipient.rbs +30 -0
  135. data/sig/trycourier/models/ms_teams.rbs +16 -0
  136. data/sig/trycourier/models/ms_teams_base_properties.rbs +15 -0
  137. data/sig/trycourier/models/ms_teams_recipient.rbs +13 -0
  138. data/sig/trycourier/models/multiple_tokens.rbs +13 -0
  139. data/sig/trycourier/models/nested_filter_config.rbs +64 -0
  140. data/sig/trycourier/models/pagerduty.rbs +35 -0
  141. data/sig/trycourier/models/pagerduty_recipient.rbs +13 -0
  142. data/sig/trycourier/models/send_direct_message.rbs +13 -0
  143. data/sig/trycourier/models/send_message_params.rbs +9 -3
  144. data/sig/trycourier/models/send_to_channel.rbs +13 -0
  145. data/sig/trycourier/models/send_to_ms_teams_channel_id.rbs +26 -0
  146. data/sig/trycourier/models/send_to_ms_teams_channel_name.rbs +35 -0
  147. data/sig/trycourier/models/send_to_ms_teams_conversation_id.rbs +26 -0
  148. data/sig/trycourier/models/send_to_ms_teams_email.rbs +22 -0
  149. data/sig/trycourier/models/send_to_ms_teams_user_id.rbs +26 -0
  150. data/sig/trycourier/models/send_to_slack_channel.rbs +15 -0
  151. data/sig/trycourier/models/send_to_slack_email.rbs +15 -0
  152. data/sig/trycourier/models/send_to_slack_user_id.rbs +15 -0
  153. data/sig/trycourier/models/single_filter_config.rbs +69 -0
  154. data/sig/trycourier/models/slack.rbs +14 -0
  155. data/sig/trycourier/models/slack_base_properties.rbs +13 -0
  156. data/sig/trycourier/models/slack_recipient.rbs +13 -0
  157. data/sig/trycourier/models/token.rbs +13 -0
  158. data/sig/trycourier/models/user_profile.rbs +212 -0
  159. data/sig/trycourier/models/user_profile_firebase_token.rbs +13 -0
  160. data/sig/trycourier/models/webhook_auth_mode.rbs +15 -0
  161. data/sig/trycourier/models/webhook_authentication.rbs +35 -0
  162. data/sig/trycourier/models/webhook_method.rbs +14 -0
  163. data/sig/trycourier/models/webhook_profile.rbs +40 -0
  164. data/sig/trycourier/models/webhook_profile_type.rbs +14 -0
  165. data/sig/trycourier/models/webhook_recipient.rbs +13 -0
  166. data/sig/trycourier/models.rbs +92 -4
  167. data/sig/trycourier/resources/audiences.rbs +1 -1
  168. data/sig/trycourier/resources/automations.rbs +6 -0
  169. metadata +137 -5
  170. data/lib/trycourier/models/recipient.rb +0 -113
  171. data/rbi/trycourier/models/recipient.rbi +0 -161
  172. data/sig/trycourier/models/recipient.rbs +0 -92
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44c04a056977df7fe1d6cb3728f5cd20d3146303a4aa290ab736cd8b0b5b48cc
4
- data.tar.gz: 2f8b70b8eadaa154cec067afbbb503ed808278ebed1f867981790a661ea027c6
3
+ metadata.gz: 8f245290616d8bf259ac1cede4dc337f5f14ec04d8d527d96a630b854a6bb3f6
4
+ data.tar.gz: 859658f71041732efff2b2a4122e4cc493878077bcbc7c769fc1158210ede6b6
5
5
  SHA512:
6
- metadata.gz: 17ddc44b894c1652b8ab7fe614d2bcf99c936e9d36f124c1121ee913dfff46d6674c9672c1f3192c160fae83c76eaa1bd50382bcb9aff1963978ace8bf883bb2
7
- data.tar.gz: c0ce826de197896c96af433c3089989bb133d3c53dba59509e828fb52145c823bf0e77f9323004a22b87f94c073d3efe515caace6939ba167e8afae4c29d59d5
6
+ metadata.gz: 26091252593b2a6526080c3b11bb9b04aa7cff078329cd19f274d8650d97ad6ee590debcb1896c34c339229c578a7deac57d42ae1f2ac53743796a90889fbefd
7
+ data.tar.gz: ae438abbbb1d3346d10be702d37e0fac2be5ec5a1242dc80992228b0c87375655e50ec42dfb2e657825db73d4974d7a89c46737f81e28114c84bf06b6bc75bb5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.6.0 (2026-01-08)
4
+
5
+ Full Changelog: [v4.5.0...v4.6.0](https://github.com/trycourier/courier-ruby/compare/v4.5.0...v4.6.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** remove audit_events, automations, brands, bulk, inbound, translations endpoints ([f9f04c1](https://github.com/trycourier/courier-ruby/commit/f9f04c1760b4dceb5ed966449ddb19cd4bc72182))
10
+
11
+ ## 4.5.0 (2025-12-29)
12
+
13
+ Full Changelog: [v4.4.0...v4.5.0](https://github.com/trycourier/courier-ruby/compare/v4.4.0...v4.5.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** add slack/msteams/pagerduty/webhook/audience/list recipient types ([56278ef](https://github.com/trycourier/courier-ruby/commit/56278ef7d0582bfba2e2122f9682c1282f25109d))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * calling `break` out of streams should be instantaneous ([7af6435](https://github.com/trycourier/courier-ruby/commit/7af6435d8426c69cb9c07d263d3363526508be7d))
23
+ * issue where json.parse errors when receiving HTTP 204 with nobody ([6288d57](https://github.com/trycourier/courier-ruby/commit/6288d578db512479a70098e529a26a0e29139918))
24
+
3
25
  ## 4.4.0 (2025-12-16)
4
26
 
5
27
  Full Changelog: [v4.3.0...v4.4.0](https://github.com/trycourier/courier-ruby/compare/v4.3.0...v4.4.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "trycourier", "~> 4.4.0"
20
+ gem "trycourier", "~> 4.6.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -221,25 +221,25 @@ courier.send_.message(**params)
221
221
  Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
222
222
 
223
223
  ```ruby
224
- # :OPTED_OUT
225
- puts(Trycourier::SubscriptionTopicNew::Status::OPTED_OUT)
224
+ # :published
225
+ puts(Trycourier::AutomationListParams::Version::PUBLISHED)
226
226
 
227
- # Revealed type: `T.all(Trycourier::SubscriptionTopicNew::Status, Symbol)`
228
- T.reveal_type(Trycourier::SubscriptionTopicNew::Status::OPTED_OUT)
227
+ # Revealed type: `T.all(Trycourier::AutomationListParams::Version, Symbol)`
228
+ T.reveal_type(Trycourier::AutomationListParams::Version::PUBLISHED)
229
229
  ```
230
230
 
231
231
  Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
232
232
 
233
233
  ```ruby
234
234
  # Using the enum constants preserves the tagged type information:
235
- courier.tenants.preferences.items.update(
236
- status: Trycourier::SubscriptionTopicNew::Status::OPTED_OUT,
235
+ courier.automations.list(
236
+ version: Trycourier::AutomationListParams::Version::PUBLISHED,
237
237
  # …
238
238
  )
239
239
 
240
240
  # Literal values are also permissible:
241
- courier.tenants.preferences.items.update(
242
- status: :OPTED_OUT,
241
+ courier.automations.list(
242
+ version: :published,
243
243
  # …
244
244
  )
245
245
  ```
@@ -153,17 +153,19 @@ module Trycourier
153
153
  end
154
154
 
155
155
  self.class.calibrate_socket_timeout(conn, deadline)
156
- conn.request(req) do |rsp|
157
- y << [req, rsp]
158
- break if finished
159
-
160
- rsp.read_body do |bytes|
161
- y << bytes.force_encoding(Encoding::BINARY)
162
- break if finished
163
-
164
- self.class.calibrate_socket_timeout(conn, deadline)
156
+ ::Kernel.catch(:jump) do
157
+ conn.request(req) do |rsp|
158
+ y << [req, rsp]
159
+ ::Kernel.throw(:jump) if finished
160
+
161
+ rsp.read_body do |bytes|
162
+ y << bytes.force_encoding(Encoding::BINARY)
163
+ ::Kernel.throw(:jump) if finished
164
+
165
+ self.class.calibrate_socket_timeout(conn, deadline)
166
+ end
167
+ eof = true
165
168
  end
166
- eof = true
167
169
  end
168
170
  end
169
171
  ensure
@@ -438,9 +438,10 @@ module Trycourier
438
438
  # @return [Hash{Symbol=>Object}]
439
439
  #
440
440
  # @example
441
- # # `channel_preference` is a `Trycourier::ChannelPreference`
442
- # channel_preference => {
443
- # channel: channel
441
+ # # `airship_profile` is a `Trycourier::AirshipProfile`
442
+ # airship_profile => {
443
+ # audience: audience,
444
+ # device_types: device_types
444
445
  # }
445
446
  def deconstruct_keys(keys)
446
447
  (keys || self.class.known_fields.keys)
@@ -6,16 +6,14 @@ module Trycourier
6
6
  # @api private
7
7
  #
8
8
  # @example
9
- # # `elemental_node` is a `Trycourier::ElementalNode`
10
- # case elemental_node
11
- # when Trycourier::ElementalTextNodeWithType
12
- # # ...
13
- # when Trycourier::ElementalMetaNodeWithType
14
- # # ...
15
- # when Trycourier::ElementalChannelNodeWithType
16
- # # ...
9
+ # # `discord` is a `Trycourier::Discord`
10
+ # case discord
11
+ # when Trycourier::SendToChannel
12
+ # puts(discord.channel_id)
13
+ # when Trycourier::SendDirectMessage
14
+ # puts(discord.user_id)
17
15
  # else
18
- # puts(elemental_node)
16
+ # puts(discord)
19
17
  # end
20
18
  module Union
21
19
  include Trycourier::Internal::Type::Converter
@@ -657,7 +657,8 @@ module Trycourier
657
657
  def decode_content(headers, stream:, suppress_error: false)
658
658
  case (content_type = headers["content-type"])
659
659
  in Trycourier::Internal::Util::JSON_CONTENT
660
- json = stream.to_a.join
660
+ return nil if (json = stream.to_a.join).empty?
661
+
661
662
  begin
662
663
  JSON.parse(json, symbolize_names: true)
663
664
  rescue JSON::ParserError => e
@@ -667,7 +668,11 @@ module Trycourier
667
668
  in Trycourier::Internal::Util::JSONL_CONTENT
668
669
  lines = decode_lines(stream)
669
670
  chain_fused(lines) do |y|
670
- lines.each { y << JSON.parse(_1, symbolize_names: true) }
671
+ lines.each do
672
+ next if _1.empty?
673
+
674
+ y << JSON.parse(_1, symbolize_names: true)
675
+ end
671
676
  end
672
677
  in %r{^text/event-stream}
673
678
  lines = decode_lines(stream)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class AirshipProfile < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute audience
7
+ #
8
+ # @return [Trycourier::Models::AirshipProfileAudience]
9
+ required :audience, -> { Trycourier::AirshipProfileAudience }
10
+
11
+ # @!attribute device_types
12
+ #
13
+ # @return [Array<String>]
14
+ required :device_types, Trycourier::Internal::Type::ArrayOf[String]
15
+
16
+ # @!method initialize(audience:, device_types:)
17
+ # @param audience [Trycourier::Models::AirshipProfileAudience]
18
+ # @param device_types [Array<String>]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class AirshipProfileAudience < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute named_user
7
+ #
8
+ # @return [String]
9
+ required :named_user, String
10
+
11
+ # @!method initialize(named_user:)
12
+ # @param named_user [String]
13
+ end
14
+ end
15
+ end
@@ -24,8 +24,8 @@ module Trycourier
24
24
  # @!attribute filter
25
25
  # A single filter to use for filtering
26
26
  #
27
- # @return [Trycourier::Models::Filter]
28
- required :filter, -> { Trycourier::Filter }
27
+ # @return [Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig]
28
+ required :filter, union: -> { Trycourier::Filter }
29
29
 
30
30
  # @!attribute name
31
31
  # The name of the audience
@@ -45,7 +45,7 @@ module Trycourier
45
45
  #
46
46
  # @param description [String] A description of the audience
47
47
  #
48
- # @param filter [Trycourier::Models::Filter] A single filter to use for filtering
48
+ # @param filter [Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig] A single filter to use for filtering
49
49
  #
50
50
  # @param name [String] The name of the audience
51
51
  #
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class AudienceFilter < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute operator
7
+ # Send to users only if they are member of the account
8
+ #
9
+ # @return [Symbol, Trycourier::Models::AudienceFilter::Operator]
10
+ required :operator, enum: -> { Trycourier::AudienceFilter::Operator }
11
+
12
+ # @!attribute path
13
+ #
14
+ # @return [Symbol, Trycourier::Models::AudienceFilter::Path]
15
+ required :path, enum: -> { Trycourier::AudienceFilter::Path }
16
+
17
+ # @!attribute value
18
+ #
19
+ # @return [String]
20
+ required :value, String
21
+
22
+ # @!method initialize(operator:, path:, value:)
23
+ # @param operator [Symbol, Trycourier::Models::AudienceFilter::Operator] Send to users only if they are member of the account
24
+ #
25
+ # @param path [Symbol, Trycourier::Models::AudienceFilter::Path]
26
+ #
27
+ # @param value [String]
28
+
29
+ # Send to users only if they are member of the account
30
+ #
31
+ # @see Trycourier::Models::AudienceFilter#operator
32
+ module Operator
33
+ extend Trycourier::Internal::Type::Enum
34
+
35
+ MEMBER_OF = :MEMBER_OF
36
+
37
+ # @!method self.values
38
+ # @return [Array<Symbol>]
39
+ end
40
+
41
+ # @see Trycourier::Models::AudienceFilter#path
42
+ module Path
43
+ extend Trycourier::Internal::Type::Enum
44
+
45
+ ACCOUNT_ID = :account_id
46
+
47
+ # @!method self.values
48
+ # @return [Array<Symbol>]
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class AudienceRecipient < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute audience_id
7
+ # A unique identifier associated with an Audience. A message will be sent to each
8
+ # user in the audience.
9
+ #
10
+ # @return [String]
11
+ required :audience_id, String
12
+
13
+ # @!attribute data
14
+ #
15
+ # @return [Hash{Symbol=>Object}, nil]
16
+ optional :data, Trycourier::Internal::Type::HashOf[Trycourier::Internal::Type::Unknown], nil?: true
17
+
18
+ # @!attribute filters
19
+ #
20
+ # @return [Array<Trycourier::Models::AudienceFilter>, nil]
21
+ optional :filters, -> { Trycourier::Internal::Type::ArrayOf[Trycourier::AudienceFilter] }, nil?: true
22
+
23
+ # @!method initialize(audience_id:, data: nil, filters: nil)
24
+ # Some parameter documentations has been truncated, see
25
+ # {Trycourier::Models::AudienceRecipient} for more details.
26
+ #
27
+ # Send to all users in an audience
28
+ #
29
+ # @param audience_id [String] A unique identifier associated with an Audience. A message will be sent to each
30
+ #
31
+ # @param data [Hash{Symbol=>Object}, nil]
32
+ #
33
+ # @param filters [Array<Trycourier::Models::AudienceFilter>, nil]
34
+ end
35
+ end
36
+ end
@@ -16,8 +16,8 @@ module Trycourier
16
16
  # @!attribute filter
17
17
  # A single filter to use for filtering
18
18
  #
19
- # @return [Trycourier::Models::Filter, nil]
20
- optional :filter, -> { Trycourier::Filter }, nil?: true
19
+ # @return [Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig, nil]
20
+ optional :filter, union: -> { Trycourier::Filter }, nil?: true
21
21
 
22
22
  # @!attribute name
23
23
  # The name of the audience
@@ -28,7 +28,7 @@ module Trycourier
28
28
  # @!method initialize(description: nil, filter: nil, name: nil, request_options: {})
29
29
  # @param description [String, nil] A description of the audience
30
30
  #
31
- # @param filter [Trycourier::Models::Filter, nil] A single filter to use for filtering
31
+ # @param filter [Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig, nil] A single filter to use for filtering
32
32
  #
33
33
  # @param name [String, nil] The name of the audience
34
34
  #
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ # @see Trycourier::Resources::Automations#list
6
+ class AutomationListParams < Trycourier::Internal::Type::BaseModel
7
+ extend Trycourier::Internal::Type::RequestParameters::Converter
8
+ include Trycourier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute cursor
11
+ # A cursor token for pagination. Use the cursor from the previous response to
12
+ # fetch the next page of results.
13
+ #
14
+ # @return [String, nil]
15
+ optional :cursor, String
16
+
17
+ # @!attribute version
18
+ # The version of templates to retrieve. Accepted values are published (for
19
+ # published templates) or draft (for draft templates). Defaults to published.
20
+ #
21
+ # @return [Symbol, Trycourier::Models::AutomationListParams::Version, nil]
22
+ optional :version, enum: -> { Trycourier::AutomationListParams::Version }
23
+
24
+ # @!method initialize(cursor: nil, version: nil, request_options: {})
25
+ # Some parameter documentations has been truncated, see
26
+ # {Trycourier::Models::AutomationListParams} for more details.
27
+ #
28
+ # @param cursor [String] A cursor token for pagination. Use the cursor from the previous response to fetc
29
+ #
30
+ # @param version [Symbol, Trycourier::Models::AutomationListParams::Version] The version of templates to retrieve. Accepted values are published (for publish
31
+ #
32
+ # @param request_options [Trycourier::RequestOptions, Hash{Symbol=>Object}]
33
+
34
+ # The version of templates to retrieve. Accepted values are published (for
35
+ # published templates) or draft (for draft templates). Defaults to published.
36
+ module Version
37
+ extend Trycourier::Internal::Type::Enum
38
+
39
+ PUBLISHED = :published
40
+ DRAFT = :draft
41
+
42
+ # @!method self.values
43
+ # @return [Array<Symbol>]
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class AutomationTemplate < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The unique identifier of the automation template.
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute name
13
+ # The name of the automation template.
14
+ #
15
+ # @return [String]
16
+ required :name, String
17
+
18
+ # @!attribute version
19
+ # The version of the template published, draft.
20
+ #
21
+ # @return [Symbol, Trycourier::Models::AutomationTemplate::Version]
22
+ required :version, enum: -> { Trycourier::AutomationTemplate::Version }
23
+
24
+ # @!attribute created_at
25
+ # ISO 8601 timestamp when the template was created.
26
+ #
27
+ # @return [Time, nil]
28
+ optional :created_at, Time, api_name: :createdAt
29
+
30
+ # @!attribute updated_at
31
+ # ISO 8601 timestamp when the template was last updated.
32
+ #
33
+ # @return [Time, nil]
34
+ optional :updated_at, Time, api_name: :updatedAt
35
+
36
+ # @!method initialize(id:, name:, version:, created_at: nil, updated_at: nil)
37
+ # @param id [String] The unique identifier of the automation template.
38
+ #
39
+ # @param name [String] The name of the automation template.
40
+ #
41
+ # @param version [Symbol, Trycourier::Models::AutomationTemplate::Version] The version of the template published, draft.
42
+ #
43
+ # @param created_at [Time] ISO 8601 timestamp when the template was created.
44
+ #
45
+ # @param updated_at [Time] ISO 8601 timestamp when the template was last updated.
46
+
47
+ # The version of the template published, draft.
48
+ #
49
+ # @see Trycourier::Models::AutomationTemplate#version
50
+ module Version
51
+ extend Trycourier::Internal::Type::Enum
52
+
53
+ PUBLISHED = :published
54
+ DRAFT = :draft
55
+
56
+ # @!method self.values
57
+ # @return [Array<Symbol>]
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ # @see Trycourier::Resources::Automations#list
6
+ class AutomationTemplateListResponse < Trycourier::Internal::Type::BaseModel
7
+ # @!attribute cursor
8
+ # A cursor token for pagination. Present when there are more results available.
9
+ #
10
+ # @return [String, nil]
11
+ optional :cursor, String
12
+
13
+ # @!attribute templates
14
+ #
15
+ # @return [Array<Trycourier::Models::AutomationTemplate>, nil]
16
+ optional :templates, -> { Trycourier::Internal::Type::ArrayOf[Trycourier::AutomationTemplate] }
17
+
18
+ # @!method initialize(cursor: nil, templates: nil)
19
+ # @param cursor [String] A cursor token for pagination. Present when there are more results available.
20
+ #
21
+ # @param templates [Array<Trycourier::Models::AutomationTemplate>]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ DeviceType = String
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ module Discord
6
+ extend Trycourier::Internal::Type::Union
7
+
8
+ variant -> { Trycourier::SendToChannel }
9
+
10
+ variant -> { Trycourier::SendDirectMessage }
11
+
12
+ # @!method self.variants
13
+ # @return [Array(Trycourier::Models::SendToChannel, Trycourier::Models::SendDirectMessage)]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ module Expo
6
+ extend Trycourier::Internal::Type::Union
7
+
8
+ variant -> { Trycourier::Token }
9
+
10
+ variant -> { Trycourier::MultipleTokens }
11
+
12
+ # @!method self.variants
13
+ # @return [Array(Trycourier::Models::Token, Trycourier::Models::MultipleTokens)]
14
+ end
15
+ end
16
+ end
@@ -2,61 +2,18 @@
2
2
 
3
3
  module Trycourier
4
4
  module Models
5
- class Filter < Trycourier::Internal::Type::BaseModel
6
- # @!attribute operator
7
- # The operator to use for filtering
8
- #
9
- # @return [Symbol, Trycourier::Models::Filter::Operator]
10
- required :operator, enum: -> { Trycourier::Filter::Operator }
5
+ # A single filter to use for filtering
6
+ module Filter
7
+ extend Trycourier::Internal::Type::Union
11
8
 
12
- # @!attribute path
13
- # The attribe name from profile whose value will be operated against the filter
14
- # value
15
- #
16
- # @return [String]
17
- required :path, String
18
-
19
- # @!attribute value
20
- # The value to use for filtering
21
- #
22
- # @return [String]
23
- required :value, String
24
-
25
- # @!method initialize(operator:, path:, value:)
26
- # Some parameter documentations has been truncated, see
27
- # {Trycourier::Models::Filter} for more details.
28
- #
29
- # @param operator [Symbol, Trycourier::Models::Filter::Operator] The operator to use for filtering
30
- #
31
- # @param path [String] The attribe name from profile whose value will be operated against the filter va
32
- #
33
- # @param value [String] The value to use for filtering
9
+ # A single filter to use for filtering
10
+ variant -> { Trycourier::SingleFilterConfig }
34
11
 
35
12
  # The operator to use for filtering
36
- #
37
- # @see Trycourier::Models::Filter#operator
38
- module Operator
39
- extend Trycourier::Internal::Type::Enum
40
-
41
- ENDS_WITH = :ENDS_WITH
42
- EQ = :EQ
43
- EXISTS = :EXISTS
44
- GT = :GT
45
- GTE = :GTE
46
- INCLUDES = :INCLUDES
47
- IS_AFTER = :IS_AFTER
48
- IS_BEFORE = :IS_BEFORE
49
- LT = :LT
50
- LTE = :LTE
51
- NEQ = :NEQ
52
- OMIT = :OMIT
53
- STARTS_WITH = :STARTS_WITH
54
- AND = :AND
55
- OR = :OR
13
+ variant -> { Trycourier::NestedFilterConfig }
56
14
 
57
- # @!method self.values
58
- # @return [Array<Symbol>]
59
- end
15
+ # @!method self.variants
16
+ # @return [Array(Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig)]
60
17
  end
61
18
  end
62
19
  end
@@ -2,61 +2,18 @@
2
2
 
3
3
  module Trycourier
4
4
  module Models
5
- class FilterConfig < Trycourier::Internal::Type::BaseModel
6
- # @!attribute operator
7
- # The operator to use for filtering
8
- #
9
- # @return [Symbol, Trycourier::Models::FilterConfig::Operator]
10
- required :operator, enum: -> { Trycourier::FilterConfig::Operator }
5
+ # A single filter to use for filtering
6
+ module FilterConfig
7
+ extend Trycourier::Internal::Type::Union
11
8
 
12
- # @!attribute path
13
- # The attribe name from profile whose value will be operated against the filter
14
- # value
15
- #
16
- # @return [String]
17
- required :path, String
18
-
19
- # @!attribute value
20
- # The value to use for filtering
21
- #
22
- # @return [String]
23
- required :value, String
24
-
25
- # @!method initialize(operator:, path:, value:)
26
- # Some parameter documentations has been truncated, see
27
- # {Trycourier::Models::FilterConfig} for more details.
28
- #
29
- # @param operator [Symbol, Trycourier::Models::FilterConfig::Operator] The operator to use for filtering
30
- #
31
- # @param path [String] The attribe name from profile whose value will be operated against the filter va
32
- #
33
- # @param value [String] The value to use for filtering
9
+ # A single filter to use for filtering
10
+ variant -> { Trycourier::SingleFilterConfig }
34
11
 
35
12
  # The operator to use for filtering
36
- #
37
- # @see Trycourier::Models::FilterConfig#operator
38
- module Operator
39
- extend Trycourier::Internal::Type::Enum
40
-
41
- ENDS_WITH = :ENDS_WITH
42
- EQ = :EQ
43
- EXISTS = :EXISTS
44
- GT = :GT
45
- GTE = :GTE
46
- INCLUDES = :INCLUDES
47
- IS_AFTER = :IS_AFTER
48
- IS_BEFORE = :IS_BEFORE
49
- LT = :LT
50
- LTE = :LTE
51
- NEQ = :NEQ
52
- OMIT = :OMIT
53
- STARTS_WITH = :STARTS_WITH
54
- AND = :AND
55
- OR = :OR
13
+ variant -> { Trycourier::NestedFilterConfig }
56
14
 
57
- # @!method self.values
58
- # @return [Array<Symbol>]
59
- end
15
+ # @!method self.variants
16
+ # @return [Array(Trycourier::Models::SingleFilterConfig, Trycourier::Models::NestedFilterConfig)]
60
17
  end
61
18
  end
62
19
  end