trycourier 6.9.0 → 6.11.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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/courier/client.rb +6 -0
  5. data/lib/courier/models/create_device_set_request.rb +27 -0
  6. data/lib/courier/models/device_set.rb +63 -0
  7. data/lib/courier/models/device_set_list_response.rb +18 -0
  8. data/lib/courier/models/notifications/previews/create_preview_run_request.rb +68 -0
  9. data/lib/courier/models/notifications/previews/preview_result.rb +67 -0
  10. data/lib/courier/models/notifications/previews/preview_result_failure_reason.rb +24 -0
  11. data/lib/courier/models/notifications/previews/preview_result_status.rb +29 -0
  12. data/lib/courier/models/notifications/previews/preview_run.rb +84 -0
  13. data/lib/courier/models/notifications/previews/preview_run_detail.rb +93 -0
  14. data/lib/courier/models/notifications/previews/preview_run_failure_reason.rb +28 -0
  15. data/lib/courier/models/notifications/previews/preview_run_list_response.rb +30 -0
  16. data/lib/courier/models/notifications/previews/preview_run_status.rb +28 -0
  17. data/lib/courier/models/notifications/previews/run_create_params.rb +36 -0
  18. data/lib/courier/models/notifications/previews/run_list_params.rb +41 -0
  19. data/lib/courier/models/notifications/previews/run_retrieve_params.rb +30 -0
  20. data/lib/courier/models/preference_change_log_entry.rb +94 -0
  21. data/lib/courier/models/preference_change_log_value.rb +32 -0
  22. data/lib/courier/models/preference_logs_list_response.rb +24 -0
  23. data/lib/courier/models/preview_archive_device_set_params.rb +20 -0
  24. data/lib/courier/models/preview_create_device_set_params.rb +14 -0
  25. data/lib/courier/models/preview_device.rb +125 -0
  26. data/lib/courier/models/preview_device_list_response.rb +18 -0
  27. data/lib/courier/models/preview_list_device_sets_params.rb +14 -0
  28. data/lib/courier/models/preview_list_devices_params.rb +14 -0
  29. data/lib/courier/models/preview_retrieve_device_set_params.rb +20 -0
  30. data/lib/courier/models/preview_update_device_set_params.rb +20 -0
  31. data/lib/courier/models/workspace_preference_list_logs_params.rb +61 -0
  32. data/lib/courier/models.rb +30 -0
  33. data/lib/courier/resources/notifications/previews/runs.rb +148 -0
  34. data/lib/courier/resources/notifications/previews.rb +22 -0
  35. data/lib/courier/resources/notifications.rb +4 -0
  36. data/lib/courier/resources/previews.rb +153 -0
  37. data/lib/courier/resources/workspace_preferences.rb +37 -0
  38. data/lib/courier/version.rb +1 -1
  39. data/lib/courier.rb +30 -0
  40. data/rbi/courier/client.rbi +5 -0
  41. data/rbi/courier/models/create_device_set_request.rbi +39 -0
  42. data/rbi/courier/models/device_set.rbi +81 -0
  43. data/rbi/courier/models/device_set_list_response.rbi +28 -0
  44. data/rbi/courier/models/notifications/previews/create_preview_run_request.rbi +110 -0
  45. data/rbi/courier/models/notifications/previews/preview_result.rbi +117 -0
  46. data/rbi/courier/models/notifications/previews/preview_result_failure_reason.rbi +44 -0
  47. data/rbi/courier/models/notifications/previews/preview_result_status.rbi +69 -0
  48. data/rbi/courier/models/notifications/previews/preview_run.rbi +134 -0
  49. data/rbi/courier/models/notifications/previews/preview_run_detail.rbi +148 -0
  50. data/rbi/courier/models/notifications/previews/preview_run_failure_reason.rbi +64 -0
  51. data/rbi/courier/models/notifications/previews/preview_run_list_response.rbi +54 -0
  52. data/rbi/courier/models/notifications/previews/preview_run_status.rbi +61 -0
  53. data/rbi/courier/models/notifications/previews/run_create_params.rbi +66 -0
  54. data/rbi/courier/models/notifications/previews/run_list_params.rbi +67 -0
  55. data/rbi/courier/models/notifications/previews/run_retrieve_params.rbi +50 -0
  56. data/rbi/courier/models/preference_change_log_entry.rbi +122 -0
  57. data/rbi/courier/models/preference_change_log_value.rbi +54 -0
  58. data/rbi/courier/models/preference_logs_list_response.rbi +46 -0
  59. data/rbi/courier/models/preview_archive_device_set_params.rbi +38 -0
  60. data/rbi/courier/models/preview_create_device_set_params.rbi +30 -0
  61. data/rbi/courier/models/preview_device.rbi +168 -0
  62. data/rbi/courier/models/preview_device_list_response.rbi +28 -0
  63. data/rbi/courier/models/preview_list_device_sets_params.rbi +30 -0
  64. data/rbi/courier/models/preview_list_devices_params.rbi +27 -0
  65. data/rbi/courier/models/preview_retrieve_device_set_params.rbi +38 -0
  66. data/rbi/courier/models/preview_update_device_set_params.rbi +38 -0
  67. data/rbi/courier/models/workspace_preference_list_logs_params.rbi +101 -0
  68. data/rbi/courier/models.rbi +32 -0
  69. data/rbi/courier/resources/notifications/previews/runs.rbi +136 -0
  70. data/rbi/courier/resources/notifications/previews.rbi +19 -0
  71. data/rbi/courier/resources/notifications.rbi +3 -0
  72. data/rbi/courier/resources/previews.rbi +106 -0
  73. data/rbi/courier/resources/workspace_preferences.rbi +33 -0
  74. data/sig/courier/client.rbs +2 -0
  75. data/sig/courier/models/create_device_set_request.rbs +16 -0
  76. data/sig/courier/models/device_set.rbs +47 -0
  77. data/sig/courier/models/device_set_list_response.rbs +13 -0
  78. data/sig/courier/models/notifications/previews/create_preview_run_request.rbs +54 -0
  79. data/sig/courier/models/notifications/previews/preview_result.rbs +50 -0
  80. data/sig/courier/models/notifications/previews/preview_result_failure_reason.rbs +19 -0
  81. data/sig/courier/models/notifications/previews/preview_result_status.rbs +30 -0
  82. data/sig/courier/models/notifications/previews/preview_run.rbs +62 -0
  83. data/sig/courier/models/notifications/previews/preview_run_detail.rbs +67 -0
  84. data/sig/courier/models/notifications/previews/preview_run_failure_reason.rbs +28 -0
  85. data/sig/courier/models/notifications/previews/preview_run_list_response.rbs +31 -0
  86. data/sig/courier/models/notifications/previews/preview_run_status.rbs +24 -0
  87. data/sig/courier/models/notifications/previews/run_create_params.rbs +46 -0
  88. data/sig/courier/models/notifications/previews/run_list_params.rbs +38 -0
  89. data/sig/courier/models/notifications/previews/run_retrieve_params.rbs +32 -0
  90. data/sig/courier/models/preference_change_log_entry.rbs +71 -0
  91. data/sig/courier/models/preference_change_log_value.rbs +30 -0
  92. data/sig/courier/models/preference_logs_list_response.rbs +25 -0
  93. data/sig/courier/models/preview_archive_device_set_params.rbs +23 -0
  94. data/sig/courier/models/preview_create_device_set_params.rbs +15 -0
  95. data/sig/courier/models/preview_device.rbs +83 -0
  96. data/sig/courier/models/preview_device_list_response.rbs +14 -0
  97. data/sig/courier/models/preview_list_device_sets_params.rbs +15 -0
  98. data/sig/courier/models/preview_list_devices_params.rbs +15 -0
  99. data/sig/courier/models/preview_retrieve_device_set_params.rbs +23 -0
  100. data/sig/courier/models/preview_update_device_set_params.rbs +25 -0
  101. data/sig/courier/models/workspace_preference_list_logs_params.rbs +56 -0
  102. data/sig/courier/models.rbs +30 -0
  103. data/sig/courier/resources/notifications/previews/runs.rbs +36 -0
  104. data/sig/courier/resources/notifications/previews.rbs +11 -0
  105. data/sig/courier/resources/notifications.rbs +2 -0
  106. data/sig/courier/resources/previews.rbs +38 -0
  107. data/sig/courier/resources/workspace_preferences.rbs +9 -0
  108. metadata +91 -1
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Notifications
6
+ class Previews
7
+ # Render a template's email content on real email clients and read back the
8
+ # screenshots, so you can check how it looks before you send it.
9
+ class Runs
10
+ # Some parameter documentations has been truncated, see
11
+ # {Courier::Models::Notifications::Previews::RunCreateParams} for more details.
12
+ #
13
+ # Render this template's email content on each of the requested devices.
14
+ #
15
+ # Returns as soon as the run exists and its render is queued — the screenshots are
16
+ # produced asynchronously. Poll
17
+ # `GET /notifications/{id}/previews/runs/{previewRunId}` until every result
18
+ # reaches a terminal status.
19
+ #
20
+ # Name the devices either with `device_set_id`, for a saved set, or with
21
+ # `device_ids`, for a one-off list. Exactly one of the two is required. Inline
22
+ # `device_ids` must be ids listed by `GET /previews/devices`; any other id is a
23
+ # 422, refused before the run exists or is billed.
24
+ #
25
+ # A template that does not exist is a 404. One that exists but cannot be previewed
26
+ # — not a Design Studio template, no email channel, or no such `template_version`
27
+ # — is a 422, also refused before the run exists or is billed.
28
+ #
29
+ # Preview runs are a metered add-on. A workspace without it, or with its billing
30
+ # suspended, receives a 402.
31
+ #
32
+ # @overload create(id, data: nil, device_ids: nil, device_set_id: nil, locale: nil, template_version: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
33
+ #
34
+ # @param id [String] Path param: Template ID (nt\_ prefix). Must be a Design Studio template.
35
+ #
36
+ # @param data [Hash{Symbol=>Object}] Body param: Template variables to render with, the same shape as the `data` obje
37
+ #
38
+ # @param device_ids [Array<String>] Body param: The devices to render on, by `PreviewDevice.id`, for a one-off run.
39
+ #
40
+ # @param device_set_id [String] Body param: A saved device set naming the devices to render on. Mutually exclusi
41
+ #
42
+ # @param locale [String] Body param: Render the template's content for this locale, e.g. "fr-FR".
43
+ #
44
+ # @param template_version [String] Body param: Which version of the template to render. Omit for the latest saved d
45
+ #
46
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
47
+ #
48
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
49
+ #
50
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
51
+ #
52
+ # @return [Courier::Models::Notifications::Previews::PreviewRun]
53
+ #
54
+ # @see Courier::Models::Notifications::Previews::RunCreateParams
55
+ def create(id, params = {})
56
+ parsed, options = Courier::Notifications::Previews::RunCreateParams.dump_request(params)
57
+ header_params =
58
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
59
+ @client.request(
60
+ method: :post,
61
+ path: ["notifications/%1$s/previews/runs", id],
62
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
63
+ body: parsed.except(*header_params.keys),
64
+ model: Courier::Notifications::Previews::PreviewRun,
65
+ options: options
66
+ )
67
+ end
68
+
69
+ # Some parameter documentations has been truncated, see
70
+ # {Courier::Models::Notifications::Previews::RunRetrieveParams} for more details.
71
+ #
72
+ # Retrieve one of this template's preview runs together with its per-device
73
+ # results.
74
+ #
75
+ # A run is only readable under the template it previewed: under any other template
76
+ # it is a 404, the same as a run that does not exist.
77
+ #
78
+ # `thumbnail_url` and `screenshot_url` are short-lived signed URLs, re-signed on
79
+ # every read. Fetch them now rather than storing them. Both are null until
80
+ # Courier's own copy of the image exists, which is what `status: COMPLETED` on a
81
+ # result means.
82
+ #
83
+ # @overload retrieve(preview_run_id, id:, request_options: {})
84
+ #
85
+ # @param preview_run_id [String] The preview run to retrieve, identified by the `id` returned when it was created
86
+ #
87
+ # @param id [String] Template ID (nt\_ prefix).
88
+ #
89
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
90
+ #
91
+ # @return [Courier::Models::Notifications::Previews::PreviewRunDetail]
92
+ #
93
+ # @see Courier::Models::Notifications::Previews::RunRetrieveParams
94
+ def retrieve(preview_run_id, params)
95
+ parsed, options = Courier::Notifications::Previews::RunRetrieveParams.dump_request(params)
96
+ id =
97
+ parsed.delete(:id) do
98
+ raise ArgumentError.new("missing required path argument #{_1}")
99
+ end
100
+ @client.request(
101
+ method: :get,
102
+ path: ["notifications/%1$s/previews/runs/%2$s", id, preview_run_id],
103
+ model: Courier::Notifications::Previews::PreviewRunDetail,
104
+ options: options
105
+ )
106
+ end
107
+
108
+ # List this template's preview runs, newest first. Cursor-paginated.
109
+ #
110
+ # A template that does not exist is a 404, the same as every other
111
+ # `/notifications/{id}` route.
112
+ #
113
+ # @overload list(id, cursor: nil, limit: nil, request_options: {})
114
+ #
115
+ # @param id [String] Template ID (nt\_ prefix).
116
+ #
117
+ # @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
118
+ #
119
+ # @param limit [Integer] Maximum number of results per page.
120
+ #
121
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
122
+ #
123
+ # @return [Courier::Models::Notifications::Previews::PreviewRunListResponse]
124
+ #
125
+ # @see Courier::Models::Notifications::Previews::RunListParams
126
+ def list(id, params = {})
127
+ parsed, options = Courier::Notifications::Previews::RunListParams.dump_request(params)
128
+ query = Courier::Internal::Util.encode_query_params(parsed)
129
+ @client.request(
130
+ method: :get,
131
+ path: ["notifications/%1$s/previews/runs", id],
132
+ query: query,
133
+ model: Courier::Notifications::Previews::PreviewRunListResponse,
134
+ options: options
135
+ )
136
+ end
137
+
138
+ # @api private
139
+ #
140
+ # @param client [Courier::Client]
141
+ def initialize(client:)
142
+ @client = client
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Notifications
6
+ class Previews
7
+ # Render a template's email content on real email clients and read back the
8
+ # screenshots, so you can check how it looks before you send it.
9
+ # @return [Courier::Resources::Notifications::Previews::Runs]
10
+ attr_reader :runs
11
+
12
+ # @api private
13
+ #
14
+ # @param client [Courier::Client]
15
+ def initialize(client:)
16
+ @client = client
17
+ @runs = Courier::Resources::Notifications::Previews::Runs.new(client: client)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -10,6 +10,9 @@ module Courier
10
10
  # @return [Courier::Resources::Notifications::Checks]
