Skip to content

Commit 9f3e4d2

Browse files
feat(api): add notification template CRUD methods, update list params/types
1 parent 6a262f2 commit 9f3e4d2

48 files changed

Lines changed: 2768 additions & 299 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: 83
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-19330fca8fa9bbae835ec9d9f83b37b3df364d9b462090b9623bfc9b6eae99c2.yml
3-
openapi_spec_hash: 0bc6889464c9ac2542b4837f569c1837
4-
config_hash: c501fe3838c270e9b44dd5dc4b7fca70
1+
configured_endpoints: 88
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-288ef53fff4d0cc92b3ac14bc1e03dc41c112b55634713adb75158b1c97c4576.yml
3+
openapi_spec_hash: 5c4fed9a1639a6cdfcb5adaf666c9ed6
4+
config_hash: a0ecf9dfbd637db38508b3de2b81aeeb

lib/courier.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
require_relative "courier/models/elemental_channel_node"
6161
require_relative "courier/models/journeys_invoke_request"
6262
require_relative "courier/models/message_details"
63+
require_relative "courier/models/notification_template_create_request"
64+
require_relative "courier/models/notification_template_update_request"
65+
require_relative "courier/models/notification_template_payload"
6366
require_relative "courier/models/base_template_tenant_association"
6467
require_relative "courier/models/post_tenant_template_publish_request"
6568
require_relative "courier/models/put_tenant_template_request"
@@ -176,17 +179,25 @@
176179
require_relative "courier/models/ms_teams_base_properties"
177180
require_relative "courier/models/ms_teams_recipient"
178181
require_relative "courier/models/multiple_tokens"
182+
require_relative "courier/models/notification_archive_params"
183+
require_relative "courier/models/notification_create_params"
179184
require_relative "courier/models/notification_get_content"
180185
require_relative "courier/models/notification_list_params"
181186
require_relative "courier/models/notification_list_response"
182187
require_relative "courier/models/notification_preference_details"
188+
require_relative "courier/models/notification_publish_params"
189+
require_relative "courier/models/notification_replace_params"
183190
require_relative "courier/models/notification_retrieve_content_params"
191+
require_relative "courier/models/notification_retrieve_params"
184192
require_relative "courier/models/notifications/check_delete_params"
185193
require_relative "courier/models/notifications/check_list_params"
186194
require_relative "courier/models/notifications/check_list_response"
187195
require_relative "courier/models/notifications/check_update_params"
188196
require_relative "courier/models/notifications/check_update_response"
189197
require_relative "courier/models/notifications/draft_retrieve_content_params"
198+
require_relative "courier/models/notification_template_get_response"
199+
require_relative "courier/models/notification_template_mutation_response"
200+
require_relative "courier/models/notification_template_summary"
190201
require_relative "courier/models/pagerduty"
191202
require_relative "courier/models/pagerduty_recipient"
192203
require_relative "courier/models/paging"

lib/courier/models.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,38 @@ module Courier
237237

238238
MultipleTokens = Courier::Models::MultipleTokens
239239

240+
NotificationArchiveParams = Courier::Models::NotificationArchiveParams
241+
242+
NotificationCreateParams = Courier::Models::NotificationCreateParams
243+
240244
NotificationGetContent = Courier::Models::NotificationGetContent
241245

242246
NotificationListParams = Courier::Models::NotificationListParams
243247

244248
NotificationPreferenceDetails = Courier::Models::NotificationPreferenceDetails
245249

250+
NotificationPublishParams = Courier::Models::NotificationPublishParams
251+
252+
NotificationReplaceParams = Courier::Models::NotificationReplaceParams
253+
246254
NotificationRetrieveContentParams = Courier::Models::NotificationRetrieveContentParams
247255

256+
NotificationRetrieveParams = Courier::Models::NotificationRetrieveParams
257+
248258
Notifications = Courier::Models::Notifications
249259

260+
NotificationTemplateCreateRequest = Courier::Models::NotificationTemplateCreateRequest
261+
262+
NotificationTemplateGetResponse = Courier::Models::NotificationTemplateGetResponse
263+
264+
NotificationTemplateMutationResponse = Courier::Models::NotificationTemplateMutationResponse
265+
266+
NotificationTemplatePayload = Courier::Models::NotificationTemplatePayload
267+
268+
NotificationTemplateSummary = Courier::Models::NotificationTemplateSummary
269+
270+
NotificationTemplateUpdateRequest = Courier::Models::NotificationTemplateUpdateRequest
271+
250272
Pagerduty = Courier::Models::Pagerduty
251273

