trycourier 4.21.0 → 4.22.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 (174) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/lib/courier/client.rb +39 -0
  4. data/lib/courier/models/automations/invoke_invoke_ad_hoc_params.rb +13 -1
  5. data/lib/courier/models/automations/invoke_invoke_by_template_params.rb +13 -1
  6. data/lib/courier/models/brand_create_params.rb +13 -1
  7. data/lib/courier/models/inbox/message_delete_params.rb +22 -0
  8. data/lib/courier/models/inbox/message_restore_params.rb +22 -0
  9. data/lib/courier/models/journey_cancel_params.rb +13 -1
  10. data/lib/courier/models/journey_create_params.rb +13 -1
  11. data/lib/courier/models/journey_invoke_params.rb +13 -1
  12. data/lib/courier/models/journey_publish_params.rb +13 -1
  13. data/lib/courier/models/journeys/template_create_params.rb +13 -1
  14. data/lib/courier/models/journeys/template_publish_params.rb +13 -1
  15. data/lib/courier/models/lists/subscription_add_params.rb +13 -1
  16. data/lib/courier/models/notification_create_params.rb +13 -1
  17. data/lib/courier/models/notification_publish_params.rb +13 -1
  18. data/lib/courier/models/profile_create_params.rb +13 -1
  19. data/lib/courier/models/profiles/list_subscribe_params.rb +13 -1
  20. data/lib/courier/models/provider_create_params.rb +15 -1
  21. data/lib/courier/models/routing_strategy_create_params.rb +13 -1
  22. data/lib/courier/models/send_message_params.rb +15 -1
  23. data/lib/courier/models/users/preference_bulk_update_params.rb +15 -1
  24. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +14 -4
  25. data/lib/courier/models/users/topic_preference.rb +21 -7
  26. data/lib/courier/models/workspace_preference_create_params.rb +13 -1
  27. data/lib/courier/models/workspace_preference_publish_params.rb +13 -1
  28. data/lib/courier/models/workspace_preferences/topic_create_params.rb +13 -1
  29. data/lib/courier/models.rb +2 -0
  30. data/lib/courier/resources/audiences.rb +12 -5
  31. data/lib/courier/resources/audit_events.rb +5 -2
  32. data/lib/courier/resources/auth.rb +5 -1
  33. data/lib/courier/resources/automations/invoke.rb +47 -23
  34. data/lib/courier/resources/automations.rb +6 -1
  35. data/lib/courier/resources/brands.rb +38 -12
  36. data/lib/courier/resources/digests/schedules.rb +4 -3
  37. data/lib/courier/resources/digests.rb +2 -0
  38. data/lib/courier/resources/inbound.rb +3 -1
  39. data/lib/courier/resources/inbox/messages.rb +58 -0
  40. data/lib/courier/resources/inbox.rb +19 -0
  41. data/lib/courier/resources/journeys/templates.rb +43 -25
  42. data/lib/courier/resources/journeys.rb +73 -44
  43. data/lib/courier/resources/lists/subscriptions.rb +22 -8
  44. data/lib/courier/resources/lists.rb +14 -5
  45. data/lib/courier/resources/messages.rb +14 -14
  46. data/lib/courier/resources/notifications/checks.rb +8 -3
  47. data/lib/courier/resources/notifications.rb +48 -30
  48. data/lib/courier/resources/profiles/lists.rb +19 -8
  49. data/lib/courier/resources/profiles.rb +25 -14
  50. data/lib/courier/resources/providers/catalog.rb +4 -4
  51. data/lib/courier/resources/providers.rb +27 -18
  52. data/lib/courier/resources/requests.rb +4 -1
  53. data/lib/courier/resources/routing_strategies.rb +24 -12
  54. data/lib/courier/resources/send.rb +14 -4
  55. data/lib/courier/resources/tenants/preferences/items.rb +6 -2
  56. data/lib/courier/resources/tenants/preferences.rb +2 -0
  57. data/lib/courier/resources/tenants/templates/versions.rb +4 -7
  58. data/lib/courier/resources/tenants/templates.rb +14 -19
  59. data/lib/courier/resources/tenants.rb +14 -5
  60. data/lib/courier/resources/translations.rb +6 -2
  61. data/lib/courier/resources/users/preferences.rb +23 -42
  62. data/lib/courier/resources/users/tenants.rb +12 -10
  63. data/lib/courier/resources/users/tokens.rb +14 -6
  64. data/lib/courier/resources/users.rb +6 -0
  65. data/lib/courier/resources/workspace_preferences/topics.rb +27 -19
  66. data/lib/courier/resources/workspace_preferences.rb +40 -20
  67. data/lib/courier/version.rb +1 -1
  68. data/lib/courier.rb +4 -0
  69. data/rbi/courier/client.rbi +38 -0
  70. data/rbi/courier/models/automations/invoke_invoke_ad_hoc_params.rbi +18 -0
  71. data/rbi/courier/models/automations/invoke_invoke_by_template_params.rbi +18 -0
  72. data/rbi/courier/models/brand_create_params.rbi +18 -0
  73. data/rbi/courier/models/inbox/message_delete_params.rbi +40 -0
  74. data/rbi/courier/models/inbox/message_restore_params.rbi +40 -0
  75. data/rbi/courier/models/journey_cancel_params.rbi +31 -5
  76. data/rbi/courier/models/journey_create_params.rbi +31 -5
  77. data/rbi/courier/models/journey_invoke_params.rbi +26 -2
  78. data/rbi/courier/models/journey_publish_params.rbi +26 -2
  79. data/rbi/courier/models/journeys/template_create_params.rbi +26 -2
  80. data/rbi/courier/models/journeys/template_publish_params.rbi +23 -1
  81. data/rbi/courier/models/lists/subscription_add_params.rbi +23 -1
  82. data/rbi/courier/models/notification_create_params.rbi +31 -5
  83. data/rbi/courier/models/notification_publish_params.rbi +26 -2
  84. data/rbi/courier/models/profile_create_params.rbi +23 -1
  85. data/rbi/courier/models/profiles/list_subscribe_params.rbi +23 -1
  86. data/rbi/courier/models/provider_create_params.rbi +18 -0
  87. data/rbi/courier/models/routing_strategy_create_params.rbi +31 -5
  88. data/rbi/courier/models/send_message_params.rbi +18 -0
  89. data/rbi/courier/models/users/preference_bulk_update_params.rbi +18 -0
  90. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +14 -2
  91. data/rbi/courier/models/users/topic_preference.rbi +24 -2
  92. data/rbi/courier/models/workspace_preference_create_params.rbi +31 -5
  93. data/rbi/courier/models/workspace_preference_publish_params.rbi +31 -5
  94. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +26 -2
  95. data/rbi/courier/models.rbi +2 -0
  96. data/rbi/courier/resources/audiences.rbi +12 -5
  97. data/rbi/courier/resources/audit_events.rbi +5 -2
  98. data/rbi/courier/resources/auth.rbi +5 -1
  99. data/rbi/courier/resources/automations/invoke.rbi +48 -7
  100. data/rbi/courier/resources/automations.rbi +6 -1
  101. data/rbi/courier/resources/brands.rbi +37 -7
  102. data/rbi/courier/resources/digests/schedules.rbi +4 -3
  103. data/rbi/courier/resources/digests.rbi +2 -0
  104. data/rbi/courier/resources/inbound.rbi +3 -1
  105. data/rbi/courier/resources/inbox/messages.rbi +44 -0
  106. data/rbi/courier/resources/inbox.rbi +16 -0
  107. data/rbi/courier/resources/journeys/templates.rbi +47 -17
  108. data/rbi/courier/resources/journeys.rbi +93 -39
  109. data/rbi/courier/resources/lists/subscriptions.rbi +24 -5
  110. data/rbi/courier/resources/lists.rbi +14 -5
  111. data/rbi/courier/resources/messages.rbi +14 -14
  112. data/rbi/courier/resources/notifications/checks.rbi +8 -3
  113. data/rbi/courier/resources/notifications.rbi +58 -28
  114. data/rbi/courier/resources/profiles/lists.rbi +25 -6
  115. data/rbi/courier/resources/profiles.rbi +31 -11
  116. data/rbi/courier/resources/providers/catalog.rbi +4 -4
  117. data/rbi/courier/resources/providers.rbi +35 -19
  118. data/rbi/courier/resources/requests.rbi +4 -1
  119. data/rbi/courier/resources/routing_strategies.rbi +26 -10
  120. data/rbi/courier/resources/send.rbi +20 -3
  121. data/rbi/courier/resources/tenants/preferences/items.rbi +6 -2
  122. data/rbi/courier/resources/tenants/preferences.rbi +2 -0
  123. data/rbi/courier/resources/tenants/templates/versions.rbi +4 -7
  124. data/rbi/courier/resources/tenants/templates.rbi +14 -19
  125. data/rbi/courier/resources/tenants.rbi +14 -5
  126. data/rbi/courier/resources/translations.rbi +6 -2
  127. data/rbi/courier/resources/users/preferences.rbi +28 -40
  128. data/rbi/courier/resources/users/tenants.rbi +12 -10
  129. data/rbi/courier/resources/users/tokens.rbi +14 -6
  130. data/rbi/courier/resources/users.rbi +6 -0
  131. data/rbi/courier/resources/workspace_preferences/topics.rbi +37 -18
  132. data/rbi/courier/resources/workspace_preferences.rbi +51 -17
  133. data/sig/courier/client.rbs +2 -0
  134. data/sig/courier/models/automations/invoke_invoke_ad_hoc_params.rbs +15 -1
  135. data/sig/courier/models/automations/invoke_invoke_by_template_params.rbs +15 -1
  136. data/sig/courier/models/brand_create_params.rbs +15 -1
  137. data/sig/courier/models/inbox/message_delete_params.rbs +25 -0
  138. data/sig/courier/models/inbox/message_restore_params.rbs +25 -0
  139. data/sig/courier/models/journey_cancel_params.rbs +20 -3
  140. data/sig/courier/models/journey_create_params.rbs +20 -3
  141. data/sig/courier/models/journey_invoke_params.rbs +18 -1
  142. data/sig/courier/models/journey_publish_params.rbs +18 -1
  143. data/sig/courier/models/journeys/template_create_params.rbs +18 -1
  144. data/sig/courier/models/journeys/template_publish_params.rbs +18 -1
  145. data/sig/courier/models/lists/subscription_add_params.rbs +15 -1
  146. data/sig/courier/models/notification_create_params.rbs +20 -3
  147. data/sig/courier/models/notification_publish_params.rbs +18 -2
  148. data/sig/courier/models/profile_create_params.rbs +18 -1
  149. data/sig/courier/models/profiles/list_subscribe_params.rbs +15 -1
  150. data/sig/courier/models/provider_create_params.rbs +15 -1
  151. data/sig/courier/models/routing_strategy_create_params.rbs +20 -3
  152. data/sig/courier/models/send_message_params.rbs +17 -1
  153. data/sig/courier/models/users/preference_bulk_update_params.rbs +15 -1
  154. data/sig/courier/models/workspace_preference_create_params.rbs +20 -3
  155. data/sig/courier/models/workspace_preference_publish_params.rbs +20 -3
  156. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +18 -1
  157. data/sig/courier/models.rbs +2 -0
  158. data/sig/courier/resources/automations/invoke.rbs +4 -0
  159. data/sig/courier/resources/brands.rbs +2 -0
  160. data/sig/courier/resources/inbox/messages.rbs +19 -0
  161. data/sig/courier/resources/inbox.rbs +9 -0
  162. data/sig/courier/resources/journeys/templates.rbs +4 -0
  163. data/sig/courier/resources/journeys.rbs +8 -0
  164. data/sig/courier/resources/lists/subscriptions.rbs +2 -0
  165. data/sig/courier/resources/notifications.rbs +4 -0
  166. data/sig/courier/resources/profiles/lists.rbs +2 -0
  167. data/sig/courier/resources/profiles.rbs +2 -0
  168. data/sig/courier/resources/providers.rbs +2 -0
  169. data/sig/courier/resources/routing_strategies.rbs +2 -0
  170. data/sig/courier/resources/send.rbs +2 -0
  171. data/sig/courier/resources/users/preferences.rbs +2 -0
  172. data/sig/courier/resources/workspace_preferences/topics.rbs +2 -0
  173. data/sig/courier/resources/workspace_preferences.rbs +4 -0
  174. metadata +14 -2
