trycourier 4.6.3 → 4.7.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/lib/courier/internal/transport/pooled_net_requester.rb +1 -1
  5. data/lib/courier/models/post_tenant_template_publish_request.rb +22 -0
  6. data/lib/courier/models/post_tenant_template_publish_response.rb +34 -0
  7. data/lib/courier/models/put_tenant_template_request.rb +31 -0
  8. data/lib/courier/models/put_tenant_template_response.rb +38 -0
  9. data/lib/courier/models/send_message_params.rb +49 -3
  10. data/lib/courier/models/tenant_template_input.rb +192 -0
  11. data/lib/courier/models/tenants/template_publish_params.rb +22 -0
  12. data/lib/courier/models/tenants/template_replace_params.rb +22 -0
  13. data/lib/courier/models/tenants/templates/version_retrieve_params.rb +30 -0
  14. data/lib/courier/models.rb +10 -0
  15. data/lib/courier/resources/tenants/templates/versions.rb +60 -0
  16. data/lib/courier/resources/tenants/templates.rb +81 -0
  17. data/lib/courier/version.rb +1 -1
  18. data/lib/courier.rb +9 -0
  19. data/rbi/courier/models/post_tenant_template_publish_request.rbi +36 -0
  20. data/rbi/courier/models/post_tenant_template_publish_response.rbi +49 -0
  21. data/rbi/courier/models/put_tenant_template_request.rbi +53 -0
  22. data/rbi/courier/models/put_tenant_template_response.rbi +52 -0
  23. data/rbi/courier/models/send_message_params.rbi +86 -4
  24. data/rbi/courier/models/tenant_template_input.rbi +408 -0
  25. data/rbi/courier/models/tenants/template_publish_params.rbi +40 -0
  26. data/rbi/courier/models/tenants/template_replace_params.rbi +40 -0
  27. data/rbi/courier/models/tenants/templates/version_retrieve_params.rbi +50 -0
  28. data/rbi/courier/models.rbi +12 -0
  29. data/rbi/courier/resources/tenants/templates/versions.rbi +43 -0
  30. data/rbi/courier/resources/tenants/templates.rbi +59 -0
  31. data/sig/courier/models/post_tenant_template_publish_request.rbs +15 -0
  32. data/sig/courier/models/post_tenant_template_publish_response.rbs +22 -0
  33. data/sig/courier/models/put_tenant_template_request.rbs +24 -0
  34. data/sig/courier/models/put_tenant_template_response.rbs +22 -0
  35. data/sig/courier/models/send_message_params.rbs +19 -0
  36. data/sig/courier/models/tenant_template_input.rbs +167 -0
  37. data/sig/courier/models/tenants/template_publish_params.rbs +27 -0
  38. data/sig/courier/models/tenants/template_replace_params.rbs +27 -0
  39. data/sig/courier/models/tenants/templates/version_retrieve_params.rbs +32 -0
  40. data/sig/courier/models.rbs +10 -0
  41. data/sig/courier/resources/tenants/templates/versions.rbs +18 -0
  42. data/sig/courier/resources/tenants/templates.rbs +17 -0
  43. metadata +29 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b3c3af37c6f737d91d83290e647983613019baa618752d7c8a1d36c49093a04
4
- data.tar.gz: 1d04dfb232d575a256224d0108f62ad205aad4e4084fe6ee1733957a65454d5c
3
+ metadata.gz: 3dd2288c8edaa2eaa89d4a639297c9d02f7c4b1361bfb352430e8efa8344e009
4
+ data.tar.gz: 6afb815a642a95197e1b8ad54aa84bbdceac455f19fac9e7ae75145b30461f50
5
5
  SHA512:
