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
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Users
6
+ # Read and write a single user's notification preferences, per topic and per
7
+ # channel.
6
8
  class Preferences
7
- # Fetch all user preferences.
9
+ # Returns a user's preference overrides with paging, one entry per subscription
10
+ # topic they have set a choice for.
8
11
  sig do
9
12
  params(
10
13
  user_id: String,
@@ -22,23 +25,8 @@ module Courier
22
25
  )
23
26
  end
24
27
 
25
- # Replace a user's complete set of preference overrides in a single request. The
26
- # topics in the request body become the recipient's entire set of overrides:
27
- # listed topics are created or updated, and every existing override that is not
28
- # included in the body is reset to its topic default. Submitting an empty `topics`
29
- # array is a valid clear-all that resets every existing override.
30
- #
31
- # This operation is validation-atomic (all-or-nothing): structural validation
32
- # fails fast with a single `400`, and if any topic is semantically invalid (an
33
- # unknown topic, a `REQUIRED` topic that cannot be opted out, or a custom routing
34
- # request that is not available on the workspace's plan) the request returns a
35
- # single `400` aggregating every failure in `errors` and writes nothing. On
36
- # success it returns `200` with `items` (the complete resulting override set) and
37
- # `deleted` (the ids of the overrides that were reset to default).
38
- #
39
- # Every `topic_id` in the response — in `items`, `deleted`, and any `errors` — is
40
- # returned in Courier's canonical topic id form, regardless of the form supplied
41
- # in the request.
28
+ # Replaces a user's entire set of preference overrides. Any topic you leave out is
29
+ # reset to its default, so send the full set rather than a subset.
42
30
  sig do
43
31
  params(
44
32
  user_id: String,
@@ -64,23 +52,8 @@ module Courier
64
52
  )
65
53
  end
66
54
 
67
- # Additively create or update a user's preferences for one or more subscription
68
- # topics in a single request. Only the topics included in the request body are
69
- # created or updated; any existing overrides for topics not listed are left
70
- # untouched.
71
- #
72
- # Structural validation of the request body fails fast with a single `400`. Beyond
73
- # that, each topic is processed independently (partial-success, not
74
- # all-or-nothing): valid topics are written and returned in `items`, while topics
75
- # that cannot be applied are collected in `errors` with a per-topic `reason` (for
76
- # example an unknown topic, a `REQUIRED` topic that cannot be opted out, a custom
77
- # routing request that is not available on the workspace's plan, or a write
78
- # failure). The request therefore returns `200` with both lists whenever the body
79
- # is structurally valid.
80
- #
81
- # Every `topic_id` in the response — in both `items` and `errors` — is returned in
82
- # Courier's canonical topic id form, regardless of the form supplied in the
83
- # request.
55
+ # Adds or updates a user's preferences for several subscription topics at once.
56
+ # Topics you leave out keep whatever they were set to before.
84
57
  sig do
85
58
  params(
86
59
  user_id: String,
@@ -89,6 +62,8 @@ module Courier
89
62
  Courier::Users::PreferenceBulkUpdateParams::Topic::OrHash
90
63
  ],
91
64
  tenant_id: T.nilable(String),
65
+ idempotency_key: String,
66
+ x_idempotency_expiration: String,
92
67
  request_options: Courier::RequestOptions::OrHash
93
68
  ).returns(Courier::Models::Users::PreferenceBulkUpdateResponse)
94
69
  end
@@ -101,13 +76,24 @@ module Courier
101
76
  topics:,
102
77
  # Query param: Update the preferences of a user for this specific tenant context.
103
78
  tenant_id: nil,
79
+ # Header param: A unique key that makes this request idempotent. If Courier
80
+ # receives another request with the same `Idempotency-Key`, it returns the stored
81
+ # response from the first request without performing the operation again
82
+ # (including the original status code and any error). Use it to safely retry
83
+ # `POST` requests after network failures without risking duplicate sends. The key
84
+ # is scoped to this endpoint.
85
+ idempotency_key: nil,
86
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
87
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
88
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
89
+ # maximum is 1 year.
90
+ x_idempotency_expiration: nil,
104
91
  request_options: {}
105
92
  )
106
93
  end
107
94
 