@@ -11,15 +11,41 @@ module Courier
11
11
  T.any(Courier::NotificationCreateParams, Courier::Internal::AnyHash)
12
12
  end
13
13
 
14
+ sig { returns(T.nilable(String)) }
15
+ attr_reader :idempotency_key
16
+
17
+ sig { params(idempotency_key: String).void }
18
+ attr_writer :idempotency_key
19
+
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :x_idempotency_expiration
22
+
23
+ sig { params(x_idempotency_expiration: String).void }
24
+ attr_writer :x_idempotency_expiration
25
+
14
26
  sig do
15
- params(request_options: Courier::RequestOptions::OrHash).returns(
16
- T.attached_class
17
- )
27
+ params(
28
+ idempotency_key: String,
29
+ x_idempotency_expiration: String,
30
+ request_options: Courier::RequestOptions::OrHash
31
+ ).returns(T.attached_class)
18
32
  end
19
- def self.new(request_options: {})
33
+ def self.new(
34
+ idempotency_key: nil,
35
+ x_idempotency_expiration: nil,
36
+ request_options: {}
37
+ )
20
38
  end
21
39
 
22
- sig { override.returns({ request_options: Courier::RequestOptions }) }
40
+ sig do
41
+ override.returns(
42
+ {
43
+ idempotency_key: String,
44
+ x_idempotency_expiration: String,
45
+ request_options: Courier::RequestOptions
46
+ }
47
+ )
48
+ end
23
49
  def to_hash
