Skip to content

Commit ecb21e4

Browse files
feat(api): add put_content/put_element/put_locale, remove draft resource, update retrieve_content
1 parent 4ea51b0 commit ecb21e4

53 files changed

Lines changed: 2002 additions & 212 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 100
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-06779bbaf9cb7a27215b6c6d1376f93a1e17ab21b111b55e89e9c989b1dc1b85.yml
3-
openapi_spec_hash: 69995747786fb3e075363162bc4c5d6f
4-
config_hash: c6ccb6f2954c650b88d1825501e727f5
1+
configured_endpoints: 102
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-c22b0f83f2edb9cc171977928b3e630e57a9b607a12c7ebaaee4bf2915ad0686.yml
3+
openapi_spec_hash: 9ebc6453998e155b12fb35c40c7d5249
4+
config_hash: cecef6fb68feaa0bda820cd86fa4f045

lib/courier.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
require_relative "courier/models/message_details"
6363
require_relative "courier/models/notification_template_create_request"
6464
require_relative "courier/models/notification_template_publish_request"
65+
require_relative "courier/models/notification_content_put_request"
66+
require_relative "courier/models/notification_element_put_request"
67+
require_relative "courier/models/notification_locale_put_request"
6568
require_relative "courier/models/notification_template_update_request"
6669
require_relative "courier/models/notification_template_payload"
6770
require_relative "courier/models/routing_strategy_create_request"
@@ -137,6 +140,7 @@
137140
require_relative "courier/models/elemental_node"
138141
require_relative "courier/models/elemental_quote_node_with_type"
139142
require_relative "courier/models/elemental_text_node_with_type"
143+
require_relative "courier/models/element_with_checksums"
140144
require_relative "courier/models/email_footer"
141145
require_relative "courier/models/email_head"
142146
require_relative "courier/models/email_header"
@@ -190,24 +194,30 @@
190194
require_relative "courier/models/ms_teams_recipient"
191195
require_relative "courier/models/multiple_tokens"
192196
require_relative "courier/models/notification_archive_params"
197+
require_relative "courier/models/notification_content_get_response"
198+
require_relative "courier/models/notification_content_mutation_response"
193199
require_relative "courier/models/notification_create_params"
194200
require_relative "courier/models/notification_get_content"
195201
require_relative "courier/models/notification_list_params"
196202
require_relative "courier/models/notification_list_response"
197203
require_relative "courier/models/notification_list_versions_params"
198204
require_relative "courier/models/notification_preference_details"
199205
require_relative "courier/models/notification_publish_params"
206+
require_relative "courier/models/notification_put_content_params"
207+
require_relative "courier/models/notification_put_element_params"
208+
require_relative "courier/models/notification_put_locale_params"
200209
require_relative "courier/models/notification_replace_params"
201210
require_relative "courier/models/notification_retrieve_content_params"
211+
require_relative "courier/models/notification_retrieve_content_response"
202212
require_relative "courier/models/notification_retrieve_params"
203213
require_relative "courier/models/notifications/check_delete_params"
204214
require_relative "courier/models/notifications/check_list_params"
205215
require_relative "courier/models/notifications/check_list_response"
206216
require_relative "courier/models/notifications/check_update_params"
207217
require_relative "courier/models/notifications/check_update_response"
208-
require_relative "courier/models/notifications/draft_retrieve_content_params"
209218
require_relative "courier/models/notification_template_get_response"
210219
require_relative "courier/models/notification_template_mutation_response"
220+
require_relative "courier/models/notification_template_state"
211221
require_relative "courier/models/notification_template_summary"
212222
require_relative "courier/models/notification_template_version_list_response"
213223
require_relative "courier/models/pagerduty"
@@ -343,7 +353,6 @@
343353
require_relative "courier/resources/messages"
344354
require_relative "courier/resources/notifications"
345355
require_relative "courier/resources/notifications/checks"
346-
require_relative "courier/resources/notifications/draft"
347356
require_relative "courier/resources/profiles"
348357
require_relative "courier/resources/profiles/lists"
349358
require_relative "courier/resources/providers"

lib/courier/models.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ module Courier
163163

164164
ElementalTextNodeWithType = Courier::Models::ElementalTextNodeWithType
165165

166+
ElementWithChecksums = Courier::Models::ElementWithChecksums
167+
166168
EmailFooter = Courier::Models::EmailFooter
167169

168170
EmailHead = Courier::Models::EmailHead
@@ -255,18 +257,34 @@ module Courier
255257

256258
NotificationArchiveParams = Courier::Models::NotificationArchiveParams
257259

260+
NotificationContentGetResponse = Courier::Models::NotificationContentGetResponse
261+
262+
NotificationContentMutationResponse = Courier::Models::NotificationContentMutationResponse
263+
264+
NotificationContentPutRequest = Courier::Models::NotificationContentPutRequest
265+
258266
NotificationCreateParams = Courier::Models::NotificationCreateParams
259267

