trycourier 4.4.0 → 4.5.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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  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/device_type.rb +7 -0
  15. data/lib/trycourier/models/discord.rb +16 -0
  16. data/lib/trycourier/models/expo.rb +16 -0
  17. data/lib/trycourier/models/filter.rb +8 -51
  18. data/lib/trycourier/models/filter_config.rb +8 -51
  19. data/lib/trycourier/models/intercom.rb +21 -0
  20. data/lib/trycourier/models/intercom_recipient.rb +15 -0
  21. data/lib/trycourier/models/list_filter.rb +52 -0
  22. data/lib/trycourier/models/list_pattern_recipient.rb +23 -0
  23. data/lib/trycourier/models/list_recipient.rb +29 -0
  24. data/lib/trycourier/models/ms_teams.rb +22 -0
  25. data/lib/trycourier/models/ms_teams_base_properties.rb +21 -0
  26. data/lib/trycourier/models/ms_teams_recipient.rb +17 -0
  27. data/lib/trycourier/models/multiple_tokens.rb +15 -0
  28. data/lib/trycourier/models/nested_filter_config.rb +49 -0
  29. data/lib/trycourier/models/pagerduty.rb +33 -0
  30. data/lib/trycourier/models/pagerduty_recipient.rb +17 -0
  31. data/lib/trycourier/models/send_direct_message.rb +15 -0
  32. data/lib/trycourier/models/send_message_params.rb +24 -7
  33. data/lib/trycourier/models/send_to_channel.rb +15 -0
  34. data/lib/trycourier/models/send_to_ms_teams_channel_id.rb +27 -0
  35. data/lib/trycourier/models/send_to_ms_teams_channel_name.rb +33 -0
  36. data/lib/trycourier/models/send_to_ms_teams_conversation_id.rb +27 -0
  37. data/lib/trycourier/models/send_to_ms_teams_email.rb +27 -0
  38. data/lib/trycourier/models/send_to_ms_teams_user_id.rb +27 -0
  39. data/lib/trycourier/models/send_to_slack_channel.rb +21 -0
  40. data/lib/trycourier/models/send_to_slack_email.rb +21 -0
  41. data/lib/trycourier/models/send_to_slack_user_id.rb +21 -0
  42. data/lib/trycourier/models/single_filter_config.rb +62 -0
  43. data/lib/trycourier/models/slack.rb +18 -0
  44. data/lib/trycourier/models/slack_base_properties.rb +15 -0
  45. data/lib/trycourier/models/slack_recipient.rb +17 -0
  46. data/lib/trycourier/models/token.rb +15 -0
  47. data/lib/trycourier/models/user_profile.rb +274 -0
  48. data/lib/trycourier/models/user_profile_firebase_token.rb +19 -0
  49. data/lib/trycourier/models/webhook_auth_mode.rb +16 -0
  50. data/lib/trycourier/models/webhook_authentication.rb +40 -0
  51. data/lib/trycourier/models/webhook_method.rb +15 -0
  52. data/lib/trycourier/models/webhook_profile.rb +53 -0
  53. data/lib/trycourier/models/webhook_profile_type.rb +15 -0
  54. data/lib/trycourier/models/webhook_recipient.rb +17 -0
  55. data/lib/trycourier/models.rb +84 -2
  56. data/lib/trycourier/resources/audiences.rb +1 -1
  57. data/lib/trycourier/version.rb +1 -1
  58. data/lib/trycourier.rb +42 -1
  59. data/rbi/trycourier/models/airship_profile.rbi +41 -0
  60. data/rbi/trycourier/models/airship_profile_audience.rbi +26 -0
  61. data/rbi/trycourier/models/audience.rbi +8 -7
  62. data/rbi/trycourier/models/audience_filter.rbi +88 -0
  63. data/rbi/trycourier/models/audience_recipient.rbi +52 -0
  64. data/rbi/trycourier/models/audience_update_params.rbi +25 -7
  65. data/rbi/trycourier/models/device_type.rbi +7 -0
  66. data/rbi/trycourier/models/discord.rbi +18 -0
  67. data/rbi/trycourier/models/expo.rbi +16 -0
  68. data/rbi/trycourier/models/filter.rbi +8 -78
  69. data/rbi/trycourier/models/filter_config.rbi +8 -83
  70. data/rbi/trycourier/models/intercom.rbi +35 -0
  71. data/rbi/trycourier/models/intercom_recipient.rbi +23 -0
  72. data/rbi/trycourier/models/list_filter.rbi +86 -0
  73. data/rbi/trycourier/models/list_pattern_recipient.rbi +39 -0
  74. data/rbi/trycourier/models/list_recipient.rbi +44 -0
  75. data/rbi/trycourier/models/ms_teams.rbi +24 -0
  76. data/rbi/trycourier/models/ms_teams_base_properties.rbi +31 -0
  77. data/rbi/trycourier/models/ms_teams_recipient.rbi +58 -0
  78. data/rbi/trycourier/models/multiple_tokens.rbi +27 -0
  79. data/rbi/trycourier/models/nested_filter_config.rbi +104 -0
  80. data/rbi/trycourier/models/pagerduty.rbi +53 -0
  81. data/rbi/trycourier/models/pagerduty_recipient.rbi +31 -0
  82. data/rbi/trycourier/models/send_direct_message.rbi +23 -0
  83. data/rbi/trycourier/models/send_message_params.rbi +34 -10
  84. data/rbi/trycourier/models/send_to_channel.rbi +23 -0
  85. data/rbi/trycourier/models/send_to_ms_teams_channel_id.rbi +42 -0
  86. data/rbi/trycourier/models/send_to_ms_teams_channel_name.rbi +51 -0
  87. data/rbi/trycourier/models/send_to_ms_teams_conversation_id.rbi +42 -0
  88. data/rbi/trycourier/models/send_to_ms_teams_email.rbi +37 -0
  89. data/rbi/trycourier/models/send_to_ms_teams_user_id.rbi +37 -0
  90. data/rbi/trycourier/models/send_to_slack_channel.rbi +28 -0
  91. data/rbi/trycourier/models/send_to_slack_email.rbi +28 -0
  92. data/rbi/trycourier/models/send_to_slack_user_id.rbi +28 -0
  93. data/rbi/trycourier/models/single_filter_config.rbi +116 -0
  94. data/rbi/trycourier/models/slack.rbi +22 -0
  95. data/rbi/trycourier/models/slack_base_properties.rbi +23 -0
  96. data/rbi/trycourier/models/slack_recipient.rbi +52 -0
  97. data/rbi/trycourier/models/token.rbi +21 -0
  98. data/rbi/trycourier/models/user_profile.rbi +377 -0
  99. data/rbi/trycourier/models/user_profile_firebase_token.rbi +25 -0
  100. data/rbi/trycourier/models/webhook_auth_mode.rbi +22 -0
  101. data/rbi/trycourier/models/webhook_authentication.rbi +64 -0
  102. data/rbi/trycourier/models/webhook_method.rbi +21 -0
  103. data/rbi/trycourier/models/webhook_profile.rbi +80 -0
  104. data/rbi/trycourier/models/webhook_profile_type.rbi +22 -0
  105. data/rbi/trycourier/models/webhook_recipient.rbi +31 -0
  106. data/rbi/trycourier/models.rbi +84 -2
  107. data/rbi/trycourier/resources/audiences.rbi +7 -1
  108. data/sig/trycourier/models/airship_profile.rbs +25 -0
  109. data/sig/trycourier/models/airship_profile_audience.rbs +13 -0
  110. data/sig/trycourier/models/audience.rbs +4 -4
  111. data/sig/trycourier/models/audience_filter.rbs +50 -0
  112. data/sig/trycourier/models/audience_recipient.rbs +30 -0
  113. data/sig/trycourier/models/audience_update_params.rbs +8 -4
  114. data/sig/trycourier/models/device_type.rbs +5 -0
  115. data/sig/trycourier/models/discord.rbs +11 -0
  116. data/sig/trycourier/models/expo.rbs +11 -0
  117. data/sig/trycourier/models/filter.rbs +4 -61
  118. data/sig/trycourier/models/filter_config.rbs +4 -61
  119. data/sig/trycourier/models/intercom.rbs +15 -0
  120. data/sig/trycourier/models/intercom_recipient.rbs +13 -0
  121. data/sig/trycourier/models/list_filter.rbs +50 -0
  122. data/sig/trycourier/models/list_pattern_recipient.rbs +19 -0
  123. data/sig/trycourier/models/list_recipient.rbs +30 -0
  124. data/sig/trycourier/models/ms_teams.rbs +16 -0
  125. data/sig/trycourier/models/ms_teams_base_properties.rbs +15 -0
  126. data/sig/trycourier/models/ms_teams_recipient.rbs +13 -0
  127. data/sig/trycourier/models/multiple_tokens.rbs +13 -0
  128. data/sig/trycourier/models/nested_filter_config.rbs +64 -0
  129. data/sig/trycourier/models/pagerduty.rbs +35 -0
  130. data/sig/trycourier/models/pagerduty_recipient.rbs +13 -0
  131. data/sig/trycourier/models/send_direct_message.rbs +13 -0
  132. data/sig/trycourier/models/send_message_params.rbs +9 -3
  133. data/sig/trycourier/models/send_to_channel.rbs +13 -0
  134. data/sig/trycourier/models/send_to_ms_teams_channel_id.rbs +26 -0
  135. data/sig/trycourier/models/send_to_ms_teams_channel_name.rbs +35 -0
  136. data/sig/trycourier/models/send_to_ms_teams_conversation_id.rbs +26 -0
  137. data/sig/trycourier/models/send_to_ms_teams_email.rbs +22 -0
  138. data/sig/trycourier/models/send_to_ms_teams_user_id.rbs +26 -0
  139. data/sig/trycourier/models/send_to_slack_channel.rbs +15 -0
  140. data/sig/trycourier/models/send_to_slack_email.rbs +15 -0
  141. data/sig/trycourier/models/send_to_slack_user_id.rbs +15 -0
  142. data/sig/trycourier/models/single_filter_config.rbs +69 -0
  143. data/sig/trycourier/models/slack.rbs +14 -0
  144. data/sig/trycourier/models/slack_base_properties.rbs +13 -0
  145. data/sig/trycourier/models/slack_recipient.rbs +13 -0
  146. data/sig/trycourier/models/token.rbs +13 -0
  147. data/sig/trycourier/models/user_profile.rbs +212 -0
  148. data/sig/trycourier/models/user_profile_firebase_token.rbs +13 -0
  149. data/sig/trycourier/models/webhook_auth_mode.rbs +15 -0
  150. data/sig/trycourier/models/webhook_authentication.rbs +35 -0
  151. data/sig/trycourier/models/webhook_method.rbs +14 -0
  152. data/sig/trycourier/models/webhook_profile.rbs +40 -0
  153. data/sig/trycourier/models/webhook_profile_type.rbs +14 -0
  154. data/sig/trycourier/models/webhook_recipient.rbs +13 -0
  155. data/sig/trycourier/models.rbs +86 -4
  156. data/sig/trycourier/resources/audiences.rbs +1 -1
  157. metadata +128 -5
  158. data/lib/trycourier/models/recipient.rb +0 -113
  159. data/rbi/trycourier/models/recipient.rbi +0 -161
  160. 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: 50b24baf1344688ba29d949d04f66b3841f3272ab0db0e353d9364a3441d39b6