24
50
  end
25
51
  end
@@ -14,18 +14,42 @@ module Courier
14
14
  sig { returns(String) }
15
15
  attr_accessor :id
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
30
  params(
19
31
  id: String,
32
+ idempotency_key: String,
33
+ x_idempotency_expiration: String,
20
34
  request_options: Courier::RequestOptions::OrHash
21
35
  ).returns(T.attached_class)
22
36
  end
23
- def self.new(id:, request_options: {})
37
+ def self.new(
38
+ id:,
39
+ idempotency_key: nil,
40
+ x_idempotency_expiration: nil,
41
+ request_options: {}
42
+ )
24
43
  end
25
44
 
26
45
  sig do
27
46
  override.returns(
28
- { id: String, request_options: Courier::RequestOptions }
47
+ {
48
+ id: String,
49
+ idempotency_key: String,
50
+ x_idempotency_expiration: String,
51
+ request_options: Courier::RequestOptions
52
+ }
29
53
  )
30
54
  end
31
55
  def to_hash
@@ -17,14 +17,34 @@ module Courier
17
17
  sig { returns(T::Hash[Symbol, T.anything]) }
18
18
  attr_accessor :profile
19
19
 
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :idempotency_key
22
+
23
+ sig { params(idempotency_key: String).void }
24
+ attr_writer :idempotency_key
25
+
26
+ sig { returns(T.nilable(String)) }
27
+ attr_reader :x_idempotency_expiration
28
+
29
+ sig { params(x_idempotency_expiration: String).void }
30
+ attr_writer :x_idempotency_expiration
31
+
20
32
  sig do
