trycourier 4.16.0 → 4.17.1

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/lib/courier/client.rb +4 -0
  4. data/lib/courier/models/publish_preferences_response.rb +51 -0
  5. data/lib/courier/models/workspace_preference_archive_params.rb +20 -0
  6. data/lib/courier/models/workspace_preference_create_params.rb +14 -0
  7. data/lib/courier/models/workspace_preference_create_request.rb +36 -0
  8. data/lib/courier/models/workspace_preference_get_response.rb +83 -0
  9. data/lib/courier/models/workspace_preference_list_params.rb +14 -0
  10. data/lib/courier/models/workspace_preference_list_response.rb +18 -0
  11. data/lib/courier/models/workspace_preference_publish_params.rb +14 -0
  12. data/lib/courier/models/workspace_preference_replace_params.rb +20 -0
  13. data/lib/courier/models/workspace_preference_replace_request.rb +37 -0
  14. data/lib/courier/models/workspace_preference_retrieve_params.rb +20 -0
  15. data/lib/courier/models/workspace_preference_topic_create_request.rb +93 -0
  16. data/lib/courier/models/workspace_preference_topic_get_response.rb +124 -0
  17. data/lib/courier/models/workspace_preference_topic_list_response.rb +17 -0
  18. data/lib/courier/models/workspace_preference_topic_replace_request.rb +90 -0
  19. data/lib/courier/models/workspace_preferences/topic_archive_params.rb +28 -0
  20. data/lib/courier/models/workspace_preferences/topic_create_params.rb +22 -0
  21. data/lib/courier/models/workspace_preferences/topic_list_params.rb +22 -0
  22. data/lib/courier/models/workspace_preferences/topic_replace_params.rb +28 -0
  23. data/lib/courier/models/workspace_preferences/topic_retrieve_params.rb +28 -0
  24. data/lib/courier/models.rb +32 -0
  25. data/lib/courier/resources/notifications/checks.rb +3 -3
  26. data/lib/courier/resources/workspace_preferences/topics.rb +176 -0
  27. data/lib/courier/resources/workspace_preferences.rb +155 -0
  28. data/lib/courier/version.rb +1 -1
  29. data/lib/courier.rb +22 -0
  30. data/rbi/courier/client.rbi +3 -0
  31. data/rbi/courier/models/publish_preferences_response.rbi +70 -0
  32. data/rbi/courier/models/workspace_preference_archive_params.rbi +38 -0
  33. data/rbi/courier/models/workspace_preference_create_params.rbi +30 -0
  34. data/rbi/courier/models/workspace_preference_create_request.rbi +61 -0
  35. data/rbi/courier/models/workspace_preference_get_response.rbi +107 -0
  36. data/rbi/courier/models/workspace_preference_list_params.rbi +30 -0
  37. data/rbi/courier/models/workspace_preference_list_response.rbi +35 -0
  38. data/rbi/courier/models/workspace_preference_publish_params.rbi +30 -0
  39. data/rbi/courier/models/workspace_preference_replace_params.rbi +38 -0
  40. data/rbi/courier/models/workspace_preference_replace_request.rbi +62 -0
  41. data/rbi/courier/models/workspace_preference_retrieve_params.rbi +38 -0
  42. data/rbi/courier/models/workspace_preference_topic_create_request.rbi +186 -0
  43. data/rbi/courier/models/workspace_preference_topic_get_response.rbi +215 -0
  44. data/rbi/courier/models/workspace_preference_topic_list_response.rbi +36 -0
  45. data/rbi/courier/models/workspace_preference_topic_replace_request.rbi +185 -0
  46. data/rbi/courier/models/workspace_preferences/topic_archive_params.rbi +48 -0
  47. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +40 -0
  48. data/rbi/courier/models/workspace_preferences/topic_list_params.rbi +40 -0
  49. data/rbi/courier/models/workspace_preferences/topic_replace_params.rbi +48 -0
  50. data/rbi/courier/models/workspace_preferences/topic_retrieve_params.rbi +48 -0
  51. data/rbi/courier/models.rbi +45 -0
  52. data/rbi/courier/resources/notifications/checks.rbi +3 -3
  53. data/rbi/courier/resources/workspace_preferences/topics.rbi +152 -0
  54. data/rbi/courier/resources/workspace_preferences.rbi +113 -0
  55. data/sig/courier/client.rbs +2 -0
  56. data/sig/courier/models/publish_preferences_response.rbs +40 -0
  57. data/sig/courier/models/workspace_preference_archive_params.rbs +23 -0
  58. data/sig/courier/models/workspace_preference_create_params.rbs +15 -0
  59. data/sig/courier/models/workspace_preference_create_request.rbs +30 -0
  60. data/sig/courier/models/workspace_preference_get_response.rbs +60 -0
  61. data/sig/courier/models/workspace_preference_list_params.rbs +15 -0
  62. data/sig/courier/models/workspace_preference_list_response.rbs +18 -0
  63. data/sig/courier/models/workspace_preference_publish_params.rbs +15 -0
  64. data/sig/courier/models/workspace_preference_replace_params.rbs +25 -0
  65. data/sig/courier/models/workspace_preference_replace_request.rbs +30 -0
  66. data/sig/courier/models/workspace_preference_retrieve_params.rbs +23 -0
  67. data/sig/courier/models/workspace_preference_topic_create_request.rbs +68 -0
  68. data/sig/courier/models/workspace_preference_topic_get_response.rbs +93 -0
  69. data/sig/courier/models/workspace_preference_topic_list_response.rbs +18 -0
  70. data/sig/courier/models/workspace_preference_topic_replace_request.rbs +68 -0
  71. data/sig/courier/models/workspace_preferences/topic_archive_params.rbs +30 -0
  72. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +27 -0
  73. data/sig/courier/models/workspace_preferences/topic_list_params.rbs +25 -0
  74. data/sig/courier/models/workspace_preferences/topic_replace_params.rbs +34 -0
  75. data/sig/courier/models/workspace_preferences/topic_retrieve_params.rbs +30 -0
  76. data/sig/courier/models.rbs +32 -0
  77. data/sig/courier/resources/workspace_preferences/topics.rbs +49 -0
  78. data/sig/courier/resources/workspace_preferences.rbs +42 -0
  79. metadata +68 -2
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class WorkspacePreferenceTopicReplaceRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute default_status
7
+ # The default subscription status applied when a recipient has not set their own.
8
+ #
9
+ # @return [Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::DefaultStatus]
10
+ required :default_status, enum: -> { Courier::WorkspacePreferenceTopicReplaceRequest::DefaultStatus }
11
+
12
+ # @!attribute name
13
+ # Human-readable name for the preference topic.
14
+ #
15
+ # @return [String]
16
+ required :name, String
17
+
18
+ # @!attribute allowed_preferences
19
+ # Preference controls a recipient may customize. Omit to clear.
20
+ #
21
+ # @return [Array<Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::AllowedPreference>, nil]
22
+ optional :allowed_preferences,
23
+ -> {
24
+ Courier::Internal::Type::ArrayOf[enum: Courier::WorkspacePreferenceTopicReplaceRequest::AllowedPreference]
25
+ },
26
+ nil?: true
27
+
28
+ # @!attribute include_unsubscribe_header
29
+ # Whether to include a list-unsubscribe header on emails for this topic.
30
+ #
31
+ # @return [Boolean, nil]
32
+ optional :include_unsubscribe_header, Courier::Internal::Type::Boolean, nil?: true
33
+
34
+ # @!attribute routing_options
35
+ # Default channels delivered for this topic. Omit to clear.
36
+ #
37
+ # @return [Array<Symbol, Courier::Models::ChannelClassification>, nil]
38
+ optional :routing_options,
39
+ -> { Courier::Internal::Type::ArrayOf[enum: Courier::ChannelClassification] },
40
+ nil?: true
41
+
42
+ # @!attribute topic_data
43
+ # Arbitrary metadata associated with the topic. Omit to clear.
44
+ #
45
+ # @return [Hash{Symbol=>Object}, nil]
46
+ optional :topic_data, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true
47
+
48
+ # @!method initialize(default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil)
49
+ # Request body for replacing a preference topic. Full document replacement;
50
+ # missing optional fields are cleared.
51
+ #
52
+ # @param default_status [Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::DefaultStatus] The default subscription status applied when a recipient has not set their own.
53
+ #
54
+ # @param name [String] Human-readable name for the preference topic.
55
+ #
56
+ # @param allowed_preferences [Array<Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::AllowedPreference>, nil] Preference controls a recipient may customize. Omit to clear.
57
+ #
58
+ # @param include_unsubscribe_header [Boolean, nil] Whether to include a list-unsubscribe header on emails for this topic.
59
+ #
60
+ # @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels delivered for this topic. Omit to clear.
61
+ #
62
+ # @param topic_data [Hash{Symbol=>Object}, nil] Arbitrary metadata associated with the topic. Omit to clear.
63
+
64
+ # The default subscription status applied when a recipient has not set their own.
65
+ #
66
+ # @see Courier::Models::WorkspacePreferenceTopicReplaceRequest#default_status
67
+ module DefaultStatus
68
+ extend Courier::Internal::Type::Enum
69
+
70
+ OPTED_OUT = :OPTED_OUT
71
+ OPTED_IN = :OPTED_IN
72
+ REQUIRED = :REQUIRED
73
+
74
+ # @!method self.values
75
+ # @return [Array<Symbol>]
76
+ end
77
+
78
+ # A preference control a recipient may customize for a topic.
79
+ module AllowedPreference
80
+ extend Courier::Internal::Type::Enum
81
+
82
+ SNOOZE = :snooze
83
+ CHANNEL_PREFERENCES = :channel_preferences
84
+
85
+ # @!method self.values
86
+ # @return [Array<Symbol>]
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module WorkspacePreferences
6
+ # @see Courier::Resources::WorkspacePreferences::Topics#archive
7
+ class TopicArchiveParams < Courier::Internal::Type::BaseModel
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute section_id
12
+ #
13
+ # @return [String]
14
+ required :section_id, String
15
+
16
+ # @!attribute topic_id
17
+ #
18
+ # @return [String]
19
+ required :topic_id, String
20
+
21
+ # @!method initialize(section_id:, topic_id:, request_options: {})
22
+ # @param section_id [String]
23
+ # @param topic_id [String]
24
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module WorkspacePreferences
6
+ # @see Courier::Resources::WorkspacePreferences::Topics#create
7
+ class TopicCreateParams < Courier::Models::WorkspacePreferenceTopicCreateRequest
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute section_id
12
+ #
13
+ # @return [String]
14
+ required :section_id, String
15
+
16
+ # @!method initialize(section_id:, request_options: {})
17
+ # @param section_id [String]
18
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module WorkspacePreferences
6
+ # @see Courier::Resources::WorkspacePreferences::Topics#list
7
+ class TopicListParams < Courier::Internal::Type::BaseModel
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute section_id
12
+ #
13
+ # @return [String]
14
+ required :section_id, String
15
+
16
+ # @!method initialize(section_id:, request_options: {})
17
+ # @param section_id [String]
18
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module WorkspacePreferences
6
+ # @see Courier::Resources::WorkspacePreferences::Topics#replace
7
+ class TopicReplaceParams < Courier::Models::WorkspacePreferenceTopicReplaceRequest
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute section_id
12
+ #
13
+ # @return [String]
14
+ required :section_id, String
15
+
16
+ # @!attribute topic_id
17
+ #
18
+ # @return [String]
19
+ required :topic_id, String
20
+
21
+ # @!method initialize(section_id:, topic_id:, request_options: {})
22
+ # @param section_id [String]
23
+ # @param topic_id [String]
24
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module WorkspacePreferences
6
+ # @see Courier::Resources::WorkspacePreferences::Topics#retrieve
7
+ class TopicRetrieveParams < Courier::Internal::Type::BaseModel
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ # @!attribute section_id
12
+ #
13
+ # @return [String]
14
+ required :section_id, String
15
+
16
+ # @!attribute topic_id
17
+ #
18
+ # @return [String]
19
+ required :topic_id, String
20
+
21
+ # @!method initialize(section_id:, topic_id:, request_options: {})
22
+ # @param section_id [String]
23
+ # @param topic_id [String]
24
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -434,6 +434,8 @@ module Courier
434
434
 
