trycourier 4.3.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 (175) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -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/bulk_create_job_params.rb +12 -3
  15. data/lib/trycourier/models/bulk_retrieve_job_response.rb +15 -3
  16. data/lib/trycourier/models/device_type.rb +7 -0
  17. data/lib/trycourier/models/discord.rb +16 -0
  18. data/lib/trycourier/models/expo.rb +16 -0
  19. data/lib/trycourier/models/filter.rb +8 -51
  20. data/lib/trycourier/models/filter_config.rb +8 -51
  21. data/lib/trycourier/models/inbound_bulk_message.rb +79 -113
  22. data/lib/trycourier/models/inbound_bulk_message_user.rb +21 -6
  23. data/lib/trycourier/models/intercom.rb +21 -0
  24. data/lib/trycourier/models/intercom_recipient.rb +15 -0
  25. data/lib/trycourier/models/list_filter.rb +52 -0
  26. data/lib/trycourier/models/list_pattern_recipient.rb +23 -0
  27. data/lib/trycourier/models/list_recipient.rb +29 -0
  28. data/lib/trycourier/models/ms_teams.rb +22 -0
  29. data/lib/trycourier/models/ms_teams_base_properties.rb +21 -0
  30. data/lib/trycourier/models/ms_teams_recipient.rb +17 -0
  31. data/lib/trycourier/models/multiple_tokens.rb +15 -0
  32. data/lib/trycourier/models/nested_filter_config.rb +49 -0
  33. data/lib/trycourier/models/pagerduty.rb +33 -0
  34. data/lib/trycourier/models/pagerduty_recipient.rb +17 -0
  35. data/lib/trycourier/models/send_direct_message.rb +15 -0
  36. data/lib/trycourier/models/send_message_params.rb +38 -8
  37. data/lib/trycourier/models/send_to_channel.rb +15 -0
  38. data/lib/trycourier/models/send_to_ms_teams_channel_id.rb +27 -0
  39. data/lib/trycourier/models/send_to_ms_teams_channel_name.rb +33 -0
  40. data/lib/trycourier/models/send_to_ms_teams_conversation_id.rb +27 -0
  41. data/lib/trycourier/models/send_to_ms_teams_email.rb +27 -0
  42. data/lib/trycourier/models/send_to_ms_teams_user_id.rb +27 -0
  43. data/lib/trycourier/models/send_to_slack_channel.rb +21 -0
  44. data/lib/trycourier/models/send_to_slack_email.rb +21 -0
  45. data/lib/trycourier/models/send_to_slack_user_id.rb +21 -0
  46. data/lib/trycourier/models/single_filter_config.rb +62 -0
  47. data/lib/trycourier/models/slack.rb +18 -0
  48. data/lib/trycourier/models/slack_base_properties.rb +15 -0
  49. data/lib/trycourier/models/slack_recipient.rb +17 -0
  50. data/lib/trycourier/models/token.rb +15 -0
  51. data/lib/trycourier/models/user_profile.rb +274 -0
  52. data/lib/trycourier/models/user_profile_firebase_token.rb +19 -0
  53. data/lib/trycourier/models/webhook_auth_mode.rb +16 -0
  54. data/lib/trycourier/models/webhook_authentication.rb +40 -0
  55. data/lib/trycourier/models/webhook_method.rb +15 -0
  56. data/lib/trycourier/models/webhook_profile.rb +53 -0
  57. data/lib/trycourier/models/webhook_profile_type.rb +15 -0
  58. data/lib/trycourier/models/webhook_recipient.rb +17 -0
  59. data/lib/trycourier/models.rb +84 -2
  60. data/lib/trycourier/resources/audiences.rb +1 -1
  61. data/lib/trycourier/resources/bulk.rb +17 -3
  62. data/lib/trycourier/version.rb +1 -1
  63. data/lib/trycourier.rb +42 -1
  64. data/rbi/trycourier/models/airship_profile.rbi +41 -0
  65. data/rbi/trycourier/models/airship_profile_audience.rbi +26 -0
  66. data/rbi/trycourier/models/audience.rbi +8 -7
  67. data/rbi/trycourier/models/audience_filter.rbi +88 -0
  68. data/rbi/trycourier/models/audience_recipient.rbi +52 -0
  69. data/rbi/trycourier/models/audience_update_params.rbi +25 -7
  70. data/rbi/trycourier/models/bulk_create_job_params.rbi +21 -20
  71. data/rbi/trycourier/models/bulk_retrieve_job_response.rbi +24 -9
  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/inbound_bulk_message.rbi +97 -153
  78. data/rbi/trycourier/models/inbound_bulk_message_user.rbi +20 -7
  79. data/rbi/trycourier/models/intercom.rbi +35 -0
  80. data/rbi/trycourier/models/intercom_recipient.rbi +23 -0
  81. data/rbi/trycourier/models/list_filter.rbi +86 -0
  82. data/rbi/trycourier/models/list_pattern_recipient.rbi +39 -0
  83. data/rbi/trycourier/models/list_recipient.rbi +44 -0
  84. data/rbi/trycourier/models/ms_teams.rbi +24 -0
  85. data/rbi/trycourier/models/ms_teams_base_properties.rbi +31 -0
  86. data/rbi/trycourier/models/ms_teams_recipient.rbi +58 -0
  87. data/rbi/trycourier/models/multiple_tokens.rbi +27 -0
  88. data/rbi/trycourier/models/nested_filter_config.rbi +104 -0
  89. data/rbi/trycourier/models/pagerduty.rbi +53 -0
  90. data/rbi/trycourier/models/pagerduty_recipient.rbi +31 -0
  91. data/rbi/trycourier/models/send_direct_message.rbi +23 -0
  92. data/rbi/trycourier/models/send_message_params.rbi +50 -11
  93. data/rbi/trycourier/models/send_to_channel.rbi +23 -0
  94. data/rbi/trycourier/models/send_to_ms_teams_channel_id.rbi +42 -0
  95. data/rbi/trycourier/models/send_to_ms_teams_channel_name.rbi +51 -0
  96. data/rbi/trycourier/models/send_to_ms_teams_conversation_id.rbi +42 -0
  97. data/rbi/trycourier/models/send_to_ms_teams_email.rbi +37 -0
  98. data/rbi/trycourier/models/send_to_ms_teams_user_id.rbi +37 -0
  99. data/rbi/trycourier/models/send_to_slack_channel.rbi +28 -0
  100. data/rbi/trycourier/models/send_to_slack_email.rbi +28 -0
  101. data/rbi/trycourier/models/send_to_slack_user_id.rbi +28 -0
  102. data/rbi/trycourier/models/single_filter_config.rbi +116 -0
  103. data/rbi/trycourier/models/slack.rbi +22 -0
  104. data/rbi/trycourier/models/slack_base_properties.rbi +23 -0
  105. data/rbi/trycourier/models/slack_recipient.rbi +52 -0
  106. data/rbi/trycourier/models/token.rbi +21 -0
  107. data/rbi/trycourier/models/user_profile.rbi +377 -0
  108. data/rbi/trycourier/models/user_profile_firebase_token.rbi +25 -0
  109. data/rbi/trycourier/models/webhook_auth_mode.rbi +22 -0
  110. data/rbi/trycourier/models/webhook_authentication.rbi +64 -0
  111. data/rbi/trycourier/models/webhook_method.rbi +21 -0
  112. data/rbi/trycourier/models/webhook_profile.rbi +80 -0
  113. data/rbi/trycourier/models/webhook_profile_type.rbi +22 -0
  114. data/rbi/trycourier/models/webhook_recipient.rbi +31 -0
  115. data/rbi/trycourier/models.rbi +84 -2
  116. data/rbi/trycourier/resources/audiences.rbi +7 -1
  117. data/rbi/trycourier/resources/bulk.rbi +22 -8
  118. data/sig/trycourier/models/airship_profile.rbs +25 -0
  119. data/sig/trycourier/models/airship_profile_audience.rbs +13 -0
  120. data/sig/trycourier/models/audience.rbs +4 -4
  121. data/sig/trycourier/models/audience_filter.rbs +50 -0
  122. data/sig/trycourier/models/audience_recipient.rbs +30 -0
  123. data/sig/trycourier/models/audience_update_params.rbs +8 -4
  124. data/sig/trycourier/models/bulk_create_job_params.rbs +4 -4
  125. data/sig/trycourier/models/bulk_retrieve_job_response.rbs +4 -4
  126. data/sig/trycourier/models/device_type.rbs +5 -0
  127. data/sig/trycourier/models/discord.rbs +11 -0
  128. data/sig/trycourier/models/expo.rbs +11 -0
  129. data/sig/trycourier/models/filter.rbs +4 -61
  130. data/sig/trycourier/models/filter_config.rbs +4 -61
  131. data/sig/trycourier/models/inbound_bulk_message.rbs +52 -99
  132. data/sig/trycourier/models/inbound_bulk_message_user.rbs +4 -6
  133. data/sig/trycourier/models/intercom.rbs +15 -0
  134. data/sig/trycourier/models/intercom_recipient.rbs +13 -0
  135. data/sig/trycourier/models/list_filter.rbs +50 -0
  136. data/sig/trycourier/models/list_pattern_recipient.rbs +19 -0
  137. data/sig/trycourier/models/list_recipient.rbs +30 -0
  138. data/sig/trycourier/models/ms_teams.rbs +16 -0
  139. data/sig/trycourier/models/ms_teams_base_properties.rbs +15 -0
  140. data/sig/trycourier/models/ms_teams_recipient.rbs +13 -0
  141. data/sig/trycourier/models/multiple_tokens.rbs +13 -0
  142. data/sig/trycourier/models/nested_filter_config.rbs +64 -0
  143. data/sig/trycourier/models/pagerduty.rbs +35 -0
  144. data/sig/trycourier/models/pagerduty_recipient.rbs +13 -0
  145. data/sig/trycourier/models/send_direct_message.rbs +13 -0
  146. data/sig/trycourier/models/send_message_params.rbs +22 -6
  147. data/sig/trycourier/models/send_to_channel.rbs +13 -0
  148. data/sig/trycourier/models/send_to_ms_teams_channel_id.rbs +26 -0
  149. data/sig/trycourier/models/send_to_ms_teams_channel_name.rbs +35 -0
  150. data/sig/trycourier/models/send_to_ms_teams_conversation_id.rbs +26 -0
  151. data/sig/trycourier/models/send_to_ms_teams_email.rbs +22 -0
  152. data/sig/trycourier/models/send_to_ms_teams_user_id.rbs +26 -0
  153. data/sig/trycourier/models/send_to_slack_channel.rbs +15 -0
  154. data/sig/trycourier/models/send_to_slack_email.rbs +15 -0
  155. data/sig/trycourier/models/send_to_slack_user_id.rbs +15 -0
  156. data/sig/trycourier/models/single_filter_config.rbs +69 -0
  157. data/sig/trycourier/models/slack.rbs +14 -0
  158. data/sig/trycourier/models/slack_base_properties.rbs +13 -0
  159. data/sig/trycourier/models/slack_recipient.rbs +13 -0
  160. data/sig/trycourier/models/token.rbs +13 -0
  161. data/sig/trycourier/models/user_profile.rbs +212 -0
  162. data/sig/trycourier/models/user_profile_firebase_token.rbs +13 -0
  163. data/sig/trycourier/models/webhook_auth_mode.rbs +15 -0
  164. data/sig/trycourier/models/webhook_authentication.rbs +35 -0
  165. data/sig/trycourier/models/webhook_method.rbs +14 -0
  166. data/sig/trycourier/models/webhook_profile.rbs +40 -0
  167. data/sig/trycourier/models/webhook_profile_type.rbs +14 -0
  168. data/sig/trycourier/models/webhook_recipient.rbs +13 -0
  169. data/sig/trycourier/models.rbs +87 -5
  170. data/sig/trycourier/resources/audiences.rbs +1 -1
  171. data/sig/trycourier/resources/bulk.rbs +1 -1
  172. metadata +128 -5
  173. data/lib/trycourier/models/recipient.rb +0 -113
  174. data/rbi/trycourier/models/recipient.rbi +0 -161
  175. data/sig/trycourier/models/recipient.rbs +0 -92