252274
PagerdutyRecipient = Courier::Models::PagerdutyRecipient
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::Notifications#archive
6+
class NotificationArchiveParams < Courier::Internal::Type::BaseModel
7+
extend Courier::Internal::Type::RequestParameters::Converter
8+
include Courier::Internal::Type::RequestParameters
9+
10+
# @!attribute id
11+
#
12+
# @return [String]
13+
required :id, String
14+
15+
# @!method initialize(id:, request_options: {})
16+
# @param id [String]
17+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
18+
end
19+
end
20+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::Notifications#create
6+
class NotificationCreateParams < Courier::Models::NotificationTemplateCreateRequest
7+
extend Courier::Internal::Type::RequestParameters::Converter
8+
include Courier::Internal::Type::RequestParameters
9+
10+
# @!method initialize(request_options: {})
11+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
12+
end
13+
end
14+
end

lib/courier/models/notification_list_params.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,29 @@ class NotificationListParams < Courier::Internal::Type::BaseModel
88
include Courier::Internal::Type::RequestParameters
99

1010
# @!attribute cursor
11+
# Opaque pagination cursor from a previous response. Omit for the first page.
1112
#
1213
# @return [String, nil]
1314
optional :cursor, String, nil?: true
1415

16+
# @!attribute event_id
17+
# Filter to templates linked to this event map ID.
18+
#
19+
# @return [String, nil]
20+
optional :event_id, String
21+
1522
# @!attribute notes
16-
# Retrieve the notes from the Notification template settings.
23+
# Include template notes in the response. Only applies to legacy templates.
1724
#
1825
# @return [Boolean, nil]
1926
optional :notes, Courier::Internal::Type::Boolean, nil?: true
2027

21-
# @!method initialize(cursor: nil, notes: nil, request_options: {})
22-
# @param cursor [String, nil]
28+
# @!method initialize(cursor: nil, event_id: nil, notes: nil, request_options: {})
29+
# @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
30+
#
31+
# @param event_id [String] Filter to templates linked to this event map ID.
2332
#
24-
# @param notes [Boolean, nil] Retrieve the notes from the Notification template settings.
33+
# @param notes [Boolean, nil] Include template notes in the response. Only applies to legacy templates.
2534
#
2635
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
2736
end

lib/courier/models/notification_list_response.rb

Lines changed: 108 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -10,108 +10,123 @@ class NotificationListResponse < Courier::Internal::Type::BaseModel
1010
required :paging, -> { Courier::Paging }
1111

1212
# @!attribute results
13+
# Notification templates in this workspace.
1314
#
14-
# @return [Array<Courier::Models::NotificationListResponse::Result>]
15+
# @return [Array<Courier::Models::NotificationListResponse::Result::Notification, Courier::Models::NotificationTemplateSummary>]
1516
required :results,
16-
-> { Courier::Internal::Type::ArrayOf[Courier::Models::NotificationListResponse::Result] }
17+
-> { Courier::Internal::Type::ArrayOf[union: Courier::Models::NotificationListResponse::Result] }
1718

1819
# @!method initialize(paging:, results:)
1920
# @param paging [Courier::Models::Paging]
20-
# @param results [Array<Courier::Models::NotificationListResponse::Result>]
21-
22-
class Result < Courier::Internal::Type::BaseModel
23-
# @!attribute id
24-
#
25-
# @return [String]
26-
required :id, String
27-
28-
# @!attribute created_at
29-
#
30-
# @return [Integer]
31-
required :created_at, Integer
32-
33-
# @!attribute event_ids
34-
# Array of event IDs associated with this notification
35-
#
36-
# @return [Array<String>]
37-
required :event_ids, Courier::Internal::Type::ArrayOf[String]
38-
39-
# @!attribute note
40-
#
41-
# @return [String]
42-
required :note, String
43-
44-
# @!attribute routing
45-
#
46-
# @return [Courier::Models::MessageRouting]
47-
required :routing, -> { Courier::MessageRouting }
48-
49-
# @!attribute topic_id
50-
#
51-
# @return [String]
52-
required :topic_id, String
53-
54-
# @!attribute updated_at
55-
#
56-
# @return [Integer]
57-
required :updated_at, Integer
58-
59-
# @!attribute tags
60-
#
61-
# @return [Courier::Models::NotificationListResponse::Result::Tags, nil]
62-
optional :tags, -> { Courier::Models::NotificationListResponse::Result::Tags }, nil?: true
63-
64-
# @!attribute title
65-
#
66-
# @return [String, nil]
67-
optional :title, String, nil?: true
68-
69-
# @!method initialize(id:, created_at:, event_ids:, note:, routing:, topic_id:, updated_at:, tags: nil, title: nil)
70-
# @param id [String]
71-
#
72-
# @param created_at [Integer]
73-
#
74-
# @param event_ids [Array<String>] Array of event IDs associated with this notification
75-
#
76-
# @param note [String]
77-
#
78-
# @param routing [Courier::Models::MessageRouting]
79-
#
80-
# @param topic_id [String]
81-
#
82-
# @param updated_at [Integer]
83-
#
84-
# @param tags [Courier::Models::NotificationListResponse::Result::Tags, nil]
85-
#
86-
# @param title [String, nil]
87-
88-
# @see Courier::Models::NotificationListResponse::Result#tags
89-
class Tags < Courier::Internal::Type::BaseModel
90-
# @!attribute data
91-
#
92-
# @return [Array<Courier::Models::NotificationListResponse::Result::Tags::Data>]
93-
required :data,
94-
-> { Courier::Internal::Type::ArrayOf[Courier::Models::NotificationListResponse::Result::Tags::Data] }
95-
96-
# @!method initialize(data:)
97-
# @param data [Array<Courier::Models::NotificationListResponse::Result::Tags::Data>]
98-
99-
class Data < Courier::Internal::Type::BaseModel
100-
# @!attribute id
101-
#
102-
# @return [String]
103-
required :id, String
21+
#
22+
# @param results [Array<Courier::Models::NotificationListResponse::Result::Notification, Courier::Models::NotificationTemplateSummary>] Notification templates in this workspace.
10423

