trycourier 4.2.0 → 4.4.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/trycourier/models/bulk_create_job_params.rb +12 -3
  5. data/lib/trycourier/models/bulk_retrieve_job_response.rb +15 -3
  6. data/lib/trycourier/models/inbound_bulk_message.rb +79 -113
  7. data/lib/trycourier/models/inbound_bulk_message_user.rb +21 -6
  8. data/lib/trycourier/models/recipient.rb +26 -3
  9. data/lib/trycourier/models/send_message_params.rb +14 -1
  10. data/lib/trycourier/models/user_recipient.rb +26 -3
  11. data/lib/trycourier/models/users/token_list_response.rb +12 -2
  12. data/lib/trycourier/models.rb +0 -2
  13. data/lib/trycourier/resources/bulk.rb +17 -3
  14. data/lib/trycourier/resources/users/tokens.rb +2 -2
  15. data/lib/trycourier/version.rb +1 -1
  16. data/lib/trycourier.rb +0 -1
  17. data/rbi/trycourier/models/bulk_create_job_params.rbi +21 -20
  18. data/rbi/trycourier/models/bulk_retrieve_job_response.rbi +24 -9
  19. data/rbi/trycourier/models/inbound_bulk_message.rbi +97 -153
  20. data/rbi/trycourier/models/inbound_bulk_message_user.rbi +20 -7
  21. data/rbi/trycourier/models/recipient.rbi +46 -4
  22. data/rbi/trycourier/models/send_message_params.rbi +16 -1
  23. data/rbi/trycourier/models/user_recipient.rbi +47 -4
  24. data/rbi/trycourier/models/users/token_list_response.rbi +27 -5
  25. data/rbi/trycourier/models.rbi +0 -2
  26. data/rbi/trycourier/resources/bulk.rbi +22 -8
  27. data/rbi/trycourier/resources/users/tokens.rbi +1 -1
  28. data/sig/trycourier/models/bulk_create_job_params.rbs +4 -4
  29. data/sig/trycourier/models/bulk_retrieve_job_response.rbs +4 -4
  30. data/sig/trycourier/models/inbound_bulk_message.rbs +52 -99
  31. data/sig/trycourier/models/inbound_bulk_message_user.rbs +4 -6
  32. data/sig/trycourier/models/recipient.rbs +31 -4
  33. data/sig/trycourier/models/send_message_params.rbs +13 -3
  34. data/sig/trycourier/models/user_recipient.rbs +31 -4
  35. data/sig/trycourier/models/users/token_list_response.rbs +9 -2
  36. data/sig/trycourier/models.rbs +1 -3
  37. data/sig/trycourier/resources/bulk.rbs +1 -1
  38. data/sig/trycourier/resources/users/tokens.rbs +1 -1
  39. metadata +2 -5
  40. data/lib/trycourier/models/profile_preferences.rb +0 -27
  41. data/rbi/trycourier/models/profile_preferences.rbi +0 -44
  42. data/sig/trycourier/models/profile_preferences.rbs +0 -30
@@ -11,37 +11,38 @@ module Trycourier
11
11
  T.any(Trycourier::BulkCreateJobParams, Trycourier::Internal::AnyHash)
12
12
  end
13
13
 
14
- sig do
15
- returns(
16
- T.any(
17
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage,
18
- Trycourier::InboundBulkMessage::InboundBulkContentMessage
19
- )
20
- )
21
- end
22
- attr_accessor :message
14
+ # Bulk message definition. Supports two formats:
15
+ #
16
+ # - V1 format: Requires `event` field (event ID or notification ID)
17
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
18
+ # content) in addition to `event`
19
+ sig { returns(Trycourier::InboundBulkMessage) }
20
+ attr_reader :message
21
+
22
+ sig { params(message: Trycourier::InboundBulkMessage::OrHash).void }
23
+ attr_writer :message
23
24
 
24
25
  sig do