@@ -2,92 +2,17 @@
2
2
 
3
3
  module Trycourier
4
4
  module Models
5
- class FilterConfig < Trycourier::Internal::Type::BaseModel
6
- OrHash =
5
+ # A single filter to use for filtering
6
+ module FilterConfig
7
+ extend Trycourier::Internal::Type::Union
8
+
9
+ Variants =
7
10
  T.type_alias do
8
- T.any(Trycourier::FilterConfig, Trycourier::Internal::AnyHash)
11
+ T.any(Trycourier::SingleFilterConfig, Trycourier::NestedFilterConfig)
9
12
  end
10
13
 
11
- # The operator to use for filtering
12
- sig { returns(Trycourier::FilterConfig::Operator::OrSymbol) }
13
- attr_accessor :operator
14
-
15
- # The attribe name from profile whose value will be operated against the filter
16
- # value
17
- sig { returns(String) }
18
- attr_accessor :path
19
-
20
- # The value to use for filtering
21
- sig { returns(String) }
22
- attr_accessor :value
23
-
24
- sig do
25
- params(
26
- operator: Trycourier::FilterConfig::Operator::OrSymbol,
27
- path: String,
28
- value: String
29
- ).returns(T.attached_class)
30
- end
31
- def self.new(
32
- # The operator to use for filtering
33
- operator:,
34
- # The attribe name from profile whose value will be operated against the filter
35
- # value
36
- path:,
37
- # The value to use for filtering
38
- value:
39
- )
40
- end
41
-
42
- sig do
43
- override.returns(
44
- {
45
- operator: Trycourier::FilterConfig::Operator::OrSymbol,
46
- path: String,
47
- value: String
48
- }
49
- )
50
- end
51
- def to_hash
52
- end
53
-
54
- # The operator to use for filtering
55
- module Operator
56
- extend Trycourier::Internal::Type::Enum
57
-
58
- TaggedSymbol =
59
- T.type_alias { T.all(Symbol, Trycourier::FilterConfig::Operator) }
60
- OrSymbol = T.type_alias { T.any(Symbol, String) }
61
-
62
- ENDS_WITH =
63
- T.let(:ENDS_WITH, Trycourier::FilterConfig::Operator::TaggedSymbol)
64
- EQ = T.let(:EQ, Trycourier::FilterConfig::Operator::TaggedSymbol)
65
- EXISTS =
66
- T.let(:EXISTS, Trycourier::FilterConfig::Operator::TaggedSymbol)
67
- GT = T.let(:GT, Trycourier::FilterConfig::Operator::TaggedSymbol)
68
- GTE = T.let(:GTE, Trycourier::FilterConfig::Operator::TaggedSymbol)
69
- INCLUDES =
70
- T.let(:INCLUDES, Trycourier::FilterConfig::Operator::TaggedSymbol)
71
- IS_AFTER =
72
- T.let(:IS_AFTER, Trycourier::FilterConfig::Operator::TaggedSymbol)
73
- IS_BEFORE =
74
- T.let(:IS_BEFORE, Trycourier::FilterConfig::Operator::TaggedSymbol)
75
- LT = T.let(:LT, Trycourier::FilterConfig::Operator::TaggedSymbol)
76
- LTE = T.let(:LTE, Trycourier::FilterConfig::Operator::TaggedSymbol)
77
- NEQ = T.let(:NEQ, Trycourier::FilterConfig::Operator::TaggedSymbol)
78
- OMIT = T.let(:OMIT, Trycourier::FilterConfig::Operator::TaggedSymbol)
79
- STARTS_WITH =
80
- T.let(:STARTS_WITH, Trycourier::FilterConfig::Operator::TaggedSymbol)
81
- AND = T.let(:AND, Trycourier::FilterConfig::Operator::TaggedSymbol)
82
- OR = T.let(:OR, Trycourier::FilterConfig::Operator::TaggedSymbol)
83
-
84
- sig do
85
- override.returns(
86
- T::Array[Trycourier::FilterConfig::Operator::TaggedSymbol]
87
- )
88
- end
89
- def self.values
90
- end
14
+ sig { override.returns(T::Array[Trycourier::FilterConfig::Variants]) }
15
+ def self.variants
91
16
  end