21
33
  params(
22
34
  user_id: String,
23
35
  profile: T::Hash[Symbol, T.anything],
36
+ idempotency_key: String,
37
+ x_idempotency_expiration: String,
24
38
  request_options: Courier::RequestOptions::OrHash
25
39
  ).returns(T.attached_class)
26
40
  end
27
- def self.new(user_id:, profile:, request_options: {})
41
+ def self.new(
42
+ user_id:,
43
+ profile:,
44
+ idempotency_key: nil,
45
+ x_idempotency_expiration: nil,
46
+ request_options: {}
47
+ )
28
48
  end
29
49
 
30
50
  sig do
@@ -32,6 +52,8 @@ module Courier
32
52
  {
33
53
  user_id: String,
34
54
  profile: T::Hash[Symbol, T.anything],
55
+ idempotency_key: String,
56
+ x_idempotency_expiration: String,
35
57
  request_options: Courier::RequestOptions
36
58
  }
37
59
  )
@@ -21,14 +21,34 @@ module Courier
21
21
  sig { returns(T::Array[Courier::SubscribeToListsRequestItem]) }
22
22
  attr_accessor :lists
23
23
 
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :idempotency_key
26
+
27
+ sig { params(idempotency_key: String).void }
28
+ attr_writer :idempotency_key
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :x_idempotency_expiration
32
+
33
+ sig { params(x_idempotency_expiration: String).void }
34
+ attr_writer :x_idempotency_expiration
35
+
24
36
  sig do