25
26
  params(
26
- message:
27
- T.any(
28
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage::OrHash,
29
- Trycourier::InboundBulkMessage::InboundBulkContentMessage::OrHash
30
- ),
27
+ message: Trycourier::InboundBulkMessage::OrHash,
31
28
  request_options: Trycourier::RequestOptions::OrHash
32
29
  ).returns(T.attached_class)
33
30
  end
34
- def self.new(message:, request_options: {})
31
+ def self.new(
32
+ # Bulk message definition. Supports two formats:
33
+ #
34
+ # - V1 format: Requires `event` field (event ID or notification ID)
35
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
36
+ # content) in addition to `event`
37
+ message:,
38
+ request_options: {}
39
+ )
35
40
  end
36
41
 
37
42
  sig do
38
43
  override.returns(
39
44
  {
40
- message:
41
- T.any(
42
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage,
43
- Trycourier::InboundBulkMessage::InboundBulkContentMessage
44
- ),
45
+ message: Trycourier::InboundBulkMessage,
45
46
  request_options: Trycourier::RequestOptions
46
47
  }
47
48
  )
@@ -46,8 +46,16 @@ module Trycourier
46
46
  )
47
47
  end
48
48
 
49
- sig { returns(Trycourier::InboundBulkMessage::Variants) }
50
- attr_accessor :definition
49
+ # Bulk message definition. Supports two formats:
50
+ #
51
+ # - V1 format: Requires `event` field (event ID or notification ID)
52
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
53
+ # content) in addition to `event`
54
+ sig { returns(Trycourier::InboundBulkMessage) }
55
+ attr_reader :definition
56
+
57
+ sig { params(definition: Trycourier::InboundBulkMessage::OrHash).void }
58
+ attr_writer :definition
51
59
 
52
60
  sig { returns(Integer) }
53
61
  attr_accessor :enqueued
@@ -67,11 +75,7 @@ module Trycourier
67
75
 
68
76
  sig do
69
77
  params(
70
- definition:
71
- T.any(
72
- Trycourier::InboundBulkMessage::InboundBulkTemplateMessage::OrHash,
73
- Trycourier::InboundBulkMessage::InboundBulkContentMessage::OrHash
74
- ),
78
+ definition: Trycourier::InboundBulkMessage::OrHash,
75
79
  enqueued: Integer,
76
80
  failures: Integer,
77
81
  received: Integer,
@@ -79,13 +83,24 @@ module Trycourier
79
83
  Trycourier::Models::BulkRetrieveJobResponse::Job::Status::OrSymbol
80
84
  ).returns(T.attached_class)
81
85
  end
82
- def self.new(definition:, enqueued:, failures:, received:, status:)
86
+ def self.new(
87
+ # Bulk message definition. Supports two formats:
88
+ #
89
+ # - V1 format: Requires `event` field (event ID or notification ID)
90
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
91
+ # content) in addition to `event`
92
+ definition:,
93
+ enqueued:,
94
+ failures:,
95
+ received:,
96
+ status:
97
+ )
83
98
  end
84
99
 
85
100
  sig do
86
101
  override.returns(
87
102
  {
88
- definition: Trycourier::InboundBulkMessage::Variants,
103
+ definition: Trycourier::InboundBulkMessage,
89
104
  enqueued: Integer,
90
105
  failures: Integer,
91
106
  received: Integer,
@@ -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
  }
@@ -40,12 +40,12 @@ module Trycourier
40
40
  sig { returns(T.nilable(String)) }
41
41
  attr_accessor :phone_number
42
42
 
43
- sig { returns(T.nilable(Trycourier::ProfilePreferences)) }
43
+ sig { returns(T.nilable(Trycourier::Recipient::Preferences)) }
44
44
  attr_reader :preferences
45
45
 
46
46
  sig do
47
47
  params(
48
- preferences: T.nilable(Trycourier::ProfilePreferences::OrHash)
48
+ preferences: T.nilable(Trycourier::Recipient::Preferences::OrHash)
49
49
  ).void
50
50
  end
51
51
  attr_writer :preferences
@@ -68,7 +68,7 @@ module Trycourier
68
68
  list_id: T.nilable(String),
69
69
  locale: T.nilable(String),
70
70
  phone_number: T.nilable(String),
71
- preferences: T.nilable(Trycourier::ProfilePreferences::OrHash),
71
+ preferences: T.nilable(Trycourier::Recipient::Preferences::OrHash),
72
72
  tenant_id: T.nilable(String),
73
73
  user_id: T.nilable(String)
74
74
  ).returns(T.attached_class)