92
17
  end
93
18
  end
@@ -2,187 +2,131 @@
2
2
 
3
3
  module Trycourier
4
4
  module Models
5
- module InboundBulkMessage
6
- extend Trycourier::Internal::Type::Union
7
-
8
- Variants =
5
+ class InboundBulkMessage < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
9
7
  T.type_alias do
10
- T.any(
11
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage,
12
- Trycourier::InboundBulkMessage::InboundBulkContentMessage
13
- )
14
- end
15
-
16
- class InboundBulkTemplateMessage < Trycourier::Internal::Type::BaseModel
17
- OrHash =
18
- T.type_alias do
19
- T.any(
20
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage,
21
- Trycourier::Internal::AnyHash
22
- )
23
- end
24
-
25
- sig { returns(String) }
26
- attr_accessor :template
27
-
28
- sig { returns(T.nilable(String)) }
29
- attr_accessor :brand
30
-
31
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
32
- attr_accessor :data
33
-
34
- sig { returns(T.nilable(String)) }
35
- attr_accessor :event
36
-
37
- sig { returns(T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]])) }
38
- attr_accessor :locale
39
-
40
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
41
- attr_accessor :override
42
-
43
- sig do
44
- params(
45
- template: String,
46
- brand: T.nilable(String),
47
- data: T.nilable(T::Hash[Symbol, T.anything]),
48
- event: T.nilable(String),
49
- locale: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]]),
50
- override: T.nilable(T::Hash[Symbol, T.anything])
51
- ).returns(T.attached_class)
52
- end
53
- def self.new(
54
- template:,
55
- brand: nil,
56
- data: nil,
57
- event: nil,
58
- locale: nil,
59
- override: nil
60
- )
8
+ T.any(Trycourier::InboundBulkMessage, Trycourier::Internal::AnyHash)
61
9
  end