268+
NotificationElementPutRequest = Courier::Models::NotificationElementPutRequest
269+
260270
NotificationGetContent = Courier::Models::NotificationGetContent
261271

262272
NotificationListParams = Courier::Models::NotificationListParams
263273

264274
NotificationListVersionsParams = Courier::Models::NotificationListVersionsParams
265275

276+
NotificationLocalePutRequest = Courier::Models::NotificationLocalePutRequest
277+
266278
NotificationPreferenceDetails = Courier::Models::NotificationPreferenceDetails
267279

268280
NotificationPublishParams = Courier::Models::NotificationPublishParams
269281

282+
NotificationPutContentParams = Courier::Models::NotificationPutContentParams
283+
284+
NotificationPutElementParams = Courier::Models::NotificationPutElementParams
285+
286+
NotificationPutLocaleParams = Courier::Models::NotificationPutLocaleParams
287+
270288
NotificationReplaceParams = Courier::Models::NotificationReplaceParams
271289

272290
NotificationRetrieveContentParams = Courier::Models::NotificationRetrieveContentParams
@@ -285,6 +303,8 @@ module Courier
285303

286304
NotificationTemplatePublishRequest = Courier::Models::NotificationTemplatePublishRequest
287305

306+
NotificationTemplateState = Courier::Models::NotificationTemplateState
307+
288308
NotificationTemplateSummary = Courier::Models::NotificationTemplateSummary
289309