108
- # Remove a user's preferences for a specific subscription topic, resetting the
109
- # topic to its effective default. This operation is idempotent: deleting a
110
- # preference that does not exist succeeds with no error.
95
+ # Removes a user's override for one subscription topic, resetting it to the
96
+ # effective default from the tenant or workspace.
111
97
  sig do
112
98
  params(
113
99
  topic_id: String,
@@ -128,7 +114,8 @@ module Courier
128
114
  )
129
115
  end
130
116
 
131
- # Fetch user preferences for a specific subscription topic.
117
+ # Returns a user's opt-in status and channel choices for one subscription topic,
118
+ # or the effective default if they have set no override.
132
119
  sig do
133
120
  params(
134
121
  topic_id: String,
@@ -149,7 +136,8 @@ module Courier
149
136
  )
150
137
  end
151
138
 
152
- # Update or Create user preferences for a specific subscription topic.
139
+ # Sets a user's opt-in status and channel choices for one subscription topic,
140
+ # overriding the tenant default for that topic only.
153
141
  sig do
154
142
  params(
155
143
  topic_id: String,
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Users
6
+ # Associate a user with one or more tenants, and read or remove those
7
+ # associations.
6
8
  class Tenants
7
- # Returns a paginated list of user tenant associations.
9
+ # Returns the tenants a user belongs to, with cursor paging. A user can belong to
10
+ # many tenants, each with its own profile and preferences.
8
11
  sig do
9
12
  params(
10
13
  user_id: String,
@@ -24,9 +27,8 @@ module Courier
24
27
  )
25
28
  end
26
29
 
27
- # This endpoint is used to add a user to multiple tenants in one call. A custom
28
- # profile can also be supplied for each tenant. This profile will be merged with
29
- # the user's main profile when sending to the user with that tenant.
30
+ # Adds a user to several tenants in one call, each optionally with a per-tenant
31
+ # profile that overrides their workspace profile.
30
32
  sig do
31
33
  params(
32
34
  user_id: String,
@@ -42,10 +44,8 @@ module Courier
42
44
  )
43
45
  end
44
46
 
45
- # This endpoint is used to add a single tenant.
46
- #
47
- # A custom profile can also be supplied with the tenant. This profile will be
48
- # merged with the user's main profile when sending to the user with that tenant.
47
+ # Adds a user to one tenant, optionally with a tenant-specific profile that
48
+ # overrides their workspace profile for sends in that tenant.
49
49
  sig do
50
50
  params(
51
51
  tenant_id: String,
@@ -65,7 +65,8 @@ module Courier
65
65
  )
66
66
  end
67
67
 
68
- # Removes a user from any tenants they may have been associated with.
68
+ # Removes a user from every tenant they belong to in one call. Their
69
+ # workspace-level profile is a separate resource.
69
70
  sig do
70
71
  params(
71
72
  user_id: String,
@@ -79,7 +80,8 @@ module Courier
79
80
  )
80
81
  end
81
82
 
82
- # Removes a user from the supplied tenant.
83
+ # Removes a user from one tenant. Their other tenant memberships and workspace
84
+ # profile are managed through separate endpoints.
83
85
  sig do
84
86
  params(
85
87
  tenant_id: String,
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Users
6
+ # Register and manage the APNS and FCM device tokens Courier delivers push
7
+ # notifications to.
6
8
  class Tokens
7
- # Get single token available for a `:token`
9
+ # Returns one device token with its provider key, status and status reason, expiry
10
+ # date, and any properties stored alongside it.
8
11
  sig do
9
12
  params(
10
13
  token: String,
@@ -21,7 +24,8 @@ module Courier
21
24
  )
22
25
  end
23
26
 
24
- # Apply a JSON Patch (RFC 6902) to the specified token.
27
+ # Applies a JSON Patch to a device token, changing its status, expiry, or
28
+ # properties without re-registering it.
25
29
  sig do
26
30
  params(
27
31
  token: String,
@@ -41,7 +45,8 @@ module Courier
41
45
  )
42
46
  end
43
47
 
44
- # Gets all tokens available for a :user_id
48
+ # Returns every device token registered for a user, each with its provider key,
49
+ # status, and expiry date.
45
50
  sig do
46
51
  params(
47
52
  user_id: String,
@@ -55,7 +60,8 @@ module Courier
55
60
  )
56
61
  end
57
62
 
58
- # Delete User Token
63
+ # Deletes one device token for a user, addressed by the token value, so push sends
64
+ # no longer target that device.
59
65
  sig do
60
66
  params(
61
67
  token: String,
@@ -72,7 +78,8 @@ module Courier
72
78
  )
73
79
  end
74
80
 
75
- # Adds multiple tokens to a user and overwrites matching existing tokens.
81
+ # Registers several device tokens for a user in one call, overwriting any stored
82
+ # token with a matching value.
76
83
  sig do
77
84
  params(
78
85
  user_id: String,
@@ -86,7 +93,8 @@ module Courier
86
93
  )
87
94
  end
88
95
 
89
- # Adds a single token to a user and overwrites a matching existing token.
96
+ # Registers one device token for a user against a provider key, overwriting the
97
+ # token if it already exists. Push sends resolve tokens per user.
90
98
  sig do
91
99
  params(
92
100
  token: String,
@@ -3,12 +3,18 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Users
6
+ # Read and write a single user's notification preferences, per topic and per
7
+ # channel.
6
8
  sig { returns(Courier::Resources::Users::Preferences) }
7
9
  attr_reader :preferences
8
10
 
11
+ # Associate a user with one or more tenants, and read or remove those
12
+ # associations.
9
13
  sig { returns(Courier::Resources::Users::Tenants) }
10
14
  attr_reader :tenants
11
15
 
16
+ # Register and manage the APNS and FCM device tokens Courier delivers push
17
+ # notifications to.
12
18
  sig { returns(Courier::Resources::Users::Tokens) }
13
19
  attr_reader :tokens
14
20
 
@@ -3,10 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class WorkspacePreferences
6
+ # Manage the workspace catalog of subscription topics, the sections that group
7
+ # them, and publishing the preference page.
6
8
  class Topics
7
- # Create a subscription preference topic inside a workspace preference. Fails with
8
- # 404 if the workspace preference does not exist. The topic id is generated and
9
- # returned.
9
+ # Creates a subscription topic inside a workspace preference. The default status
10
+ # sets whether users start opted in, opted out, or required.
10
11
  sig do
11
12
  params(
12
13
  section_id: String,
@@ -24,34 +25,51 @@ module Courier
24
25
  routing_options:
25
26
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
26
27
  topic_data: T.nilable(T::Hash[Symbol, T.anything]),
28
+ idempotency_key: String,
29
+ x_idempotency_expiration: String,
27
30
  request_options: Courier::RequestOptions::OrHash
28
31
  ).returns(Courier::WorkspacePreferenceTopicGetResponse)
29
32
  end
30
33
  def create(
31
- # Id of the workspace preference to create the topic in.
34
+ # Path param: Id of the workspace preference to create the topic in.
32
35
  section_id,
33
- # The default subscription status applied when a recipient has not set their own.
36
+ # Body param: The default subscription status applied when a recipient has not set
37
+ # their own.
34
38
  default_status:,
35
- # Human-readable name for the preference topic.
39
+ # Body param: Human-readable name for the preference topic.
36
40
  name:,
37
- # Preference controls a recipient may customize for this topic. Defaults to empty
38
- # if omitted.
41
+ # Body param: Preference controls a recipient may customize for this topic.
42
+ # Defaults to empty if omitted.
39
43
  allowed_preferences: nil,
40
- # Optional description shown under the topic on the hosted preferences page.
44
+ # Body param: Optional description shown under the topic on the hosted preferences
45
+ # page.
41
46
  description: nil,
42
- # Whether to include a list-unsubscribe header on emails for this topic.
47
+ # Body param: Whether to include a list-unsubscribe header on emails for this
48
+ # topic.
43
49
  include_unsubscribe_header: nil,
44
- # Default channels delivered for this topic. Defaults to empty if omitted.
50
+ # Body param: Default channels delivered for this topic. Defaults to empty if
51
+ # omitted.
45
52
  routing_options: nil,
46
- # Arbitrary metadata associated with the topic.
53
+ # Body param: Arbitrary metadata associated with the topic.
47
54
  topic_data: nil,
55
+ # Header param: A unique key that makes this request idempotent. If Courier
56
+ # receives another request with the same `Idempotency-Key`, it returns the stored
57
+ # response from the first request without performing the operation again
58
+ # (including the original status code and any error). Use it to safely retry
59
+ # `POST` requests after network failures without risking duplicate sends. The key
60
+ # is scoped to this endpoint.
61
+ idempotency_key: nil,
62
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
63
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
64
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
65
+ # maximum is 1 year.
66
+ x_idempotency_expiration: nil,
48
67
  request_options: {}
49
68
  )
50
69
  end
51
70
 
52
- # Retrieve a topic within a workspace preference. Returns 404 if the workspace
53
- # preference does not exist, the topic does not exist, or the topic belongs to a
54
- # different workspace preference.
71
+ # Returns one subscription topic with its default status, routing options, allowed
72
+ # preferences, and unsubscribe header setting.
55
73
  sig do
56
74
  params(
57
75
  topic_id: String,
@@ -68,7 +86,8 @@ module Courier
68
86
  )
69
87
  end
70
88
 
71
- # List the topics in a workspace preference.
89
+ # Returns the subscription topics inside a workspace preference, each with its
90
+ # default status and routing options.
72
91
  sig do
73
92
  params(
74
93
  section_id: String,
@@ -82,8 +101,8 @@ module Courier
82
101
  )
83
102
  end
84
103
 
85
- # Archive a topic and remove it from its workspace preference. Same 404 rules as
86
- # GET.
104
+ # Archives a subscription topic and removes it from its workspace preference,
105
+ # addressed by section id and topic id.
87
106
  sig do
88
107
  params(
89
108
  topic_id: String,
@@ -2,13 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage the workspace catalog of subscription topics, the sections that group
6
+ # them, and publishing the preference page.
5
7
  class WorkspacePreferences
8
+ # Manage the workspace catalog of subscription topics, the sections that group
9
+ # them, and publishing the preference page.
6
10
  sig { returns(Courier::Resources::WorkspacePreferences::Topics) }
7
11
  attr_reader :topics
8
12
 
9
- # Create a workspace preference. The workspace preference id is generated and
10
- # returned. Topics are created inside a workspace preference via POST
11
- # /preferences/sections/{section_id}/topics.
13
+ # Creates a workspace preference and returns its generated id. Add subscription
14
+ # topics to it afterwards with the topics endpoint.
12
15
  sig do
13
16
  params(
14
17
  name: String,
@@ -16,23 +19,41 @@ module Courier
16
19
  has_custom_routing: T.nilable(T::Boolean),
17
20
  routing_options:
18
21
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
22
+ idempotency_key: String,
23
+ x_idempotency_expiration: String,
19
24
  request_options: Courier::RequestOptions::OrHash
20
25
  ).returns(Courier::WorkspacePreferenceGetResponse)
21
26
  end
22
27
  def create(
23
- # Human-readable name for the workspace preference.
28
+ # Body param: Human-readable name for the workspace preference.
24
29
  name:,
25
- # Optional description shown under the section on the hosted preferences page.
30
+ # Body param: Optional description shown under the section on the hosted
31
+ # preferences page.
26
32
  description: nil,
27
- # Whether the workspace preference defines custom routing for its topics.
33
+ # Body param: Whether the workspace preference defines custom routing for its
34
+ # topics.
28
35
  has_custom_routing: nil,
29
- # Default channels for the workspace preference. Defaults to empty if omitted.
36
+ # Body param: Default channels for the workspace preference. Defaults to empty if
37
+ # omitted.
30
38
  routing_options: nil,
39
+ # Header param: A unique key that makes this request idempotent. If Courier
40
+ # receives another request with the same `Idempotency-Key`, it returns the stored
41
+ # response from the first request without performing the operation again
42
+ # (including the original status code and any error). Use it to safely retry
43
+ # `POST` requests after network failures without risking duplicate sends. The key
44
+ # is scoped to this endpoint.
45
+ idempotency_key: nil,
46
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
47
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
48
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
49
+ # maximum is 1 year.
50
+ x_idempotency_expiration: nil,
31
51
  request_options: {}
32
52
  )
33
53
  end
34
54
 
35
- # Retrieve a workspace preference by id, including its topics.
55
+ # Returns one workspace preference by id, including its subscription topics,
56
+ # routing options, and custom routing flag.
36
57
  sig do
37
58
  params(
38
59
  section_id: String,
@@ -46,8 +67,8 @@ module Courier
46
67
  )
47
68
  end
48
69
 
49
- # List the workspace's preferences. Each workspace preference embeds its topics.
50
- # Scoped to the workspace of the API key.
70
+ # Returns the workspace's preferences, each embedding its subscription topics,
71
+ # routing options, and whether custom routing is allowed.
51
72
  sig do
52
73
  params(request_options: Courier::RequestOptions::OrHash).returns(
53
74
  Courier::WorkspacePreferenceListResponse
@@ -71,25 +92,38 @@ module Courier
71
92
  )
72
93
  end
73
94
 
74
- # Publish the workspace's preferences page. Takes a snapshot of every workspace
75
- # preference with its topics under a new published version, making the current
76
- # state visible on the hosted preferences page (non-draft).
95
+ # Publishes the workspace preference page, snapshotting every preference and
96
+ # topic, and returns the page id and a preview URL.
77
97
  sig do
78
98
  params(
79
99
  brand_id: T.nilable(String),
80
100
  description: T.nilable(String),
81
101
  heading: T.nilable(String),
102
+ idempotency_key: String,
103
+ x_idempotency_expiration: String,
82
104
  request_options: Courier::RequestOptions::OrHash
83
105
  ).returns(Courier::PublishPreferencesResponse)
84
106
  end
85
107
  def publish(
86
- # Brand for the hosted page - "default" (workspace default brand), "none" (no
87
- # brand), or a specific brand id. Defaults to "default".
108
+ # Body param: Brand for the hosted page - "default" (workspace default brand),
109
+ # "none" (no brand), or a specific brand id. Defaults to "default".
88
110
  brand_id: nil,
89
- # Description shown under the heading on the hosted preferences page.
111
+ # Body param: Description shown under the heading on the hosted preferences page.
90
112
  description: nil,
91
- # Heading shown at the top of the hosted preferences page.
113
+ # Body param: Heading shown at the top of the hosted preferences page.
92
114
  heading: nil,
115
+ # Header param: A unique key that makes this request idempotent. If Courier
116
+ # receives another request with the same `Idempotency-Key`, it returns the stored
117
+ # response from the first request without performing the operation again
118
+ # (including the original status code and any error). Use it to safely retry
119
+ # `POST` requests after network failures without risking duplicate sends. The key
120
+ # is scoped to this endpoint.
121
+ idempotency_key: nil,
122
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
123
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
124
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
125
+ # maximum is 1 year.
126
+ x_idempotency_expiration: nil,
93
127
  request_options: {}
94
128
  )
95
129
  end
@@ -32,6 +32,8 @@ module Courier
32
32
 
33
33
  attr_reader lists: Courier::Resources::Lists
34
34
 
35
+ attr_reader inbox: Courier::Resources::Inbox
36
+
35
37
  attr_reader messages: Courier::Resources::Messages
36
38
 
37
39
  attr_reader requests: Courier::Resources::Requests
@@ -8,7 +8,9 @@ module Courier
8
8
  data: ::Hash[Symbol, top]?,
9
9
  profile: ::Hash[Symbol, top]?,
10
10
  recipient: String?,
11
- template: String?
11
+ template: String?,
12
+ idempotency_key: String,
13
+ x_idempotency_expiration: String
12
14
  }
13
15
  & Courier::Internal::Type::request_parameters
14
16
 
@@ -28,6 +30,14 @@ module Courier
28
30
 
29
31
  attr_accessor template: String?
30
32
 
33
+ attr_reader idempotency_key: String?
34
+
35
+ def idempotency_key=: (String) -> String
36
+
37
+ attr_reader x_idempotency_expiration: String?
38
+
39
+ def x_idempotency_expiration=: (String) -> String
40
+
31
41
  def initialize: (
32
42
  automation: Courier::Automations::InvokeInvokeAdHocParams::Automation,
33
43
  ?brand: String?,
@@ -35,6 +45,8 @@ module Courier
35
45
  ?profile: ::Hash[Symbol, top]?,
36
46
  ?recipient: String?,
37
47
  ?template: String?,
48
+ ?idempotency_key: String,
49
+ ?x_idempotency_expiration: String,
38
50
  ?request_options: Courier::request_opts
39
51
  ) -> void
40
52
 
@@ -45,6 +57,8 @@ module Courier
45
57
  profile: ::Hash[Symbol, top]?,
46
58
  recipient: String?,
47
59
  template: String?,
60
+ idempotency_key: String,
61
+ x_idempotency_expiration: String,
48
62
  request_options: Courier::RequestOptions
49
63
  }
50
64
 
@@ -8,7 +8,9 @@ module Courier
8
8
  brand: String?,
9
9
  data: ::Hash[Symbol, top]?,
10
10
  profile: ::Hash[Symbol, top]?,
11
- template: String?
11
+ template: String?,
12
+ idempotency_key: String,
13
+ x_idempotency_expiration: String
12
14
  }
13
15
  & Courier::Internal::Type::request_parameters
14
16
 
@@ -28,6 +30,14 @@ module Courier
28
30
 
29
31
  attr_accessor template: String?
30
32
 
33
+ attr_reader idempotency_key: String?
34
+
35
+ def idempotency_key=: (String) -> String
36
+
37
+ attr_reader x_idempotency_expiration: String?
38
+
39
+ def x_idempotency_expiration=: (String) -> String
40
+
31
41
  def initialize: (
32
42
  template_id: String,
33
43
  recipient: String?,
@@ -35,6 +45,8 @@ module Courier
35
45
  ?data: ::Hash[Symbol, top]?,
36
46
  ?profile: ::Hash[Symbol, top]?,
37
47
  ?template: String?,
48
+ ?idempotency_key: String,
49
+ ?x_idempotency_expiration: String,
38
50
  ?request_options: Courier::request_opts
39
51
  ) -> void
40
52
 
@@ -45,6 +57,8 @@ module Courier
45
57
  data: ::Hash[Symbol, top]?,
46
58
  profile: ::Hash[Symbol, top]?,
47
59
  template: String?,
60
+ idempotency_key: String,
61
+ x_idempotency_expiration: String,
48
62
  request_options: Courier::RequestOptions
49
63
  }