25
37
  params(
26
38
  user_id: String,
27
39
  lists: T::Array[Courier::SubscribeToListsRequestItem::OrHash],
40
+ idempotency_key: String,
41
+ x_idempotency_expiration: String,
28
42
  request_options: Courier::RequestOptions::OrHash
29
43
  ).returns(T.attached_class)
30
44
  end
31
- def self.new(user_id:, lists:, request_options: {})
45
+ def self.new(
46
+ user_id:,
47
+ lists:,
48
+ idempotency_key: nil,
49
+ x_idempotency_expiration: nil,
50
+ request_options: {}
51
+ )
32
52
  end
33
53
 
34
54
  sig do
@@ -36,6 +56,8 @@ module Courier
36
56
  {
37
57
  user_id: String,
38
58
  lists: T::Array[Courier::SubscribeToListsRequestItem],
59
+ idempotency_key: String,
60
+ x_idempotency_expiration: String,
39
61
  request_options: Courier::RequestOptions
40
62
  }
41
63
  )
@@ -39,12 +39,26 @@ module Courier
39
39
  sig { params(title: String).void }
40
40
  attr_writer :title
41
41
 
42
+ sig { returns(T.nilable(String)) }
43
+ attr_reader :idempotency_key
44
+
45
+ sig { params(idempotency_key: String).void }
46
+ attr_writer :idempotency_key
47
+
48
+ sig { returns(T.nilable(String)) }
49
+ attr_reader :x_idempotency_expiration
50
+
51
+ sig { params(x_idempotency_expiration: String).void }
52
+ attr_writer :x_idempotency_expiration
53
+
42
54
  sig do
43
55
  params(
44
56
  provider: String,
45
57
  alias_: String,
46
58
  settings: T::Hash[Symbol, T.anything],
47
59
  title: String,
60
+ idempotency_key: String,
61
+ x_idempotency_expiration: String,
48
62
  request_options: Courier::RequestOptions::OrHash
49
63
  ).returns(T.attached_class)
50
64
  end
@@ -60,6 +74,8 @@ module Courier
60
74
  settings: nil,
61
75
  # Optional display title. Omit to use "Default Configuration".
62
76
  title: nil,
77
+ idempotency_key: nil,
78
+ x_idempotency_expiration: nil,
63
79
  request_options: {}
64
80
  )
65
81
  end
@@ -71,6 +87,8 @@ module Courier
71
87
  alias_: String,
72
88
  settings: T::Hash[Symbol, T.anything],
73
89
  title: String,
90
+ idempotency_key: String,
91
+ x_idempotency_expiration: String,
74
92
  request_options: Courier::RequestOptions
75
93
  }
76
94
  )
@@ -14,15 +14,41 @@ module Courier
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
- params(request_options: Courier::RequestOptions::OrHash).returns(
19
- T.attached_class
20
- )
30
+ params(
31
+ idempotency_key: String,
32
+ x_idempotency_expiration: String,
33
+ request_options: Courier::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
21
35
  end
22
- def self.new(request_options: {})
36
+ def self.new(
37
+ idempotency_key: nil,
38
+ x_idempotency_expiration: nil,
39
+ request_options: {}
40
+ )
23
41
  end
24
42
 
25
- sig { override.returns({ request_options: Courier::RequestOptions }) }
43
+ sig do
44
+ override.returns(
45
+ {
46
+ idempotency_key: String,
47
+ x_idempotency_expiration: String,
48
+ request_options: Courier::RequestOptions
49
+ }
50
+ )
51
+ end
26
52
  def to_hash
27
53
  end
28
54
  end
@@ -19,9 +19,23 @@ module Courier
19
19
  sig { params(message: Courier::SendMessageParams::Message::OrHash).void }
20
20
  attr_writer :message
21
21
 
22
+ sig { returns(T.nilable(String)) }
23
+ attr_reader :idempotency_key
24
+
25
+ sig { params(idempotency_key: String).void }
26
+ attr_writer :idempotency_key
27
+
28
+ sig { returns(T.nilable(String)) }
29
+ attr_reader :x_idempotency_expiration
30
+
31
+ sig { params(x_idempotency_expiration: String).void }
32
+ attr_writer :x_idempotency_expiration
33
+
22
34
  sig do
23
35
  params(
24
36
  message: Courier::SendMessageParams::Message::OrHash,
37
+ idempotency_key: String,
38
+ x_idempotency_expiration: String,
25
39
  request_options: Courier::RequestOptions::OrHash
26
40
  ).returns(T.attached_class)
27
41
  end
@@ -29,6 +43,8 @@ module Courier
29
43
  # The message property has the following primary top-level properties. They define
30
44
  # the destination and content of the message.
31
45
  message:,
46
+ idempotency_key: nil,
47
+ x_idempotency_expiration: nil,
32
48
  request_options: {}
33
49
  )