11
11
  attr_reader :checks
12
12
 
13
+ # @return [Courier::Resources::Notifications::Previews]
14
+ attr_reader :previews
15
+
13
16
  # Some parameter documentations has been truncated, see
14
17
  # {Courier::Models::NotificationCreateParams} for more details.
15
18
  #
@@ -422,6 +425,7 @@ module Courier
422
425
  def initialize(client:)
423
426
  @client = client
424
427
  @checks = Courier::Resources::Notifications::Checks.new(client: client)
428
+ @previews = Courier::Resources::Notifications::Previews.new(client: client)
425
429
  end
426
430
  end
427
431
  end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ # Render a template's email content on real email clients and read back the
6
+ # screenshots, so you can check how it looks before you send it.
7
+ class Previews
8
+ # Archive a device set. This is a soft delete — the archived set is returned and
9
+ # no longer appears in list results. Runs already created against it keep their
10
+ # own copy of the device list and are unaffected. The Courier-provided default set
11
+ # cannot be archived and returns 409.
12
+ #
13
+ # @overload archive_device_set(device_set_id, request_options: {})
14
+ #
15
+ # @param device_set_id [String] The preview set to archive.
16
+ #
17
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
18
+ #
19
+ # @return [Courier::Models::DeviceSet]
20
+ #
21
+ # @see Courier::Models::PreviewArchiveDeviceSetParams
22
+ def archive_device_set(device_set_id, params = {})
23
+ @client.request(
24
+ method: :delete,
25
+ path: ["previews/device-sets/%1$s", device_set_id],
26
+ model: Courier::DeviceSet,
27
+ options: params[:request_options]
28
+ )
29
+ end
30
+
31
+ # Create a named, reusable set of preview devices. Every id must be one listed by
32
+ # `GET /previews/devices`; any other is a 422.
33
+ #
34
+ # @overload create_device_set(device_ids:, name:, request_options: {})
35
+ #
36
+ # @param device_ids [Array<String>] The devices the set contains, by `PreviewDevice.id`. At least one is required.
37
+ #
38
+ # @param name [String] Human-readable name.
39
+ #
40
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
41
+ #
42
+ # @return [Courier::Models::DeviceSet]
43
+ #
44
+ # @see Courier::Models::PreviewCreateDeviceSetParams
45
+ def create_device_set(params)
46
+ parsed, options = Courier::PreviewCreateDeviceSetParams.dump_request(params)
47
+ @client.request(
48
+ method: :post,
49
+ path: "previews/device-sets",
50
+ body: parsed,
51
+ model: Courier::DeviceSet,
52
+ options: options
53
+ )
54
+ end
55
+
56
+ # List the workspace's preview sets. Archived sets are not returned.
57
+ #
58
+ # @overload list_device_sets(request_options: {})
59
+ #
60
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
61
+ #
62
+ # @return [Courier::Models::DeviceSetListResponse]
63
+ #
64
+ # @see Courier::Models::PreviewListDeviceSetsParams
65
+ def list_device_sets(params = {})
66
+ @client.request(
67
+ method: :get,
68
+ path: "previews/device-sets",
69
+ model: Courier::DeviceSetListResponse,
70
+ options: params[:request_options]
71
+ )
72
+ end
73
+
74
+ # List the devices a preview can be rendered on. Reference data, identical for
75
+ # every workspace — these ids are what a device set is built from and what a run
76
+ # reports results for.
77
+ #
78
+ # @overload list_devices(request_options: {})
79
+ #
80
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
81
+ #
82
+ # @return [Courier::Models::PreviewDeviceListResponse]
83
+ #
84
+ # @see Courier::Models::PreviewListDevicesParams
85
+ def list_devices(params = {})
86
+ @client.request(
87
+ method: :get,
88
+ path: "previews/devices",
89
+ model: Courier::PreviewDeviceListResponse,
90
+ options: params[:request_options]
91
+ )
92
+ end
93
+
94
+ # Some parameter documentations has been truncated, see
95
+ # {Courier::Models::PreviewRetrieveDeviceSetParams} for more details.
96
+ #
97
+ # Retrieve a preview set by ID. Archived sets return 404.
98
+ #
99
+ # @overload retrieve_device_set(device_set_id, request_options: {})
100
+ #
101
+ # @param device_set_id [String] The preview set to retrieve, identified by the `id` returned when it was created
102
+ #
103
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
104
+ #
105
+ # @return [Courier::Models::DeviceSet]
106
+ #
107
+ # @see Courier::Models::PreviewRetrieveDeviceSetParams
108
+ def retrieve_device_set(device_set_id, params = {})
109
+ @client.request(
110
+ method: :get,
111
+ path: ["previews/device-sets/%1$s", device_set_id],
112
+ model: Courier::DeviceSet,
113
+ options: params[:request_options]
114
+ )
115
+ end
116
+
117
+ # Replace a device set. This is a full replace, not a patch — both the name and
118
+ # the device list are always written. The Courier-provided default set cannot be
119
+ # changed and returns 409.
120
+ #
121
+ # @overload update_device_set(device_set_id, device_ids:, name:, request_options: {})
122
+ #
123
+ # @param device_set_id [String] The preview set to replace.
124
+ #
125
+ # @param device_ids [Array<String>] The devices the set contains, by `PreviewDevice.id`. At least one is required.
126
+ #
127
+ # @param name [String] Human-readable name.
128
+ #
129
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
130
+ #
131
+ # @return [Courier::Models::DeviceSet]
132
+ #
133
+ # @see Courier::Models::PreviewUpdateDeviceSetParams
134
+ def update_device_set(device_set_id, params)
135
+ parsed, options = Courier::PreviewUpdateDeviceSetParams.dump_request(params)
136
+ @client.request(
137
+ method: :put,
138
+ path: ["previews/device-sets/%1$s", device_set_id],
139
+ body: parsed,
140
+ model: Courier::DeviceSet,
141
+ options: options
142
+ )
143
+ end
144
+
145
+ # @api private
146
+ #
147
+ # @param client [Courier::Client]
148
+ def initialize(client:)
149
+ @client = client
150
+ end
151
+ end
152
+ end
153
+ end
@@ -108,6 +108,43 @@ module Courier
108
108
  )
