trycourier 6.10.0 → 6.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) 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/preview_archive_device_set_params.rb +20 -0
  21. data/lib/courier/models/preview_create_device_set_params.rb +14 -0
  22. data/lib/courier/models/preview_device.rb +125 -0
  23. data/lib/courier/models/preview_device_list_response.rb +18 -0
  24. data/lib/courier/models/preview_list_device_sets_params.rb +14 -0
  25. data/lib/courier/models/preview_list_devices_params.rb +14 -0
  26. data/lib/courier/models/preview_retrieve_device_set_params.rb +20 -0
  27. data/lib/courier/models/preview_update_device_set_params.rb +20 -0
  28. data/lib/courier/models.rb +22 -0
  29. data/lib/courier/resources/notifications/previews/runs.rb +148 -0
  30. data/lib/courier/resources/notifications/previews.rb +22 -0
  31. data/lib/courier/resources/notifications.rb +4 -0
  32. data/lib/courier/resources/previews.rb +153 -0
  33. data/lib/courier/version.rb +1 -1
  34. data/lib/courier.rb +26 -0
  35. data/rbi/courier/client.rbi +5 -0
  36. data/rbi/courier/models/create_device_set_request.rbi +39 -0
  37. data/rbi/courier/models/device_set.rbi +81 -0
  38. data/rbi/courier/models/device_set_list_response.rbi +28 -0
  39. data/rbi/courier/models/notifications/previews/create_preview_run_request.rbi +110 -0
  40. data/rbi/courier/models/notifications/previews/preview_result.rbi +117 -0
  41. data/rbi/courier/models/notifications/previews/preview_result_failure_reason.rbi +44 -0
  42. data/rbi/courier/models/notifications/previews/preview_result_status.rbi +69 -0
  43. data/rbi/courier/models/notifications/previews/preview_run.rbi +134 -0
  44. data/rbi/courier/models/notifications/previews/preview_run_detail.rbi +148 -0
  45. data/rbi/courier/models/notifications/previews/preview_run_failure_reason.rbi +64 -0
  46. data/rbi/courier/models/notifications/previews/preview_run_list_response.rbi +54 -0
  47. data/rbi/courier/models/notifications/previews/preview_run_status.rbi +61 -0
  48. data/rbi/courier/models/notifications/previews/run_create_params.rbi +66 -0
  49. data/rbi/courier/models/notifications/previews/run_list_params.rbi +67 -0
  50. data/rbi/courier/models/notifications/previews/run_retrieve_params.rbi +50 -0
  51. data/rbi/courier/models/preview_archive_device_set_params.rbi +38 -0
  52. data/rbi/courier/models/preview_create_device_set_params.rbi +30 -0
  53. data/rbi/courier/models/preview_device.rbi +168 -0
  54. data/rbi/courier/models/preview_device_list_response.rbi +28 -0
  55. data/rbi/courier/models/preview_list_device_sets_params.rbi +30 -0
  56. data/rbi/courier/models/preview_list_devices_params.rbi +27 -0
  57. data/rbi/courier/models/preview_retrieve_device_set_params.rbi +38 -0
  58. data/rbi/courier/models/preview_update_device_set_params.rbi +38 -0
  59. data/rbi/courier/models.rbi +23 -0
  60. data/rbi/courier/resources/notifications/previews/runs.rbi +136 -0
  61. data/rbi/courier/resources/notifications/previews.rbi +19 -0
  62. data/rbi/courier/resources/notifications.rbi +3 -0
  63. data/rbi/courier/resources/previews.rbi +106 -0
  64. data/sig/courier/client.rbs +2 -0
  65. data/sig/courier/models/create_device_set_request.rbs +16 -0
  66. data/sig/courier/models/device_set.rbs +47 -0
  67. data/sig/courier/models/device_set_list_response.rbs +13 -0
  68. data/sig/courier/models/notifications/previews/create_preview_run_request.rbs +54 -0
  69. data/sig/courier/models/notifications/previews/preview_result.rbs +50 -0
  70. data/sig/courier/models/notifications/previews/preview_result_failure_reason.rbs +19 -0
  71. data/sig/courier/models/notifications/previews/preview_result_status.rbs +30 -0
  72. data/sig/courier/models/notifications/previews/preview_run.rbs +62 -0
  73. data/sig/courier/models/notifications/previews/preview_run_detail.rbs +67 -0
  74. data/sig/courier/models/notifications/previews/preview_run_failure_reason.rbs +28 -0
  75. data/sig/courier/models/notifications/previews/preview_run_list_response.rbs +31 -0
  76. data/sig/courier/models/notifications/previews/preview_run_status.rbs +24 -0
  77. data/sig/courier/models/notifications/previews/run_create_params.rbs +46 -0
  78. data/sig/courier/models/notifications/previews/run_list_params.rbs +38 -0
  79. data/sig/courier/models/notifications/previews/run_retrieve_params.rbs +32 -0
  80. data/sig/courier/models/preview_archive_device_set_params.rbs +23 -0
  81. data/sig/courier/models/preview_create_device_set_params.rbs +15 -0
  82. data/sig/courier/models/preview_device.rbs +83 -0
  83. data/sig/courier/models/preview_device_list_response.rbs +14 -0
  84. data/sig/courier/models/preview_list_device_sets_params.rbs +15 -0
  85. data/sig/courier/models/preview_list_devices_params.rbs +15 -0
  86. data/sig/courier/models/preview_retrieve_device_set_params.rbs +23 -0
  87. data/sig/courier/models/preview_update_device_set_params.rbs +25 -0
  88. data/sig/courier/models.rbs +22 -0
  89. data/sig/courier/resources/notifications/previews/runs.rbs +36 -0
  90. data/sig/courier/resources/notifications/previews.rbs +11 -0
  91. data/sig/courier/resources/notifications.rbs +2 -0
  92. data/sig/courier/resources/previews.rbs +38 -0
  93. metadata +79 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bab9f203d342c48548c1f0e174e23733585494b0b3b8369d2ccedab9fbbaf34
