trycourier 6.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/courier/client.rb +6 -0
- data/lib/courier/models/create_device_set_request.rb +27 -0
- data/lib/courier/models/device_set.rb +63 -0
- data/lib/courier/models/device_set_list_response.rb +18 -0
- data/lib/courier/models/notifications/previews/create_preview_run_request.rb +68 -0
- data/lib/courier/models/notifications/previews/preview_result.rb +67 -0
- data/lib/courier/models/notifications/previews/preview_result_failure_reason.rb +24 -0
- data/lib/courier/models/notifications/previews/preview_result_status.rb +29 -0
- data/lib/courier/models/notifications/previews/preview_run.rb +84 -0
- data/lib/courier/models/notifications/previews/preview_run_detail.rb +93 -0
- data/lib/courier/models/notifications/previews/preview_run_failure_reason.rb +28 -0
- data/lib/courier/models/notifications/previews/preview_run_list_response.rb +30 -0
- data/lib/courier/models/notifications/previews/preview_run_status.rb +28 -0
- data/lib/courier/models/notifications/previews/run_create_params.rb +36 -0
- data/lib/courier/models/notifications/previews/run_list_params.rb +41 -0
- data/lib/courier/models/notifications/previews/run_retrieve_params.rb +30 -0
- data/lib/courier/models/preview_archive_device_set_params.rb +20 -0
- data/lib/courier/models/preview_create_device_set_params.rb +14 -0
- data/lib/courier/models/preview_device.rb +125 -0
- data/lib/courier/models/preview_device_list_response.rb +18 -0
- data/lib/courier/models/preview_list_device_sets_params.rb +14 -0
- data/lib/courier/models/preview_list_devices_params.rb +14 -0
- data/lib/courier/models/preview_retrieve_device_set_params.rb +20 -0
- data/lib/courier/models/preview_update_device_set_params.rb +20 -0
- data/lib/courier/models.rb +22 -0
- data/lib/courier/resources/notifications/previews/runs.rb +148 -0
- data/lib/courier/resources/notifications/previews.rb +22 -0
- data/lib/courier/resources/notifications.rb +4 -0
- data/lib/courier/resources/previews.rb +153 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +26 -0
- data/rbi/courier/client.rbi +5 -0
- data/rbi/courier/models/create_device_set_request.rbi +39 -0
- data/rbi/courier/models/device_set.rbi +81 -0
- data/rbi/courier/models/device_set_list_response.rbi +28 -0
- data/rbi/courier/models/notifications/previews/create_preview_run_request.rbi +110 -0
- data/rbi/courier/models/notifications/previews/preview_result.rbi +117 -0
- data/rbi/courier/models/notifications/previews/preview_result_failure_reason.rbi +44 -0
- data/rbi/courier/models/notifications/previews/preview_result_status.rbi +69 -0
- data/rbi/courier/models/notifications/previews/preview_run.rbi +134 -0
- data/rbi/courier/models/notifications/previews/preview_run_detail.rbi +148 -0
- data/rbi/courier/models/notifications/previews/preview_run_failure_reason.rbi +64 -0
- data/rbi/courier/models/notifications/previews/preview_run_list_response.rbi +54 -0
- data/rbi/courier/models/notifications/previews/preview_run_status.rbi +61 -0
- data/rbi/courier/models/notifications/previews/run_create_params.rbi +66 -0
- data/rbi/courier/models/notifications/previews/run_list_params.rbi +67 -0
- data/rbi/courier/models/notifications/previews/run_retrieve_params.rbi +50 -0
- data/rbi/courier/models/preview_archive_device_set_params.rbi +38 -0
- data/rbi/courier/models/preview_create_device_set_params.rbi +30 -0
- data/rbi/courier/models/preview_device.rbi +168 -0
- data/rbi/courier/models/preview_device_list_response.rbi +28 -0
- data/rbi/courier/models/preview_list_device_sets_params.rbi +30 -0
- data/rbi/courier/models/preview_list_devices_params.rbi +27 -0
- data/rbi/courier/models/preview_retrieve_device_set_params.rbi +38 -0
- data/rbi/courier/models/preview_update_device_set_params.rbi +38 -0
- data/rbi/courier/models.rbi +23 -0
- data/rbi/courier/resources/notifications/previews/runs.rbi +136 -0
- data/rbi/courier/resources/notifications/previews.rbi +19 -0
- data/rbi/courier/resources/notifications.rbi +3 -0
- data/rbi/courier/resources/previews.rbi +106 -0
- data/sig/courier/client.rbs +2 -0
- data/sig/courier/models/create_device_set_request.rbs +16 -0
- data/sig/courier/models/device_set.rbs +47 -0
- data/sig/courier/models/device_set_list_response.rbs +13 -0
- data/sig/courier/models/notifications/previews/create_preview_run_request.rbs +54 -0
- data/sig/courier/models/notifications/previews/preview_result.rbs +50 -0
- data/sig/courier/models/notifications/previews/preview_result_failure_reason.rbs +19 -0
- data/sig/courier/models/notifications/previews/preview_result_status.rbs +30 -0
- data/sig/courier/models/notifications/previews/preview_run.rbs +62 -0
- data/sig/courier/models/notifications/previews/preview_run_detail.rbs +67 -0
- data/sig/courier/models/notifications/previews/preview_run_failure_reason.rbs +28 -0
- data/sig/courier/models/notifications/previews/preview_run_list_response.rbs +31 -0
- data/sig/courier/models/notifications/previews/preview_run_status.rbs +24 -0
- data/sig/courier/models/notifications/previews/run_create_params.rbs +46 -0
- data/sig/courier/models/notifications/previews/run_list_params.rbs +38 -0
- data/sig/courier/models/notifications/previews/run_retrieve_params.rbs +32 -0
- data/sig/courier/models/preview_archive_device_set_params.rbs +23 -0
- data/sig/courier/models/preview_create_device_set_params.rbs +15 -0
- data/sig/courier/models/preview_device.rbs +83 -0
- data/sig/courier/models/preview_device_list_response.rbs +14 -0
- data/sig/courier/models/preview_list_device_sets_params.rbs +15 -0
- data/sig/courier/models/preview_list_devices_params.rbs +15 -0
- data/sig/courier/models/preview_retrieve_device_set_params.rbs +23 -0
- data/sig/courier/models/preview_update_device_set_params.rbs +25 -0
- data/sig/courier/models.rbs +22 -0
- data/sig/courier/resources/notifications/previews/runs.rbs +36 -0
- data/sig/courier/resources/notifications/previews.rbs +11 -0
- data/sig/courier/resources/notifications.rbs +2 -0
- data/sig/courier/resources/previews.rbs +38 -0
- metadata +79 -1
|
@@ -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
|
data/lib/courier/version.rb
CHANGED
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"
|
|
@@ -349,6 +364,14 @@ require_relative "courier/models/preference_change_log_entry"
|
|
|
349
364
|
require_relative "courier/models/preference_change_log_value"
|
|
350
365
|
require_relative "courier/models/preference_logs_list_response"
|
|
351
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"
|
|
352
375
|
require_relative "courier/models/profile_create_params"
|
|
353
376
|
require_relative "courier/models/profile_create_response"
|
|
354
377
|
require_relative "courier/models/profile_delete_params"
|
|
@@ -513,6 +536,9 @@ require_relative "courier/resources/lists/subscriptions"
|
|
|
513
536
|
require_relative "courier/resources/messages"
|
|
514
537
|
require_relative "courier/resources/notifications"
|
|
515
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"
|
|
516
542
|
require_relative "courier/resources/profiles"
|
|
517
543
|
require_relative "courier/resources/profiles/lists"
|
|
518
544
|
require_relative "courier/resources/providers"
|
data/rbi/courier/client.rbi
CHANGED
|
@@ -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
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Notifications
|
|
6
|
+
module Previews
|
|
7
|
+
class CreatePreviewRunRequest < Courier::Internal::Type::BaseModel
|
|
8
|
+
OrHash =
|
|
9
|
+
T.type_alias do
|
|
10
|
+
T.any(
|
|
11
|
+
Courier::Notifications::Previews::CreatePreviewRunRequest,
|
|
12
|
+
Courier::Internal::AnyHash
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Template variables to render with, the same shape as the `data` object on a
|
|
17
|
+
# send.
|
|
18
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
19
|
+
attr_reader :data
|
|
20
|
+
|
|
21
|
+
sig { params(data: T::Hash[Symbol, T.anything]).void }
|
|
22
|
+
attr_writer :data
|
|
23
|
+
|
|
24
|
+
# The devices to render on, by `PreviewDevice.id`, for a one-off run. Mutually
|
|
25
|
+
# exclusive with `device_set_id`.
|
|
26
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
27
|
+
attr_reader :device_ids
|
|
28
|
+
|
|
29
|
+
sig { params(device_ids: T::Array[String]).void }
|
|
30
|
+
attr_writer :device_ids
|
|
31
|
+
|
|
32
|
+
# A saved device set naming the devices to render on. Mutually exclusive with
|
|
33
|
+
# `device_ids`.
|
|
34
|
+
sig { returns(T.nilable(String)) }
|
|
35
|
+
attr_reader :device_set_id
|
|
36
|
+
|
|
37
|
+
sig { params(device_set_id: String).void }
|
|
38
|
+
attr_writer :device_set_id
|
|
39
|
+
|
|
40
|
+
# Render the template's content for this locale, e.g. "fr-FR".
|
|
41
|
+
sig { returns(T.nilable(String)) }
|
|
42
|
+
attr_reader :locale
|
|
43
|
+
|
|
44
|
+
sig { params(locale: String).void }
|
|
45
|
+
attr_writer :locale
|
|
46
|
+
|
|
47
|
+
# Which version of the template to render. Omit for the latest saved draft, which
|
|
48
|
+
# always exists and is what the editor shows. `published` renders the live
|
|
49
|
+
# version; a zero-padded `v002` renders that specific publish. Versions are
|
|
50
|
+
# 1-based, so `v000` is not a version, and the unpadded `v2` is rejected — that
|
|
51
|
+
# spelling belongs to journeys' AutomationVersionId, a different scheme in which
|
|
52
|
+
# `v0` means published.
|
|
53
|
+
sig { returns(T.nilable(String)) }
|
|
54
|
+
attr_reader :template_version
|
|
55
|
+
|
|
56
|
+
sig { params(template_version: String).void }
|
|
57
|
+
attr_writer :template_version
|
|
58
|
+
|
|
59
|
+
# Request body for creating a preview run of the template in the path. Provide
|
|
60
|
+
# exactly one of `device_set_id` or `device_ids`. The template is the path's
|
|
61
|
+
# `{id}`; a `template_id` here is an unknown key and a 400.
|
|
62
|
+
sig do
|
|
63
|
+
params(
|
|
64
|
+
data: T::Hash[Symbol, T.anything],
|
|
65
|
+
device_ids: T::Array[String],
|
|
66
|
+
device_set_id: String,
|
|
67
|
+
locale: String,
|
|
68
|
+
template_version: String
|
|
69
|
+
).returns(T.attached_class)
|
|
70
|
+
end
|
|
71
|
+
def self.new(
|
|
72
|
+
# Template variables to render with, the same shape as the `data` object on a
|
|
73
|
+
# send.
|
|
74
|
+
data: nil,
|
|
75
|
+
# The devices to render on, by `PreviewDevice.id`, for a one-off run. Mutually
|
|
76
|
+
# exclusive with `device_set_id`.
|
|
77
|
+
device_ids: nil,
|
|
78
|
+
# A saved device set naming the devices to render on. Mutually exclusive with
|
|
79
|
+
# `device_ids`.
|
|
80
|
+
device_set_id: nil,
|
|
81
|
+
# Render the template's content for this locale, e.g. "fr-FR".
|
|
82
|
+
locale: nil,
|
|
83
|
+
# Which version of the template to render. Omit for the latest saved draft, which
|
|
84
|
+
# always exists and is what the editor shows. `published` renders the live
|
|
85
|
+
# version; a zero-padded `v002` renders that specific publish. Versions are
|
|
86
|
+
# 1-based, so `v000` is not a version, and the unpadded `v2` is rejected — that
|
|
87
|
+
# spelling belongs to journeys' AutomationVersionId, a different scheme in which
|
|
88
|
+
# `v0` means published.
|
|
89
|
+
template_version: nil
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
sig do
|
|
94
|
+
override.returns(
|
|
95
|
+
{
|
|
96
|
+
data: T::Hash[Symbol, T.anything],
|
|
97
|
+
device_ids: T::Array[String],
|
|
98
|
+
device_set_id: String,
|
|
99
|
+
locale: String,
|
|
100
|
+
template_version: String
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
def to_hash
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Notifications
|
|
6
|
+
PreviewResult = Previews::PreviewResult
|
|
7
|
+
|
|
8
|
+
module Previews
|
|
9
|
+
class PreviewResult < Courier::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Courier::Notifications::Previews::PreviewResult,
|
|
14
|
+
Courier::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The device this result is for, by `PreviewDevice.id`.
|
|
19
|
+
sig { returns(String) }
|
|
20
|
+
attr_accessor :device_id
|
|
21
|
+
|
|
22
|
+
# Short-lived signed URL for the full-sized image. Null until the screenshot
|
|
23
|
+
# exists. Re-signed on every read, so fetch it rather than storing it.
|
|
24
|
+
sig { returns(T.nilable(String)) }
|
|
25
|
+
attr_accessor :screenshot_url
|
|
26
|
+
|
|
27
|
+
# One device's outcome. `COMPLETED` means the screenshot exists and its URLs are
|
|
28
|
+
# populated. `UNSUPPORTED`, `TIMED_OUT` and `FAILED` are all terminal, and none
|
|
29
|
+
# stands in for another — `UNSUPPORTED` means the device was retired at the
|
|
30
|
+
# vendor, `TIMED_OUT` means it did not report in time.
|
|
31
|
+
sig do
|
|
32
|
+
returns(
|
|
33
|
+
Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
attr_accessor :status
|
|
37
|
+
|
|
38
|
+
# Short-lived signed URL for the grid-sized image. Null until the screenshot
|
|
39
|
+
# exists. Re-signed on every read, so fetch it rather than storing it.
|
|
40
|
+
sig { returns(T.nilable(String)) }
|
|
41
|
+
attr_accessor :thumbnail_url
|
|
42
|
+
|
|
43
|
+
# Why one device's render failed, when its `status` is `FAILED` and the cause has
|
|
44
|
+
# a public name. `DELIVERY_FAILED` means the rendering service could not deliver
|
|
45
|
+
# the message to its own capture mailbox — infrastructure, not anything wrong with
|
|
46
|
+
# the template.
|
|
47
|
+
sig do
|
|
48
|
+
returns(
|
|
49
|
+
T.nilable(
|
|
50
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::TaggedSymbol
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
attr_reader :failure_reason
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
params(
|
|
58
|
+
failure_reason:
|
|
59
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::OrSymbol
|
|
60
|
+
).void
|
|
61
|
+
end
|
|
62
|
+
attr_writer :failure_reason
|
|
63
|
+
|
|
64
|
+
# One device's result within a preview run.
|
|
65
|
+
sig do
|
|
66
|
+
params(
|
|
67
|
+
device_id: String,
|
|
68
|
+
screenshot_url: T.nilable(String),
|
|
69
|
+
status:
|
|
70
|
+
Courier::Notifications::Previews::PreviewResultStatus::OrSymbol,
|
|
71
|
+
thumbnail_url: T.nilable(String),
|
|
72
|
+
failure_reason:
|
|
73
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::OrSymbol
|
|
74
|
+
).returns(T.attached_class)
|
|
75
|
+
end
|
|
76
|
+
def self.new(
|
|
77
|
+
# The device this result is for, by `PreviewDevice.id`.
|
|
78
|
+
device_id:,
|
|
79
|
+
# Short-lived signed URL for the full-sized image. Null until the screenshot
|
|
80
|
+
# exists. Re-signed on every read, so fetch it rather than storing it.
|
|
81
|
+
screenshot_url:,
|
|
82
|
+
# One device's outcome. `COMPLETED` means the screenshot exists and its URLs are
|
|
83
|
+
# populated. `UNSUPPORTED`, `TIMED_OUT` and `FAILED` are all terminal, and none
|
|
84
|
+
# stands in for another — `UNSUPPORTED` means the device was retired at the
|
|
85
|
+
# vendor, `TIMED_OUT` means it did not report in time.
|
|
86
|
+
status:,
|
|
87
|
+
# Short-lived signed URL for the grid-sized image. Null until the screenshot
|
|
88
|
+
# exists. Re-signed on every read, so fetch it rather than storing it.
|
|
89
|
+
thumbnail_url:,
|
|
90
|
+
# Why one device's render failed, when its `status` is `FAILED` and the cause has
|
|
91
|
+
# a public name. `DELIVERY_FAILED` means the rendering service could not deliver
|
|
92
|
+
# the message to its own capture mailbox — infrastructure, not anything wrong with
|
|
93
|
+
# the template.
|
|
94
|
+
failure_reason: nil
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
sig do
|
|
99
|
+
override.returns(
|
|
100
|
+
{
|
|
101
|
+
device_id: String,
|
|
102
|
+
screenshot_url: T.nilable(String),
|
|
103
|
+
status:
|
|
104
|
+
Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol,
|
|
105
|
+
thumbnail_url: T.nilable(String),
|
|
106
|
+
failure_reason:
|
|
107
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::TaggedSymbol
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
end
|
|
111
|
+
def to_hash
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
module Notifications
|
|
6
|
+
PreviewResultFailureReason = Previews::PreviewResultFailureReason
|
|
7
|
+
|
|
8
|
+
module Previews
|
|
9
|
+
# Why one device's render failed, when its `status` is `FAILED` and the cause has
|
|
10
|
+
# a public name. `DELIVERY_FAILED` means the rendering service could not deliver
|
|
11
|
+
# the message to its own capture mailbox — infrastructure, not anything wrong with
|
|
12
|
+
# the template.
|
|
13
|
+
module PreviewResultFailureReason
|
|
14
|
+
extend Courier::Internal::Type::Enum
|
|
15
|
+
|
|
16
|
+
TaggedSymbol =
|
|
17
|
+
T.type_alias do
|
|
18
|
+
T.all(
|
|
19
|
+
Symbol,
|
|
20
|
+
Courier::Notifications::Previews::PreviewResultFailureReason
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
24
|
+
|
|
25
|
+
DELIVERY_FAILED =
|
|
26
|
+
T.let(
|
|
27
|
+
:DELIVERY_FAILED,
|
|
28
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::TaggedSymbol
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
sig do
|
|
32
|
+
override.returns(
|
|
33
|
+
T::Array[
|
|
34
|
+
Courier::Notifications::Previews::PreviewResultFailureReason::TaggedSymbol
|
|
35
|
+
]
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
def self.values
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|