trycourier 4.15.0 → 4.17.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/lib/courier/client.rb +4 -0
- data/lib/courier/models/journeys/template_put_content_params.rb +28 -0
- data/lib/courier/models/journeys/template_put_locale_params.rb +34 -0
- data/lib/courier/models/journeys/template_retrieve_content_params.rb +42 -0
- data/lib/courier/models/preference_section_archive_params.rb +20 -0
- data/lib/courier/models/preference_section_create_params.rb +14 -0
- data/lib/courier/models/preference_section_create_request.rb +36 -0
- data/lib/courier/models/preference_section_get_response.rb +83 -0
- data/lib/courier/models/preference_section_list_params.rb +14 -0
- data/lib/courier/models/preference_section_list_response.rb +18 -0
- data/lib/courier/models/preference_section_publish_params.rb +14 -0
- data/lib/courier/models/preference_section_replace_params.rb +20 -0
- data/lib/courier/models/preference_section_replace_request.rb +37 -0
- data/lib/courier/models/preference_section_retrieve_params.rb +20 -0
- data/lib/courier/models/preference_sections/topic_archive_params.rb +28 -0
- data/lib/courier/models/preference_sections/topic_create_params.rb +22 -0
- data/lib/courier/models/preference_sections/topic_list_params.rb +22 -0
- data/lib/courier/models/preference_sections/topic_replace_params.rb +28 -0
- data/lib/courier/models/preference_sections/topic_retrieve_params.rb +28 -0
- data/lib/courier/models/preference_topic_create_request.rb +93 -0
- data/lib/courier/models/preference_topic_get_response.rb +124 -0
- data/lib/courier/models/preference_topic_list_response.rb +17 -0
- data/lib/courier/models/preference_topic_replace_request.rb +90 -0
- data/lib/courier/models/publish_preferences_response.rb +51 -0
- data/lib/courier/models.rb +32 -0
- data/lib/courier/resources/journeys/templates.rb +113 -0
- data/lib/courier/resources/preference_sections/topics.rb +173 -0
- data/lib/courier/resources/preference_sections.rb +155 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +27 -2
- data/rbi/courier/client.rbi +3 -0
- data/rbi/courier/models/journeys/template_put_content_params.rbi +48 -0
- data/rbi/courier/models/journeys/template_put_locale_params.rbi +58 -0
- data/rbi/courier/models/journeys/template_retrieve_content_params.rbi +65 -0
- data/rbi/courier/models/preference_section_archive_params.rbi +38 -0
- data/rbi/courier/models/preference_section_create_params.rbi +30 -0
- data/rbi/courier/models/preference_section_create_request.rbi +61 -0
- data/rbi/courier/models/preference_section_get_response.rbi +106 -0
- data/rbi/courier/models/preference_section_list_params.rbi +30 -0
- data/rbi/courier/models/preference_section_list_response.rbi +35 -0
- data/rbi/courier/models/preference_section_publish_params.rbi +30 -0
- data/rbi/courier/models/preference_section_replace_params.rbi +38 -0
- data/rbi/courier/models/preference_section_replace_request.rbi +62 -0
- data/rbi/courier/models/preference_section_retrieve_params.rbi +38 -0
- data/rbi/courier/models/preference_sections/topic_archive_params.rbi +48 -0
- data/rbi/courier/models/preference_sections/topic_create_params.rbi +40 -0
- data/rbi/courier/models/preference_sections/topic_list_params.rbi +40 -0
- data/rbi/courier/models/preference_sections/topic_replace_params.rbi +48 -0
- data/rbi/courier/models/preference_sections/topic_retrieve_params.rbi +48 -0
- data/rbi/courier/models/preference_topic_create_request.rbi +181 -0
- data/rbi/courier/models/preference_topic_get_response.rbi +209 -0
- data/rbi/courier/models/preference_topic_list_response.rbi +35 -0
- data/rbi/courier/models/preference_topic_replace_request.rbi +180 -0
- data/rbi/courier/models/publish_preferences_response.rbi +70 -0
- data/rbi/courier/models.rbi +38 -0
- data/rbi/courier/resources/journeys/templates.rbi +78 -0
- data/rbi/courier/resources/preference_sections/topics.rbi +149 -0
- data/rbi/courier/resources/preference_sections.rbi +113 -0
- data/sig/courier/client.rbs +2 -0
- data/sig/courier/models/journeys/template_put_content_params.rbs +34 -0
- data/sig/courier/models/journeys/template_put_locale_params.rbs +40 -0
- data/sig/courier/models/journeys/template_retrieve_content_params.rbs +36 -0
- data/sig/courier/models/preference_section_archive_params.rbs +23 -0
- data/sig/courier/models/preference_section_create_params.rbs +15 -0
- data/sig/courier/models/preference_section_create_request.rbs +30 -0
- data/sig/courier/models/preference_section_get_response.rbs +60 -0
- data/sig/courier/models/preference_section_list_params.rbs +15 -0
- data/sig/courier/models/preference_section_list_response.rbs +18 -0
- data/sig/courier/models/preference_section_publish_params.rbs +15 -0
- data/sig/courier/models/preference_section_replace_params.rbs +25 -0
- data/sig/courier/models/preference_section_replace_request.rbs +30 -0
- data/sig/courier/models/preference_section_retrieve_params.rbs +23 -0
- data/sig/courier/models/preference_sections/topic_archive_params.rbs +30 -0
- data/sig/courier/models/preference_sections/topic_create_params.rbs +27 -0
- data/sig/courier/models/preference_sections/topic_list_params.rbs +25 -0
- data/sig/courier/models/preference_sections/topic_replace_params.rbs +34 -0
- data/sig/courier/models/preference_sections/topic_retrieve_params.rbs +30 -0
- data/sig/courier/models/preference_topic_create_request.rbs +68 -0
- data/sig/courier/models/preference_topic_get_response.rbs +93 -0
- data/sig/courier/models/preference_topic_list_response.rbs +16 -0
- data/sig/courier/models/preference_topic_replace_request.rbs +68 -0
- data/sig/courier/models/publish_preferences_response.rbs +40 -0
- data/sig/courier/models.rbs +32 -0
- data/sig/courier/resources/journeys/templates.rbs +24 -0
- data/sig/courier/resources/preference_sections/topics.rbs +49 -0
- data/sig/courier/resources/preference_sections.rbs +42 -0
- metadata +77 -2
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class PreferenceSections
|
|
6
|
+
class Topics
|
|
7
|
+
# Some parameter documentations has been truncated, see
|
|
8
|
+
# {Courier::Models::PreferenceSections::TopicCreateParams} for more details.
|
|
9
|
+
#
|
|
10
|
+
# Create a subscription preference topic inside a section. Fails with 404 if the
|
|
11
|
+
# section does not exist. The topic id is generated and returned.
|
|
12
|
+
#
|
|
13
|
+
# @overload create(section_id, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {})
|
|
14
|
+
#
|
|
15
|
+
# @param section_id [String] Id of the preference section to create the topic in.
|
|
16
|
+
#
|
|
17
|
+
# @param default_status [Symbol, Courier::Models::PreferenceTopicCreateRequest::DefaultStatus] The default subscription status applied when a recipient has not set their own.
|
|
18
|
+
#
|
|
19
|
+
# @param name [String] Human-readable name for the preference topic.
|
|
20
|
+
#
|
|
21
|
+
# @param allowed_preferences [Array<Symbol, Courier::Models::PreferenceTopicCreateRequest::AllowedPreference>, nil] Preference controls a recipient may customize for this topic. Defaults to empty
|
|
22
|
+
#
|
|
23
|
+
# @param include_unsubscribe_header [Boolean, nil] Whether to include a list-unsubscribe header on emails for this topic.
|
|
24
|
+
#
|
|
25
|
+
# @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels delivered for this topic. Defaults to empty if omitted.
|
|
26
|
+
#
|
|
27
|
+
# @param topic_data [Hash{Symbol=>Object}, nil] Arbitrary metadata associated with the topic.
|
|
28
|
+
#
|
|
29
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
30
|
+
#
|
|
31
|
+
# @return [Courier::Models::PreferenceTopicGetResponse]
|
|
32
|
+
#
|
|
33
|
+
# @see Courier::Models::PreferenceSections::TopicCreateParams
|
|
34
|
+
def create(section_id, params)
|
|
35
|
+
parsed, options = Courier::PreferenceSections::TopicCreateParams.dump_request(params)
|
|
36
|
+
@client.request(
|
|
37
|
+
method: :post,
|
|
38
|
+
path: ["preferences/sections/%1$s/topics", section_id],
|
|
39
|
+
body: parsed,
|
|
40
|
+
model: Courier::PreferenceTopicGetResponse,
|
|
41
|
+
options: options
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Retrieve a topic within a section. Returns 404 if the section does not exist,
|
|
46
|
+
# the topic does not exist, or the topic belongs to a different section.
|
|
47
|
+
#
|
|
48
|
+
# @overload retrieve(topic_id, section_id:, request_options: {})
|
|
49
|
+
#
|
|
50
|
+
# @param topic_id [String] Id of the subscription preference topic.
|
|
51
|
+
#
|
|
52
|
+
# @param section_id [String] Id of the preference section.
|
|
53
|
+
#
|
|
54
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
55
|
+
#
|
|
56
|
+
# @return [Courier::Models::PreferenceTopicGetResponse]
|
|
57
|
+
#
|
|
58
|
+
# @see Courier::Models::PreferenceSections::TopicRetrieveParams
|
|
59
|
+
def retrieve(topic_id, params)
|
|
60
|
+
parsed, options = Courier::PreferenceSections::TopicRetrieveParams.dump_request(params)
|
|
61
|
+
section_id =
|
|
62
|
+
parsed.delete(:section_id) do
|
|
63
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
64
|
+
end
|
|
65
|
+
@client.request(
|
|
66
|
+
method: :get,
|
|
67
|
+
path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
|
|
68
|
+
model: Courier::PreferenceTopicGetResponse,
|
|
69
|
+
options: options
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List the topics in a preference section.
|
|
74
|
+
#
|
|
75
|
+
# @overload list(section_id, request_options: {})
|
|
76
|
+
#
|
|
77
|
+
# @param section_id [String] Id of the preference section.
|
|
78
|
+
#
|
|
79
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
80
|
+
#
|
|
81
|
+
# @return [Courier::Models::PreferenceTopicListResponse]
|
|
82
|
+
#
|
|
83
|
+
# @see Courier::Models::PreferenceSections::TopicListParams
|
|
84
|
+
def list(section_id, params = {})
|
|
85
|
+
@client.request(
|
|
86
|
+
method: :get,
|
|
87
|
+
path: ["preferences/sections/%1$s/topics", section_id],
|
|
88
|
+
model: Courier::PreferenceTopicListResponse,
|
|
89
|
+
options: params[:request_options]
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Archive a topic and remove it from its section. Same 404 rules as GET.
|
|
94
|
+
#
|
|
95
|
+
# @overload archive(topic_id, section_id:, request_options: {})
|
|
96
|
+
#
|
|
97
|
+
# @param topic_id [String] Id of the subscription preference topic.
|
|
98
|
+
#
|
|
99
|
+
# @param section_id [String] Id of the preference section.
|
|
100
|
+
#
|
|
101
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
102
|
+
#
|
|
103
|
+
# @return [nil]
|
|
104
|
+
#
|
|
105
|
+
# @see Courier::Models::PreferenceSections::TopicArchiveParams
|
|
106
|
+
def archive(topic_id, params)
|
|
107
|
+
parsed, options = Courier::PreferenceSections::TopicArchiveParams.dump_request(params)
|
|
108
|
+
section_id =
|
|
109
|
+
parsed.delete(:section_id) do
|
|
110
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
111
|
+
end
|
|
112
|
+
@client.request(
|
|
113
|
+
method: :delete,
|
|
114
|
+
path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
|
|
115
|
+
model: NilClass,
|
|
116
|
+
options: options
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Some parameter documentations has been truncated, see
|
|
121
|
+
# {Courier::Models::PreferenceSections::TopicReplaceParams} for more details.
|
|
122
|
+
#
|
|
123
|
+
# Replace a topic within a section. Full document replacement; missing optional
|
|
124
|
+
# fields are cleared. Same 404 rules as GET.
|
|
125
|
+
#
|
|
126
|
+
# @overload replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {})
|
|
127
|
+
#
|
|
128
|
+
# @param topic_id [String] Path param: Id of the subscription preference topic.
|
|
129
|
+
#
|
|
130
|
+
# @param section_id [String] Path param: Id of the preference section.
|
|
131
|
+
#
|
|
132
|
+
# @param default_status [Symbol, Courier::Models::PreferenceTopicReplaceRequest::DefaultStatus] Body param: The default subscription status applied when a recipient has not set
|
|
133
|
+
#
|
|
134
|
+
# @param name [String] Body param: Human-readable name for the preference topic.
|
|
135
|
+
#
|
|
136
|
+
# @param allowed_preferences [Array<Symbol, Courier::Models::PreferenceTopicReplaceRequest::AllowedPreference>, nil] Body param: Preference controls a recipient may customize. Omit to clear.
|
|
137
|
+
#
|
|
138
|
+
# @param include_unsubscribe_header [Boolean, nil] Body param: Whether to include a list-unsubscribe header on emails for this topi
|
|
139
|
+
#
|
|
140
|
+
# @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Body param: Default channels delivered for this topic. Omit to clear.
|
|
141
|
+
#
|
|
142
|
+
# @param topic_data [Hash{Symbol=>Object}, nil] Body param: Arbitrary metadata associated with the topic. Omit to clear.
|
|
143
|
+
#
|
|
144
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
145
|
+
#
|
|
146
|
+
# @return [Courier::Models::PreferenceTopicGetResponse]
|
|
147
|
+
#
|
|
148
|
+
# @see Courier::Models::PreferenceSections::TopicReplaceParams
|
|
149
|
+
def replace(topic_id, params)
|
|
150
|
+
parsed, options = Courier::PreferenceSections::TopicReplaceParams.dump_request(params)
|
|
151
|
+
section_id =
|
|
152
|
+
parsed.delete(:section_id) do
|
|
153
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
154
|
+
end
|
|
155
|
+
@client.request(
|
|
156
|
+
method: :put,
|
|
157
|
+
path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
|
|
158
|
+
body: parsed,
|
|
159
|
+
model: Courier::PreferenceTopicGetResponse,
|
|
160
|
+
options: options
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# @api private
|
|
165
|
+
#
|
|
166
|
+
# @param client [Courier::Client]
|
|
167
|
+
def initialize(client:)
|
|
168
|
+
@client = client
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class PreferenceSections
|
|
6
|
+
# @return [Courier::Resources::PreferenceSections::Topics]
|
|
7
|
+
attr_reader :topics
|
|
8
|
+
|
|
9
|
+
# Create a preference section in your workspace. The section id is generated and
|
|
10
|
+
# returned. Topics are created inside a section via POST
|
|
11
|
+
# /preferences/sections/{section_id}/topics.
|
|
12
|
+
#
|
|
13
|
+
# @overload create(name:, has_custom_routing: nil, routing_options: nil, request_options: {})
|
|
14
|
+
#
|
|
15
|
+
# @param name [String] Human-readable name for the section.
|
|
16
|
+
#
|
|
17
|
+
# @param has_custom_routing [Boolean, nil] Whether the section defines custom routing for its topics.
|
|
18
|
+
#
|
|
19
|
+
# @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels for the section. Defaults to empty if omitted.
|
|
20
|
+
#
|
|
21
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
22
|
+
#
|
|
23
|
+
# @return [Courier::Models::PreferenceSectionGetResponse]
|
|
24
|
+
#
|
|
25
|
+
# @see Courier::Models::PreferenceSectionCreateParams
|
|
26
|
+
def create(params)
|
|
27
|
+
parsed, options = Courier::PreferenceSectionCreateParams.dump_request(params)
|
|
28
|
+
@client.request(
|
|
29
|
+
method: :post,
|
|
30
|
+
path: "preferences/sections",
|
|
31
|
+
body: parsed,
|
|
32
|
+
model: Courier::PreferenceSectionGetResponse,
|
|
33
|
+
options: options
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Retrieve a preference section by id, including its topics.
|
|
38
|
+
#
|
|
39
|
+
# @overload retrieve(section_id, request_options: {})
|
|
40
|
+
#
|
|
41
|
+
# @param section_id [String] Id of the preference section.
|
|
42
|
+
#
|
|
43
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
44
|
+
#
|
|
45
|
+
# @return [Courier::Models::PreferenceSectionGetResponse]
|
|
46
|
+
#
|
|
47
|
+
# @see Courier::Models::PreferenceSectionRetrieveParams
|
|
48
|
+
def retrieve(section_id, params = {})
|
|
49
|
+
@client.request(
|
|
50
|
+
method: :get,
|
|
51
|
+
path: ["preferences/sections/%1$s", section_id],
|
|
52
|
+
model: Courier::PreferenceSectionGetResponse,
|
|
53
|
+
options: params[:request_options]
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# List the workspace's preference sections. Each section embeds its topics. Scoped
|
|
58
|
+
# to the workspace of the API key.
|
|
59
|
+
#
|
|
60
|
+
# @overload list(request_options: {})
|
|
61
|
+
#
|
|
62
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
63
|
+
#
|
|
64
|
+
# @return [Courier::Models::PreferenceSectionListResponse]
|
|
65
|
+
#
|
|
66
|
+
# @see Courier::Models::PreferenceSectionListParams
|
|
67
|
+
def list(params = {})
|
|
68
|
+
@client.request(
|
|
69
|
+
method: :get,
|
|
70
|
+
path: "preferences/sections",
|
|
71
|
+
model: Courier::PreferenceSectionListResponse,
|
|
72
|
+
options: params[:request_options]
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Archive a preference section. The section must be empty: delete its topics
|
|
77
|
+
# first, otherwise the request fails with 409.
|
|
78
|
+
#
|
|
79
|
+
# @overload archive(section_id, request_options: {})
|
|
80
|
+
#
|
|
81
|
+
# @param section_id [String] Id of the preference section.
|
|
82
|
+
#
|
|
83
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
84
|
+
#
|
|
85
|
+
# @return [nil]
|
|
86
|
+
#
|
|
87
|
+
# @see Courier::Models::PreferenceSectionArchiveParams
|
|
88
|
+
def archive(section_id, params = {})
|
|
89
|
+
@client.request(
|
|
90
|
+
method: :delete,
|
|
91
|
+
path: ["preferences/sections/%1$s", section_id],
|
|
92
|
+
model: NilClass,
|
|
93
|
+
options: params[:request_options]
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Publish the workspace's preferences page. Takes a snapshot of every section with
|
|
98
|
+
# its topics under a new published version, making the current state visible on
|
|
99
|
+
# the hosted preferences page (non-draft).
|
|
100
|
+
#
|
|
101
|
+
# @overload publish(request_options: {})
|
|
102
|
+
#
|
|
103
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
104
|
+
#
|
|
105
|
+
# @return [Courier::Models::PublishPreferencesResponse]
|
|
106
|
+
#
|
|
107
|
+
# @see Courier::Models::PreferenceSectionPublishParams
|
|
108
|
+
def publish(params = {})
|
|
109
|
+
@client.request(
|
|
110
|
+
method: :post,
|
|
111
|
+
path: "preferences/publish",
|
|
112
|
+
model: Courier::PublishPreferencesResponse,
|
|
113
|
+
options: params[:request_options]
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Replace a preference section. Full document replacement; missing optional fields
|
|
118
|
+
# are cleared. Topics attached to the section are unaffected.
|
|
119
|
+
#
|
|
120
|
+
# @overload replace(section_id, name:, has_custom_routing: nil, routing_options: nil, request_options: {})
|
|
121
|
+
#
|
|
122
|
+
# @param section_id [String] Id of the preference section.
|
|
123
|
+
#
|
|
124
|
+
# @param name [String] Human-readable name for the section.
|
|
125
|
+
#
|
|
126
|
+
# @param has_custom_routing [Boolean, nil] Whether the section defines custom routing for its topics.
|
|
127
|
+
#
|
|
128
|
+
# @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels for the section. Omit to clear.
|
|
129
|
+
#
|
|
130
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
131
|
+
#
|
|
132
|
+
# @return [Courier::Models::PreferenceSectionGetResponse]
|
|
133
|
+
#
|
|
134
|
+
# @see Courier::Models::PreferenceSectionReplaceParams
|
|
135
|
+
def replace(section_id, params)
|
|
136
|
+
parsed, options = Courier::PreferenceSectionReplaceParams.dump_request(params)
|
|
137
|
+
@client.request(
|
|
138
|
+
method: :put,
|
|
139
|
+
path: ["preferences/sections/%1$s", section_id],
|
|
140
|
+
body: parsed,
|
|
141
|
+
model: Courier::PreferenceSectionGetResponse,
|
|
142
|
+
options: options
|
|
143
|
+
)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# @api private
|
|
147
|
+
#
|
|
148
|
+
# @param client [Courier::Client]
|
|
149
|
+
def initialize(client:)
|
|
150
|
+
@client = client
|
|
151
|
+
@topics = Courier::Resources::PreferenceSections::Topics.new(client: client)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
data/lib/courier/version.rb
CHANGED
data/lib/courier.rb
CHANGED
|
@@ -63,15 +63,19 @@ require_relative "courier/models/journeys_invoke_request"
|
|
|
63
63
|
require_relative "courier/models/journey_publish_request"
|
|
64
64
|
require_relative "courier/models/journey_template_create_request"
|
|
65
65
|
require_relative "courier/models/journey_template_publish_request"
|
|
66
|
+
require_relative "courier/models/notification_content_put_request"
|
|
67
|
+
require_relative "courier/models/notification_locale_put_request"
|
|
66
68
|
require_relative "courier/models/journey_template_replace_request"
|
|
67
69
|
require_relative "courier/models/message_details"
|
|
68
70
|
require_relative "courier/models/notification_template_create_request"
|
|
69
71
|
require_relative "courier/models/notification_template_publish_request"
|
|
70
|
-
require_relative "courier/models/notification_content_put_request"
|
|
71
72
|
require_relative "courier/models/notification_element_put_request"
|
|
72
|
-
require_relative "courier/models/notification_locale_put_request"
|
|
73
73
|
require_relative "courier/models/notification_template_update_request"
|
|
74
74
|
require_relative "courier/models/notification_template_payload"
|
|
75
|
+
require_relative "courier/models/preference_section_create_request"
|
|
76
|
+
require_relative "courier/models/preference_section_replace_request"
|
|
77
|
+
require_relative "courier/models/preference_topic_create_request"
|
|
78
|
+
require_relative "courier/models/preference_topic_replace_request"
|
|
75
79
|
require_relative "courier/models/routing_strategy_create_request"
|
|
76
80
|
require_relative "courier/models/routing_strategy_replace_request"
|
|
77
81
|
require_relative "courier/models/base_template_tenant_association"
|
|
@@ -191,7 +195,10 @@ require_relative "courier/models/journeys/template_create_params"
|
|
|
191
195
|
require_relative "courier/models/journeys/template_list_params"
|
|
192
196
|
require_relative "courier/models/journeys/template_list_versions_params"
|
|
193
197
|
require_relative "courier/models/journeys/template_publish_params"
|
|
198
|
+
require_relative "courier/models/journeys/template_put_content_params"
|
|
199
|
+
require_relative "courier/models/journeys/template_put_locale_params"
|
|
194
200
|
require_relative "courier/models/journeys/template_replace_params"
|
|
201
|
+
require_relative "courier/models/journeys/template_retrieve_content_params"
|
|
195
202
|
require_relative "courier/models/journeys/template_retrieve_params"
|
|
196
203
|
require_relative "courier/models/journey_segment_trigger_node"
|
|
197
204
|
require_relative "courier/models/journey_send_node"
|
|
@@ -272,7 +279,22 @@ require_relative "courier/models/pagerduty_recipient"
|
|
|
272
279
|
require_relative "courier/models/paging"
|
|
273
280
|
require_relative "courier/models/post_tenant_template_publish_response"
|
|
274
281
|
require_relative "courier/models/preference"
|
|
282
|
+
require_relative "courier/models/preference_section_archive_params"
|
|
283
|
+
require_relative "courier/models/preference_section_create_params"
|
|
284
|
+
require_relative "courier/models/preference_section_get_response"
|
|
285
|
+
require_relative "courier/models/preference_section_list_params"
|
|
286
|
+
require_relative "courier/models/preference_section_list_response"
|
|
287
|
+
require_relative "courier/models/preference_section_publish_params"
|
|
288
|
+
require_relative "courier/models/preference_section_replace_params"
|
|
289
|
+
require_relative "courier/models/preference_section_retrieve_params"
|
|
290
|
+
require_relative "courier/models/preference_sections/topic_archive_params"
|
|
291
|
+
require_relative "courier/models/preference_sections/topic_create_params"
|
|
292
|
+
require_relative "courier/models/preference_sections/topic_list_params"
|
|
293
|
+
require_relative "courier/models/preference_sections/topic_replace_params"
|
|
294
|
+
require_relative "courier/models/preference_sections/topic_retrieve_params"
|
|
275
295
|
require_relative "courier/models/preference_status"
|
|
296
|
+
require_relative "courier/models/preference_topic_get_response"
|
|
297
|
+
require_relative "courier/models/preference_topic_list_response"
|
|
276
298
|
require_relative "courier/models/profile_create_params"
|
|
277
299
|
require_relative "courier/models/profile_create_response"
|
|
278
300
|
require_relative "courier/models/profile_delete_params"
|
|
@@ -297,6 +319,7 @@ require_relative "courier/models/providers/catalog_list_params"
|
|
|
297
319
|
require_relative "courier/models/providers/catalog_list_response"
|
|
298
320
|
require_relative "courier/models/providers_catalog_entry"
|
|
299
321
|
require_relative "courier/models/provider_update_params"
|
|
322
|
+
require_relative "courier/models/publish_preferences_response"
|
|
300
323
|
require_relative "courier/models/put_subscriptions_recipient"
|
|
301
324
|
require_relative "courier/models/put_tenant_template_response"
|
|
302
325
|
require_relative "courier/models/recipient_preferences"
|
|
@@ -405,6 +428,8 @@ require_relative "courier/resources/lists/subscriptions"
|
|
|
405
428
|
require_relative "courier/resources/messages"
|
|
406
429
|
require_relative "courier/resources/notifications"
|
|
407
430
|
require_relative "courier/resources/notifications/checks"
|
|
431
|
+
require_relative "courier/resources/preference_sections"
|
|
432
|
+
require_relative "courier/resources/preference_sections/topics"
|
|
408
433
|
require_relative "courier/resources/profiles"
|
|
409
434
|
require_relative "courier/resources/profiles/lists"
|
|
410
435
|
require_relative "courier/resources/providers"
|
data/rbi/courier/client.rbi
CHANGED
|
@@ -61,6 +61,9 @@ module Courier
|
|
|
61
61
|
sig { returns(Courier::Resources::RoutingStrategies) }
|
|
62
62
|
attr_reader :routing_strategies
|
|
63
63
|
|
|
64
|
+
sig { returns(Courier::Resources::PreferenceSections) }
|
|
65
|
+
attr_reader :preference_sections
|
|
66
|
+
|
|
64
67
|
sig { returns(Courier::Resources::Profiles) }
|
|
65
68
|
attr_reader :profiles
|
|
66
69
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Journeys
|
|
6
|
+
class TemplatePutContentParams < Courier::Models::NotificationContentPutRequest
|
|
7
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Courier::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Courier::Journeys::TemplatePutContentParams,
|
|
14
|
+
Courier::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :template_id
|
|
20
|
+
|
|
21
|
+
sig { returns(String) }
|
|
22
|
+
attr_accessor :notification_id
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
template_id: String,
|
|
27
|
+
notification_id: String,
|
|
28
|
+
request_options: Courier::RequestOptions::OrHash
|
|
29
|
+
).returns(T.attached_class)
|
|
30
|
+
end
|
|
31
|
+
def self.new(template_id:, notification_id:, request_options: {})
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
sig do
|
|
35
|
+
override.returns(
|
|
36
|
+
{
|
|
37
|
+
template_id: String,
|
|
38
|
+
notification_id: String,
|
|
39
|
+
request_options: Courier::RequestOptions
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
def to_hash
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Journeys
|
|
6
|
+
class TemplatePutLocaleParams < Courier::Models::NotificationLocalePutRequest
|
|
7
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Courier::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Courier::Journeys::TemplatePutLocaleParams,
|
|
14
|
+
Courier::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :template_id
|
|
20
|
+
|
|
21
|
+
sig { returns(String) }
|
|
22
|
+
attr_accessor :notification_id
|
|
23
|
+
|
|
24
|
+
sig { returns(String) }
|
|
25
|
+
attr_accessor :locale_id
|
|
26
|
+
|
|
27
|
+
sig do
|
|
28
|
+
params(
|
|
29
|
+
template_id: String,
|
|
30
|
+
notification_id: String,
|
|
31
|
+
locale_id: String,
|
|
32
|
+
request_options: Courier::RequestOptions::OrHash
|
|
33
|
+
).returns(T.attached_class)
|
|
34
|
+
end
|
|
35
|
+
def self.new(
|
|
36
|
+
template_id:,
|
|
37
|
+
notification_id:,
|
|
38
|
+
locale_id:,
|
|
39
|
+
request_options: {}
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
sig do
|
|
44
|
+
override.returns(
|
|
45
|
+
{
|
|
46
|
+
template_id: String,
|
|
47
|
+
notification_id: String,
|
|
48
|
+
locale_id: String,
|
|
49
|
+
request_options: Courier::RequestOptions
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
def to_hash
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Journeys
|
|
6
|
+
class TemplateRetrieveContentParams < Courier::Internal::Type::BaseModel
|
|
7
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Courier::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Courier::Journeys::TemplateRetrieveContentParams,
|
|
14
|
+
Courier::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :template_id
|
|
20
|
+
|
|
21
|
+
sig { returns(String) }
|
|
22
|
+
attr_accessor :notification_id
|
|
23
|
+
|
|
24
|
+
# Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to
|
|
25
|
+
# `published`.
|
|
26
|
+
sig { returns(T.nilable(String)) }
|
|
27
|
+
attr_reader :version
|
|
28
|
+
|
|
29
|
+
sig { params(version: String).void }
|
|
30
|
+
attr_writer :version
|
|
31
|
+
|
|
32
|
+
sig do
|
|
33
|
+
params(
|
|
34
|
+
template_id: String,
|
|
35
|
+
notification_id: String,
|
|
36
|
+
version: String,
|
|
37
|
+
request_options: Courier::RequestOptions::OrHash
|
|
38
|
+
).returns(T.attached_class)
|
|
39
|
+
end
|
|
40
|
+
def self.new(
|
|
41
|
+
template_id:,
|
|
42
|
+
notification_id:,
|
|
43
|
+
# Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to
|
|
44
|
+
# `published`.
|
|
45
|
+
version: nil,
|
|
46
|
+
request_options: {}
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
sig do
|
|
51
|
+
override.returns(
|
|
52
|
+
{
|
|
53
|
+
template_id: String,
|
|
54
|
+
notification_id: String,
|
|
55
|
+
version: String,
|
|
56
|
+
request_options: Courier::RequestOptions
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
def to_hash
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class PreferenceSectionArchiveParams < 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::PreferenceSectionArchiveParams,
|
|
13
|
+
Courier::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(String) }
|
|
18
|
+
attr_accessor :section_id
|
|
19
|
+
|
|
20
|
+
sig do
|
|
21
|
+
params(
|
|
22
|
+
section_id: String,
|
|
23
|
+
request_options: Courier::RequestOptions::OrHash
|
|
24
|
+
).returns(T.attached_class)
|
|
25
|
+
end
|
|
26
|
+
def self.new(section_id:, request_options: {})
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
sig do
|
|
30
|
+
override.returns(
|
|
31
|
+
{ section_id: String, request_options: Courier::RequestOptions }
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
def to_hash
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class PreferenceSectionCreateParams < Courier::Models::PreferenceSectionCreateRequest
|
|
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::PreferenceSectionCreateParams,
|
|
13
|
+
Courier::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
params(request_options: Courier::RequestOptions::OrHash).returns(
|
|
19
|
+
T.attached_class
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
def self.new(request_options: {})
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig { override.returns({ request_options: Courier::RequestOptions }) }
|
|
26
|
+
def to_hash
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|