@@ -106,7 +106,7 @@ module Trycourier
106
106
  list_id: T.nilable(String),
107
107
  locale: T.nilable(String),
108
108
  phone_number: T.nilable(String),
109
- preferences: T.nilable(Trycourier::ProfilePreferences),
109
+ preferences: T.nilable(Trycourier::Recipient::Preferences),
110
110
  tenant_id: T.nilable(String),
111
111
  user_id: T.nilable(String)
112
112
  }
@@ -114,6 +114,48 @@ module Trycourier
114
114
  end
115
115
  def to_hash
116
116
  end
117
+
118
+ class Preferences < Trycourier::Internal::Type::BaseModel
119
+ OrHash =
120
+ T.type_alias do
121
+ T.any(
122
+ Trycourier::Recipient::Preferences,
123
+ Trycourier::Internal::AnyHash
124
+ )
125
+ end
126
+
127
+ sig { returns(T::Hash[Symbol, Trycourier::Preference]) }
128
+ attr_accessor :notifications
129
+
130
+ sig { returns(T.nilable(T::Hash[Symbol, Trycourier::Preference])) }
131
+ attr_accessor :categories
132
+
133
+ sig { returns(T.nilable(String)) }
134
+ attr_accessor :template_id
135
+
136
+ sig do
137
+ params(
138
+ notifications: T::Hash[Symbol, Trycourier::Preference::OrHash],
139
+ categories:
140
+ T.nilable(T::Hash[Symbol, Trycourier::Preference::OrHash]),
141
+ template_id: T.nilable(String)
142
+ ).returns(T.attached_class)
143
+ end
144
+ def self.new(notifications:, categories: nil, template_id: nil)
145
+ end
146
+
147
+ sig do
148
+ override.returns(
149
+ {
150
+ notifications: T::Hash[Symbol, Trycourier::Preference],
151
+ categories: T.nilable(T::Hash[Symbol, Trycourier::Preference]),
152
+ template_id: T.nilable(String)
153
+ }
154
+ )
155
+ end
156
+ def to_hash
157
+ end
158
+ end
117
159
  end
118
160
  end
119
161
  end
@@ -609,6 +609,12 @@ module Trycourier
609
609
  sig { returns(T.nilable(Integer)) }
610
610
  attr_accessor :duration
611
611
 
612
+ # IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Used when
613
+ # resolving opening hours expressions. Takes precedence over user profile timezone
614
+ # settings.
615
+ sig { returns(T.nilable(String)) }
616
+ attr_accessor :timezone
617
+
612
618
  # ISO 8601 timestamp or opening_hours-like format.
613
619
  sig { returns(T.nilable(String)) }
614
620
  attr_accessor :until_
@@ -616,12 +622,17 @@ module Trycourier
616
622
  sig do
617
623
  params(
618
624
  duration: T.nilable(Integer),
625
+ timezone: T.nilable(String),
619
626
  until_: T.nilable(String)
620
627
  ).returns(T.attached_class)
621
628
  end
622
629
  def self.new(
623
630
  # The duration of the delay in milliseconds.
624
631
  duration: nil,
632
+ # IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Used when
633
+ # resolving opening hours expressions. Takes precedence over user profile timezone
634
+ # settings.
635
+ timezone: nil,
625
636
  # ISO 8601 timestamp or opening_hours-like format.
626
637
  until_: nil
627
638
  )
@@ -629,7 +640,11 @@ module Trycourier
629
640
 
630
641
  sig do
631
642
  override.returns(
632
- { duration: T.nilable(Integer), until_: T.nilable(String) }
643
+ {
644
+ duration: T.nilable(Integer),
645
+ timezone: T.nilable(String),
646
+ until_: T.nilable(String)
647
+ }
633
648
  )
634
649
  end
635
650
  def to_hash
@@ -40,12 +40,12 @@ module Trycourier
40
40
  sig { returns(T.nilable(String)) }
41
41
  attr_accessor :phone_number
42
42
 
43
- sig { returns(T.nilable(Trycourier::ProfilePreferences)) }
43
+ sig { returns(T.nilable(Trycourier::UserRecipient::Preferences)) }
44
44
  attr_reader :preferences
45
45
 
46
46
  sig do
47
47
  params(
48
- preferences: T.nilable(Trycourier::ProfilePreferences::OrHash)
48
+ preferences: T.nilable(Trycourier::UserRecipient::Preferences::OrHash)
49
49
  ).void
50
50
  end
51
51
  attr_writer :preferences
@@ -68,7 +68,8 @@ module Trycourier
68
68
  list_id: T.nilable(String),
69
69
  locale: T.nilable(String),
70
70
  phone_number: T.nilable(String),
71
- preferences: T.nilable(Trycourier::ProfilePreferences::OrHash),
71
+ preferences:
72
+ T.nilable(Trycourier::UserRecipient::Preferences::OrHash),
72
73
  tenant_id: T.nilable(String),
73
74
  user_id: T.nilable(String)
74
75
  ).returns(T.attached_class)
@@ -106,7 +107,7 @@ module Trycourier
106
107
  list_id: T.nilable(String),
107
108
  locale: T.nilable(String),
108
109
  phone_number: T.nilable(String),
109
- preferences: T.nilable(Trycourier::ProfilePreferences),
110
+ preferences: T.nilable(Trycourier::UserRecipient::Preferences),
110
111
  tenant_id: T.nilable(String),
111
112
  user_id: T.nilable(String)
112
113
  }
@@ -114,6 +115,48 @@ module Trycourier
114
115
  end
115
116
  def to_hash
116
117
  end
118
+
119
+ class Preferences < Trycourier::Internal::Type::BaseModel
120
+ OrHash =
121
+ T.type_alias do
122
+ T.any(
123
+ Trycourier::UserRecipient::Preferences,
124
+ Trycourier::Internal::AnyHash
125
+ )
126
+ end
127
+
128
+ sig { returns(T::Hash[Symbol, Trycourier::Preference]) }
129
+ attr_accessor :notifications
130
+
131
+ sig { returns(T.nilable(T::Hash[Symbol, Trycourier::Preference])) }
132
+ attr_accessor :categories
133
+
134
+ sig { returns(T.nilable(String)) }
135
+ attr_accessor :template_id
136
+
137
+ sig do
138
+ params(
139
+ notifications: T::Hash[Symbol, Trycourier::Preference::OrHash],
140
+ categories:
141
+ T.nilable(T::Hash[Symbol, Trycourier::Preference::OrHash]),
142
+ template_id: T.nilable(String)
143
+ ).returns(T.attached_class)
144
+ end
145
+ def self.new(notifications:, categories: nil, template_id: nil)
146
+ end
147
+
148
+ sig do
149
+ override.returns(
150
+ {
151
+ notifications: T::Hash[Symbol, Trycourier::Preference],
152
+ categories: T.nilable(T::Hash[Symbol, Trycourier::Preference]),
153
+ template_id: T.nilable(String)
154
+ }
155
+ )
156
+ end
157
+ def to_hash
158
+ end
159
+ end
117
160
  end
118
161
  end
119
162
  end