435
435
  ProviderUpdateParams = Courier::Models::ProviderUpdateParams
436
436
 
437
+ PublishPreferencesResponse = Courier::Models::PublishPreferencesResponse
438
+
437
439
  PutSubscriptionsRecipient = Courier::Models::PutSubscriptionsRecipient
438
440
 
439
441
  PutTenantTemplateRequest = Courier::Models::PutTenantTemplateRequest
@@ -555,4 +557,34 @@ module Courier
555
557
  WebhookRecipient = Courier::Models::WebhookRecipient
556
558
 
557
559
  WidgetBackground = Courier::Models::WidgetBackground
560
+
561
+ WorkspacePreferenceArchiveParams = Courier::Models::WorkspacePreferenceArchiveParams
562
+
563
+ WorkspacePreferenceCreateParams = Courier::Models::WorkspacePreferenceCreateParams
564
+
565
+ WorkspacePreferenceCreateRequest = Courier::Models::WorkspacePreferenceCreateRequest
566
+
567
+ WorkspacePreferenceGetResponse = Courier::Models::WorkspacePreferenceGetResponse
568
+
569
+ WorkspacePreferenceListParams = Courier::Models::WorkspacePreferenceListParams
570
+
571
+ WorkspacePreferenceListResponse = Courier::Models::WorkspacePreferenceListResponse
572
+
573
+ WorkspacePreferencePublishParams = Courier::Models::WorkspacePreferencePublishParams
574
+
575
+ WorkspacePreferenceReplaceParams = Courier::Models::WorkspacePreferenceReplaceParams
576
+
577
+ WorkspacePreferenceReplaceRequest = Courier::Models::WorkspacePreferenceReplaceRequest
578
+
579
+ WorkspacePreferenceRetrieveParams = Courier::Models::WorkspacePreferenceRetrieveParams
580
+
581
+ WorkspacePreferences = Courier::Models::WorkspacePreferences
582
+
583
+ WorkspacePreferenceTopicCreateRequest = Courier::Models::WorkspacePreferenceTopicCreateRequest
584
+
585
+ WorkspacePreferenceTopicGetResponse = Courier::Models::WorkspacePreferenceTopicGetResponse
586
+
587
+ WorkspacePreferenceTopicListResponse = Courier::Models::WorkspacePreferenceTopicListResponse
588
+
589
+ WorkspacePreferenceTopicReplaceRequest = Courier::Models::WorkspacePreferenceTopicReplaceRequest
558
590
  end
