Skip to content

Commit ce8f121

Browse files
feat(api): add list_notifications method to routing_strategies
1 parent ecb21e4 commit ce8f121

15 files changed

Lines changed: 321 additions & 4 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
1+
configured_endpoints: 103
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-d891c800ffe6b7eddce179c225367cedcb49dab758ebc03e352d945240918d96.yml
3+
openapi_spec_hash: 852d55192b8d7ad96c1f85cd9070ef64
4+
config_hash: a730d0e598dc108e89c016802008c9b3

lib/courier.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
require_relative "courier/models/airship_profile"
7777
require_relative "courier/models/airship_profile_audience"
7878
require_relative "courier/models/alignment"
79+
require_relative "courier/models/associated_notification_list_response"
7980
require_relative "courier/models/audience"
8081
require_relative "courier/models/audience_delete_params"
8182
require_relative "courier/models/audience_filter"
@@ -257,6 +258,7 @@
257258
require_relative "courier/models/routing_strategy_archive_params"
258259
require_relative "courier/models/routing_strategy_create_params"
259260
require_relative "courier/models/routing_strategy_get_response"
261+
require_relative "courier/models/routing_strategy_list_notifications_params"
260262
require_relative "courier/models/routing_strategy_list_params"
261263
require_relative "courier/models/routing_strategy_list_response"
262264
require_relative "courier/models/routing_strategy_mutation_response"

lib/courier/models.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ module Courier
4545

4646
Alignment = Courier::Models::Alignment
4747

48+
AssociatedNotificationListResponse = Courier::Models::AssociatedNotificationListResponse
49+
4850
Audience = Courier::Models::Audience
4951

5052
AudienceDeleteParams = Courier::Models::AudienceDeleteParams
@@ -371,6 +373,8 @@ module Courier
371373

372374
RoutingStrategyGetResponse = Courier::Models::RoutingStrategyGetResponse
373375

376+
RoutingStrategyListNotificationsParams = Courier::Models::RoutingStrategyListNotificationsParams
377+
374378
RoutingStrategyListParams = Courier::Models::RoutingStrategyListParams
375379

376380
RoutingStrategyListResponse = Courier::Models::RoutingStrategyListResponse
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::RoutingStrategies#list_notifications
6+
class AssociatedNotificationListResponse < Courier::Internal::Type::BaseModel
7+
# @!attribute paging
8+
#
9+
# @return [Courier::Models::Paging]
10+
required :paging, -> { Courier::Paging }
11+
12+
# @!attribute results
13+
#
14+
# @return [Array<Courier::Models::NotificationTemplateSummary>]
15+
required :results, -> { Courier::Internal::Type::ArrayOf[Courier::NotificationTemplateSummary] }
16+
17+
# @!method initialize(paging:, results:)
18+
# Paginated list of notification templates associated with a routing strategy.
19+
#
20+
# @param paging [Courier::Models::Paging]
21+
# @param results [Array<Courier::Models::NotificationTemplateSummary>]
22+
end
23+
end
24+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
3+
module Courier
4+
module Models
5+
# @see Courier::Resources::RoutingStrategies#list_notifications
6+
class RoutingStrategyListNotificationsParams < 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+
# @!attribute cursor
16+
# Opaque pagination cursor from a previous response. Omit for the first page.
17+
#
18+
# @return [String, nil]
19+
optional :cursor, String, nil?: true
20+
21+
# @!attribute limit
22+
# Maximum number of results per page. Default 20, max 100.
23+
#
24+
# @return [Integer, nil]
25+
optional :limit, Integer
26+
27+
# @!method initialize(id:, cursor: nil, limit: nil, request_options: {})
28+
# @param id [String]
29+
#
30+
# @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
31+
#
32+
# @param limit [Integer] Maximum number of results per page. Default 20, max 100.
33+
#
34+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
35+
end
36+
end
37+
end

lib/courier/resources/routing_strategies.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,34 @@ def archive(id, params = {})
105105
)
106106
end
107107

108+
# List notification templates associated with a routing strategy. Includes
109+
# template metadata only, not full content.
110+
#
111+
# @overload list_notifications(id, cursor: nil, limit: nil, request_options: {})
112+
#
113+
# @param id [String] Routing strategy ID (`rs_` prefix).
114+
#
115+
# @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
116+
#
117+
# @param limit [Integer] Maximum number of results per page. Default 20, max 100.
118+
#
119+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
120+
#
121+
# @return [Courier::Models::AssociatedNotificationListResponse]
122+
#
123+
# @see Courier::Models::RoutingStrategyListNotificationsParams
124+
def list_notifications(id, params = {})
125+
parsed, options = Courier::RoutingStrategyListNotificationsParams.dump_request(params)
126+
query = Courier::Internal::Util.encode_query_params(parsed)
127+
@client.request(
128+
method: :get,
129+
path: ["routing-strategies/%1$s/notifications", id],
130+
query: query,
131+
model: Courier::AssociatedNotificationListResponse,
132+
options: options
133+
)
134+
end
135+
108136
# Replace a routing strategy. Full document replacement; the caller must send the
109137
# complete desired state. Missing optional fields are cleared.
110138
#

