Class: Courier::Resources::WorkspacePreferences::Topics
- Inherits:
-
Object
- Object
- Courier::Resources::WorkspacePreferences::Topics
- Defined in:
- lib/courier/resources/workspace_preferences/topics.rb,
sig/courier/resources/workspace_preferences/topics.rbs
Instance Method Summary collapse
-
#archive(topic_id, section_id:, request_options: {}) ⇒ nil
Archives a subscription topic and removes it from its workspace preference, addressed by section id and topic id.
-
#create(section_id, default_status:, name:, allowed_preferences: nil, description: nil, digest: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicCreateParams for more details.
-
#delete_digest(topic_id, section_id:, request_options: {}) ⇒ nil
Turn off a topic's digest, leaving the topic itself in place.
-
#initialize(client:) ⇒ Topics
constructor
private
A new instance of Topics.
-
#list(section_id, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicListResponse
Returns the subscription topics inside a workspace preference, each with its default status and routing options.
-
#release_digest(topic_id, section_id:, user_id:, tenant_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReleaseDigestParams for more details.
-
#replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, description: nil, digest: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReplaceParams for more details.
-
#retrieve(topic_id, section_id:, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Returns one subscription topic with its default status, routing options, allowed preferences, and unsubscribe header setting.
Constructor Details
#initialize(client:) ⇒ Topics
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Topics.
255 256 257 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 255 def initialize(client:) @client = client end |
Instance Method Details
#archive(topic_id, section_id:, request_options: {}) ⇒ nil
Archives a subscription topic and removes it from its workspace preference, addressed by section id and topic id.
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 119 def archive(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicArchiveParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], model: NilClass, options: ) end |
#create(section_id, default_status:, name:, allowed_preferences: nil, description: nil, digest: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicCreateParams for more details.
Creates a subscription topic inside a workspace preference. The default status sets whether users start opted in, opted out, or required.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 42 def create(section_id, params) parsed, = Courier::WorkspacePreferences::TopicCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"} @client.request( method: :post, path: ["preferences/sections/%1$s/topics", section_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |
#delete_digest(topic_id, section_id:, request_options: {}) ⇒ nil
Turn off a topic's digest, leaving the topic itself in place. The template is
unlinked and the digest's schedules are removed along with their delivery rules.
Equivalent to sending digest: null on a topic replace.
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 148 def delete_digest(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicDeleteDigestParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["preferences/sections/%1$s/topics/%2$s/digest", section_id, topic_id], model: NilClass, options: ) end |
#list(section_id, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicListResponse
Returns the subscription topics inside a workspace preference, each with its default status and routing options.
96 97 98 99 100 101 102 103 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 96 def list(section_id, params = {}) @client.request( method: :get, path: ["preferences/sections/%1$s/topics", section_id], model: Courier::WorkspacePreferenceTopicListResponse, options: params[:request_options] ) end |
#release_digest(topic_id, section_id:, user_id:, tenant_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReleaseDigestParams for more details.
Send one recipient's held digest now, instead of waiting for its schedule. Use it to preview what a digest will look like, or to let someone flush their own.
Keyed on the topic because that is how a held digest is stored: one per
recipient per topic, with the schedule recorded on it rather than part of its
identity. To flush every recipient on a schedule instead, use
POST /digests/schedules/{schedule_id}/trigger.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 189 def release_digest(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicReleaseDigestParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["preferences/sections/%1$s/topics/%2$s/digest/release", section_id, topic_id], body: parsed, model: NilClass, options: ) end |
#replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, description: nil, digest: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReplaceParams for more details.
Replace a topic within a workspace preference. Full document replacement; missing optional fields are cleared. Same 404 rules as GET.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 237 def replace(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicReplaceParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], body: parsed, model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |
#retrieve(topic_id, section_id:, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Returns one subscription topic with its default status, routing options, allowed preferences, and unsubscribe header setting.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 70 def retrieve(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicRetrieveParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |