trycourier 4.25.0 → 4.26.1

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +16 -19
  4. data/lib/courier/client.rb +4 -0
  5. data/lib/courier/models/bulk_add_users_params.rb +26 -0
  6. data/lib/courier/models/bulk_create_job_params.rb +29 -0
  7. data/lib/courier/models/bulk_create_job_response.rb +16 -0
  8. data/lib/courier/models/bulk_list_users_params.rb +33 -0
  9. data/lib/courier/models/bulk_list_users_response.rb +49 -0
  10. data/lib/courier/models/bulk_retrieve_job_params.rb +20 -0
  11. data/lib/courier/models/bulk_retrieve_job_response.rb +76 -0
  12. data/lib/courier/models/bulk_run_job_params.rb +20 -0
  13. data/lib/courier/models/inbound_bulk_message.rb +91 -0
  14. data/lib/courier/models/inbound_bulk_message_user.rb +54 -0
  15. data/lib/courier/models/notification_template_alias.rb +24 -0
  16. data/lib/courier/models/notification_template_create_request.rb +5 -5
  17. data/lib/courier/models/notification_template_response.rb +16 -1
  18. data/lib/courier/models/notification_template_update_request.rb +7 -6
  19. data/lib/courier/models/notification_template_write_payload.rb +28 -0
  20. data/lib/courier/models.rb +18 -0
  21. data/lib/courier/resources/bulk.rb +141 -0
  22. data/lib/courier/resources/notifications.rb +2 -2
  23. data/lib/courier/resources/send.rb +2 -1
  24. data/lib/courier/version.rb +1 -1
  25. data/lib/courier.rb +13 -0
  26. data/rbi/courier/client.rbi +3 -0
  27. data/rbi/courier/models/bulk_add_users_params.rbi +43 -0
  28. data/rbi/courier/models/bulk_create_job_params.rbi +54 -0
  29. data/rbi/courier/models/bulk_create_job_response.rbi +26 -0
  30. data/rbi/courier/models/bulk_list_users_params.rbi +51 -0
  31. data/rbi/courier/models/bulk_list_users_response.rbi +125 -0
  32. data/rbi/courier/models/bulk_retrieve_job_params.rbi +35 -0
  33. data/rbi/courier/models/bulk_retrieve_job_response.rbi +157 -0
  34. data/rbi/courier/models/bulk_run_job_params.rbi +35 -0
  35. data/rbi/courier/models/inbound_bulk_message.rbi +124 -0
  36. data/rbi/courier/models/inbound_bulk_message_user.rbi +88 -0
  37. data/rbi/courier/models/notification_template_alias.rbi +28 -0
  38. data/rbi/courier/models/notification_template_create_request.rbi +10 -8
  39. data/rbi/courier/models/notification_template_response.rbi +19 -0
  40. data/rbi/courier/models/notification_template_update_request.rbi +12 -9
  41. data/rbi/courier/models/notification_template_write_payload.rbi +44 -0
  42. data/rbi/courier/models.rbi +19 -0
  43. data/rbi/courier/resources/bulk.rbi +102 -0
  44. data/rbi/courier/resources/notifications.rbi +6 -6
  45. data/rbi/courier/resources/send.rbi +2 -1
  46. data/sig/courier/client.rbs +2 -0
  47. data/sig/courier/models/bulk_add_users_params.rbs +28 -0
  48. data/sig/courier/models/bulk_create_job_params.rbs +24 -0
  49. data/sig/courier/models/bulk_create_job_response.rbs +13 -0
  50. data/sig/courier/models/bulk_list_users_params.rbs +28 -0
  51. data/sig/courier/models/bulk_list_users_response.rbs +65 -0
  52. data/sig/courier/models/bulk_retrieve_job_params.rbs +23 -0
  53. data/sig/courier/models/bulk_retrieve_job_response.rbs +66 -0
  54. data/sig/courier/models/bulk_run_job_params.rbs +23 -0
  55. data/sig/courier/models/inbound_bulk_message.rbs +58 -0
  56. data/sig/courier/models/inbound_bulk_message_user.rbs +42 -0
  57. data/sig/courier/models/notification_template_alias.rbs +13 -0
  58. data/sig/courier/models/notification_template_create_request.rbs +4 -4
  59. data/sig/courier/models/notification_template_response.rbs +9 -0
  60. data/sig/courier/models/notification_template_update_request.rbs +4 -4
  61. data/sig/courier/models/notification_template_write_payload.rbs +15 -0
  62. data/sig/courier/models.rbs +18 -0
  63. data/sig/courier/resources/bulk.rbs +34 -0
  64. data/sig/courier/resources/notifications.rbs +2 -2
  65. metadata +41 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6479592040b865063a1f1d9bec5fbea1650cdd5025a335068c39feefb4ae6fd9