rbi/courier/models.rbi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module Courier
77

88
Alignment = Courier::Models::Alignment
99

10+
AssociatedNotificationListResponse =
11+
Courier::Models::AssociatedNotificationListResponse
12+
1013
Audience = Courier::Models::Audience
1114

1215
AudienceDeleteParams = Courier::Models::AudienceDeleteParams
@@ -346,6 +349,9 @@ module Courier
346349

347350
RoutingStrategyGetResponse = Courier::Models::RoutingStrategyGetResponse
348351

352+
RoutingStrategyListNotificationsParams =
353+
Courier::Models::RoutingStrategyListNotificationsParams
354+
349355
RoutingStrategyListParams = Courier::Models::RoutingStrategyListParams
350356

351357
RoutingStrategyListResponse = Courier::Models::RoutingStrategyListResponse
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# typed: strong
2+
3+
module Courier
4+
module Models
5+
class AssociatedNotificationListResponse < Courier::Internal::Type::BaseModel
6+
OrHash =
7+
T.type_alias do
8+
T.any(
9+
Courier::AssociatedNotificationListResponse,
10+
Courier::Internal::AnyHash
11+
)
12+
end
13+
14+
sig { returns(Courier::Paging) }
15+
attr_reader :paging
16+
17+
sig { params(paging: Courier::Paging::OrHash).void }
18+
attr_writer :paging
19+
20+
sig { returns(T::Array[Courier::NotificationTemplateSummary]) }
21+
attr_accessor :results
22+
23+
# Paginated list of notification templates associated with a routing strategy.
24+
sig do
25+
params(
26+
paging: Courier::Paging::OrHash,
27+
results: T::Array[Courier::NotificationTemplateSummary::OrHash]
28+
).returns(T.attached_class)
29+
end
30+
def self.new(paging:, results:)
31+
end
32+
33+
sig do
34+
override.returns(
35+
{
36+
paging: Courier::Paging,
37+
results: T::Array[Courier::NotificationTemplateSummary]
38+
}
39+
)
40+
end
41+
def to_hash
42+
end
43+
end
44+
end
45+
end
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# typed: strong
2+
3+
module Courier
4+
module Models
5+
class RoutingStrategyListNotificationsParams < Courier::Internal::Type::BaseModel
6+
extend Courier::Internal::Type::RequestParameters::Converter
7+
include Courier::Internal::Type::RequestParameters
8+
9+
OrHash =
10+
T.type_alias do
11+
T.any(
12+
Courier::RoutingStrategyListNotificationsParams,
13+
Courier::Internal::AnyHash
14+
)
15+
end
16+
17+
sig { returns(String) }
18+
attr_accessor :id
19+
20+
# Opaque pagination cursor from a previous response. Omit for the first page.
21+
sig { returns(T.nilable(String)) }
22+
attr_accessor :cursor
23+
24+
# Maximum number of results per page. Default 20, max 100.
25+
sig { returns(T.nilable(Integer)) }
26+
attr_reader :limit
27+
28+
sig { params(limit: Integer).void }
29+
attr_writer :limit
30+
31+
sig do
32+
params(
33+
id: String,
34+
cursor: T.nilable(String),
35+
limit: Integer,
36+
request_options: Courier::RequestOptions::OrHash
37+
).returns(T.attached_class)
38+
end
39+
def self.new(
40+
id:,
41+
# Opaque pagination cursor from a previous response. Omit for the first page.
42+
cursor: nil,
43+
# Maximum number of results per page. Default 20, max 100.
44+
limit: nil,
45+
request_options: {}
46+
)
47+
end
48+
49+
sig do
50+
override.returns(
51+
{
52+
id: String,
53+
cursor: T.nilable(String),
54+
limit: Integer,
55+
request_options: Courier::RequestOptions
56+
}
57+
)
58+
end
59+
def to_hash
60+
end
61+
end
62+
end
63+
end

rbi/courier/resources/routing_strategies.rbi

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ module Courier
8383
)
8484
end
8585

86+
# List notification templates associated with a routing strategy. Includes
87+
# template metadata only, not full content.
88+
sig do
89+
params(
90+
id: String,
91+
cursor: T.nilable(String),
92+
limit: Integer,
93+
request_options: Courier::RequestOptions::OrHash
94+
).returns(Courier::AssociatedNotificationListResponse)
95+
end
96+
def list_notifications(
97+
# Routing strategy ID (`rs_` prefix).
98+
id,
99+
# Opaque pagination cursor from a previous response. Omit for the first page.
100+
cursor: nil,
101+
# Maximum number of results per page. Default 20, max 100.
102+
limit: nil,
103+
request_options: {}
104+
)
105+
end
106+
86107
# Replace a routing strategy. Full document replacement; the caller must send the
87108
# complete desired state. Missing optional fields are cleared.
88109
sig do

0 commit comments

Comments
 (0)