105-
# @!attribute name
106-
#
107-
# @return [String]
108-
required :name, String
24+
# V2 (CDS) template summary returned in list responses.
25+
module Result
26+
extend Courier::Internal::Type::Union
27+
28+
variant -> { Courier::Models::NotificationListResponse::Result::Notification }
29+
30+
# V2 (CDS) template summary returned in list responses.
31+
variant -> { Courier::NotificationTemplateSummary }
32+
33+
class Notification < Courier::Internal::Type::BaseModel
34+
# @!attribute id
35+
#
36+
# @return [String]
37+
required :id, String
38+
39+
# @!attribute created_at
40+
#
41+
# @return [Integer]
42+
required :created_at, Integer
43+
44+
# @!attribute event_ids
45+
# Array of event IDs associated with this notification
46+
#
47+
# @return [Array<String>]
48+
required :event_ids, Courier::Internal::Type::ArrayOf[String]
49+
50+
# @!attribute note
51+
#
52+
# @return [String]
53+
required :note, String
54+
55+
# @!attribute routing
56+
#
57+
# @return [Courier::Models::MessageRouting]
58+
required :routing, -> { Courier::MessageRouting }
59+
60+
# @!attribute topic_id
61+
#
62+
# @return [String]
63+
required :topic_id, String
10964

110-
# @!method initialize(id:, name:)
111-
# @param id [String]
112-
# @param name [String]
65+
# @!attribute updated_at
66+
#
67+
# @return [Integer]
68+
required :updated_at, Integer
69+
70+
# @!attribute tags
71+
#
72+
# @return [Courier::Models::NotificationListResponse::Result::Notification::Tags, nil]
73+
optional :tags, -> { Courier::Models::NotificationListResponse::Result::Notification::Tags }, nil?: true
74+
75+
# @!attribute title
76+
#
77+
# @return [String, nil]
78+
optional :title, String, nil?: true
79+
80+
# @!method initialize(id:, created_at:, event_ids:, note:, routing:, topic_id:, updated_at:, tags: nil, title: nil)
81+
# @param id [String]
82+
#
83+
# @param created_at [Integer]
84+
#
85+
# @param event_ids [Array<String>] Array of event IDs associated with this notification
86+
#
87+
# @param note [String]
88+
#
89+
# @param routing [Courier::Models::MessageRouting]
90+
#
91+
# @param topic_id [String]
92+
#
93+
# @param updated_at [Integer]
94+
#
95+
# @param tags [Courier::Models::NotificationListResponse::Result::Notification::Tags, nil]
96+
#
97+
# @param title [String, nil]
98+
99+
# @see Courier::Models::NotificationListResponse::Result::Notification#tags
100+
class Tags < Courier::Internal::Type::BaseModel
101+
# @!attribute data
102+
#
103+
# @return [Array<Courier::Models::NotificationListResponse::Result::Notification::Tags::Data>]
104+
required :data,
105+
-> { Courier::Internal::Type::ArrayOf[Courier::Models::NotificationListResponse::Result::Notification::Tags::Data] }
106+
107+
# @!method initialize(data:)
108+
# @param data [Array<Courier::Models::NotificationListResponse::Result::Notification::Tags::Data>]
109+
110+
class Data < Courier::Internal::Type::BaseModel
111+
# @!attribute id
112+
#
113+
# @return [String]
114+
required :id, String
115+
116+
# @!attribute name
117+
#
118+
# @return [String]
119+
required :name, String
120+
121+
# @!method initialize(id:, name:)
122+
# @param id [String]
123+
# @param name [String]
124+
end
113125
end
114126
end
127+
128+
# @!method self.variants
129+
# @return [Array(Courier::Models::NotificationListResponse::Result::Notification, Courier::Models::NotificationTemplateSummary)]
115130
end
116131
end
117132
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::Notifications#publish
6+
class NotificationPublishParams < Courier::Internal::Type::BaseModel
7+
extend Courier::Internal::Type::RequestParameters::Converter
8+
include Courier::Internal::Type::RequestParameters
9+
10+
# @!attribute id
11+
#
12+
# @return [String]
13+
required :id, String
14+
15+
# @!method initialize(id:, request_options: {})
16+
# @param id [String]
17+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)