109
109
  end
110
110
 
111
+ # Some parameter documentations has been truncated, see
112
+ # {Courier::Models::WorkspacePreferenceListLogsParams} for more details.
113
+ #
114
+ # Returns the history of preference changes in this environment, newest first.
115
+ # Each entry records one change a user made to one subscription topic, and carries
116
+ # the value before it where there was one. Supply user_id to read a single user's
117
+ # history instead of the whole environment.
118
+ #
119
+ # @overload list_logs(cursor: nil, limit: nil, since: nil, tenant_id: nil, user_id: nil, request_options: {})
120
+ #
121
+ # @param cursor [String] A cursor from a previous response's paging.cursor. Continue only while paging.mo
122
+ #
123
+ # @param limit [Integer] How many entries to return. Defaults to 25.
124
+ #
125
+ # @param since [String] Return only changes at or after this time, as an ISO-8601 date or date-time. A d
126
+ #
127
+ # @param tenant_id [String] Narrow to the changes this user made in one tenant context. Only valid together
128
+ #
129
+ # @param user_id [String] Return only this user's changes. Omit it to read every change in the environment
130
+ #
131
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
132
+ #
133
+ # @return [Courier::Models::PreferenceLogsListResponse]
134
+ #
135
+ # @see Courier::Models::WorkspacePreferenceListLogsParams
136
+ def list_logs(params = {})
137
+ parsed, options = Courier::WorkspacePreferenceListLogsParams.dump_request(params)
138
+ query = Courier::Internal::Util.encode_query_params(parsed)
139
+ @client.request(
140
+ method: :get,
141
+ path: "preferences/logs",
142
+ query: query,
143
+ model: Courier::PreferenceLogsListResponse,
144
+ options: options
145
+ )
146
+ end
147
+
111
148
  # Some parameter documentations has been truncated, see
