diff --git a/.release-please-manifest.json b/.release-please-manifest.json index abeb3cc..88e4c44 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.19.2" + ".": "4.20.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9e3b99b..809d9f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 138 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-11e1931d767cef402bbed5a965746d1933ae72db0f41881860593a0b1424fd80.yml -openapi_spec_hash: 9def941805f233f8761c4bdae88f6137 -config_hash: 6c3a754258f0f77e9032a90a478ab76d +configured_endpoints: 139 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-def1e982add0411bf64b48cdf5e4f2c1b85b9bd0ada0d5e6fc4869afa85e0bff.yml +openapi_spec_hash: 5d129cdf800798bcd4a93585ec89c696 +config_hash: dcd58abf1e56b114bdce22336ca3d570 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1a41a..c1119db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.20.0 (2026-07-14) + +Full Changelog: [v4.19.2...v4.20.0](https://github.com/trycourier/courier-ruby/compare/v4.19.2...v4.20.0) + +### Features + +* Document POST /notifications/{id}/duplicate [C-18607] ([#165](https://github.com/trycourier/courier-ruby/issues/165)) ([212644c](https://github.com/trycourier/courier-ruby/commit/212644cd49ac7b108944831e04289d2e9e073b7d)) +* Merge pull request [#149](https://github.com/trycourier/courier-ruby/issues/149) from trycourier/geraldosilva/c-19201-notification-template-subscription-topic-id ([cd697fa](https://github.com/trycourier/courier-ruby/commit/cd697fa2d3b49db32db582dae1789ab03706ced5)) + ## 4.19.2 (2026-07-10) Full Changelog: [v4.19.1...v4.19.2](https://github.com/trycourier/courier-ruby/compare/v4.19.1...v4.19.2) diff --git a/Gemfile.lock b/Gemfile.lock index de77cce..e60f699 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - trycourier (4.19.2) + trycourier (4.20.0) cgi connection_pool diff --git a/lib/courier.rb b/lib/courier.rb index e6fa372..35cb3d7 100644 --- a/lib/courier.rb +++ b/lib/courier.rb @@ -260,6 +260,7 @@ require_relative "courier/models/notification_content_get_response" require_relative "courier/models/notification_content_mutation_response" require_relative "courier/models/notification_create_params" +require_relative "courier/models/notification_duplicate_params" require_relative "courier/models/notification_get_content" require_relative "courier/models/notification_list_params" require_relative "courier/models/notification_list_response" diff --git a/lib/courier/models.rb b/lib/courier/models.rb index f7ec0a6..4e19e6a 100644 --- a/lib/courier/models.rb +++ b/lib/courier/models.rb @@ -360,6 +360,8 @@ module Courier NotificationCreateParams = Courier::Models::NotificationCreateParams + NotificationDuplicateParams = Courier::Models::NotificationDuplicateParams + NotificationElementPutRequest = Courier::Models::NotificationElementPutRequest NotificationGetContent = Courier::Models::NotificationGetContent diff --git a/lib/courier/models/notification_duplicate_params.rb b/lib/courier/models/notification_duplicate_params.rb new file mode 100644 index 0000000..8e38bc6 --- /dev/null +++ b/lib/courier/models/notification_duplicate_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Courier + module Models + # @see Courier::Resources::Notifications#duplicate + class NotificationDuplicateParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:, request_options: {}) + # @param id [String] + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/courier/models/notification_template_summary.rb b/lib/courier/models/notification_template_summary.rb index 382cee9..2c09e81 100644 --- a/lib/courier/models/notification_template_summary.rb +++ b/lib/courier/models/notification_template_summary.rb @@ -35,6 +35,13 @@ class NotificationTemplateSummary < Courier::Internal::Type::BaseModel # @return [Array] required :tags, Courier::Internal::Type::ArrayOf[String] + # @!attribute subscription_topic_id + # The linked subscription (preference) topic of the published version. Omitted + # when no topic is linked or the template has never been published. + # + # @return [String, nil] + optional :subscription_topic_id, String + # @!attribute updated # Epoch milliseconds of last update. # @@ -47,7 +54,10 @@ class NotificationTemplateSummary < Courier::Internal::Type::BaseModel # @return [String, nil] optional :updater, String - # @!method initialize(id:, created:, creator:, name:, state:, tags:, updated: nil, updater: nil) + # @!method initialize(id:, created:, creator:, name:, state:, tags:, subscription_topic_id: nil, updated: nil, updater: nil) + # Some parameter documentations has been truncated, see + # {Courier::Models::NotificationTemplateSummary} for more details. + # # V2 (CDS) template summary returned in list responses. # # @param id [String] @@ -62,6 +72,8 @@ class NotificationTemplateSummary < Courier::Internal::Type::BaseModel # # @param tags [Array] # + # @param subscription_topic_id [String] The linked subscription (preference) topic of the published version. Omitted whe + # # @param updated [Integer] Epoch milliseconds of last update. # # @param updater [String] User ID of the last updater. diff --git a/lib/courier/resources/notifications.rb b/lib/courier/resources/notifications.rb index 43cab1a..410d855 100644 --- a/lib/courier/resources/notifications.rb +++ b/lib/courier/resources/notifications.rb @@ -110,6 +110,31 @@ def archive(id, params = {}) ) end + # Duplicate a notification template. Creates a standalone copy within the same + # workspace and environment, with " COPY" appended to the title. The copy clones + # the source draft's tags, brand, subscription topic, routing strategy, channels, + # and content, and is always created as a standalone template (it is not linked to + # any journey or broadcast, even if the source was). Templates that are scoped to + # a journey or a broadcast cannot be duplicated through this endpoint. + # + # @overload duplicate(id, request_options: {}) + # + # @param id [String] Template ID (nt\_ prefix). + # + # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Courier::Models::NotificationTemplateResponse] + # + # @see Courier::Models::NotificationDuplicateParams + def duplicate(id, params = {}) + @client.request( + method: :post, + path: ["notifications/%1$s/duplicate", id], + model: Courier::NotificationTemplateResponse, + options: params[:request_options] + ) + end + # List versions of a notification template. # # @overload list_versions(id, cursor: nil, limit: nil, request_options: {}) diff --git a/lib/courier/version.rb b/lib/courier/version.rb index 6766905..960b373 100644 --- a/lib/courier/version.rb +++ b/lib/courier/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Courier - VERSION = "4.19.2" + VERSION = "4.20.0" end diff --git a/rbi/courier/models.rbi b/rbi/courier/models.rbi index 4a10e90..4647a7e 100644 --- a/rbi/courier/models.rbi +++ b/rbi/courier/models.rbi @@ -329,6 +329,8 @@ module Courier NotificationCreateParams = Courier::Models::NotificationCreateParams + NotificationDuplicateParams = Courier::Models::NotificationDuplicateParams + NotificationElementPutRequest = Courier::Models::NotificationElementPutRequest NotificationGetContent = Courier::Models::NotificationGetContent diff --git a/rbi/courier/models/notification_duplicate_params.rbi b/rbi/courier/models/notification_duplicate_params.rbi new file mode 100644 index 0000000..8a44e15 --- /dev/null +++ b/rbi/courier/models/notification_duplicate_params.rbi @@ -0,0 +1,38 @@ +# typed: strong + +module Courier + module Models + class NotificationDuplicateParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Courier::NotificationDuplicateParams, + Courier::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(id:, request_options: {}) + end + + sig do + override.returns( + { id: String, request_options: Courier::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/courier/models/notification_template_summary.rbi b/rbi/courier/models/notification_template_summary.rbi index 1539c38..1d1d393 100644 --- a/rbi/courier/models/notification_template_summary.rbi +++ b/rbi/courier/models/notification_template_summary.rbi @@ -31,6 +31,14 @@ module Courier sig { returns(T::Array[String]) } attr_accessor :tags + # The linked subscription (preference) topic of the published version. Omitted + # when no topic is linked or the template has never been published. + sig { returns(T.nilable(String)) } + attr_reader :subscription_topic_id + + sig { params(subscription_topic_id: String).void } + attr_writer :subscription_topic_id + # Epoch milliseconds of last update. sig { returns(T.nilable(Integer)) } attr_reader :updated @@ -54,6 +62,7 @@ module Courier name: String, state: Courier::NotificationTemplateSummary::State::OrSymbol, tags: T::Array[String], + subscription_topic_id: String, updated: Integer, updater: String ).returns(T.attached_class) @@ -67,6 +76,9 @@ module Courier name:, state:, tags:, + # The linked subscription (preference) topic of the published version. Omitted + # when no topic is linked or the template has never been published. + subscription_topic_id: nil, # Epoch milliseconds of last update. updated: nil, # User ID of the last updater. @@ -83,6 +95,7 @@ module Courier name: String, state: Courier::NotificationTemplateSummary::State::TaggedSymbol, tags: T::Array[String], + subscription_topic_id: String, updated: Integer, updater: String } diff --git a/rbi/courier/resources/notifications.rbi b/rbi/courier/resources/notifications.rbi index 00efdc6..bdb459a 100644 --- a/rbi/courier/resources/notifications.rbi +++ b/rbi/courier/resources/notifications.rbi @@ -79,6 +79,25 @@ module Courier ) end + # Duplicate a notification template. Creates a standalone copy within the same + # workspace and environment, with " COPY" appended to the title. The copy clones + # the source draft's tags, brand, subscription topic, routing strategy, channels, + # and content, and is always created as a standalone template (it is not linked to + # any journey or broadcast, even if the source was). Templates that are scoped to + # a journey or a broadcast cannot be duplicated through this endpoint. + sig do + params( + id: String, + request_options: Courier::RequestOptions::OrHash + ).returns(Courier::NotificationTemplateResponse) + end + def duplicate( + # Template ID (nt\_ prefix). + id, + request_options: {} + ) + end + # List versions of a notification template. sig do params( diff --git a/sig/courier/models.rbs b/sig/courier/models.rbs index 893de37..19cb7bd 100644 --- a/sig/courier/models.rbs +++ b/sig/courier/models.rbs @@ -317,6 +317,8 @@ module Courier class NotificationCreateParams = Courier::Models::NotificationCreateParams + class NotificationDuplicateParams = Courier::Models::NotificationDuplicateParams + class NotificationElementPutRequest = Courier::Models::NotificationElementPutRequest class NotificationGetContent = Courier::Models::NotificationGetContent diff --git a/sig/courier/models/notification_duplicate_params.rbs b/sig/courier/models/notification_duplicate_params.rbs new file mode 100644 index 0000000..f99586b --- /dev/null +++ b/sig/courier/models/notification_duplicate_params.rbs @@ -0,0 +1,20 @@ +module Courier + module Models + type notification_duplicate_params = + { id: String } & Courier::Internal::Type::request_parameters + + class NotificationDuplicateParams < Courier::Internal::Type::BaseModel + extend Courier::Internal::Type::RequestParameters::Converter + include Courier::Internal::Type::RequestParameters + + attr_accessor id: String + + def initialize: ( + id: String, + ?request_options: Courier::request_opts + ) -> void + + def to_hash: -> { id: String, request_options: Courier::RequestOptions } + end + end +end diff --git a/sig/courier/models/notification_template_summary.rbs b/sig/courier/models/notification_template_summary.rbs index 81b6b6e..aa141c7 100644 --- a/sig/courier/models/notification_template_summary.rbs +++ b/sig/courier/models/notification_template_summary.rbs @@ -8,6 +8,7 @@ module Courier name: String, state: Courier::Models::NotificationTemplateSummary::state, tags: ::Array[String], + subscription_topic_id: String, updated: Integer, updater: String } @@ -25,6 +26,10 @@ module Courier attr_accessor tags: ::Array[String] + attr_reader subscription_topic_id: String? + + def subscription_topic_id=: (String) -> String + attr_reader updated: Integer? def updated=: (Integer) -> Integer @@ -40,6 +45,7 @@ module Courier name: String, state: Courier::Models::NotificationTemplateSummary::state, tags: ::Array[String], + ?subscription_topic_id: String, ?updated: Integer, ?updater: String ) -> void @@ -51,6 +57,7 @@ module Courier name: String, state: Courier::Models::NotificationTemplateSummary::state, tags: ::Array[String], + subscription_topic_id: String, updated: Integer, updater: String } diff --git a/sig/courier/resources/notifications.rbs b/sig/courier/resources/notifications.rbs index 66b875d..c5251f5 100644 --- a/sig/courier/resources/notifications.rbs +++ b/sig/courier/resources/notifications.rbs @@ -24,6 +24,11 @@ module Courier def archive: (String id, ?request_options: Courier::request_opts) -> nil + def duplicate: ( + String id, + ?request_options: Courier::request_opts + ) -> Courier::NotificationTemplateResponse + def list_versions: ( String id, ?cursor: String, diff --git a/test/courier/resources/notifications_test.rb b/test/courier/resources/notifications_test.rb index 37d0525..3003277 100644 --- a/test/courier/resources/notifications_test.rb +++ b/test/courier/resources/notifications_test.rb @@ -60,6 +60,16 @@ def test_archive end end + def test_duplicate + skip("Mock server tests are disabled") + + response = @courier.notifications.duplicate("id") + + assert_pattern do + response => Courier::NotificationTemplateResponse + end + end + def test_list_versions skip("Mock server tests are disabled")