6
- metadata.gz: becec6815cd9d64e0660caf083842eeb46c9dd07ab003e2115e5e4ec59a25a2f979e3a7180cfef702752ec3dfc5e0884c31d6feed875c0af580ebaca84fed2be
7
- data.tar.gz: fd88eb8e5c564358b5caeeffb192280deaa7453fe52482f212df863aa06549f04fb1c94fc26d07b6deefa9bdf29fbfd3816e82819b71acfec2e808950dbf79b5
6
+ metadata.gz: 8ca433a2d574f2e7c44d24927dfbb80060591ae0b42582caceb6fc93dd77f8aa2d1fea1093ad34269257effcd799b106de1178056e2430a59fc062276c0210a0
7
+ data.tar.gz: d5ca09a7b432d9bf0e071be548bd25e8121403e53609af20d257a7fa2e5094c04da95d07e8a4f5d69373a5dd7256d9f3fc57f4138168e9669b0d34da6c091c14
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.7.0 (2026-02-06)
4
+
5
+ Full Changelog: [v4.6.3...v4.7.0](https://github.com/trycourier/courier-ruby/compare/v4.6.3...v4.7.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add array support to send_message to parameter ([02f83d3](https://github.com/trycourier/courier-ruby/commit/02f83d3b73bea1b85a5bda3fe30080e0e807f753))
10
+ * **api:** add publish/replace methods and versions sub-resource to tenants templates ([7642e1b](https://github.com/trycourier/courier-ruby/commit/7642e1b9f7433ae5046f4a170c11479aee626cc4))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **client:** always add content-length to post body, even when empty ([2045d2e](https://github.com/trycourier/courier-ruby/commit/2045d2e9d416abe826dd87ff993838407784dccc))
16
+
17
+
18
+ ### Chores
19
+
20
+ * **docs:** remove www prefix ([8667b7a](https://github.com/trycourier/courier-ruby/commit/8667b7a6f52b4559e4f941b78b724b94f393b996))
21
+
3
22
  ## 4.6.3 (2026-01-27)
4
23
 
5
24
  Full Changelog: [v4.6.2...v4.6.3](https://github.com/trycourier/courier-ruby/compare/v4.6.2...v4.6.3)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "trycourier", "~> 4.6.3"
20
+ gem "trycourier", "~> 4.7.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -75,7 +75,7 @@ module Courier
75
75
 
76
76
  case body
77
77
  in nil
78
- nil
78
+ req["content-length"] ||= 0 unless req["transfer-encoding"]
79
79
  in String
80
80
  req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
81
81
  req.body_stream = Courier::Internal::Util::ReadIOAdapter.new(body, &blk)
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class PostTenantTemplatePublishRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute version
7
+ # The version of the template to publish (e.g., "v1", "v2", "latest"). If not
8
+ # provided, defaults to "latest".
9
+ #
10
+ # @return [String, nil]
11
+ optional :version, String
12
+
13
+ # @!method initialize(version: nil)
14
+ # Some parameter documentations has been truncated, see
15
+ # {Courier::Models::PostTenantTemplatePublishRequest} for more details.
16
+ #
17
+ # Request body for publishing a tenant template version
18
+ #
19
+ # @param version [String] The version of the template to publish (e.g., "v1", "v2", "latest"). If not prov
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class PostTenantTemplatePublishResponse < Courier::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The template ID
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute published_at
13
+ # The timestamp when the template was published
14
+ #
15
+ # @return [String]
16
+ required :published_at, String
17
+
18
+ # @!attribute version
19
+ # The published version of the template
20
+ #
21
+ # @return [String]
22
+ required :version, String
23
+
24
+ # @!method initialize(id:, published_at:, version:)
25
+ # Response from publishing a tenant template
26
+ #
27
+ # @param id [String] The template ID
28
+ #
29
+ # @param published_at [String] The timestamp when the template was published
30
+ #
31
+ # @param version [String] The published version of the template
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class PutTenantTemplateRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute template
7
+ # Template configuration for creating or updating a tenant notification template
8
+ #
9
+ # @return [Courier::Models::TenantTemplateInput]
10
+ required :template, -> { Courier::TenantTemplateInput }
11
+
12
+ # @!attribute published
13
+ # Whether to publish the template immediately after saving. When true, the
14
+ # template becomes the active/published version. When false (default), the
15
+ # template is saved as a draft.
16
+ #
17
+ # @return [Boolean, nil]
18
+ optional :published, Courier::Internal::Type::Boolean
19
+
20
+ # @!method initialize(template:, published: nil)
21
+ # Some parameter documentations has been truncated, see
22
+ # {Courier::Models::PutTenantTemplateRequest} for more details.
23
+ #
24
+ # Request body for creating or updating a tenant notification template
25
+ #
26
+ # @param template [Courier::Models::TenantTemplateInput] Template configuration for creating or updating a tenant notification template
27
+ #
28
+ # @param published [Boolean] Whether to publish the template immediately after saving. When true, the templat
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class PutTenantTemplateResponse < Courier::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The template ID
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute version
13
+ # The version of the saved template
14
+ #
15
+ # @return [String]
16
+ required :version, String
17
+
18
+ # @!attribute published_at
19
+ # The timestamp when the template was published. Only present if the template was
20
+ # published as part of this request.
21
+ #
22
+ # @return [String, nil]
23
+ optional :published_at, String, nil?: true
24
+
25
+ # @!method initialize(id:, version:, published_at: nil)
26
+ # Some parameter documentations has been truncated, see
27
+ # {Courier::Models::PutTenantTemplateResponse} for more details.
28
+ #
29
+ # Response from creating or updating a tenant notification template
30
+ #
31
+ # @param id [String] The template ID
32
+ #
33
+ # @param version [String] The version of the saved template
34
+ #
35
+ # @param published_at [String, nil] The timestamp when the template was published. Only present if the template was
36
+ end
37
+ end
38
+ end
@@ -100,7 +100,7 @@ module Courier
100
100
  # @!attribute to
101
101
  # The recipient or a list of recipients of the message
102
102
  #
103
- # @return [Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient, nil]
103
+ # @return [Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient, Array<Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient>, nil]
104
104
  optional :to, union: -> { Courier::SendMessageParams::Message::To }, nil?: true
105
105
 
106
106
  # @!method initialize(brand_id: nil, channels: nil, content: nil, context: nil, data: nil, delay: nil, expiry: nil, metadata: nil, preferences: nil, providers: nil, routing: nil, template: nil, timeout: nil, to: nil)
@@ -136,7 +136,7 @@ module Courier
136
136
  #
137
137
  # @param timeout [Courier::Models::SendMessageParams::Message::Timeout, nil]
138
138
  #
139
- # @param to [Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient, nil] The recipient or a list of recipients of the message
139
+ # @param to [Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient, Array<Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient>, nil] The recipient or a list of recipients of the message
140
140
 
141
141
  class Channel < Courier::Internal::Type::BaseModel
142
142
  # @!attribute brand_id
@@ -520,8 +520,54 @@ module Courier
520
520
  # Send via webhook
521
521
  variant -> { Courier::WebhookRecipient }
522
522
 
523
+ variant -> { Courier::Models::SendMessageParams::Message::To::UnionMember8Array }
524
+
525
+ # A single recipient of the message. Choose one of the following types based on
526
+ # how you want to identify the recipient: - **User**: Send to a specific user by
527
+ # user_id, email, or phone number - **Audience**: Send to all users in an
528
+ # audience - **List**: Send to all users in a list - **List Pattern**: Send to
529
+ # users in lists matching a pattern - **Slack**: Send via Slack (channel, email,
530
+ # or user_id) - **MS Teams**: Send via Microsoft Teams - **PagerDuty**: Send via
531
+ # PagerDuty - **Webhook**: Send via webhook
532
+ module UnionMember8
533
+ extend Courier::Internal::Type::Union
534
+
535
+ # Send to a specific user by user_id, email, phone_number, or list_id
536
+ variant -> { Courier::UserRecipient }
537
+
538
+ # Send to all users in an audience
539
+ variant -> { Courier::AudienceRecipient }
540
+
541
+ # Send to all users in a specific list
542
+ variant -> { Courier::ListRecipient }
543
+
544
+ # Send to users in lists matching a pattern
545
+ variant -> { Courier::ListPatternRecipient }
546
+
547
+ # Send via Slack (channel, email, or user_id)
548
+ variant -> { Courier::SlackRecipient }
549
+
550
+ # Send via Microsoft Teams
551
+ variant -> { Courier::MsTeamsRecipient }
552
+
553
+ # Send via PagerDuty
554
+ variant -> { Courier::PagerdutyRecipient }
555
+
556
+ # Send via webhook
557
+ variant -> { Courier::WebhookRecipient }
558
+
559
+ # @!method self.variants
560
+ # @return [Array(Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient)]
561
+ end
562
+
523
563
  # @!method self.variants
524
- # @return [Array(Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient)]
564
+ # @return [Array(Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient, Array<Courier::Models::UserRecipient, Courier::Models::AudienceRecipient, Courier::Models::ListRecipient, Courier::Models::ListPatternRecipient, Courier::Models::SlackRecipient, Courier::Models::MsTeamsRecipient, Courier::Models::PagerdutyRecipient, Courier::Models::WebhookRecipient>)]
565
+
566
+ # @type [Courier::Internal::Type::Converter]
567
+ UnionMember8Array =
568
+ Courier::Internal::Type::ArrayOf[union: -> {
569
+ Courier::SendMessageParams::Message::To::UnionMember8
570
+ }]
525
571
  end
526
572
  end
527
573
  end
@@ -0,0 +1,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class TenantTemplateInput < Courier::Internal::Type::BaseModel
6
+ # @!attribute content
7
+ # Template content configuration including blocks, elements, and message structure
8
+ #
9
+ # @return [Courier::Models::ElementalContent]
10
+ required :content, -> { Courier::ElementalContent }
11
+
12
+ # @!attribute channels
13
+ # Channel-specific delivery configuration (email, SMS, push, etc.)
14
+ #
15
+ # @return [Hash{Symbol=>Courier::Models::TenantTemplateInput::Channel}, nil]
16
+ optional :channels, -> { Courier::Internal::Type::HashOf[Courier::TenantTemplateInput::Channel] }
17
+
18
+ # @!attribute providers
19
+ # Provider-specific delivery configuration for routing to specific email/SMS
20
+ # providers
21
+ #
22
+ # @return [Hash{Symbol=>Courier::Models::TenantTemplateInput::Provider}, nil]
23
+ optional :providers, -> { Courier::Internal::Type::HashOf[Courier::TenantTemplateInput::Provider] }
24
+
25
+ # @!attribute routing
26
+ # Message routing configuration for multi-channel delivery strategies
27
+ #
28
+ # @return [Courier::Models::MessageRouting, nil]
29
+ optional :routing, -> { Courier::MessageRouting }
30
+
31
+ # @!method initialize(content:, channels: nil, providers: nil, routing: nil)
32
+ # Some parameter documentations has been truncated, see
33
+ # {Courier::Models::TenantTemplateInput} for more details.
34
+ #
35
+ # Template configuration for creating or updating a tenant notification template
36
+ #
37
+ # @param content [Courier::Models::ElementalContent] Template content configuration including blocks, elements, and message structure
38
+ #
39
+ # @param channels [Hash{Symbol=>Courier::Models::TenantTemplateInput::Channel}] Channel-specific delivery configuration (email, SMS, push, etc.)
40
+ #
41
+ # @param providers [Hash{Symbol=>Courier::Models::TenantTemplateInput::Provider}] Provider-specific delivery configuration for routing to specific email/SMS provi
42
+ #
43
+ # @param routing [Courier::Models::MessageRouting] Message routing configuration for multi-channel delivery strategies
44
+
45
+ class Channel < Courier::Internal::Type::BaseModel
46
+ # @!attribute brand_id
47
+ # Brand id used for rendering.
48
+ #
49
+ # @return [String, nil]
50
+ optional :brand_id, String, nil?: true
51
+
52
+ # @!attribute if_
53
+ # JS conditional with access to data/profile.
54
+ #
55
+ # @return [String, nil]
56
+ optional :if_, String, api_name: :if, nil?: true
57
+
58
+ # @!attribute metadata
59
+ #
60
+ # @return [Courier::Models::TenantTemplateInput::Channel::Metadata, nil]
61
+ optional :metadata, -> { Courier::TenantTemplateInput::Channel::Metadata }, nil?: true
62
+
63
+ # @!attribute override
64
+ # Channel specific overrides.
65
+ #
66
+ # @return [Hash{Symbol=>Object}, nil]
67
+ optional :override, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
68
+
69
+ # @!attribute providers
70
+ # Providers enabled for this channel.
71
+ #
72
+ # @return [Array<String>, nil]
73
+ optional :providers, Courier::Internal::Type::ArrayOf[String], nil?: true
74
+
75
+ # @!attribute routing_method
76
+ # Defaults to `single`.
77
+ #
78
+ # @return [Symbol, Courier::Models::TenantTemplateInput::Channel::RoutingMethod, nil]
79
+ optional :routing_method,
80
+ enum: -> {
81
+ Courier::TenantTemplateInput::Channel::RoutingMethod
82
+ },
83
+ nil?: true
84
+
85
+ # @!attribute timeouts
86
+ #
87
+ # @return [Courier::Models::TenantTemplateInput::Channel::Timeouts, nil]
88
+ optional :timeouts, -> { Courier::TenantTemplateInput::Channel::Timeouts }, nil?: true
89
+
90
+ # @!method initialize(brand_id: nil, if_: nil, metadata: nil, override: nil, providers: nil, routing_method: nil, timeouts: nil)
91
+ # @param brand_id [String, nil] Brand id used for rendering.
92
+ #
93
+ # @param if_ [String, nil] JS conditional with access to data/profile.
94
+ #
95
+ # @param metadata [Courier::Models::TenantTemplateInput::Channel::Metadata, nil]
96
+ #
97
+ # @param override [Hash{Symbol=>Object}, nil] Channel specific overrides.
98
+ #
99
+ # @param providers [Array<String>, nil] Providers enabled for this channel.
100
+ #
101
+ # @param routing_method [Symbol, Courier::Models::TenantTemplateInput::Channel::RoutingMethod, nil] Defaults to `single`.
102
+ #
103
+ # @param timeouts [Courier::Models::TenantTemplateInput::Channel::Timeouts, nil]
104
+
105
+ # @see Courier::Models::TenantTemplateInput::Channel#metadata
106
+ class Metadata < Courier::Internal::Type::BaseModel
107
+ # @!attribute utm
108
+ #
109
+ # @return [Courier::Models::Utm, nil]
110
+ optional :utm, -> { Courier::Utm }, nil?: true
111
+
112
+ # @!method initialize(utm: nil)
113
+ # @param utm [Courier::Models::Utm, nil]
114
+ end
115
+
116
+ # Defaults to `single`.
117
+ #
118
+ # @see Courier::Models::TenantTemplateInput::Channel#routing_method
119
+ module RoutingMethod
120
+ extend Courier::Internal::Type::Enum
121
+
122
+ ALL = :all
123
+ SINGLE = :single
124
+
125
+ # @!method self.values
126
+ # @return [Array<Symbol>]
127
+ end
128
+
129
+ # @see Courier::Models::TenantTemplateInput::Channel#timeouts
130
+ class Timeouts < Courier::Internal::Type::BaseModel
131
+ # @!attribute channel
132
+ #
133
+ # @return [Integer, nil]
134
+ optional :channel, Integer, nil?: true
135
+
136
+ # @!attribute provider
137
+ #
138
+ # @return [Integer, nil]
139
+ optional :provider, Integer, nil?: true
140
+
141
+ # @!method initialize(channel: nil, provider: nil)
142
+ # @param channel [Integer, nil]
143
+ # @param provider [Integer, nil]
144
+ end
145
+ end
146
+
147
+ class Provider < Courier::Internal::Type::BaseModel
148
+ # @!attribute if_
149
+ # JS conditional with access to data/profile.
150
+ #
151
+ # @return [String, nil]
152
+ optional :if_, String, api_name: :if, nil?: true
153
+
154
+ # @!attribute metadata
155
+ #
156
+ # @return [Courier::Models::TenantTemplateInput::Provider::Metadata, nil]
157
+ optional :metadata, -> { Courier::TenantTemplateInput::Provider::Metadata }, nil?: true
158
+
159
+ # @!attribute override
160
+ # Provider-specific overrides.
161
+ #
162
+ # @return [Hash{Symbol=>Object}, nil]
163
+ optional :override, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
164
+
165
+ # @!attribute timeouts
166
+ #
167
+ # @return [Integer, nil]
168
+ optional :timeouts, Integer, nil?: true
169
+
170
+ # @!method initialize(if_: nil, metadata: nil, override: nil, timeouts: nil)
171
+ # @param if_ [String, nil] JS conditional with access to data/profile.
172
+ #
173
+ # @param metadata [Courier::Models::TenantTemplateInput::Provider::Metadata, nil]
174
+ #
175
+ # @param override [Hash{Symbol=>Object}, nil] Provider-specific overrides.
176
+ #
177
+ # @param timeouts [Integer, nil]
178
+
179
+ # @see Courier::Models::TenantTemplateInput::Provider#metadata
180
+ class Metadata < Courier::Internal::Type::BaseModel
181
+ # @!attribute utm
182
+ #
183
+ # @return [Courier::Models::Utm, nil]
184
+ optional :utm, -> { Courier::Utm }, nil?: true
185
+
186
+ # @!method initialize(utm: nil)
187
+ # @param utm [Courier::Models::Utm, nil]
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Tenants
6
+ # @see Courier::Resources::Tenants::Templates#publish
7
+ class TemplatePublishParams < Courier::Models::PostTenantTemplatePublishRequest
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute tenant_id
12
+ #
13
+ # @return [String]
14
+ required :tenant_id, String
15
+
16
+ # @!method initialize(tenant_id:, request_options: {})
17
+ # @param tenant_id [String]
18
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Tenants
6
+ # @see Courier::Resources::Tenants::Templates#replace
7
+ class TemplateReplaceParams < Courier::Models::PutTenantTemplateRequest
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute tenant_id
12
+ #
13
+ # @return [String]
14
+ required :tenant_id, String
15
+
16
+ # @!method initialize(tenant_id:, request_options: {})
17
+ # @param tenant_id [String]
18
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Tenants
6
+ module Templates
7
+ # @see Courier::Resources::Tenants::Templates::Versions#retrieve
8
+ class VersionRetrieveParams < Courier::Internal::Type::BaseModel
9
+ extend Courier::Internal::Type::RequestParameters::Converter
10
+ include Courier::Internal::Type::RequestParameters
11
+
12
+ # @!attribute tenant_id
13
+ #
14
+ # @return [String]
15
+ required :tenant_id, String
16
+
17
+ # @!attribute template_id
18
+ #
19
+ # @return [String]
20
+ required :template_id, String
21
+
22
+ # @!method initialize(tenant_id:, template_id:, request_options: {})
23
+ # @param tenant_id [String]
24
+ # @param template_id [String]
25
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -241,6 +241,10 @@ module Courier
241
241
 
242
242
  Paging = Courier::Models::Paging
243
243
 
244
+ PostTenantTemplatePublishRequest = Courier::Models::PostTenantTemplatePublishRequest
245
+
246
+ PostTenantTemplatePublishResponse = Courier::Models::PostTenantTemplatePublishResponse
247
+
244
248
  Preference = Courier::Models::Preference
245
249
 
246
250
  PreferenceStatus = Courier::Models::PreferenceStatus
@@ -259,6 +263,10 @@ module Courier
259
263
 
260
264
  PutSubscriptionsRecipient = Courier::Models::PutSubscriptionsRecipient
261
265
 
266
+ PutTenantTemplateRequest = Courier::Models::PutTenantTemplateRequest
267
+
268
+ PutTenantTemplateResponse = Courier::Models::PutTenantTemplateResponse
269
+
262
270
  RecipientPreferences = Courier::Models::RecipientPreferences
263
271
 
264
272
  RequestArchiveParams = Courier::Models::RequestArchiveParams
@@ -313,6 +321,8 @@ module Courier
313
321
 
314
322
  Tenants = Courier::Models::Tenants
315
323
 
324
+ TenantTemplateInput = Courier::Models::TenantTemplateInput
325
+
316
326
  TenantUpdateParams = Courier::Models::TenantUpdateParams
317
327
 
318
328
  TextStyle = Courier::Models::TextStyle
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Tenants
6
+ class Templates
7
+ class Versions
8
+ # Some parameter documentations has been truncated, see
9
+ # {Courier::Models::Tenants::Templates::VersionRetrieveParams} for more details.
10
+ #
11
+ # Fetches a specific version of a tenant template.
12
+ #
13
+ # Supports the following version formats:
14
+ #
15
+ # - `latest` - The most recent version of the template
16
+ # - `published` - The currently published version
17
+ # - `v{version}` - A specific version (e.g., "v1", "v2", "v1.0.0")
18
+ #
19
+ # @overload retrieve(version, tenant_id:, template_id:, request_options: {})
20
+ #
21
+ # @param version [String] Version of the template to retrieve. Accepts "latest", "published", or a specifi
22
+ #
23
+ # @param tenant_id [String] Id of the tenant for which to retrieve the template.
24
+ #
25
+ # @param template_id [String] Id of the template to be retrieved.
26
+ #
27
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
28
+ #
29
+ # @return [Courier::Models::BaseTemplateTenantAssociation]
30
+ #
31
+ # @see Courier::Models::Tenants::Templates::VersionRetrieveParams
32
+ def retrieve(version, params)
33
+ parsed, options = Courier::Tenants::Templates::VersionRetrieveParams.dump_request(params)
34
+ tenant_id =
35
+ parsed.delete(:tenant_id) do
36
+ raise ArgumentError.new("missing required path argument #{_1}")
37
+ end
38
+ template_id =
39
+ parsed.delete(:template_id) do
40
+ raise ArgumentError.new("missing required path argument #{_1}")
41
+ end
42
+ @client.request(
43
+ method: :get,
44
+ path: ["tenants/%1$s/templates/%2$s/versions/%3$s", tenant_id, template_id, version],
45
+ model: Courier::BaseTemplateTenantAssociation,
46
+ options: options
47
+ )
48
+ end
49
+
50
+ # @api private
51
+ #
52
+ # @param client [Courier::Client]
53
+ def initialize(client:)
54
+ @client = client
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end