112
149
  # {Courier::Models::WorkspacePreferencePublishParams} for more details.
113
150
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "6.9.0"
4
+ VERSION = "6.11.0"
5
5
  end
data/lib/courier.rb CHANGED
@@ -83,7 +83,9 @@ require_relative "courier/models/notification_template_create_request"
83
83
  require_relative "courier/models/notification_template_publish_request"
84
84
  require_relative "courier/models/notification_element_put_request"
85
85
  require_relative "courier/models/notification_template_update_request"
86
+ require_relative "courier/models/notifications/previews/create_preview_run_request"
86
87
  require_relative "courier/models/notification_template_payload"
88
+ require_relative "courier/models/create_device_set_request"
87
89
  require_relative "courier/models/routing_strategy_create_request"
88
90
  require_relative "courier/models/routing_strategy_replace_request"
89
91
  require_relative "courier/models/base_template_tenant_association"
@@ -174,6 +176,8 @@ require_relative "courier/models/channel_metadata"
174
176
  require_relative "courier/models/channel_preference"
175
177
  require_relative "courier/models/check"
176
178
  require_relative "courier/models/default_preferences"
179
+ require_relative "courier/models/device_set"
180
+ require_relative "courier/models/device_set_list_response"
177
181
  require_relative "courier/models/device_type"