62
10
 
63
- sig do
64
- override.returns(
65
- {
66
- template: String,
67
- brand: T.nilable(String),
68
- data: T.nilable(T::Hash[Symbol, T.anything]),
69
- event: T.nilable(String),
70
- locale: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]]),
71
- override: T.nilable(T::Hash[Symbol, T.anything])
72
- }
73
- )
74
- end
75
- def to_hash
76
- end
77
- end
11
+ # Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
12
+ # "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
13
+ # mapped to a notification.
14
+ sig { returns(String) }
15
+ attr_accessor :event
78
16
 
79
- class InboundBulkContentMessage < Trycourier::Internal::Type::BaseModel
80
- OrHash =
81
- T.type_alias do
82
- T.any(
83
- Trycourier::InboundBulkMessage::InboundBulkContentMessage,
84
- Trycourier::Internal::AnyHash
85
- )
86
- end
17
+ sig { returns(T.nilable(String)) }
18
+ attr_accessor :brand
87
19
 
88
- # Syntactic sugar to provide a fast shorthand for Courier Elemental Blocks.
89
- sig do
90
- returns(
20
+ # Elemental content (optional, for V2 format). When provided, this will be used
21
+ # instead of the notification associated with the `event` field.
22
+ sig do
23
+ returns(
24
+ T.nilable(
91
25
  T.any(
92
26
  Trycourier::ElementalContentSugar,
93
27
  Trycourier::ElementalContent
94
28
  )
95
29
  )
96
- end
97
- attr_accessor :content
98
-
99
- sig { returns(T.nilable(String)) }
100
- attr_accessor :brand
30
+ )
31
+ end
32
+ attr_accessor :content
101
33
 
102
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
103
- attr_accessor :data
34
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
+ attr_accessor :data
104
36
 
105
- sig { returns(T.nilable(String)) }
106
- attr_accessor :event
37
+ sig { returns(T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]])) }
38
+ attr_accessor :locale
107
39
 