50
64
  end
@@ -5,7 +5,9 @@ module Courier
5
5
  name: String,
6
6
  settings: Courier::BrandSettings,
7
7
  id: String?,
8
- snippets: Courier::BrandSnippets?
8
+ snippets: Courier::BrandSnippets?,
9
+ idempotency_key: String,
10
+ x_idempotency_expiration: String
9
11
  }
10
12
  & Courier::Internal::Type::request_parameters
11
13
 
@@ -21,11 +23,21 @@ module Courier
21
23
 
22
24
  attr_accessor snippets: Courier::BrandSnippets?
23
25
 
26
+ attr_reader idempotency_key: String?
27
+
28
+ def idempotency_key=: (String) -> String
29
+
30
+ attr_reader x_idempotency_expiration: String?
31
+
32
+ def x_idempotency_expiration=: (String) -> String
33
+
24
34
  def initialize: (
25
35
  name: String,
26
36
  settings: Courier::BrandSettings,
27
37
  ?id: String?,
28
38
  ?snippets: Courier::BrandSnippets?,
39
+ ?idempotency_key: String,
40
+ ?x_idempotency_expiration: String,
29
41
  ?request_options: Courier::request_opts
30
42
  ) -> void
31
43
 
@@ -34,6 +46,8 @@ module Courier
34
46
  settings: Courier::BrandSettings,
35
47
  id: String?,
36
48
  snippets: Courier::BrandSnippets?,
49
+ idempotency_key: String,
50
+ x_idempotency_expiration: String,
37
51
  request_options: Courier::RequestOptions
38
52
  }
39
53
  end
@@ -0,0 +1,25 @@
1
+ module Courier
2
+ module Models
3
+ module Inbox
4
+ type message_delete_params =
5
+ { message_id: String } & Courier::Internal::Type::request_parameters
6
+
7
+ class MessageDeleteParams < Courier::Internal::Type::BaseModel
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ attr_accessor message_id: String
12
+
13
+ def initialize: (
14
+ message_id: String,
15
+ ?request_options: Courier::request_opts
16
+ ) -> void
17
+
18
+ def to_hash: -> {
19
+ message_id: String,
20
+ request_options: Courier::RequestOptions
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end