178
182
  require_relative "courier/models/digest_category"
179
183
  require_relative "courier/models/digest_day_of_week"
@@ -334,6 +338,17 @@ require_relative "courier/models/notifications/check_list_params"
334
338
  require_relative "courier/models/notifications/check_list_response"
335
339
  require_relative "courier/models/notifications/check_update_params"
336
340
  require_relative "courier/models/notifications/check_update_response"
341
+ require_relative "courier/models/notifications/previews/preview_result"
342
+ require_relative "courier/models/notifications/previews/preview_result_failure_reason"
343
+ require_relative "courier/models/notifications/previews/preview_result_status"
344
+ require_relative "courier/models/notifications/previews/preview_run"
345
+ require_relative "courier/models/notifications/previews/preview_run_detail"
346
+ require_relative "courier/models/notifications/previews/preview_run_failure_reason"
347
+ require_relative "courier/models/notifications/previews/preview_run_list_response"
348
+ require_relative "courier/models/notifications/previews/preview_run_status"
349
+ require_relative "courier/models/notifications/previews/run_create_params"
350
+ require_relative "courier/models/notifications/previews/run_list_params"
351
+ require_relative "courier/models/notifications/previews/run_retrieve_params"
337
352
  require_relative "courier/models/notification_template_alias"
338
353
  require_relative "courier/models/notification_template_response"