4
- data.tar.gz: da1ecb2bc7246befec1f12882a02c59d95e6e28b51f3348fbd75286c416cc1c1
3
+ metadata.gz: dae9e29710e0f5f51b49e7f54a4dea8ca81242d1e60b5c22c1e6fbebb40f7764
4
+ data.tar.gz: 6495ca2eb5e082913bb43f3f6d1e1b933f5b4be59de9b3d33f9c3b276027948a
5
5
  SHA512:
6
- metadata.gz: a2550c508b661f15771d19f7c3d090641f439bd10031a5cbfa9a4323e09c42ce866d58575b53333255adeeb41fe462a7108c5505dc7123b434596c62bd331412
7
- data.tar.gz: 4e3d97189c87af8c1165756d3a7a9fe69d583b0d4c3a9e223bdcefadd782e7f371aeff7c5e9548908547e85e107e34aaf11e21bd3a0c29cd5e79ab99cbddcc1b
6
+ metadata.gz: 6f700ac897dd06c5fea58697d83f3380a2b9da7228e5da085433df3eaa3e26434c6f634e2392d67e8582aa74854a6f9c1b3a6800095f3656e259bf8738bef21c
7
+ data.tar.gz: 8a2cac3bce7dc295374474a83aaf488496e8f347b4d4f0c72a9f524e4746dfa84c6c2ab6f053fbf4efac5733625d789eebe6493e7517d5ae7121d5ebe4dda8ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.26.1](https://github.com/trycourier/courier-ruby/compare/v4.26.0...v4.26.1) (2026-08-13)
4
+
5
+
6
+ ### Chores
7
+
8
+ * **api:** regenerate SDK ([#115](https://github.com/trycourier/courier-ruby/issues/115)) ([27dadbf](https://github.com/trycourier/courier-ruby/commit/27dadbfd9a49b7f2fe7970d8a63f956f76d484e6))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * **api:** give every request body an example, and correct the archive status code ([#119](https://github.com/trycourier/courier-ruby/issues/119)) ([b4ad8e9](https://github.com/trycourier/courier-ruby/commit/b4ad8e90341bc2a7a0a34c04aeddcb60a91124e7))
14
+ * sync README from api-spec ([#113](https://github.com/trycourier/courier-ruby/issues/113)) ([8d479fe](https://github.com/trycourier/courier-ruby/commit/8d479fe04eea80c8f307e054e78098fe7cde253e))
15
+
16
+ ## 4.26.0 (2026-08-10)
17
+
18
+ Full Changelog: [v4.25.0...v4.26.0](https://github.com/trycourier/courier-ruby/compare/v4.25.0...v4.26.0)
19
+
20
+ ### Features
21
+
22
+ * Merge pull request [#185](https://github.com/trycourier/courier-ruby/issues/185) from trycourier/geraldosilva/c-19821-notifications-alias-v2 ([c9a2bd8](https://github.com/trycourier/courier-ruby/commit/c9a2bd82de3f3cca82a5de6430e09e93490b709e))
23
+
3
24
  ## 4.25.0 (2026-08-04)
4
25
 
5
26
  Full Changelog: [v4.24.0...v4.25.0](https://github.com/trycourier/courier-ruby/compare/v4.24.0...v4.25.0)
data/README.md CHANGED
@@ -1,17 +1,20 @@
1
- <!-- AUTO-GENERATED-OVERVIEW:START — Do not edit this section. It is synced from mintlify-docs. -->
2
1
  # Courier Ruby SDK
3
2
 
4
- The Courier Ruby SDK provides typed access to the Courier REST API from any Ruby 3.2+ application. It ships with Yard docstrings, RBS and RBI type definitions for Sorbet, and uses `net/http` with connection pooling.
3
+ The Courier Ruby SDK provides typed access to the Courier REST API from Ruby applications. Use it to send notifications, manage user profiles, check message status, issue JWT tokens for client-side SDKs, and more.
5
4
 
6
5
  ## Installation
7
6
 
8
- Add to your `Gemfile`:
7
+ Add the gem to your `Gemfile`:
8
+
9
+ <!-- x-release-please-start-version -->
9
10
 
10
11
  ```ruby
11
- gem "trycourier"
12
+ gem "trycourier", "~> 4.26.1"
12
13
  ```
13
14
 
14
- Then run `bundle install`.
15
+ <!-- x-release-please-end -->
16
+
17
+ Then run `bundle install`. Requires Ruby 3.2+.
15
18
 
16
19
  ## Quick Start
17
20
 
@@ -19,24 +22,20 @@ Then run `bundle install`.
19
22
  require "bundler/setup"
20
23
  require "courier"
21
24
 
22
- client = Courier::Client.new
25
+ courier = Courier::Client.new(
26
+ api_key: ENV["COURIER_API_KEY"] # the default, can be omitted
27
+ )
23
28
 
24
- response = client.send_.message(
25
- message: {
26
- to: { email: "you@example.com" },
27
- content: {
28
- title: "Hello from Courier!",
29
- body: "Your first notification, sent with the Ruby SDK."
30
- }
31
- }
29
+ response = courier.send_.message(
30
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}}
32
31
  )
33
32
 
34
- puts response.request_id
33
+ puts(response.requestId)
35
34
  ```
36
35
 
37
- The client reads `COURIER_API_KEY` from your environment automatically. You can also pass it explicitly: `Courier::Client.new(api_key: "your-key")`.
36
+ The client reads `COURIER_API_KEY` from your environment automatically.
38
37
 
39
- > **Note**: The method is `send_` (with trailing underscore) because `send` is a reserved method in Ruby.
38
+ Note the trailing underscore on `send_` `send` is reserved in Ruby.
40
39
 
41
40
  ## Documentation
42
41
 
@@ -45,5 +44,3 @@ Full documentation: **[courier.com/docs/sdk-libraries/ruby](https://www.courier.
45
44
  - [Quickstart](https://www.courier.com/docs/getting-started/quickstart/)
46
45
  - [Send API](https://www.courier.com/docs/platform/sending/send-message/)
47
46
  - [API Reference](https://www.courier.com/docs/reference/get-started/)
48
- - [RubyDoc](https://gemdocs.org/gems/trycourier)
49
- <!-- AUTO-GENERATED-OVERVIEW:END -->
@@ -58,6 +58,9 @@ module Courier
58
58
  # @return [Courier::Resources::Broadcasts]
59
59
  attr_reader :broadcasts
60
60
 
61
+ # @return [Courier::Resources::Bulk]
62
+ attr_reader :bulk
63
+
61
64
  # Manage the logos, colors, and layout that give the templates you send a
62
65
  # consistent look.
63
66
  # @return [Courier::Resources::Brands]
@@ -187,6 +190,7 @@ module Courier
187
190
  @automations = Courier::Resources::Automations.new(client: self)
188
191
  @journeys = Courier::Resources::Journeys.new(client: self)
189
192
  @broadcasts = Courier::Resources::Broadcasts.new(client: self)
193
+ @bulk = Courier::Resources::Bulk.new(client: self)
190
194
  @brands = Courier::Resources::Brands.new(client: self)
191
195
  @digests = Courier::Resources::Digests.new(client: self)
192
196
  @inbound = Courier::Resources::Inbound.new(client: self)
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#add_users
6
+ class BulkAddUsersParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute job_id
11
+ #
12
+ # @return [String]
13
+ required :job_id, String
14
+
15
+ # @!attribute users
16
+ #
17
+ # @return [Array<Courier::Models::InboundBulkMessageUser>]
18
+ required :users, -> { Courier::Internal::Type::ArrayOf[Courier::InboundBulkMessageUser] }
19
+
20
+ # @!method initialize(job_id:, users:, request_options: {})
21
+ # @param job_id [String]
22
+ # @param users [Array<Courier::Models::InboundBulkMessageUser>]
23
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#create_job
6
+ class BulkCreateJobParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute message
11
+ # Bulk message definition. Supports two formats:
12
+ #
13
+ # - V1 format: Requires `event` field (event ID or notification ID)
14
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
15
+ # content) in addition to `event`
16
+ #
17
+ # @return [Courier::Models::InboundBulkMessage]
18
+ required :message, -> { Courier::InboundBulkMessage }
19
+
20
+ # @!method initialize(message:, request_options: {})
21
+ # Some parameter documentations has been truncated, see
22
+ # {Courier::Models::BulkCreateJobParams} for more details.
23
+ #
24
+ # @param message [Courier::Models::InboundBulkMessage] Bulk message definition. Supports two formats:
25
+ #
26
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#create_job
6
+ class BulkCreateJobResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute job_id
8
+ #
9
+ # @return [String]
10
+ required :job_id, String, api_name: :jobId
11
+
12
+ # @!method initialize(job_id:)
13
+ # @param job_id [String]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#list_users
6
+ class BulkListUsersParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute job_id
11
+ #
12
+ # @return [String]
13
+ required :job_id, String
14
+
15
+ # @!attribute cursor
16
+ # A unique identifier that allows for fetching the next set of users added to the
17
+ # bulk job
18
+ #
19
+ # @return [String, nil]
20
+ optional :cursor, String, nil?: true
21
+
22
+ # @!method initialize(job_id:, cursor: nil, request_options: {})
23
+ # Some parameter documentations has been truncated, see
24
+ # {Courier::Models::BulkListUsersParams} for more details.
25
+ #
26
+ # @param job_id [String]
27
+ #
28
+ # @param cursor [String, nil] A unique identifier that allows for fetching the next set of users added to the
29
+ #
30
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#list_users
6
+ class BulkListUsersResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute items
8
+ #
9
+ # @return [Array<Courier::Models::BulkListUsersResponse::Item>]
10
+ required :items, -> { Courier::Internal::Type::ArrayOf[Courier::Models::BulkListUsersResponse::Item] }
11
+
12
+ # @!attribute paging
13
+ #
14
+ # @return [Courier::Models::Paging]
15
+ required :paging, -> { Courier::Paging }
16
+
17
+ # @!method initialize(items:, paging:)
18
+ # @param items [Array<Courier::Models::BulkListUsersResponse::Item>]
19
+ # @param paging [Courier::Models::Paging]
20
+
21
+ class Item < Courier::Models::InboundBulkMessageUser
22
+ # @!attribute status
23
+ #
24
+ # @return [Symbol, Courier::Models::BulkListUsersResponse::Item::Status]
25
+ required :status, enum: -> { Courier::Models::BulkListUsersResponse::Item::Status }
26
+
27
+ # @!attribute message_id
28
+ #
29
+ # @return [String, nil]
30
+ optional :message_id, String, api_name: :messageId, nil?: true
31
+
32
+ # @!method initialize(status:, message_id: nil)
33
+ # @param status [Symbol, Courier::Models::BulkListUsersResponse::Item::Status]
34
+ # @param message_id [String, nil]
35
+
36
+ module Status
37
+ extend Courier::Internal::Type::Enum
38
+
39
+ PENDING = :PENDING
40
+ ENQUEUED = :ENQUEUED
41
+ ERROR = :ERROR
42
+
43
+ # @!method self.values
44
+ # @return [Array<Symbol>]
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#retrieve_job
6
+ class BulkRetrieveJobParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute job_id
11
+ #
12
+ # @return [String]
13
+ required :job_id, String
14
+
15
+ # @!method initialize(job_id:, request_options: {})
16
+ # @param job_id [String]
17
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#retrieve_job
6
+ class BulkRetrieveJobResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute job
8
+ #
9
+ # @return [Courier::Models::BulkRetrieveJobResponse::Job]
10
+ required :job, -> { Courier::Models::BulkRetrieveJobResponse::Job }
11
+
12
+ # @!method initialize(job:)
13
+ # @param job [Courier::Models::BulkRetrieveJobResponse::Job]
14
+
15
+ # @see Courier::Models::BulkRetrieveJobResponse#job
16
+ class Job < Courier::Internal::Type::BaseModel
17
+ # @!attribute definition
18
+ # Bulk message definition. Supports two formats:
19
+ #
20
+ # - V1 format: Requires `event` field (event ID or notification ID)
21
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
22
+ # content) in addition to `event`
23
+ #
24
+ # @return [Courier::Models::InboundBulkMessage]
25
+ required :definition, -> { Courier::InboundBulkMessage }
26
+
27
+ # @!attribute enqueued
28
+ #
29
+ # @return [Integer]
30
+ required :enqueued, Integer
31
+
32
+ # @!attribute failures
33
+ #
34
+ # @return [Integer]
35
+ required :failures, Integer
36
+
37
+ # @!attribute received
38
+ #
39
+ # @return [Integer]
40
+ required :received, Integer
41
+
42
+ # @!attribute status
43
+ #
44
+ # @return [Symbol, Courier::Models::BulkRetrieveJobResponse::Job::Status]
45
+ required :status, enum: -> { Courier::Models::BulkRetrieveJobResponse::Job::Status }
46
+
47
+ # @!method initialize(definition:, enqueued:, failures:, received:, status:)
48
+ # Some parameter documentations has been truncated, see
49
+ # {Courier::Models::BulkRetrieveJobResponse::Job} for more details.
50
+ #
51
+ # @param definition [Courier::Models::InboundBulkMessage] Bulk message definition. Supports two formats:
52
+ #
53
+ # @param enqueued [Integer]
54
+ #
55
+ # @param failures [Integer]
56
+ #
57
+ # @param received [Integer]
58
+ #
59
+ # @param status [Symbol, Courier::Models::BulkRetrieveJobResponse::Job::Status]
60
+
61
+ # @see Courier::Models::BulkRetrieveJobResponse::Job#status
62
+ module Status
63
+ extend Courier::Internal::Type::Enum
64
+
65
+ CREATED = :CREATED
66
+ PROCESSING = :PROCESSING
67
+ COMPLETED = :COMPLETED
68
+ ERROR = :ERROR
69
+
70
+ # @!method self.values
71
+ # @return [Array<Symbol>]
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Bulk#run_job
6
+ class BulkRunJobParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ # @!attribute job_id
11
+ #
12
+ # @return [String]
13
+ required :job_id, String
14
+
15
+ # @!method initialize(job_id:, request_options: {})
16
+ # @param job_id [String]
17
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class InboundBulkMessage < Courier::Internal::Type::BaseModel
6
+ # @!attribute event
7
+ # Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
8
+ # "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
9
+ # mapped to a notification.
10
+ #
11
+ # @return [String]
12
+ required :event, String
13
+
14
+ # @!attribute brand
15
+ #
16
+ # @return [String, nil]
17
+ optional :brand, String, nil?: true
18
+
19
+ # @!attribute content
20
+ # Elemental content (optional, for V2 format). When provided, this will be used
21
+ # instead of the notification associated with the `event` field.
22
+ #
23
+ # @return [Courier::Models::ElementalContentSugar, Courier::Models::ElementalContent, nil]
24
+ optional :content, union: -> { Courier::InboundBulkMessage::Content }, nil?: true
25
+
26
+ # @!attribute data
27
+ #
28
+ # @return [Hash{Symbol=>Object}, nil]
29
+ optional :data, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
30
+
31
+ # @!attribute locale
32
+ #
33
+ # @return [Hash{Symbol=>Hash{Symbol=>Object}}, nil]
34
+ optional :locale,
35
+ Courier::Internal::Type::HashOf[Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown]],
36
+ nil?: true
37
+
38
+ # @!attribute override
39
+ #
40
+ # @return [Hash{Symbol=>Object}, nil]
41
+ optional :override, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
42
+
43
+ # @!attribute template
44
+ # Notification ID or template ID (optional, for V2 format). When provided, this
45
+ # will be used instead of the notification associated with the `event` field.
46
+ #
47
+ # @return [String, nil]
48
+ optional :template, String, nil?: true
49
+
50
+ # @!method initialize(event:, brand: nil, content: nil, data: nil, locale: nil, override: nil, template: nil)
51
+ # Some parameter documentations has been truncated, see
52
+ # {Courier::Models::InboundBulkMessage} for more details.
53
+ #
54
+ # Bulk message definition. Supports two formats:
55
+ #
56
+ # - V1 format: Requires `event` field (event ID or notification ID)
57
+ # - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
58
+ # content) in addition to `event`
59
+ #
60
+ # @param event [String] Event ID or Notification ID (required). Can be either a
61
+ #
62
+ # @param brand [String, nil]
63
+ #
64
+ # @param content [Courier::Models::ElementalContentSugar, Courier::Models::ElementalContent, nil] Elemental content (optional, for V2 format). When provided, this will be used
65
+ #
66
+ # @param data [Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @param locale [Hash{Symbol=>Hash{Symbol=>Object}}, nil]
69
+ #
70
+ # @param override [Hash{Symbol=>Object}, nil]
71
+ #
72
+ # @param template [String, nil] Notification ID or template ID (optional, for V2 format). When provided,
73
+
74
+ # Elemental content (optional, for V2 format). When provided, this will be used
75
+ # instead of the notification associated with the `event` field.
76
+ #
77
+ # @see Courier::Models::InboundBulkMessage#content
78
+ module Content
79
+ extend Courier::Internal::Type::Union
80
+
81
+ # Syntactic sugar to provide a fast shorthand for Courier Elemental Blocks.
82
+ variant -> { Courier::ElementalContentSugar }
83
+
84
+ variant -> { Courier::ElementalContent }
85
+
86
+ # @!method self.variants
87
+ # @return [Array(Courier::Models::ElementalContentSugar, Courier::Models::ElementalContent)]
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class InboundBulkMessageUser < Courier::Internal::Type::BaseModel
6
+ # @!attribute data
7
+ # User-specific data that will be merged with message.data
8
+ #
9
+ # @return [Object, nil]
10
+ optional :data, Courier::Internal::Type::Unknown
11
+
12
+ # @!attribute preferences
13
+ #
14
+ # @return [Courier::Models::RecipientPreferences, nil]
15
+ optional :preferences, -> { Courier::RecipientPreferences }, nil?: true
16
+
17
+ # @!attribute profile
18
+ # User profile information. For email-based bulk jobs, `profile.email` is required
19
+ # for provider routing to determine if the message can be delivered. The email
20
+ # address should be provided here rather than in `to.email`.
21
+ #
22
+ # @return [Hash{Symbol=>Object}, nil]
23
+ optional :profile, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
24
+
25
+ # @!attribute recipient
26
+ # User ID (legacy field, use profile or to.user_id instead)
27
+ #
28
+ # @return [String, nil]
29
+ optional :recipient, String, nil?: true
30
+
31
+ # @!attribute to
32
+ # Optional recipient information. Note: For email provider routing, use
33
+ # `profile.email` instead of `to.email`. The `to` field is primarily used for
34
+ # recipient identification and data merging.
35
+ #
36
+ # @return [Courier::Models::UserRecipient, nil]
37
+ optional :to, -> { Courier::UserRecipient }, nil?: true
38
+
39
+ # @!method initialize(data: nil, preferences: nil, profile: nil, recipient: nil, to: nil)
40
+ # Some parameter documentations has been truncated, see
41
+ # {Courier::Models::InboundBulkMessageUser} for more details.
42
+ #
43
+ # @param data [Object] User-specific data that will be merged with message.data
44
+ #
45
+ # @param preferences [Courier::Models::RecipientPreferences, nil]
46
+ #
47
+ # @param profile [Hash{Symbol=>Object}, nil] User profile information. For email-based bulk jobs, `profile.email` is required
48
+ #
49
+ # @param recipient [String, nil] User ID (legacy field, use profile or to.user_id instead)
50
+ #
51
+ # @param to [Courier::Models::UserRecipient, nil] Optional recipient information. Note: For email provider routing, use
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # A template's send-time alias as returned by a read, omitted entirely when it has
6
+ # none. Usually a single string; an array for a template that resolves from
7
+ # several aliases, which writes through this API can no longer produce — only
8
+ # templates predating that restriction, or aliases attached outside this API, hold
9
+ # more than one.
10
+ module NotificationTemplateAlias
11
+ extend Courier::Internal::Type::Union
12
+
13
+ variant String
14
+
15
+ variant -> { Courier::Models::NotificationTemplateAlias::StringArray }
16
+
17
+ # @!method self.variants
18
+ # @return [Array(String, Array<String>)]
19
+
20
+ # @type [Courier::Internal::Type::Converter]
21
+ StringArray = Courier::Internal::Type::ArrayOf[String]
22
+ end
23
+ end
24
+ end
@@ -4,11 +4,11 @@ module Courier
4
4
  module Models
5
5
  class NotificationTemplateCreateRequest < Courier::Internal::Type::BaseModel
6
6
  # @!attribute notification
7
- # Core template fields used in POST and PUT request bodies (nested under a
8
- # `notification` key) and returned at the top level in responses.
7
+ # Template fields accepted in POST and PUT request bodies, nested under a
8
+ # `notification` key.
9
9
  #
10
- # @return [Courier::Models::NotificationTemplatePayload]
11
- required :notification, -> { Courier::NotificationTemplatePayload }
10
+ # @return [Courier::Models::NotificationTemplateWritePayload]
11
+ required :notification, -> { Courier::NotificationTemplateWritePayload }
12
12
 
13
13
  # @!attribute state
14
14
  # Template state after creation. Case-insensitive input, normalized to uppercase
@@ -23,7 +23,7 @@ module Courier
23
23
  #
24
24
  # Request body for creating a notification template.
25
25
  #
26
- # @param notification [Courier::Models::NotificationTemplatePayload] Core template fields used in POST and PUT request bodies (nested under a `notifi
26
+ # @param notification [Courier::Models::NotificationTemplateWritePayload] Template fields accepted in POST and PUT request bodies, nested under a `notific
27
27
  #
28
28
  # @param state [Symbol, Courier::Models::NotificationTemplateCreateRequest::State] Template state after creation. Case-insensitive input, normalized to uppercase i
29
29
 
@@ -28,6 +28,16 @@ module Courier
28
28
  # @return [Symbol, Courier::Models::NotificationTemplateResponse::State]
29
29
  required :state, enum: -> { Courier::NotificationTemplateResponse::State }
30
30
 
31
+ # @!attribute alias_
32
+ # A template's send-time alias as returned by a read, omitted entirely when it has
33
+ # none. Usually a single string; an array for a template that resolves from
34
+ # several aliases, which writes through this API can no longer produce — only
35
+ # templates predating that restriction, or aliases attached outside this API, hold
36
+ # more than one.
37
+ #
38
+ # @return [String, Array<String>, nil]
39
+ optional :alias_, union: -> { Courier::NotificationTemplateAlias }, api_name: :alias
40
+
31
41
  # @!attribute updated
32
42
  # Epoch milliseconds of last update.
33
43
  #
@@ -40,7 +50,10 @@ module Courier
40
50
  # @return [String, nil]
41
51
  optional :updater, String
42
52
 
43
- # @!method initialize(id:, created:, creator:, state:, updated: nil, updater: nil)
53
+ # @!method initialize(id:, created:, creator:, state:, alias_: nil, updated: nil, updater: nil)
54
+ # Some parameter documentations has been truncated, see
55
+ # {Courier::Models::NotificationTemplateResponse} for more details.
56
+ #
44
57
  # Response for GET /notifications/{id}, POST /notifications, and PUT
45
58
  # /notifications/{id}. Returns all template fields at the top level.
46
59
  #
@@ -52,6 +65,8 @@ module Courier
52
65
  #
53
66
  # @param state [Symbol, Courier::Models::NotificationTemplateResponse::State] The template state. Always uppercase.
54
67
  #
68
+ # @param alias_ [String, Array<String>] A template's send-time alias as returned by a read, omitted entirely when it has
69
+ #
55
70
  # @param updated [Integer] Epoch milliseconds of last update.
56
71
  #
57
72
  # @param updater [String] User ID of the last updater.
@@ -4,11 +4,11 @@ module Courier
4
4
  module Models
5
5
  class NotificationTemplateUpdateRequest < Courier::Internal::Type::BaseModel
6
6
  # @!attribute notification
7
- # Core template fields used in POST and PUT request bodies (nested under a
8
- # `notification` key) and returned at the top level in responses.
7
+ # Template fields accepted in POST and PUT request bodies, nested under a
8
+ # `notification` key.
9
9
  #
10
- # @return [Courier::Models::NotificationTemplatePayload]
11
- required :notification, -> { Courier::NotificationTemplatePayload }
10
+ # @return [Courier::Models::NotificationTemplateWritePayload]
11
+ required :notification, -> { Courier::NotificationTemplateWritePayload }
12
12
 
13
13
  # @!attribute state
14
14
  # Template state after update. Case-insensitive input, normalized to uppercase in
@@ -22,9 +22,10 @@ module Courier
22
22
  # {Courier::Models::NotificationTemplateUpdateRequest} for more details.
23
23
  #
24
24
  # Request body for replacing a notification template. Same shape as create. All
25
- # fields required (PUT = full replacement).
25
+ # fields required (PUT = full replacement), except `alias`, whose omission means
26
+ # "leave the existing aliases alone".
26
27
  #
27
- # @param notification [Courier::Models::NotificationTemplatePayload] Core template fields used in POST and PUT request bodies (nested under a `notifi
28
+ # @param notification [Courier::Models::NotificationTemplateWritePayload] Template fields accepted in POST and PUT request bodies, nested under a `notific
28
29
  #
29
30
  # @param state [Symbol, Courier::Models::NotificationTemplateUpdateRequest::State] Template state after update. Case-insensitive input, normalized to uppercase in
30
31