108
- sig { returns(T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]])) }
109
- attr_accessor :locale
40
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
41
+ attr_accessor :override
110
42
 
111
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
112
- attr_accessor :override
43
+ # Notification ID or template ID (optional, for V2 format). When provided, this
44
+ # will be used instead of the notification associated with the `event` field.
45
+ sig { returns(T.nilable(String)) }
46
+ attr_accessor :template
113
47
 
114
- sig do
115
- params(
116
- content:
48
+ # Bulk message definition. Supports two formats:
49
+ #
50
+ # - V1 format: Requires `event` field (event ID or notification ID)
51
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
52
+ # content) in addition to `event`
53
+ sig do
54
+ params(
55
+ event: String,
56
+ brand: T.nilable(String),
57
+ content:
58
+ T.nilable(
117
59
  T.any(
118
60
  Trycourier::ElementalContentSugar::OrHash,
119
61
  Trycourier::ElementalContent::OrHash
120
- ),
62
+ )
63
+ ),
64
+ data: T.nilable(T::Hash[Symbol, T.anything]),
65
+ locale: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]]),
66
+ override: T.nilable(T::Hash[Symbol, T.anything]),
67
+ template: T.nilable(String)
68
+ ).returns(T.attached_class)
69
+ end
70
+ def self.new(
71
+ # Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
72
+ # "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
73
+ # mapped to a notification.
74
+ event:,
75
+ brand: nil,
76
+ # Elemental content (optional, for V2 format). When provided, this will be used
77
+ # instead of the notification associated with the `event` field.
78
+ content: nil,
79
+ data: nil,
80
+ locale: nil,
81
+ override: nil,
82
+ # Notification ID or template ID (optional, for V2 format). When provided, this
83
+ # will be used instead of the notification associated with the `event` field.
84
+ template: nil
85
+ )
86
+ end
87
+
88
+ sig do
89
+ override.returns(
90
+ {
91
+ event: String,
121
92
  brand: T.nilable(String),
93
+ content:
94
+ T.nilable(
95
+ T.any(
96
+ Trycourier::ElementalContentSugar,
97
+ Trycourier::ElementalContent
98
+ )
99
+ ),
122
100
  data: T.nilable(T::Hash[Symbol, T.anything]),
123
- event: T.nilable(String),
124
101
  locale: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]]),