339
354
  require_relative "courier/models/notification_template_state"
@@ -345,7 +360,18 @@ require_relative "courier/models/pagerduty_recipient"
345
360
  require_relative "courier/models/paging"
346
361
  require_relative "courier/models/post_tenant_template_publish_response"
347
362
  require_relative "courier/models/preference"
363
+ require_relative "courier/models/preference_change_log_entry"
364
+ require_relative "courier/models/preference_change_log_value"
365
+ require_relative "courier/models/preference_logs_list_response"
348
366
  require_relative "courier/models/preference_status"
367
+ require_relative "courier/models/preview_archive_device_set_params"
368
+ require_relative "courier/models/preview_create_device_set_params"
369
+ require_relative "courier/models/preview_device"
370
+ require_relative "courier/models/preview_device_list_response"
371
+ require_relative "courier/models/preview_list_device_sets_params"
372
+ require_relative "courier/models/preview_list_devices_params"
373
+ require_relative "courier/models/preview_retrieve_device_set_params"
374
+ require_relative "courier/models/preview_update_device_set_params"
349
375
  require_relative "courier/models/profile_create_params"
350
376
  require_relative "courier/models/profile_create_response"
351
377
  require_relative "courier/models/profile_delete_params"
@@ -474,6 +500,7 @@ require_relative "courier/models/widget_background"
474
500
  require_relative "courier/models/workspace_preference_archive_params"