@@ -4,7 +4,7 @@ module Courier
4
4
  module Resources
5
5
  class Notifications
6
6
  class Checks
7
- # Replace the checks for a notification template submission.
7
+ # Replace the submission checks for a notification template.
8
8
  #
9
9
  # @overload update(submission_id, id:, checks:, request_options: {})
10
10
  #
@@ -34,7 +34,7 @@ module Courier
34
34
  )
35
35
  end
36
36
 
37
- # Retrieve the checks for a notification template submission.
37
+ # Retrieve the submission checks for a notification template.
38
38
  #
39
39
  # @overload list(submission_id, id:, request_options: {})
40
40
  #
@@ -61,7 +61,7 @@ module Courier
61
61
  )
62
62
  end
63
63
 
64
- # Cancel a notification template submission.
64
+ # Cancel a submission for a notification template.
65
65
  #
66
66
  # @overload delete(submission_id, id:, request_options: {})
67
67
  #
@@ -0,0 +1,176 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class WorkspacePreferences
6
+ class Topics
7
+ # Some parameter documentations has been truncated, see
8
+ # {Courier::Models::WorkspacePreferences::TopicCreateParams} for more details.
9
+ #
10
+ # Create a subscription preference topic inside a workspace preference. Fails with
11
+ # 404 if the workspace preference does not exist. The topic id is generated and
12
+ # returned.
13
+ #
14
+ # @overload create(section_id, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {})
15
+ #
16
+ # @param section_id [String] Id of the workspace preference to create the topic in.
17
+ #
18
+ # @param default_status [Symbol, Courier::Models::WorkspacePreferenceTopicCreateRequest::DefaultStatus] The default subscription status applied when a recipient has not set their own.
19
+ #
20
+ # @param name [String] Human-readable name for the preference topic.
21
+ #
22
+ # @param allowed_preferences [Array<Symbol, Courier::Models::WorkspacePreferenceTopicCreateRequest::AllowedPreference>, nil] Preference controls a recipient may customize for this topic. Defaults to empty
23
+ #
24
+ # @param include_unsubscribe_header [Boolean, nil] Whether to include a list-unsubscribe header on emails for this topic.
25
+ #
26
+ # @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels delivered for this topic. Defaults to empty if omitted.
27
+ #
28
+ # @param topic_data [Hash{Symbol=>Object}, nil] Arbitrary metadata associated with the topic.
29
+ #
30
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
31
+ #
32
+ # @return [Courier::Models::WorkspacePreferenceTopicGetResponse]
33
+ #
34
+ # @see Courier::Models::WorkspacePreferences::TopicCreateParams
35
+ def create(section_id, params)
36
+ parsed, options = Courier::WorkspacePreferences::TopicCreateParams.dump_request(params)
37
+ @client.request(
38
+ method: :post,
39
+ path: ["preferences/sections/%1$s/topics", section_id],
40
+ body: parsed,
41
+ model: Courier::WorkspacePreferenceTopicGetResponse,
42
+ options: options
43
+ )
44
+ end
45
+
46
+ # Retrieve a topic within a workspace preference. Returns 404 if the workspace
47
+ # preference does not exist, the topic does not exist, or the topic belongs to a
48
+ # different workspace preference.
49
+ #
50
+ # @overload retrieve(topic_id, section_id:, request_options: {})
51
+ #
52
+ # @param topic_id [String] Id of the subscription preference topic.
53
+ #
54
+ # @param section_id [String] Id of the workspace preference.
55
+ #
56
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
57
+ #
58
+ # @return [Courier::Models::WorkspacePreferenceTopicGetResponse]
59
+ #
60
+ # @see Courier::Models::WorkspacePreferences::TopicRetrieveParams
61
+ def retrieve(topic_id, params)
62
+ parsed, options = Courier::WorkspacePreferences::TopicRetrieveParams.dump_request(params)
63
+ section_id =
64
+ parsed.delete(:section_id) do
65
+ raise ArgumentError.new("missing required path argument #{_1}")
66
+ end
67
+ @client.request(
68
+ method: :get,
69
+ path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
70
+ model: Courier::WorkspacePreferenceTopicGetResponse,
71
+ options: options
72
+ )
73
+ end
74
+
75
+ # List the topics in a workspace preference.
76
+ #
77
+ # @overload list(section_id, request_options: {})
78
+ #
79
+ # @param section_id [String] Id of the workspace preference.
80
+ #
81
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
82
+ #
83
+ # @return [Courier::Models::WorkspacePreferenceTopicListResponse]
84
+ #
85
+ # @see Courier::Models::WorkspacePreferences::TopicListParams
86
+ def list(section_id, params = {})
87
+ @client.request(
88
+ method: :get,
89
+ path: ["preferences/sections/%1$s/topics", section_id],
90
+ model: Courier::WorkspacePreferenceTopicListResponse,
91
+ options: params[:request_options]
92
+ )
93
+ end
94
+
95
+ # Archive a topic and remove it from its workspace preference. Same 404 rules as
96
+ # GET.
97
+ #
98
+ # @overload archive(topic_id, section_id:, request_options: {})
99
+ #
100
+ # @param topic_id [String] Id of the subscription preference topic.
101
+ #
102
+ # @param section_id [String] Id of the workspace preference.
103
+ #
104
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
105
+ #
106
+ # @return [nil]
107
+ #
108
+ # @see Courier::Models::WorkspacePreferences::TopicArchiveParams
109
+ def archive(topic_id, params)
110
+ parsed, options = Courier::WorkspacePreferences::TopicArchiveParams.dump_request(params)
111
+ section_id =
112
+ parsed.delete(:section_id) do
113
+ raise ArgumentError.new("missing required path argument #{_1}")
114
+ end
115
+ @client.request(
116
+ method: :delete,
117
+ path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
118
+ model: NilClass,
119
+ options: options
120
+ )
121
+ end
122
+
123
+ # Some parameter documentations has been truncated, see
124
+ # {Courier::Models::WorkspacePreferences::TopicReplaceParams} for more details.
125
+ #
126
+ # Replace a topic within a workspace preference. Full document replacement;
127
+ # missing optional fields are cleared. Same 404 rules as GET.
128
+ #
129
+ # @overload replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {})
130
+ #
131
+ # @param topic_id [String] Path param: Id of the subscription preference topic.
132
+ #
133
+ # @param section_id [String] Path param: Id of the workspace preference.
134
+ #
135
+ # @param default_status [Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::DefaultStatus] Body param: The default subscription status applied when a recipient has not set
136
+ #
137
+ # @param name [String] Body param: Human-readable name for the preference topic.
138
+ #
139
+ # @param allowed_preferences [Array<Symbol, Courier::Models::WorkspacePreferenceTopicReplaceRequest::AllowedPreference>, nil] Body param: Preference controls a recipient may customize. Omit to clear.
140
+ #
141
+ # @param include_unsubscribe_header [Boolean, nil] Body param: Whether to include a list-unsubscribe header on emails for this topi
142
+ #
143
+ # @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Body param: Default channels delivered for this topic. Omit to clear.
144
+ #
145
+ # @param topic_data [Hash{Symbol=>Object}, nil] Body param: Arbitrary metadata associated with the topic. Omit to clear.
146
+ #
147
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
148
+ #
149
+ # @return [Courier::Models::WorkspacePreferenceTopicGetResponse]
150
+ #
151
+ # @see Courier::Models::WorkspacePreferences::TopicReplaceParams
152
+ def replace(topic_id, params)
153
+ parsed, options = Courier::WorkspacePreferences::TopicReplaceParams.dump_request(params)
154
+ section_id =
155
+ parsed.delete(:section_id) do
156
+ raise ArgumentError.new("missing required path argument #{_1}")
157
+ end
158
+ @client.request(
159
+ method: :put,
160
+ path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id],
161
+ body: parsed,
162
+ model: Courier::WorkspacePreferenceTopicGetResponse,
163
+ options: options
164
+ )
165
+ end
166
+
167
+ # @api private
168
+ #
169
+ # @param client [Courier::Client]
170
+ def initialize(client:)
171
+ @client = client
172
+ end
173
+ end
174
+ end
175
+ end
176
+ end
@@ -0,0 +1,155 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class WorkspacePreferences
6
+ # @return [Courier::Resources::WorkspacePreferences::Topics]
7
+ attr_reader :topics
8
+
9
+ # Create a workspace preference. The workspace preference id is generated and
10
+ # returned. Topics are created inside a workspace preference 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 workspace preference.
16
+ #
17
+ # @param has_custom_routing [Boolean, nil] Whether the workspace preference defines custom routing for its topics.
18
+ #
19
+ # @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels for the workspace preference. Defaults to empty if omitted.
20
+ #
21
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
22
+ #
23
+ # @return [Courier::Models::WorkspacePreferenceGetResponse]
24
+ #
25
+ # @see Courier::Models::WorkspacePreferenceCreateParams
26
+ def create(params)
27
+ parsed, options = Courier::WorkspacePreferenceCreateParams.dump_request(params)
28
+ @client.request(
29
+ method: :post,
30
+ path: "preferences/sections",
31
+ body: parsed,
32
+ model: Courier::WorkspacePreferenceGetResponse,
33
+ options: options
34
+ )
35
+ end
36
+
37
+ # Retrieve a workspace preference by id, including its topics.
38
+ #
39
+ # @overload retrieve(section_id, request_options: {})
40
+ #
41
+ # @param section_id [String] Id of the workspace preference.
42
+ #
43
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
44
+ #
45
+ # @return [Courier::Models::WorkspacePreferenceGetResponse]
46
+ #
47
+ # @see Courier::Models::WorkspacePreferenceRetrieveParams
48
+ def retrieve(section_id, params = {})
49
+ @client.request(
50
+ method: :get,
51
+ path: ["preferences/sections/%1$s", section_id],
52
+ model: Courier::WorkspacePreferenceGetResponse,
53
+ options: params[:request_options]
54
+ )
55
+ end
56
+
57
+ # List the workspace's preferences. Each workspace preference embeds its topics.
58
+ # Scoped 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::WorkspacePreferenceListResponse]
65
+ #
66
+ # @see Courier::Models::WorkspacePreferenceListParams
67
+ def list(params = {})
68
+ @client.request(
69
+ method: :get,
70
+ path: "preferences/sections",
71
+ model: Courier::WorkspacePreferenceListResponse,
72
+ options: params[:request_options]
73
+ )
74
+ end
75
+
76
+ # Archive a workspace preference. The workspace preference must be empty: delete
77
+ # its topics first, otherwise the request fails with 409.
78
+ #
79
+ # @overload archive(section_id, request_options: {})
80
+ #
81
+ # @param section_id [String] Id of the workspace preference.
82
+ #
83
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
84
+ #
85
+ # @return [nil]
86
+ #
87
+ # @see Courier::Models::WorkspacePreferenceArchiveParams
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 workspace
98
+ # preference with its topics under a new published version, making the current
99
+ # state visible on 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::WorkspacePreferencePublishParams
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 workspace preference. Full document replacement; missing optional
118
+ # fields are cleared. Topics attached to the workspace preference 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 workspace preference.
123
+ #
124
+ # @param name [String] Human-readable name for the workspace preference.
125
+ #
126
+ # @param has_custom_routing [Boolean, nil] Whether the workspace preference defines custom routing for its topics.
127
+ #
128
+ # @param routing_options [Array<Symbol, Courier::Models::ChannelClassification>, nil] Default channels for the workspace preference. Omit to clear.
129
+ #
130
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
131
+ #
132
+ # @return [Courier::Models::WorkspacePreferenceGetResponse]
133
+ #
134
+ # @see Courier::Models::WorkspacePreferenceReplaceParams
135
+ def replace(section_id, params)
136
+ parsed, options = Courier::WorkspacePreferenceReplaceParams.dump_request(params)
137
+ @client.request(
138
+ method: :put,
139
+ path: ["preferences/sections/%1$s", section_id],
140
+ body: parsed,
141
+ model: Courier::WorkspacePreferenceGetResponse,
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::WorkspacePreferences::Topics.new(client: client)
152
+ end
153
+ end
154
+ end
155
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "4.16.0"
4
+ VERSION = "4.17.1"
5
5
  end
data/lib/courier.rb CHANGED
@@ -78,6 +78,10 @@ require_relative "courier/models/base_template_tenant_association"
78
78
  require_relative "courier/models/post_tenant_template_publish_request"
79
79
  require_relative "courier/models/put_tenant_template_request"
80
80
  require_relative "courier/models/users/user_token"
81
+ require_relative "courier/models/workspace_preference_create_request"
82
+ require_relative "courier/models/workspace_preference_replace_request"
83
+ require_relative "courier/models/workspace_preference_topic_create_request"
84
+ require_relative "courier/models/workspace_preference_topic_replace_request"
81
85
  require_relative "courier/models/airship_profile"
82
86
  require_relative "courier/models/airship_profile_audience"
83
87
  require_relative "courier/models/alignment"
@@ -300,6 +304,7 @@ require_relative "courier/models/providers/catalog_list_params"
300
304
  require_relative "courier/models/providers/catalog_list_response"
301
305
  require_relative "courier/models/providers_catalog_entry"
302
306
  require_relative "courier/models/provider_update_params"
307
+ require_relative "courier/models/publish_preferences_response"
303
308
  require_relative "courier/models/put_subscriptions_recipient"
304
309
  require_relative "courier/models/put_tenant_template_response"
305
310
  require_relative "courier/models/recipient_preferences"
@@ -390,6 +395,21 @@ require_relative "courier/models/webhook_profile"
390
395
  require_relative "courier/models/webhook_profile_type"
391
396
  require_relative "courier/models/webhook_recipient"
392
397
  require_relative "courier/models/widget_background"
398
+ require_relative "courier/models/workspace_preference_archive_params"
399
+ require_relative "courier/models/workspace_preference_create_params"
400
+ require_relative "courier/models/workspace_preference_get_response"
401
+ require_relative "courier/models/workspace_preference_list_params"
402
+ require_relative "courier/models/workspace_preference_list_response"
403
+ require_relative "courier/models/workspace_preference_publish_params"
404
+ require_relative "courier/models/workspace_preference_replace_params"
405
+ require_relative "courier/models/workspace_preference_retrieve_params"
406
+ require_relative "courier/models/workspace_preferences/topic_archive_params"
407
+ require_relative "courier/models/workspace_preferences/topic_create_params"
408
+ require_relative "courier/models/workspace_preferences/topic_list_params"
409
+ require_relative "courier/models/workspace_preferences/topic_replace_params"
410
+ require_relative "courier/models/workspace_preferences/topic_retrieve_params"
411
+ require_relative "courier/models/workspace_preference_topic_get_response"
412
+ require_relative "courier/models/workspace_preference_topic_list_response"
393
413
  require_relative "courier/models"
394
414
  require_relative "courier/resources/audiences"
395
415
  require_relative "courier/resources/audit_events"
@@ -425,3 +445,5 @@ require_relative "courier/resources/users"
425
445
  require_relative "courier/resources/users/preferences"
426
446
  require_relative "courier/resources/users/tenants"
427
447
  require_relative "courier/resources/users/tokens"
448
+ require_relative "courier/resources/workspace_preferences"
449
+ require_relative "courier/resources/workspace_preferences/topics"