34
50
  end
@@ -37,6 +53,8 @@ module Courier
37
53
  override.returns(
38
54
  {
39
55
  message: Courier::SendMessageParams::Message,
56
+ idempotency_key: String,
57
+ x_idempotency_expiration: String,
40
58
  request_options: Courier::RequestOptions
41
59
  }
42
60
  )
@@ -29,6 +29,18 @@ module Courier
29
29
  sig { returns(T.nilable(String)) }
30
30
  attr_accessor :tenant_id
31
31
 
32
+ sig { returns(T.nilable(String)) }
33
+ attr_reader :idempotency_key
34
+
35
+ sig { params(idempotency_key: String).void }
36
+ attr_writer :idempotency_key
37
+
38
+ sig { returns(T.nilable(String)) }
39
+ attr_reader :x_idempotency_expiration
40
+
41
+ sig { params(x_idempotency_expiration: String).void }
42
+ attr_writer :x_idempotency_expiration
43
+
32
44
  sig do
33
45
  params(
34
46
  user_id: String,
@@ -37,6 +49,8 @@ module Courier
37
49
  Courier::Users::PreferenceBulkUpdateParams::Topic::OrHash
38
50
  ],
39
51
  tenant_id: T.nilable(String),
52
+ idempotency_key: String,
53
+ x_idempotency_expiration: String,
40
54
  request_options: Courier::RequestOptions::OrHash
41
55
  ).returns(T.attached_class)
42
56
  end
@@ -47,6 +61,8 @@ module Courier
47
61
  topics:,
48
62
  # Update the preferences of a user for this specific tenant context.
49
63
  tenant_id: nil,
64
+ idempotency_key: nil,
65
+ x_idempotency_expiration: nil,
50
66
  request_options: {}
51
67
  )
52
68
  end
@@ -58,6 +74,8 @@ module Courier
58
74
  topics:
59
75
  T::Array[Courier::Users::PreferenceBulkUpdateParams::Topic],
60
76
  tenant_id: T.nilable(String),
77
+ idempotency_key: String,
78
+ x_idempotency_expiration: String,
61
79
  request_options: Courier::RequestOptions
62
80
  }
63
81
  )
@@ -81,10 +81,14 @@ module Courier
81
81
  )
82
82
  end
83
83
 
84
+ # The subscription status to set: OPTED_IN or OPTED_OUT. REQUIRED is a topic-level
85
+ # default, not a user choice; the API rejects opting a user out of a REQUIRED
86
+ # topic.
84
87
  sig { returns(Courier::PreferenceStatus::OrSymbol) }
85
88
  attr_accessor :status
86
89
 
87
- # The Channels a user has chosen to receive notifications through for this topic
90
+ # The channels to deliver this topic on when has_custom_routing is true. One or
91
+ # more of: direct_message, email, push, sms, webhook, inbox.
88
92
  sig do
89
93
  returns(
90
94
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol])
@@ -92,6 +96,8 @@ module Courier
92
96
  end
93
97
  attr_accessor :custom_routing
94
98
 
99
+ # Set to true to route this topic to the channels in custom_routing instead of the
100
+ # topic's default routing.
95
101
  sig { returns(T.nilable(T::Boolean)) }
96
102
  attr_accessor :has_custom_routing
97
103
 
@@ -104,9 +110,15 @@ module Courier
104
110
  ).returns(T.attached_class)
105
111
  end
106
112
  def self.new(
113
+ # The subscription status to set: OPTED_IN or OPTED_OUT. REQUIRED is a topic-level
114
+ # default, not a user choice; the API rejects opting a user out of a REQUIRED
115
+ # topic.
107
116
  status:,
108
- # The Channels a user has chosen to receive notifications through for this topic
117
+ # The channels to deliver this topic on when has_custom_routing is true. One or
118
+ # more of: direct_message, email, push, sms, webhook, inbox.
109
119
  custom_routing: nil,
120
+ # Set to true to route this topic to the channels in custom_routing instead of the
121
+ # topic's default routing.
110
122
  has_custom_routing: nil
111
123
  )