125
- override: T.nilable(T::Hash[Symbol, T.anything])
126
- ).returns(T.attached_class)
127
- end
128
- def self.new(
129
- # Syntactic sugar to provide a fast shorthand for Courier Elemental Blocks.
130
- content:,
131
- brand: nil,
132
- data: nil,
133
- event: nil,
134
- locale: nil,
135
- override: nil
102
+ override: T.nilable(T::Hash[Symbol, T.anything]),
103
+ template: T.nilable(String)
104
+ }
136
105
  )
137
- end
106
+ end
107
+ def to_hash
108
+ end
109
+
110
+ # Elemental content (optional, for V2 format). When provided, this will be used
111
+ # instead of the notification associated with the `event` field.
112
+ module Content
113
+ extend Trycourier::Internal::Type::Union
114
+
115
+ Variants =
116
+ T.type_alias do
117
+ T.any(
118
+ Trycourier::ElementalContentSugar,
119
+ Trycourier::ElementalContent
120
+ )
121
+ end
138
122
 
139
123
  sig do
140
124
  override.returns(
141
- {
142
- content:
143
- T.any(
144
- Trycourier::ElementalContentSugar,
145
- Trycourier::ElementalContent
146
- ),
147
- brand: T.nilable(String),
148
- data: T.nilable(T::Hash[Symbol, T.anything]),
149
- event: T.nilable(String),
150
- locale: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T.anything]]),
151
- override: T.nilable(T::Hash[Symbol, T.anything])
152
- }
125
+ T::Array[Trycourier::InboundBulkMessage::Content::Variants]
153
126
  )
154
127
  end
155
- def to_hash
128
+ def self.variants
156
129
  end
157
-
158
- # Syntactic sugar to provide a fast shorthand for Courier Elemental Blocks.
159
- module Content
160
- extend Trycourier::Internal::Type::Union
161
-
162
- Variants =
163
- T.type_alias do
164
- T.any(
165
- Trycourier::ElementalContentSugar,
166
- Trycourier::ElementalContent
167
- )
168
- end
169
-
170
- sig do
171
- override.returns(
172
- T::Array[
173
- Trycourier::InboundBulkMessage::InboundBulkContentMessage::Content::Variants
174
- ]
175
- )
176
- end
177
- def self.variants
178
- end
179
- end
180
- end
181
-
182
- sig do
183
- override.returns(T::Array[Trycourier::InboundBulkMessage::Variants])
184
- end
185
- def self.variants
186
130
  end
187
131
  end
188
132
  end
@@ -11,6 +11,7 @@ module Trycourier
11
11
  )
12
12
  end
13
13
 
14
+ # User-specific data that will be merged with message.data
14
15
  sig { returns(T.nilable(T.anything)) }
