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,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
@@ -0,0 +1,69 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ PreviewResultStatus = Previews::PreviewResultStatus
7
+
8
+ module Previews
9
+ # One device's outcome. `COMPLETED` means the screenshot exists and its URLs are
10
+ # populated. `UNSUPPORTED`, `TIMED_OUT` and `FAILED` are all terminal, and none
11
+ # stands in for another — `UNSUPPORTED` means the device was retired at the
12
+ # vendor, `TIMED_OUT` means it did not report in time.
13
+ module PreviewResultStatus
14
+ extend Courier::Internal::Type::Enum
15
+
16
+ TaggedSymbol =
17
+ T.type_alias do
18
+ T.all(
19
+ Symbol,
20
+ Courier::Notifications::Previews::PreviewResultStatus
21
+ )
22
+ end
23
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
24
+
25
+ PENDING =
26
+ T.let(
27
+ :PENDING,
28
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
29
+ )
30
+ PROCESSING =
31
+ T.let(
32
+ :PROCESSING,
33
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
34
+ )
35
+ COMPLETED =
36
+ T.let(
37
+ :COMPLETED,
38
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
39
+ )
40
+ UNSUPPORTED =
41
+ T.let(
42
+ :UNSUPPORTED,
43
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
44
+ )
45
+ TIMED_OUT =
46
+ T.let(
47
+ :TIMED_OUT,
48
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
49
+ )
50
+ FAILED =
51
+ T.let(
52
+ :FAILED,
53
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
54
+ )
55
+
56
+ sig do
57
+ override.returns(
58
+ T::Array[
59
+ Courier::Notifications::Previews::PreviewResultStatus::TaggedSymbol
60
+ ]
61
+ )
62
+ end
63
+ def self.values
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,134 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ PreviewRun = Previews::PreviewRun
7
+
8
+ module Previews
9
+ class PreviewRun < Courier::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Courier::Notifications::Previews::PreviewRun,
14
+ Courier::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Unique identifier for the preview run.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ # ISO-8601 timestamp of when the run was created.
23
+ sig { returns(String) }
24
+ attr_accessor :created_at
25
+
26
+ # The devices this run was submitted for, snapshotted when the run was created.
27
+ sig { returns(T::Array[String]) }
28
+ attr_accessor :device_ids
29
+
30
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
31
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
32
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
33
+ # failing — an individual device failing never fails the run.
34
+ sig do
35
+ returns(
36
+ Courier::Notifications::Previews::PreviewRunStatus::TaggedSymbol
37
+ )
38
+ end
39
+ attr_accessor :status
40
+
41
+ # The template that was rendered.
42
+ sig { returns(String) }
43
+ attr_accessor :template_id
44
+
45
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
46
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
47
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
48
+ # request can be fixed by choosing others.
49
+ sig do
50
+ returns(
51
+ T.nilable(
52
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
53
+ )
54
+ )
55
+ end
56
+ attr_reader :failure_reason
57
+
58
+ sig do
59
+ params(
60
+ failure_reason:
61
+ Courier::Notifications::Previews::PreviewRunFailureReason::OrSymbol
62
+ ).void
63
+ end
64
+ attr_writer :failure_reason
65
+
66
+ # The version of the template that was rendered — `draft`, or a zero-padded
67
+ # published version such as `v002`. Absent until the render settles.
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :template_version
70
+
71
+ sig { params(template_version: String).void }
72
+ attr_writer :template_version
73
+
74
+ # One render of a template across a set of devices. Billable.
75
+ sig do
76
+ params(
77
+ id: String,
78
+ created_at: String,
79
+ device_ids: T::Array[String],
80
+ status:
81
+ Courier::Notifications::Previews::PreviewRunStatus::OrSymbol,
82
+ template_id: String,
83
+ failure_reason:
84
+ Courier::Notifications::Previews::PreviewRunFailureReason::OrSymbol,
85
+ template_version: String
86
+ ).returns(T.attached_class)
87
+ end
88
+ def self.new(
89
+ # Unique identifier for the preview run.
90
+ id:,
91
+ # ISO-8601 timestamp of when the run was created.
92
+ created_at:,
93
+ # The devices this run was submitted for, snapshotted when the run was created.
94
+ device_ids:,
95
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
96
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
97
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
98
+ # failing — an individual device failing never fails the run.
99
+ status:,
100
+ # The template that was rendered.
101
+ template_id:,
102
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
103
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
104
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
105
+ # request can be fixed by choosing others.
106
+ failure_reason: nil,
107
+ # The version of the template that was rendered — `draft`, or a zero-padded
108
+ # published version such as `v002`. Absent until the render settles.
109
+ template_version: nil
110
+ )
111
+ end
112
+
113
+ sig do
114
+ override.returns(
115
+ {
116
+ id: String,
117
+ created_at: String,
118
+ device_ids: T::Array[String],
119
+ status:
120
+ Courier::Notifications::Previews::PreviewRunStatus::TaggedSymbol,
121
+ template_id: String,
122
+ failure_reason:
123
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol,
124
+ template_version: String
125
+ }
126
+ )
127
+ end
128
+ def to_hash
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,148 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ PreviewRunDetail = Previews::PreviewRunDetail
7
+
8
+ module Previews
9
+ class PreviewRunDetail < Courier::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Courier::Notifications::Previews::PreviewRunDetail,
14
+ Courier::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Unique identifier for the preview run.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ # ISO-8601 timestamp of when the run was created.
23
+ sig { returns(String) }
24
+ attr_accessor :created_at
25
+
26
+ # The devices this run was submitted for, snapshotted when the run was created.
27
+ sig { returns(T::Array[String]) }
28
+ attr_accessor :device_ids
29
+
30
+ # One entry per device in `device_ids`.
31
+ sig do
32
+ returns(T::Array[Courier::Notifications::Previews::PreviewResult])
33
+ end
34
+ attr_accessor :results
35
+
36
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
37
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
38
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
39
+ # failing — an individual device failing never fails the run.
40
+ sig do
41
+ returns(
42
+ Courier::Notifications::Previews::PreviewRunStatus::TaggedSymbol
43
+ )
44
+ end
45
+ attr_accessor :status
46
+
47
+ # The template that was rendered.
48
+ sig { returns(String) }
49
+ attr_accessor :template_id
50
+
51
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
52
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
53
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
54
+ # request can be fixed by choosing others.
55
+ sig do
56
+ returns(
57
+ T.nilable(
58
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
59
+ )
60
+ )
61
+ end
62
+ attr_reader :failure_reason
63
+
64
+ sig do
65
+ params(
66
+ failure_reason:
67
+ Courier::Notifications::Previews::PreviewRunFailureReason::OrSymbol
68
+ ).void
69
+ end
70
+ attr_writer :failure_reason
71
+
72
+ # The version of the template that was rendered — `draft`, or a zero-padded
73
+ # published version such as `v002`. Absent until the render settles.
74
+ sig { returns(T.nilable(String)) }
75
+ attr_reader :template_version
76
+
77
+ sig { params(template_version: String).void }
78
+ attr_writer :template_version
79
+
80
+ # A preview run together with its per-device results.
81
+ sig do
82
+ params(
83
+ id: String,
84
+ created_at: String,
85
+ device_ids: T::Array[String],
86
+ results:
87
+ T::Array[
88
+ Courier::Notifications::Previews::PreviewResult::OrHash
89
+ ],
90
+ status:
91
+ Courier::Notifications::Previews::PreviewRunStatus::OrSymbol,
92
+ template_id: String,
93
+ failure_reason:
94
+ Courier::Notifications::Previews::PreviewRunFailureReason::OrSymbol,
95
+ template_version: String
96
+ ).returns(T.attached_class)
97
+ end
98
+ def self.new(
99
+ # Unique identifier for the preview run.
100
+ id:,
101
+ # ISO-8601 timestamp of when the run was created.
102
+ created_at:,
103
+ # The devices this run was submitted for, snapshotted when the run was created.
104
+ device_ids:,
105
+ # One entry per device in `device_ids`.
106
+ results:,
107
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
108
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
109
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
110
+ # failing — an individual device failing never fails the run.
111
+ status:,
112
+ # The template that was rendered.
113
+ template_id:,
114
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
115
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
116
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
117
+ # request can be fixed by choosing others.
118
+ failure_reason: nil,
119
+ # The version of the template that was rendered — `draft`, or a zero-padded
120
+ # published version such as `v002`. Absent until the render settles.
121
+ template_version: nil
122
+ )
123
+ end
124
+
125
+ sig do
126
+ override.returns(
127
+ {
128
+ id: String,
129
+ created_at: String,
130
+ device_ids: T::Array[String],
131
+ results:
132
+ T::Array[Courier::Notifications::Previews::PreviewResult],
133
+ status:
134
+ Courier::Notifications::Previews::PreviewRunStatus::TaggedSymbol,
135
+ template_id: String,
136
+ failure_reason:
137
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol,
138
+ template_version: String
139
+ }
140
+ )
141
+ end
142
+ def to_hash
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ PreviewRunFailureReason = Previews::PreviewRunFailureReason
7
+
8
+ module Previews
9
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
10
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
11
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
12
+ # request can be fixed by choosing others.
13
+ module PreviewRunFailureReason
14
+ extend Courier::Internal::Type::Enum
15
+
16
+ TaggedSymbol =
17
+ T.type_alias do
18
+ T.all(
19
+ Symbol,
20
+ Courier::Notifications::Previews::PreviewRunFailureReason
21
+ )
22
+ end
23
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
24
+
25
+ TEMPLATE_NOT_SUPPORTED =
26
+ T.let(
27
+ :TEMPLATE_NOT_SUPPORTED,
28
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
29
+ )
30
+ NO_EMAIL_CHANNEL =
31
+ T.let(
32
+ :NO_EMAIL_CHANNEL,
33
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
34
+ )
35
+ RENDER_FAILED =
36
+ T.let(
37
+ :RENDER_FAILED,
38
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
39
+ )
40
+ ALL_DEVICES_UNSUPPORTED =
41
+ T.let(
42
+ :ALL_DEVICES_UNSUPPORTED,
43
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
44
+ )
45
+ VENDOR_ERROR =
46
+ T.let(
47
+ :VENDOR_ERROR,
48
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
49
+ )
50
+
51
+ sig do
52
+ override.returns(
53
+ T::Array[
54
+ Courier::Notifications::Previews::PreviewRunFailureReason::TaggedSymbol
55
+ ]
56
+ )
57
+ end
58
+ def self.values
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end