112
124
  end
@@ -9,19 +9,28 @@ module Courier
9
9
  T.any(Courier::Users::TopicPreference, Courier::Internal::AnyHash)
10
10
  end
11
11
 
12
+ # The topic's default status, returned on reads. It applies whenever the user has
13
+ # no override of their own (status equals this value).
12
14
  sig { returns(Courier::PreferenceStatus::TaggedSymbol) }
13
15
  attr_accessor :default_status
14
16
 
17
+ # The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the
18
+ # user's own choice; REQUIRED is a topic-level default set in the preferences
19
+ # editor, not a user choice.
15
20
  sig { returns(Courier::PreferenceStatus::TaggedSymbol) }
16
21
  attr_accessor :status
17
22
 
23
+ # The unique identifier of the subscription topic this preference applies to.
18
24
  sig { returns(String) }
19
25
  attr_accessor :topic_id
20
26
 
27
+ # The display name of the subscription topic, returned on reads.
21
28
  sig { returns(String) }
22
29
  attr_accessor :topic_name
23
30
 
24
- # The Channels a user has chosen to receive notifications through for this topic
31
+ # The channels the user has chosen to receive this topic on, present only when
32
+ # has_custom_routing is true. One or more of: direct_message, email, push, sms,
33
+ # webhook, inbox.
25
34
  sig do
26
35
  returns(
27
36
  T.nilable(T::Array[Courier::ChannelClassification::TaggedSymbol])
@@ -29,6 +38,8 @@ module Courier
29
38
  end
30
39
  attr_accessor :custom_routing
31
40
 
41
+ # Whether the user has chosen specific delivery channels for this topic (listed in
42
+ # custom_routing) rather than the topic's default routing.
32
43
  sig { returns(T.nilable(T::Boolean)) }
33
44
  attr_accessor :has_custom_routing
34
45
 
@@ -44,12 +55,23 @@ module Courier
44
55
  ).returns(T.attached_class)
45
56
  end
46
57
  def self.new(
58
+ # The topic's default status, returned on reads. It applies whenever the user has
59
+ # no override of their own (status equals this value).
47
60
  default_status:,
61
+ # The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the
62
+ # user's own choice; REQUIRED is a topic-level default set in the preferences
63
+ # editor, not a user choice.
48
64
  status:,
65
+ # The unique identifier of the subscription topic this preference applies to.
49
66
  topic_id:,
67
+ # The display name of the subscription topic, returned on reads.
50
68
  topic_name:,
51
- # The Channels a user has chosen to receive notifications through for this topic
69
+ # The channels the user has chosen to receive this topic on, present only when
70
+ # has_custom_routing is true. One or more of: direct_message, email, push, sms,
71
+ # webhook, inbox.
52
72
  custom_routing: nil,
73
+ # Whether the user has chosen specific delivery channels for this topic (listed in
74
+ # custom_routing) rather than the topic's default routing.
53
75
  has_custom_routing: nil
54
76
  )
55
77
  end