475
501
  require_relative "courier/models/workspace_preference_create_params"
476
502
  require_relative "courier/models/workspace_preference_get_response"
503
+ require_relative "courier/models/workspace_preference_list_logs_params"
477
504
  require_relative "courier/models/workspace_preference_list_params"
478
505
  require_relative "courier/models/workspace_preference_list_response"
479
506
  require_relative "courier/models/workspace_preference_publish_params"
@@ -509,6 +536,9 @@ require_relative "courier/resources/lists/subscriptions"
509
536
  require_relative "courier/resources/messages"
510
537
  require_relative "courier/resources/notifications"
511
538
  require_relative "courier/resources/notifications/checks"
539
+ require_relative "courier/resources/notifications/previews"
540
+ require_relative "courier/resources/notifications/previews/runs"
541
+ require_relative "courier/resources/previews"
512
542
  require_relative "courier/resources/profiles"
513
543
  require_relative "courier/resources/profiles/lists"
514
544
  require_relative "courier/resources/providers"
@@ -53,6 +53,11 @@ module Courier
53
53
  sig { returns(Courier::Resources::Broadcasts) }
54
54
  attr_reader :broadcasts
55
55
 
56
+ # Render a template's email content on real email clients and read back the
57
+ # screenshots, so you can check how it looks before you send it.
58
+ sig { returns(Courier::Resources::Previews) }
59
+ attr_reader :previews
60
+
56
61
  sig { returns(Courier::Resources::Bulk) }