4
+ data.tar.gz: a0b247a913ade31c0aa104718b3607a5546367a3f69febb9a2d377d68e6dbe0b
5
5
  SHA512:
6
- metadata.gz: 17ddc44b894c1652b8ab7fe614d2bcf99c936e9d36f124c1121ee913dfff46d6674c9672c1f3192c160fae83c76eaa1bd50382bcb9aff1963978ace8bf883bb2
7
- data.tar.gz: c0ce826de197896c96af433c3089989bb133d3c53dba59509e828fb52145c823bf0e77f9323004a22b87f94c073d3efe515caace6939ba167e8afae4c29d59d5
6
+ metadata.gz: 4549c791b9b0c8b1f26cca857c6ea4fccacb889d13fce5a75976f4436c987d52ef43e31c1085f79eb645f325f31263c239f1a5d2dc88c79275483137805e0928
7
+ data.tar.gz: dfc09375e3facc38b137ed1da33b7b3624751c8e10727d333f00d27fe9efddcf34a83e337aa4dfcfc0cc988f04a48f393b74437e00fb992544bc43710a6ba5ca
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.5.0 (2025-12-29)
4
+
5
+ Full Changelog: [v4.4.0...v4.5.0](https://github.com/trycourier/courier-ruby/compare/v4.4.0...v4.5.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add slack/msteams/pagerduty/webhook/audience/list recipient types ([56278ef](https://github.com/trycourier/courier-ruby/commit/56278ef7d0582bfba2e2122f9682c1282f25109d))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * calling `break` out of streams should be instantaneous ([7af6435](https://github.com/trycourier/courier-ruby/commit/7af6435d8426c69cb9c07d263d3363526508be7d))
15
+ * issue where json.parse errors when receiving HTTP 204 with nobody ([6288d57](https://github.com/trycourier/courier-ruby/commit/6288d578db512479a70098e529a26a0e29139918))
16
+
3
17
  ## 4.4.0 (2025-12-16)
4
18
 
5
19
  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.5.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -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,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
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class Intercom < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute from
7
+ #
8
+ # @return [String]
9
+ required :from, String
10
+
11
+ # @!attribute to
12
+ #
13
+ # @return [Trycourier::Models::IntercomRecipient]
14
+ required :to, -> { Trycourier::IntercomRecipient }
15
+
16
+ # @!method initialize(from:, to:)
17
+ # @param from [String]
18
+ # @param to [Trycourier::Models::IntercomRecipient]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class IntercomRecipient < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ #
8
+ # @return [String]
9
+ required :id, String
10
+
11
+ # @!method initialize(id:)
12
+ # @param id [String]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListFilter < 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::ListFilter::Operator]
10
+ required :operator, enum: -> { Trycourier::ListFilter::Operator }
11
+
12
+ # @!attribute path
13
+ #
14
+ # @return [Symbol, Trycourier::Models::ListFilter::Path]
15
+ required :path, enum: -> { Trycourier::ListFilter::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::ListFilter::Operator] Send to users only if they are member of the account
24
+ #
25
+ # @param path [Symbol, Trycourier::Models::ListFilter::Path]
26
+ #
27
+ # @param value [String]
28
+
29
+ # Send to users only if they are member of the account
30
+ #
31
+ # @see Trycourier::Models::ListFilter#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::ListFilter#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,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListPatternRecipient < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute data
7
+ #
8
+ # @return [Hash{Symbol=>Object}, nil]
9
+ optional :data, Trycourier::Internal::Type::HashOf[Trycourier::Internal::Type::Unknown], nil?: true
10
+
11
+ # @!attribute list_pattern
12
+ #
13
+ # @return [String, nil]
14
+ optional :list_pattern, String, nil?: true
15
+
16
+ # @!method initialize(data: nil, list_pattern: nil)
17
+ # Send to users in lists matching a pattern
18
+ #
19
+ # @param data [Hash{Symbol=>Object}, nil]
20
+ # @param list_pattern [String, nil]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListRecipient < Trycourier::Internal::Type::BaseModel
6
+ # @!attribute data
7
+ #
8
+ # @return [Hash{Symbol=>Object}, nil]
9
+ optional :data, Trycourier::Internal::Type::HashOf[Trycourier::Internal::Type::Unknown], nil?: true
10
+
11
+ # @!attribute filters
12
+ #
13
+ # @return [Array<Trycourier::Models::ListFilter>, nil]
14
+ optional :filters, -> { Trycourier::Internal::Type::ArrayOf[Trycourier::ListFilter] }, nil?: true
15
+
16
+ # @!attribute list_id
17
+ #
18
+ # @return [String, nil]
19
+ optional :list_id, String, nil?: true
20
+
21
+ # @!method initialize(data: nil, filters: nil, list_id: nil)
22
+ # Send to all users in a specific list
23
+ #
24
+ # @param data [Hash{Symbol=>Object}, nil]
25
+ # @param filters [Array<Trycourier::Models::ListFilter>, nil]
26
+ # @param list_id [String, nil]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Trycourier
4
+ module Models
5
+ module MsTeams
6
+ extend Trycourier::Internal::Type::Union
7
+
8
+ variant -> { Trycourier::SendToMsTeamsUserID }
9
+
10
+ variant -> { Trycourier::SendToMsTeamsEmail }
11
+
12
+ variant -> { Trycourier::SendToMsTeamsChannelID }
13
+
14
+ variant -> { Trycourier::SendToMsTeamsConversationID }
15
+
16
+ variant -> { Trycourier::SendToMsTeamsChannelName }
17
+
18
+ # @!method self.variants
19
+ # @return [Array(Trycourier::Models::SendToMsTeamsUserID, Trycourier::Models::SendToMsTeamsEmail, Trycourier::Models::SendToMsTeamsChannelID, Trycourier::Models::SendToMsTeamsConversationID, Trycourier::Models::SendToMsTeamsChannelName)]
20
+ end
21
+ end
22
+ end