@@ -14,15 +14,41 @@ module Courier
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
- params(request_options: Courier::RequestOptions::OrHash).returns(
19
- T.attached_class
20
- )
30
+ params(
31
+ idempotency_key: String,
32
+ x_idempotency_expiration: String,
33
+ request_options: Courier::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
21
35
  end
22
- def self.new(request_options: {})
36
+ def self.new(
37
+ idempotency_key: nil,
38
+ x_idempotency_expiration: nil,
39
+ request_options: {}
40
+ )
23
41
  end
24
42
 
25
- sig { override.returns({ request_options: Courier::RequestOptions }) }
43
+ sig do
44
+ override.returns(
45
+ {
46
+ idempotency_key: String,
47
+ x_idempotency_expiration: String,
48
+ request_options: Courier::RequestOptions
49
+ }
50
+ )
51
+ end
26
52
  def to_hash
27
53
  end
28
54
  end
@@ -14,15 +14,41 @@ module Courier
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
- params(request_options: Courier::RequestOptions::OrHash).returns(
19
- T.attached_class
20
- )
30
+ params(
31
+ idempotency_key: String,
32
+ x_idempotency_expiration: String,
33
+ request_options: Courier::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
21
35
  end
22
- def self.new(request_options: {})
36
+ def self.new(
37
+ idempotency_key: nil,
38
+ x_idempotency_expiration: nil,
39
+ request_options: {}
40
+ )
23
41
  end
24
42
 
25
- sig { override.returns({ request_options: Courier::RequestOptions }) }
43
+ sig do
44
+ override.returns(
45
+ {
46
+ idempotency_key: String,
47
+ x_idempotency_expiration: String,
48
+ request_options: Courier::RequestOptions
49
+ }
50
+ )
51
+ end
26
52
  def to_hash
27
53
  end
28
54
  end
@@ -18,18 +18,42 @@ module Courier
18
18
  sig { returns(String) }
19
19
  attr_accessor :section_id
20
20
 
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :idempotency_key
23
+
24
+ sig { params(idempotency_key: String).void }
25
+ attr_writer :idempotency_key
26
+
27
+ sig { returns(T.nilable(String)) }
28
+ attr_reader :x_idempotency_expiration
29
+
30
+ sig { params(x_idempotency_expiration: String).void }
31
+ attr_writer :x_idempotency_expiration
32
+
21
33
  sig do
22
34
  params(
23
35
  section_id: String,
36
+ idempotency_key: String,
37
+ x_idempotency_expiration: String,
24
38
  request_options: Courier::RequestOptions::OrHash
25
39
  ).returns(T.attached_class)
26
40
  end
27
- def self.new(section_id:, request_options: {})
41
+ def self.new(
42
+ section_id:,
43
+ idempotency_key: nil,
44
+ x_idempotency_expiration: nil,
45
+ request_options: {}
46
+ )
28
47
  end
29
48
 
30
49
  sig do
31
50
  override.returns(
32
- { section_id: String, request_options: Courier::RequestOptions }
51
+ {
52
+ section_id: String,
53
+ idempotency_key: String,
54
+ x_idempotency_expiration: String,
55
+ request_options: Courier::RequestOptions
56
+ }
33
57
  )
34
58
  end
35
59
  def to_hash
@@ -149,6 +149,8 @@ module Courier
149
149
 
150
150
  InboundTrackEventParams = Courier::Models::InboundTrackEventParams
151
151
 
152
+ Inbox = Courier::Models::Inbox
153
+
152
154
  Intercom = Courier::Models::Intercom
153
155
 
154
156
  IntercomRecipient = Courier::Models::IntercomRecipient
@@ -2,8 +2,11 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Define filter-based groups whose membership Courier recalculates as user
6
+ # profiles change.
5
7
  class Audiences
6
- # Returns the specified audience by id.
8
+ # Returns one audience with its name, description, and the filter and AND or OR
9
+ # operator that decide which users belong to it.
7
10
  sig do
8
11
  params(
9
12
  audience_id: String,
@@ -17,7 +20,8 @@ module Courier
17
20
  )
18
21
  end
19
22
 
20
- # Creates or updates audience.
23
+ # Creates or replaces an audience from a filter and an AND or OR operator.
24
+ # Membership recalculates automatically as profiles change.
21
25
  sig do
22
26
  params(
23
27
  audience_id: String,
@@ -46,7 +50,8 @@ module Courier
46
50
  )
47
51
  end
48
52
 
49
- # Get the audiences associated with the authorization token.
53
+ # Returns the audiences in the workspace with paging. Audiences are filter-based
54
+ # groups that recalculate as user profiles change.
50
55
  sig do
51
56
  params(
52
57
  cursor: T.nilable(String),
@@ -60,7 +65,8 @@ module Courier
60
65
  )
61
66
  end
62
67
 
63
- # Deletes the specified audience.
68
+ # Deletes an audience permanently, so update any caller sending to it by audience
69
+ # id first. Those sends fail once the audience is gone.
64
70
  sig do
65
71
  params(
66
72
  audience_id: String,
@@ -74,7 +80,8 @@ module Courier
74
80
  )
75
81
  end
76
82
 
77
- # Get list of members of an audience.
83
+ # Returns the users currently matching an audience filter, with paging. Membership
84
+ # is recalculated, so results shift as profiles change.
78
85
  sig do
79
86
  params(
80
87
  audience_id: String,