57
62
  attr_reader :bulk
58
63
 
@@ -0,0 +1,39 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class CreateDeviceSetRequest < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::CreateDeviceSetRequest, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The devices the set contains, by `PreviewDevice.id`. At least one is required.
12
+ sig { returns(T::Array[String]) }
13
+ attr_accessor :device_ids
14
+
15
+ # Human-readable name.
16
+ sig { returns(String) }
17
+ attr_accessor :name
18
+
19
+ # Request body for creating or replacing a device set. A full replace, not a patch
20
+ # — both fields are always written.
21
+ sig do
22
+ params(device_ids: T::Array[String], name: String).returns(
23
+ T.attached_class
24
+ )
25
+ end
26
+ def self.new(
27
+ # The devices the set contains, by `PreviewDevice.id`. At least one is required.
28
+ device_ids:,
29
+ # Human-readable name.
30
+ name:
31
+ )
32
+ end
33
+
34
+ sig { override.returns({ device_ids: T::Array[String], name: String }) }
35
+ def to_hash
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,81 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class DeviceSet < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias { T.any(Courier::DeviceSet, Courier::Internal::AnyHash) }
8
+
9
+ # Unique identifier for the device set.
10
+ sig { returns(String) }
11
+ attr_accessor :id
12
+
13
+ # ISO-8601 timestamp of when the set was created.
14
+ sig { returns(String) }
15
+ attr_accessor :created_at
16
+
17
+ # The devices in this set, by `PreviewDevice.id`.
18
+ sig { returns(T::Array[String]) }
19
+ attr_accessor :device_ids
20
+
21
+ # Human-readable name.
22
+ sig { returns(String) }
23
+ attr_accessor :name
24
+
25
+ # ISO-8601 timestamp of when the set was last written.
26
+ sig { returns(String) }
27
+ attr_accessor :updated_at
28
+
29
+ # ISO-8601 timestamp of when the set was archived. Present only on the archive
30
+ # response, which is the one place the state is observable.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_reader :archived_at
33
+
34
+ sig { params(archived_at: String).void }
35
+ attr_writer :archived_at
36
+
37
+ # A named, reusable list of preview devices.
38
+ sig do
39
+ params(
40
+ id: String,
41
+ created_at: String,
42
+ device_ids: T::Array[String],
43
+ name: String,
44
+ updated_at: String,
45
+ archived_at: String
46
+ ).returns(T.attached_class)
47
+ end
48
+ def self.new(
49
+ # Unique identifier for the device set.
50
+ id:,
51
+ # ISO-8601 timestamp of when the set was created.
52
+ created_at:,
53
+ # The devices in this set, by `PreviewDevice.id`.
54
+ device_ids:,
55
+ # Human-readable name.
56
+ name:,
57
+ # ISO-8601 timestamp of when the set was last written.
58
+ updated_at:,
59
+ # ISO-8601 timestamp of when the set was archived. Present only on the archive
60
+ # response, which is the one place the state is observable.
61
+ archived_at: nil
62
+ )
63
+ end
64
+
65
+ sig do
66
+ override.returns(
67
+ {
68
+ id: String,
69
+ created_at: String,
70
+ device_ids: T::Array[String],
71
+ name: String,
72
+ updated_at: String,
73
+ archived_at: String
74
+ }
75
+ )
76
+ end
77
+ def to_hash
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class DeviceSetListResponse < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::DeviceSetListResponse, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T::Array[Courier::DeviceSet]) }
12
+ attr_accessor :results
13
+
14
+ # The workspace's active device sets. Not paginated.
15
+ sig do
16
+ params(results: T::Array[Courier::DeviceSet::OrHash]).returns(
17
+ T.attached_class
18
+ )
19
+ end
20
+ def self.new(results:)
21
+ end
22
+
23
+ sig { override.returns({ results: T::Array[Courier::DeviceSet] }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end