15
16
  attr_reader :data
16
17
 
@@ -27,15 +28,19 @@ module Trycourier
27
28
  end
28
29
  attr_writer :preferences
29
30
 
30
- sig { returns(T.nilable(T.anything)) }
31
- attr_reader :profile
32
-
33
- sig { params(profile: T.anything).void }
34
- attr_writer :profile
31
+ # User profile information. For email-based bulk jobs, `profile.email` is required
32
+ # for provider routing to determine if the message can be delivered. The email
33
+ # address should be provided here rather than in `to.email`.
34
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
+ attr_accessor :profile
35
36
 
37
+ # User ID (legacy field, use profile or to.user_id instead)
36
38
  sig { returns(T.nilable(String)) }
37
39
  attr_accessor :recipient
38
40
 
41
+ # Optional recipient information. Note: For email provider routing, use
42
+ # `profile.email` instead of `to.email`. The `to` field is primarily used for
43
+ # recipient identification and data merging.
39
44
  sig { returns(T.nilable(Trycourier::UserRecipient)) }
40
45
  attr_reader :to
41
46
 
@@ -46,16 +51,24 @@ module Trycourier
46
51
  params(
47
52
  data: T.anything,
48
53
  preferences: T.nilable(Trycourier::RecipientPreferences::OrHash),
49
- profile: T.anything,
54
+ profile: T.nilable(T::Hash[Symbol, T.anything]),
50
55
  recipient: T.nilable(String),
51
56
  to: T.nilable(Trycourier::UserRecipient::OrHash)
52
57
  ).returns(T.attached_class)
53
58
  end
54
59
  def self.new(
60
+ # User-specific data that will be merged with message.data
55
61
  data: nil,
56
62
  preferences: nil,
63
+ # User profile information. For email-based bulk jobs, `profile.email` is required
64
+ # for provider routing to determine if the message can be delivered. The email
65
+ # address should be provided here rather than in `to.email`.
57
66
  profile: nil,
67
+ # User ID (legacy field, use profile or to.user_id instead)
58
68
  recipient: nil,
69
+ # Optional recipient information. Note: For email provider routing, use
70
+ # `profile.email` instead of `to.email`. The `to` field is primarily used for
71
+ # recipient identification and data merging.
59
72
  to: nil
60
73
  )
61
74
  end