290310
NotificationTemplateUpdateRequest = Courier::Models::NotificationTemplateUpdateRequest
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
class ElementWithChecksums < Courier::Internal::Type::BaseModel
6+
# @!attribute checksum
7+
# MD5 hash of translatable content.
8+
#
9+
# @return [String]
10+
required :checksum, String
11+
12+
# @!attribute type
13+
# Element type (text, meta, action, etc.).
14+
#
15+
# @return [String]
16+
required :type, String
17+
18+
# @!attribute id
19+
#
20+
# @return [String, nil]
21+
optional :id, String
22+
23+
# @!attribute elements
24+
# Nested child elements (for group-type elements).
25+
#
26+
# @return [Array<Courier::Models::ElementWithChecksums>, nil]
27+
optional :elements, -> { Courier::Internal::Type::ArrayOf[Courier::ElementWithChecksums] }
28+
29+
# @!attribute locales
30+
# Locale-specific content with checksums.
31+
#
32+
# @return [Hash{Symbol=>Courier::Models::ElementWithChecksums::Locale}, nil]
33+
optional :locales, -> { Courier::Internal::Type::HashOf[Courier::ElementWithChecksums::Locale] }
34+
35+
# @!method initialize(checksum:, type:, id: nil, elements: nil, locales: nil)
36+
# An element with its content checksum and optional nested elements and locale
37+
# checksums.
38+
#
39+
# @param checksum [String] MD5 hash of translatable content.
40+
#
41+
# @param type [String] Element type (text, meta, action, etc.).
42+
#
43+
# @param id [String]
44+
#
45+
# @param elements [Array<Courier::Models::ElementWithChecksums>] Nested child elements (for group-type elements).
46+
#
47+
# @param locales [Hash{Symbol=>Courier::Models::ElementWithChecksums::Locale}] Locale-specific content with checksums.
48+
49+
class Locale < Courier::Internal::Type::BaseModel
50+
# @!attribute checksum
51+
#
52+
# @return [String]
53+
required :checksum, String
54+
55+
# @!method initialize(checksum:)
56+
# @param checksum [String]
57+
end
58+
end
59+
end
60+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
class NotificationContentGetResponse < Courier::Internal::Type::BaseModel
6+
# @!attribute elements
7+
#
8+
# @return [Array<Courier::Models::ElementWithChecksums>]
9+
required :elements, -> { Courier::Internal::Type::ArrayOf[Courier::ElementWithChecksums] }
10+
11+
# @!attribute version
12+
# Content version identifier.
13+
#
14+
# @return [String]
15+
required :version, String
16+
17+
# @!method initialize(elements:, version:)
18+
# Elemental content response for V2 templates. Contains versioned elements with
19+
# content checksums.
20+
#
21+
# @param elements [Array<Courier::Models::ElementWithChecksums>]
22+
#
23+
# @param version [String] Content version identifier.
24+
end
25+
end
26+
end
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::Notifications#put_content
6+
class NotificationContentMutationResponse < Courier::Internal::Type::BaseModel
7+
# @!attribute id
8+
# Template ID.
9+
#
10+
# @return [String]
11+
required :id, String
12+
13+
# @!attribute elements
14+
#
15+
# @return [Array<Courier::Models::NotificationContentMutationResponse::Element>]
16+
required :elements,
17+
-> { Courier::Internal::Type::ArrayOf[Courier::NotificationContentMutationResponse::Element] }
18+
19+
# @!attribute state
20+
# Template state. Defaults to `DRAFT`.
21+
#
22+
# @return [Symbol, Courier::Models::NotificationTemplateState]
23+
required :state, enum: -> { Courier::NotificationTemplateState }
24+
25+
# @!attribute version
26+
# Content version identifier.
27+
#
28+
# @return [String]
29+
required :version, String
30+
31+
# @!method initialize(id:, elements:, state:, version:)
32+
# Shared mutation response for `PUT` content, `PUT` element, and `PUT` locale
33+
# operations. Contains the template ID, content version, per-element checksums,
34+
# and resulting state.
35+
#
36+
# @param id [String] Template ID.
37+
#
38+
# @param elements [Array<Courier::Models::NotificationContentMutationResponse::Element>]
39+
#
40+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
41+
#
42+
# @param version [String] Content version identifier.
43+
44+
class Element < Courier::Internal::Type::BaseModel
45+
# @!attribute id
46+
#
47+
# @return [String]
48+
required :id, String
49+
50+
# @!attribute checksum
51+
#
52+
# @return [String]
53+
required :checksum, String
54+
55+
# @!method initialize(id:, checksum:)
56+
# @param id [String]
57+
# @param checksum [String]
58+
end
59+
end
60+
end
61+
end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
class NotificationContentPutRequest < Courier::Internal::Type::BaseModel
6+
# @!attribute content
7+
# Elemental content payload. The server defaults `version` when omitted.
8+
#
9+
# @return [Courier::Models::NotificationContentPutRequest::Content]
10+
required :content, -> { Courier::NotificationContentPutRequest::Content }
11+
12+
# @!attribute state
13+
# Template state. Defaults to `DRAFT`.
14+
#
15+
# @return [Symbol, Courier::Models::NotificationTemplateState, nil]
16+
optional :state, enum: -> { Courier::NotificationTemplateState }
17+
18+
# @!method initialize(content:, state: nil)
19+
# Request body for replacing the elemental content of a notification template.
20+
#
21+
# @param content [Courier::Models::NotificationContentPutRequest::Content] Elemental content payload. The server defaults `version` when omitted.
22+
#
23+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
24+
25+
# @see Courier::Models::NotificationContentPutRequest#content
26+
class Content < Courier::Internal::Type::BaseModel
27+
# @!attribute elements
28+
#
29+
# @return [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
30+
required :elements, -> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNode] }
31+
32+
# @!attribute version
33+
# Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
34+
# omitted.
35+
#
36+
# @return [String, nil]
37+
optional :version, String
38+
39+
# @!method initialize(elements:, version: nil)
40+
# Some parameter documentations has been truncated, see
41+
# {Courier::Models::NotificationContentPutRequest::Content} for more details.
42+
#
43+
# Elemental content payload. The server defaults `version` when omitted.
44+
#
45+
# @param elements [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType, Courier::Models::ElementalHTMLNodeWithType>]
46+
#
47+
# @param version [String] Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
48+
end
49+
end
50+
end
51+
end
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
class NotificationElementPutRequest < Courier::Internal::Type::BaseModel
6+
# @!attribute type
7+
# Element type (text, meta, action, image, etc.).
8+
#
9+
# @return [String]
10+
required :type, String
11+
12+
# @!attribute channels
13+
#
14+
# @return [Array<String>, nil]
15+
optional :channels, Courier::Internal::Type::ArrayOf[String]
16+
17+
# @!attribute data
18+
#
19+
# @return [Hash{Symbol=>Object}, nil]
20+
optional :data, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown]
21+
22+
# @!attribute if_
23+
#
24+
# @return [String, nil]
25+
optional :if_, String, api_name: :if
26+
27+
# @!attribute loop_
28+
#
29+
# @return [String, nil]
30+
optional :loop_, String, api_name: :loop
31+
32+
# @!attribute ref
33+
#
34+
# @return [String, nil]
35+
optional :ref, String
36+
37+
# @!attribute state
38+
# Template state. Defaults to `DRAFT`.
39+
#
40+
# @return [Symbol, Courier::Models::NotificationTemplateState, nil]
41+
optional :state, enum: -> { Courier::NotificationTemplateState }
42+
43+
# @!method initialize(type:, channels: nil, data: nil, if_: nil, loop_: nil, ref: nil, state: nil)
44+
# Request body for updating a single element. Additional type-specific fields are
45+
# allowed.
46+
#
47+
# @param type [String] Element type (text, meta, action, image, etc.).
48+
#
49+
# @param channels [Array<String>]
50+
#
51+
# @param data [Hash{Symbol=>Object}]
52+
#
53+
# @param if_ [String]
54+
#
55+
# @param loop_ [String]
56+
#
57+
# @param ref [String]
58+
#
59+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
60+
end
61+
end
62+
end

lib/courier/models/notification_get_content.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
module Courier
44
module Models
5-
# @see Courier::Resources::Notifications#retrieve_content
65
class NotificationGetContent < Courier::Internal::Type::BaseModel
76
# @!attribute blocks
87
#

0 commit comments

Comments
 (0)