4
- data.tar.gz: 86a57ea48f82c3e4f7da5536bd4c2a3b80c07dfb9178ccdc8d36da6ef74c74ad
3
+ metadata.gz: 8355e7fd1f1c9e1ed9f2aafab8f6dbce8c8081f7e9b62ff4f43f7a218d8eb9d5
4
+ data.tar.gz: d678747f0d3d4b4107f5be81fb7dc138f7711a88eed4f37591b8e938743cf2a4
5
5
  SHA512:
6
- metadata.gz: 94fb163ff7c2e6cd81eb20e028fbbf5a0cedc2f3eb299864a3c7f19c6c2d838f329dcf329b02438318bc1ab20cba5d56604377f2e359d54d298c620ac0384340
7
- data.tar.gz: e7f0b03ecf872ddf5bc0b38a28fbd0c1bd169241e31c9729c623f1b1e7f42b58155d1ec30e3ddf60ae93aa9fb9a40337403b7f7bc581f0852a3f11cd844b5d54
6
+ metadata.gz: c190958991c41ffe7905492408eac10b80f5e237eec79efa599489176942a068be1b4de41d28ab04cdd32637d4fc5513a3bd1c9f86f1f7118295706b93c1fd89
7
+ data.tar.gz: 3f561d73086f92e6452f3d8eb632aa60f2c1158952e2aab5008440864c5cf7f82a2f188fa4218c9ae4bc071aa6663b732e42fc90d5e549b6b27944b076237a93
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.11.1](https://github.com/trycourier/courier-ruby/compare/v6.11.0...v6.11.1) (2026-09-24)
4
+
5
+
6
+ ### Documentation
7
+
8
+ * **api:** use OpenAPI 3.0 example on the preview schemas ([#167](https://github.com/trycourier/courier-ruby/issues/167)) ([1dc8ecf](https://github.com/trycourier/courier-ruby/commit/1dc8ecf475c40ea3147b52e79204b516795a092d))
9
+
10
+ ## [6.11.0](https://github.com/trycourier/courier-ruby/compare/v6.10.0...v6.11.0) (2026-09-24)
11
+
12
+
13
+ ### Features
14
+
15
+ * **api:** cross-client previews endpoints ([#165](https://github.com/trycourier/courier-ruby/issues/165)) ([0701a83](https://github.com/trycourier/courier-ruby/commit/0701a833e9b5d80ea39c8f701ae2d66b8453c165))
16
+
3
17
  ## [6.10.0](https://github.com/trycourier/courier-ruby/compare/v6.9.0...v6.10.0) (2026-09-24)
4
18
 
5
19
 
data/README.md CHANGED
@@ -9,7 +9,7 @@ Add the gem to your `Gemfile`:
9
9
  <!-- x-release-please-start-version -->
10
10
 
11
11
  ```ruby
12
- gem "trycourier", "~> 6.10.0"
12
+ gem "trycourier", "~> 6.11.1"
13
13
  ```
14
14
 
15
15
  <!-- x-release-please-end -->
@@ -58,6 +58,11 @@ module Courier
58
58
  # @return [Courier::Resources::Broadcasts]
59
59
  attr_reader :broadcasts
60
60
 
61
+ # Render a template's email content on real email clients and read back the
62
+ # screenshots, so you can check how it looks before you send it.
63
+ # @return [Courier::Resources::Previews]
64
+ attr_reader :previews
65
+
61
66
  # @return [Courier::Resources::Bulk]
62
67
  attr_reader :bulk
63
68
 
@@ -190,6 +195,7 @@ module Courier
190
195
  @automations = Courier::Resources::Automations.new(client: self)
191
196
  @journeys = Courier::Resources::Journeys.new(client: self)
192
197
  @broadcasts = Courier::Resources::Broadcasts.new(client: self)
198
+ @previews = Courier::Resources::Previews.new(client: self)
193
199
  @bulk = Courier::Resources::Bulk.new(client: self)
194
200
  @brands = Courier::Resources::Brands.new(client: self)
195
201
  @digests = Courier::Resources::Digests.new(client: self)
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class CreateDeviceSetRequest < Courier::Internal::Type::BaseModel
6
+ # @!attribute device_ids
7
+ # The devices the set contains, by `PreviewDevice.id`. At least one is required.
8
+ #
9
+ # @return [Array<String>]
10
+ required :device_ids, Courier::Internal::Type::ArrayOf[String]
11
+
12
+ # @!attribute name
13
+ # Human-readable name.
14
+ #
15
+ # @return [String]
16
+ required :name, String
17
+
18
+ # @!method initialize(device_ids:, name:)
19
+ # Request body for creating or replacing a device set. A full replace, not a patch
20
+ # — both fields are always written.
21
+ #
22
+ # @param device_ids [Array<String>] The devices the set contains, by `PreviewDevice.id`. At least one is required.
23
+ #
24
+ # @param name [String] Human-readable name.
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Previews#archive_device_set
6
+ class DeviceSet < Courier::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Unique identifier for the device set.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute created_at
14
+ # ISO-8601 timestamp of when the set was created.
15
+ #
16
+ # @return [String]
17
+ required :created_at, String
18
+
19
+ # @!attribute device_ids
20
+ # The devices in this set, by `PreviewDevice.id`.
21
+ #
22
+ # @return [Array<String>]
23
+ required :device_ids, Courier::Internal::Type::ArrayOf[String]
24
+
25
+ # @!attribute name
26
+ # Human-readable name.
27
+ #
28
+ # @return [String]
29
+ required :name, String
30
+
31
+ # @!attribute updated_at
32
+ # ISO-8601 timestamp of when the set was last written.
33
+ #
34
+ # @return [String]
35
+ required :updated_at, String
36
+
37
+ # @!attribute archived_at
38
+ # ISO-8601 timestamp of when the set was archived. Present only on the archive
39
+ # response, which is the one place the state is observable.
40
+ #
41
+ # @return [String, nil]
42
+ optional :archived_at, String
43
+
44
+ # @!method initialize(id:, created_at:, device_ids:, name:, updated_at:, archived_at: nil)
45
+ # Some parameter documentations has been truncated, see
46
+ # {Courier::Models::DeviceSet} for more details.
47
+ #
48
+ # A named, reusable list of preview devices.
49
+ #
50
+ # @param id [String] Unique identifier for the device set.
51
+ #
52
+ # @param created_at [String] ISO-8601 timestamp of when the set was created.
53
+ #
54
+ # @param device_ids [Array<String>] The devices in this set, by `PreviewDevice.id`.
55
+ #
56
+ # @param name [String] Human-readable name.
57
+ #
58
+ # @param updated_at [String] ISO-8601 timestamp of when the set was last written.
59
+ #
60
+ # @param archived_at [String] ISO-8601 timestamp of when the set was archived. Present only on the archive res
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ # @see Courier::Resources::Previews#list_device_sets
6
+ class DeviceSetListResponse < Courier::Internal::Type::BaseModel
7
+ # @!attribute results
8
+ #
9
+ # @return [Array<Courier::Models::DeviceSet>]
10
+ required :results, -> { Courier::Internal::Type::ArrayOf[Courier::DeviceSet] }
11
+
12
+ # @!method initialize(results:)
13
+ # The workspace's active device sets. Not paginated.
14
+ #
15
+ # @param results [Array<Courier::Models::DeviceSet>]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ class CreatePreviewRunRequest < Courier::Internal::Type::BaseModel
8
+ # @!attribute data
9
+ # Template variables to render with, the same shape as the `data` object on a
10
+ # send.
11
+ #
12
+ # @return [Hash{Symbol=>Object}, nil]
13
+ optional :data, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown]
14
+
15
+ # @!attribute device_ids
16
+ # The devices to render on, by `PreviewDevice.id`, for a one-off run. Mutually
17
+ # exclusive with `device_set_id`.
18
+ #
19
+ # @return [Array<String>, nil]
20
+ optional :device_ids, Courier::Internal::Type::ArrayOf[String]
21
+
22
+ # @!attribute device_set_id
23
+ # A saved device set naming the devices to render on. Mutually exclusive with
24
+ # `device_ids`.
25
+ #
26
+ # @return [String, nil]
27
+ optional :device_set_id, String
28
+
29
+ # @!attribute locale
30
+ # Render the template's content for this locale, e.g. "fr-FR".
31
+ #
32
+ # @return [String, nil]
33
+ optional :locale, String
34
+
35
+ # @!attribute template_version
36
+ # Which version of the template to render. Omit for the latest saved draft, which
37
+ # always exists and is what the editor shows. `published` renders the live
38
+ # version; a zero-padded `v002` renders that specific publish. Versions are
39
+ # 1-based, so `v000` is not a version, and the unpadded `v2` is rejected — that
40
+ # spelling belongs to journeys' AutomationVersionId, a different scheme in which
41
+ # `v0` means published.
42
+ #
43
+ # @return [String, nil]
44
+ optional :template_version, String
45
+
46
+ # @!method initialize(data: nil, device_ids: nil, device_set_id: nil, locale: nil, template_version: nil)
47
+ # Some parameter documentations has been truncated, see
48
+ # {Courier::Models::Notifications::Previews::CreatePreviewRunRequest} for more
49
+ # details.
50
+ #
51
+ # Request body for creating a preview run of the template in the path. Provide
52
+ # exactly one of `device_set_id` or `device_ids`. The template is the path's
53
+ # `{id}`; a `template_id` here is an unknown key and a 400.
54
+ #
55
+ # @param data [Hash{Symbol=>Object}] Template variables to render with, the same shape as the `data` object on a send
56
+ #
57
+ # @param device_ids [Array<String>] The devices to render on, by `PreviewDevice.id`, for a one-off run. Mutually exc
58
+ #
59
+ # @param device_set_id [String] A saved device set naming the devices to render on. Mutually exclusive with `dev
60
+ #
61
+ # @param locale [String] Render the template's content for this locale, e.g. "fr-FR".
62
+ #
63
+ # @param template_version [String] Which version of the template to render. Omit for the latest saved draft, which
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ class PreviewResult < Courier::Internal::Type::BaseModel
8
+ # @!attribute device_id
9
+ # The device this result is for, by `PreviewDevice.id`.
10
+ #
11
+ # @return [String]
12
+ required :device_id, String
13
+
14
+ # @!attribute screenshot_url
15
+ # Short-lived signed URL for the full-sized image. Null until the screenshot
16
+ # exists. Re-signed on every read, so fetch it rather than storing it.
17
+ #
18
+ # @return [String, nil]
19
+ required :screenshot_url, String, nil?: true
20
+
21
+ # @!attribute status
22
+ # One device's outcome. `COMPLETED` means the screenshot exists and its URLs are
23
+ # populated. `UNSUPPORTED`, `TIMED_OUT` and `FAILED` are all terminal, and none
24
+ # stands in for another — `UNSUPPORTED` means the device was retired at the
25
+ # vendor, `TIMED_OUT` means it did not report in time.
26
+ #
27
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewResultStatus]
28
+ required :status, enum: -> { Courier::Notifications::Previews::PreviewResultStatus }
29
+
30
+ # @!attribute thumbnail_url
31
+ # Short-lived signed URL for the grid-sized image. Null until the screenshot
32
+ # exists. Re-signed on every read, so fetch it rather than storing it.
33
+ #
34
+ # @return [String, nil]
35
+ required :thumbnail_url, String, nil?: true
36
+
37
+ # @!attribute failure_reason
38
+ # Why one device's render failed, when its `status` is `FAILED` and the cause has
39
+ # a public name. `DELIVERY_FAILED` means the rendering service could not deliver
40
+ # the message to its own capture mailbox — infrastructure, not anything wrong with
41
+ # the template.
42
+ #
43
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewResultFailureReason, nil]
44
+ optional :failure_reason, enum: -> { Courier::Notifications::Previews::PreviewResultFailureReason }
45
+
46
+ # @!method initialize(device_id:, screenshot_url:, status:, thumbnail_url:, failure_reason: nil)
47
+ # Some parameter documentations has been truncated, see
48
+ # {Courier::Models::Notifications::Previews::PreviewResult} for more details.
49
+ #
50
+ # One device's result within a preview run.
51
+ #
52
+ # @param device_id [String] The device this result is for, by `PreviewDevice.id`.
53
+ #
54
+ # @param screenshot_url [String, nil] Short-lived signed URL for the full-sized image. Null until the screenshot exist
55
+ #
56
+ # @param status [Symbol, Courier::Models::Notifications::Previews::PreviewResultStatus] One device's outcome. `COMPLETED` means the screenshot exists and its URLs are p
57
+ #
58
+ # @param thumbnail_url [String, nil] Short-lived signed URL for the grid-sized image. Null until the screenshot exist
59
+ #
60
+ # @param failure_reason [Symbol, Courier::Models::Notifications::Previews::PreviewResultFailureReason] Why one device's render failed, when its `status` is `FAILED` and the cause has
61
+ end
62
+ end
63
+
64
+ PreviewResult = Previews::PreviewResult
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # Why one device's render failed, when its `status` is `FAILED` and the cause has
8
+ # a public name. `DELIVERY_FAILED` means the rendering service could not deliver
9
+ # the message to its own capture mailbox — infrastructure, not anything wrong with
10
+ # the template.
11
+ module PreviewResultFailureReason
12
+ extend Courier::Internal::Type::Enum
13
+
14
+ DELIVERY_FAILED = :DELIVERY_FAILED
15
+
16
+ # @!method self.values
17
+ # @return [Array<Symbol>]
18
+ end
19
+ end
20
+
21
+ PreviewResultFailureReason = Previews::PreviewResultFailureReason
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # One device's outcome. `COMPLETED` means the screenshot exists and its URLs are
8
+ # populated. `UNSUPPORTED`, `TIMED_OUT` and `FAILED` are all terminal, and none
9
+ # stands in for another — `UNSUPPORTED` means the device was retired at the
10
+ # vendor, `TIMED_OUT` means it did not report in time.
11
+ module PreviewResultStatus
12
+ extend Courier::Internal::Type::Enum
13
+
14
+ PENDING = :PENDING
15
+ PROCESSING = :PROCESSING
16
+ COMPLETED = :COMPLETED
17
+ UNSUPPORTED = :UNSUPPORTED
18
+ TIMED_OUT = :TIMED_OUT
19
+ FAILED = :FAILED
20
+
21
+ # @!method self.values
22
+ # @return [Array<Symbol>]
23
+ end
24
+ end
25
+
26
+ PreviewResultStatus = Previews::PreviewResultStatus
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # @see Courier::Resources::Notifications::Previews::Runs#create
8
+ class PreviewRun < Courier::Internal::Type::BaseModel
9
+ # @!attribute id
10
+ # Unique identifier for the preview run.
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!attribute created_at
16
+ # ISO-8601 timestamp of when the run was created.
17
+ #
18
+ # @return [String]
19
+ required :created_at, String
20
+
21
+ # @!attribute device_ids
22
+ # The devices this run was submitted for, snapshotted when the run was created.
23
+ #
24
+ # @return [Array<String>]
25
+ required :device_ids, Courier::Internal::Type::ArrayOf[String]
26
+
27
+ # @!attribute status
28
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
29
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
30
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
31
+ # failing — an individual device failing never fails the run.
32
+ #
33
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewRunStatus]
34
+ required :status, enum: -> { Courier::Notifications::Previews::PreviewRunStatus }
35
+
36
+ # @!attribute template_id
37
+ # The template that was rendered.
38
+ #
39
+ # @return [String]
40
+ required :template_id, String
41
+
42
+ # @!attribute failure_reason
43
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
44
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
45
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
46
+ # request can be fixed by choosing others.
47
+ #
48
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewRunFailureReason, nil]
49
+ optional :failure_reason, enum: -> { Courier::Notifications::Previews::PreviewRunFailureReason }
50
+
51
+ # @!attribute template_version
52
+ # The version of the template that was rendered — `draft`, or a zero-padded
53
+ # published version such as `v002`. Absent until the render settles.
54
+ #
55
+ # @return [String, nil]
56
+ optional :template_version, String
57
+
58
+ # @!method initialize(id:, created_at:, device_ids:, status:, template_id:, failure_reason: nil, template_version: nil)
59
+ # Some parameter documentations has been truncated, see
60
+ # {Courier::Models::Notifications::Previews::PreviewRun} for more details.
61
+ #
62
+ # One render of a template across a set of devices. Billable.
63
+ #
64
+ # @param id [String] Unique identifier for the preview run.
65
+ #
66
+ # @param created_at [String] ISO-8601 timestamp of when the run was created.
67
+ #
68
+ # @param device_ids [Array<String>] The devices this run was submitted for, snapshotted when the run was created.
69
+ #
70
+ # @param status [Symbol, Courier::Models::Notifications::Previews::PreviewRunStatus] Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
71
+ #
72
+ # @param template_id [String] The template that was rendered.
73
+ #
74
+ # @param failure_reason [Symbol, Courier::Models::Notifications::Previews::PreviewRunFailureReason] Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
75
+ # `TEMPLATE\_
76
+ #
77
+ # @param template_version [String] The version of the template that was rendered — `draft`, or a zero-padded publis
78
+ end
79
+ end
80
+
81
+ PreviewRun = Previews::PreviewRun
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # @see Courier::Resources::Notifications::Previews::Runs#retrieve
8
+ class PreviewRunDetail < Courier::Internal::Type::BaseModel
9
+ # @!attribute id
10
+ # Unique identifier for the preview run.
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!attribute created_at
16
+ # ISO-8601 timestamp of when the run was created.
17
+ #
18
+ # @return [String]
19
+ required :created_at, String
20
+
21
+ # @!attribute device_ids
22
+ # The devices this run was submitted for, snapshotted when the run was created.
23
+ #
24
+ # @return [Array<String>]
25
+ required :device_ids, Courier::Internal::Type::ArrayOf[String]
26
+
27
+ # @!attribute results
28
+ # One entry per device in `device_ids`.
29
+ #
30
+ # @return [Array<Courier::Models::Notifications::Previews::PreviewResult>]
31
+ required :results,
32
+ -> { Courier::Internal::Type::ArrayOf[Courier::Notifications::Previews::PreviewResult] }
33
+
34
+ # @!attribute status
35
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
36
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
37
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
38
+ # failing — an individual device failing never fails the run.
39
+ #
40
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewRunStatus]
41
+ required :status, enum: -> { Courier::Notifications::Previews::PreviewRunStatus }
42
+
43
+ # @!attribute template_id
44
+ # The template that was rendered.
45
+ #
46
+ # @return [String]
47
+ required :template_id, String
48
+
49
+ # @!attribute failure_reason
50
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
51
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
52
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
53
+ # request can be fixed by choosing others.
54
+ #
55
+ # @return [Symbol, Courier::Models::Notifications::Previews::PreviewRunFailureReason, nil]
56
+ optional :failure_reason, enum: -> { Courier::Notifications::Previews::PreviewRunFailureReason }
57
+
58
+ # @!attribute template_version
59
+ # The version of the template that was rendered — `draft`, or a zero-padded
60
+ # published version such as `v002`. Absent until the render settles.
61
+ #
62
+ # @return [String, nil]
63
+ optional :template_version, String
64
+
65
+ # @!method initialize(id:, created_at:, device_ids:, results:, status:, template_id:, failure_reason: nil, template_version: nil)
66
+ # Some parameter documentations has been truncated, see
67
+ # {Courier::Models::Notifications::Previews::PreviewRunDetail} for more details.
68
+ #
69
+ # A preview run together with its per-device results.
70
+ #
71
+ # @param id [String] Unique identifier for the preview run.
72
+ #
73
+ # @param created_at [String] ISO-8601 timestamp of when the run was created.
74
+ #
75
+ # @param device_ids [Array<String>] The devices this run was submitted for, snapshotted when the run was created.
76
+ #
77
+ # @param results [Array<Courier::Models::Notifications::Previews::PreviewResult>] One entry per device in `device_ids`.
78
+ #
79
+ # @param status [Symbol, Courier::Models::Notifications::Previews::PreviewRunStatus] Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
80
+ #
81
+ # @param template_id [String] The template that was rendered.
82
+ #
83
+ # @param failure_reason [Symbol, Courier::Models::Notifications::Previews::PreviewRunFailureReason] Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
84
+ # `TEMPLATE\_
85
+ #
86
+ # @param template_version [String] The version of the template that was rendered — `draft`, or a zero-padded publis
87
+ end
88
+ end
89
+
90
+ PreviewRunDetail = Previews::PreviewRunDetail
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # Why the run failed, when `status` is `FAILED`. `NO_EMAIL_CHANNEL` and
8
+ # `TEMPLATE_NOT_SUPPORTED` mean there was nothing to render;
9
+ # `ALL_DEVICES_UNSUPPORTED` means every requested device has been retired and the
10
+ # request can be fixed by choosing others.
11
+ module PreviewRunFailureReason
12
+ extend Courier::Internal::Type::Enum
13
+
14
+ TEMPLATE_NOT_SUPPORTED = :TEMPLATE_NOT_SUPPORTED
15
+ NO_EMAIL_CHANNEL = :NO_EMAIL_CHANNEL
16
+ RENDER_FAILED = :RENDER_FAILED
17
+ ALL_DEVICES_UNSUPPORTED = :ALL_DEVICES_UNSUPPORTED
18
+ VENDOR_ERROR = :VENDOR_ERROR
19
+
20
+ # @!method self.values
21
+ # @return [Array<Symbol>]
22
+ end
23
+ end
24
+
25
+ PreviewRunFailureReason = Previews::PreviewRunFailureReason
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # @see Courier::Resources::Notifications::Previews::Runs#list
8
+ class PreviewRunListResponse < Courier::Internal::Type::BaseModel
9
+ # @!attribute paging
10
+ #
11
+ # @return [Courier::Models::Paging]
12
+ required :paging, -> { Courier::Paging }
13
+
14
+ # @!attribute results
15
+ #
16
+ # @return [Array<Courier::Models::Notifications::Previews::PreviewRun>]
17
+ required :results, -> { Courier::Internal::Type::ArrayOf[Courier::Notifications::Previews::PreviewRun] }
18
+
19
+ # @!method initialize(paging:, results:)
20
+ # Paginated list of preview runs, newest first.
21
+ #
22
+ # @param paging [Courier::Models::Paging]
23
+ # @param results [Array<Courier::Models::Notifications::Previews::PreviewRun>]
24
+ end
25
+ end
26
+
27
+ PreviewRunListResponse = Previews::PreviewRunListResponse
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # Where the run itself has got to. `PENDING` and `RENDERED` mean Courier is still
8
+ # preparing the email, `SUBMITTED` means it is with the rendering service, and
9
+ # `COMPLETED` means every device has reported. `FAILED` is the run as a whole
10
+ # failing — an individual device failing never fails the run.
11
+ module PreviewRunStatus
12
+ extend Courier::Internal::Type::Enum
13
+
14
+ PENDING = :PENDING
15
+ RENDERED = :RENDERED
16
+ SUBMITTED = :SUBMITTED
17
+ COMPLETED = :COMPLETED
18
+ FAILED = :FAILED
19
+
20
+ # @!method self.values
21
+ # @return [Array<Symbol>]
22
+ end
23
+ end
24
+
25
+ PreviewRunStatus = Previews::PreviewRunStatus
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ module Notifications
6
+ module Previews
7
+ # @see Courier::Resources::Notifications::Previews::Runs#create
8
+ class RunCreateParams < Courier::Models::Notifications::Previews::CreatePreviewRunRequest
9
+ extend Courier::Internal::Type::RequestParameters::Converter
10
+ include Courier::Internal::Type::RequestParameters
11
+
12
+ # @!attribute id
13
+ #
14
+ # @return [String]
15
+ required :id, String
16
+
17
+ # @!attribute idempotency_key
18
+ #
19
+ # @return [String, nil]
20
+ optional :idempotency_key, String
21
+
22
+ # @!attribute x_idempotency_expiration
23
+ #
24
+ # @return [String, nil]
25
+ optional :x_idempotency_expiration, String
26
+
27
+ # @!method initialize(id:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
28
+ # @param id [String]
29
+ # @param idempotency_key [String]
30
+ # @param x_idempotency_expiration [String]
31
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end