@@ -65,7 +78,7 @@ module Trycourier
65
78
  {
66
79
  data: T.anything,
67
80
  preferences: T.nilable(Trycourier::RecipientPreferences),
68
- profile: T.anything,
81
+ profile: T.nilable(T::Hash[Symbol, T.anything]),
69
82
  recipient: T.nilable(String),
70
83
  to: T.nilable(Trycourier::UserRecipient)
71
84
  }
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Trycourier
4
+ module Models
5
+ class Intercom < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Trycourier::Intercom, Trycourier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :from
13
+
14
+ sig { returns(Trycourier::IntercomRecipient) }
15
+ attr_reader :to
16
+
17
+ sig { params(to: Trycourier::IntercomRecipient::OrHash).void }
18
+ attr_writer :to
19
+
20
+ sig do
21
+ params(from: String, to: Trycourier::IntercomRecipient::OrHash).returns(
22
+ T.attached_class
23
+ )
24
+ end
25
+ def self.new(from:, to:)
26
+ end
27
+
28
+ sig do
29
+ override.returns({ from: String, to: Trycourier::IntercomRecipient })
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ # typed: strong
2
+
3
+ module Trycourier
4
+ module Models
5
+ class IntercomRecipient < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Trycourier::IntercomRecipient, Trycourier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :id
13
+
14
+ sig { params(id: String).returns(T.attached_class) }
15
+ def self.new(id:)
16
+ end
17
+
18
+ sig { override.returns({ id: String }) }
19
+ def to_hash
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,86 @@
1
+ # typed: strong
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListFilter < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Trycourier::ListFilter, Trycourier::Internal::AnyHash)
9
+ end
10
+
11
+ # Send to users only if they are member of the account
12
+ sig { returns(Trycourier::ListFilter::Operator::OrSymbol) }
13
+ attr_accessor :operator
14
+
15
+ sig { returns(Trycourier::ListFilter::Path::OrSymbol) }
16
+ attr_accessor :path
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :value
20
+
21
+ sig do
22
+ params(
23
+ operator: Trycourier::ListFilter::Operator::OrSymbol,
24
+ path: Trycourier::ListFilter::Path::OrSymbol,
25
+ value: String
26
+ ).returns(T.attached_class)
27
+ end
28
+ def self.new(
29
+ # Send to users only if they are member of the account
30
+ operator:,
31
+ path:,
32
+ value:
33
+ )
34
+ end
35
+
36
+ sig do
37
+ override.returns(
38
+ {
39
+ operator: Trycourier::ListFilter::Operator::OrSymbol,
40
+ path: Trycourier::ListFilter::Path::OrSymbol,
41
+ value: String
42
+ }
43
+ )
44
+ end
45
+ def to_hash
46
+ end
47
+
48
+ # Send to users only if they are member of the account
49
+ module Operator
50
+ extend Trycourier::Internal::Type::Enum
51
+
52
+ TaggedSymbol =
53
+ T.type_alias { T.all(Symbol, Trycourier::ListFilter::Operator) }
54
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
55
+
56
+ MEMBER_OF =
57
+ T.let(:MEMBER_OF, Trycourier::ListFilter::Operator::TaggedSymbol)
58
+
59
+ sig do
60
+ override.returns(
61
+ T::Array[Trycourier::ListFilter::Operator::TaggedSymbol]
62
+ )
63
+ end
64
+ def self.values
65
+ end
66
+ end
67
+
68
+ module Path
69
+ extend Trycourier::Internal::Type::Enum
70
+
71
+ TaggedSymbol =
72
+ T.type_alias { T.all(Symbol, Trycourier::ListFilter::Path) }
73
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
74
+
75
+ ACCOUNT_ID =
76
+ T.let(:account_id, Trycourier::ListFilter::Path::TaggedSymbol)
77
+
78
+ sig do
79
+ override.returns(T::Array[Trycourier::ListFilter::Path::TaggedSymbol])
80
+ end
81
+ def self.values
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,39 @@
1
+ # typed: strong
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListPatternRecipient < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Trycourier::ListPatternRecipient, Trycourier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
12
+ attr_accessor :data
13
+
14
+ sig { returns(T.nilable(String)) }
15
+ attr_accessor :list_pattern
16
+
17
+ # Send to users in lists matching a pattern
18
+ sig do
19
+ params(
20
+ data: T.nilable(T::Hash[Symbol, T.anything]),
21
+ list_pattern: T.nilable(String)
22
+ ).returns(T.attached_class)
23
+ end
24
+ def self.new(data: nil, list_pattern: nil)
25
+ end
26
+
27
+ sig do
28
+ override.returns(
29
+ {
30
+ data: T.nilable(T::Hash[Symbol, T.anything]),
31
+ list_pattern: T.nilable(String)
32
+ }
33
+ )
34
+ end
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,44 @@
1
+ # typed: strong
2
+
3
+ module Trycourier
4
+ module Models
5
+ class ListRecipient < Trycourier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Trycourier::ListRecipient, Trycourier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
12
+ attr_accessor :data
13
+
14
+ sig { returns(T.nilable(T::Array[Trycourier::ListFilter])) }
15
+ attr_accessor :filters
16
+
17
+ sig { returns(T.nilable(String)) }
18
+ attr_accessor :list_id
19
+
20
+ # Send to all users in a specific list
21
+ sig do
22
+ params(
23
+ data: T.nilable(T::Hash[Symbol, T.anything]),
24
+ filters: T.nilable(T::Array[Trycourier::ListFilter::OrHash]),
25
+ list_id: T.nilable(String)
26
+ ).returns(T.attached_class)
27
+ end
28
+ def self.new(data: nil, filters: nil, list_id: nil)
29
+ end
30
+
31
+ sig do
32
+ override.returns(
33
+ {
34
+ data: T.nilable(T::Hash[Symbol, T.anything]),
35
+ filters: T.nilable(T::Array[Trycourier::ListFilter]),
36
+ list_id: T.nilable(String)
37
+ }
38
+ )
39
+ end
40
+ def to_hash
41
+ end
42
+ end
43
+ end
44
+ end