knockapi 1.35.0 → 1.36.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -0
  3. data/README.md +1 -1
  4. data/lib/knockapi/client.rb +17 -0
  5. data/lib/knockapi/internal/transport/base_client.rb +5 -0
  6. data/lib/knockapi/internal/util.rb +21 -5
  7. data/lib/knockapi/models/condition.rb +1 -0
  8. data/lib/knockapi/models/message.rb +33 -1
  9. data/lib/knockapi/models/message_event.rb +11 -11
  10. data/lib/knockapi/models/object_unset_preferences_params.rb +32 -0
  11. data/lib/knockapi/models/providers/ms_team_check_auth_response.rb +9 -1
  12. data/lib/knockapi/models/recipients/slack_channel_data.rb +21 -6
  13. data/lib/knockapi/models/tenant.rb +35 -1
  14. data/lib/knockapi/models/tenant_request.rb +35 -1
  15. data/lib/knockapi/models/user_unset_preferences_params.rb +26 -0
  16. data/lib/knockapi/models/users/bulk_set_preferences_params.rb +221 -4
  17. data/lib/knockapi/models/users/guide_get_channel_response.rb +9 -1
  18. data/lib/knockapi/models/workflow_cancel_params.rb +6 -6
  19. data/lib/knockapi/models/workflow_recipient_run.rb +193 -0
  20. data/lib/knockapi/models/workflow_recipient_run_detail.rb +19 -0
  21. data/lib/knockapi/models/workflow_recipient_run_event.rb +99 -0
  22. data/lib/knockapi/models/workflow_recipient_run_get_params.rb +20 -0
  23. data/lib/knockapi/models/workflow_recipient_run_list_params.rb +112 -0
  24. data/lib/knockapi/models/workflow_trigger_params.rb +42 -7
  25. data/lib/knockapi/models.rb +14 -0
  26. data/lib/knockapi/resources/objects.rb +24 -0
  27. data/lib/knockapi/resources/users/bulk.rb +4 -1
  28. data/lib/knockapi/resources/users.rb +22 -0
  29. data/lib/knockapi/resources/workflow_recipient_runs.rb +81 -0
  30. data/lib/knockapi/resources/workflows.rb +5 -3
  31. data/lib/knockapi/version.rb +1 -1
  32. data/lib/knockapi.rb +8 -0
  33. data/rbi/knockapi/client.rbi +5 -0
  34. data/rbi/knockapi/internal/util.rbi +8 -0
  35. data/rbi/knockapi/models/condition.rbi +2 -0
  36. data/rbi/knockapi/models/message.rbi +59 -0
  37. data/rbi/knockapi/models/message_event.rbi +26 -26
  38. data/rbi/knockapi/models/object_unset_preferences_params.rbi +51 -0
  39. data/rbi/knockapi/models/providers/ms_team_check_auth_response.rbi +18 -4
  40. data/rbi/knockapi/models/recipients/slack_channel_data.rbi +57 -7
  41. data/rbi/knockapi/models/tenant.rbi +36 -0
  42. data/rbi/knockapi/models/tenant_request.rbi +36 -0
  43. data/rbi/knockapi/models/user_unset_preferences_params.rbi +46 -0
  44. data/rbi/knockapi/models/users/bulk_set_preferences_params.rbi +527 -6
  45. data/rbi/knockapi/models/users/guide_get_channel_response.rbi +11 -0
  46. data/rbi/knockapi/models/workflow_cancel_params.rbi +10 -10
  47. data/rbi/knockapi/models/workflow_recipient_run.rbi +318 -0
  48. data/rbi/knockapi/models/workflow_recipient_run_detail.rbi +39 -0
  49. data/rbi/knockapi/models/workflow_recipient_run_event.rbi +137 -0
  50. data/rbi/knockapi/models/workflow_recipient_run_get_params.rbi +38 -0
  51. data/rbi/knockapi/models/workflow_recipient_run_list_params.rbi +229 -0
  52. data/rbi/knockapi/models/workflow_trigger_params.rbi +76 -10
  53. data/rbi/knockapi/models.rbi +16 -0
  54. data/rbi/knockapi/resources/objects.rbi +20 -0
  55. data/rbi/knockapi/resources/users/bulk.rbi +4 -2
  56. data/rbi/knockapi/resources/users.rbi +17 -0
  57. data/rbi/knockapi/resources/workflow_recipient_runs.rbi +79 -0
  58. data/rbi/knockapi/resources/workflows.rbi +14 -10
  59. data/sig/knockapi/client.rbs +2 -0
  60. data/sig/knockapi/internal/util.rbs +4 -0
  61. data/sig/knockapi/models/condition.rbs +2 -0
  62. data/sig/knockapi/models/message.rbs +19 -0
  63. data/sig/knockapi/models/message_event.rbs +22 -22
  64. data/sig/knockapi/models/object_unset_preferences_params.rbs +32 -0
  65. data/sig/knockapi/models/providers/ms_team_check_auth_response.rbs +15 -4
  66. data/sig/knockapi/models/recipients/slack_channel_data.rbs +21 -4
  67. data/sig/knockapi/models/tenant.rbs +20 -0
  68. data/sig/knockapi/models/tenant_request.rbs +20 -0
  69. data/sig/knockapi/models/user_unset_preferences_params.rbs +28 -0
  70. data/sig/knockapi/models/users/bulk_set_preferences_params.rbs +149 -4
  71. data/sig/knockapi/models/users/guide_get_channel_response.rbs +7 -0
  72. data/sig/knockapi/models/workflow_recipient_run.rbs +146 -0
  73. data/sig/knockapi/models/workflow_recipient_run_detail.rbs +20 -0
  74. data/sig/knockapi/models/workflow_recipient_run_event.rbs +73 -0
  75. data/sig/knockapi/models/workflow_recipient_run_get_params.rbs +20 -0
  76. data/sig/knockapi/models/workflow_recipient_run_list_params.rbs +109 -0
  77. data/sig/knockapi/models/workflow_trigger_params.rbs +17 -0
  78. data/sig/knockapi/models.rbs +14 -0
  79. data/sig/knockapi/resources/objects.rbs +7 -0
  80. data/sig/knockapi/resources/users/bulk.rbs +1 -1
  81. data/sig/knockapi/resources/users.rbs +6 -0
  82. data/sig/knockapi/resources/workflow_recipient_runs.rbs +26 -0
  83. data/sig/knockapi/resources/workflows.rbs +1 -0
  84. metadata +26 -2
@@ -9,10 +9,11 @@ module Knockapi
9
9
  include Knockapi::Internal::Type::RequestParameters
10
10
 
11
11
  # @!attribute preferences
12
- # A request to set a preference set for a recipient.
12
+ # A preference set to apply in a bulk operation. Always replaces existing
13
+ # preferences for the specified set.
13
14
  #
14
- # @return [Knockapi::Models::Recipients::PreferenceSetRequest]
15
- required :preferences, -> { Knockapi::Recipients::PreferenceSetRequest }
15
+ # @return [Knockapi::Models::Users::BulkSetPreferencesParams::Preferences]
16
+ required :preferences, -> { Knockapi::Users::BulkSetPreferencesParams::Preferences }
16
17
 
17
18
  # @!attribute user_ids
18
19
  # A list of user IDs.
@@ -21,11 +22,227 @@ module Knockapi
21
22
  required :user_ids, Knockapi::Internal::Type::ArrayOf[String]
22
23
 
23
24
  # @!method initialize(preferences:, user_ids:, request_options: {})
24
- # @param preferences [Knockapi::Models::Recipients::PreferenceSetRequest] A request to set a preference set for a recipient.
25
+ # Some parameter documentations has been truncated, see
26
+ # {Knockapi::Models::Users::BulkSetPreferencesParams} for more details.
27
+ #
28
+ # @param preferences [Knockapi::Models::Users::BulkSetPreferencesParams::Preferences] A preference set to apply in a bulk operation. Always replaces existing preferen
25
29
  #
26
30
  # @param user_ids [Array<String>] A list of user IDs.
27
31
  #
28
32
  # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]
33
+
34
+ class Preferences < Knockapi::Internal::Type::BaseModel
35
+ # @!attribute id
36
+ # Identifier for the preference set to update. Can be `default` or a tenant ID.
37
+ #
38
+ # @return [String, nil]
39
+ optional :id, String
40
+
41
+ # @!attribute categories
42
+ # An object where the key is the category and the values are the preference
43
+ # settings for that category.
44
+ #
45
+ # @return [Hash{Symbol=>Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Category::PreferenceSetWorkflowCategorySettingObject}, nil]
46
+ optional :categories,
47
+ -> {
48
+ Knockapi::Internal::Type::HashOf[union: Knockapi::Users::BulkSetPreferencesParams::Preferences::Category]
49
+ },
50
+ nil?: true
51
+
52
+ # @!attribute channel_types
53
+ # Channel type preferences.
54
+ #
55
+ # @return [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil]
56
+ optional :channel_types, -> { Knockapi::Recipients::PreferenceSetChannelTypes }, nil?: true
57
+
58
+ # @!attribute channels
59
+ # Channel preferences.
60
+ #
61
+ # @return [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil]
62
+ optional :channels,
63
+ -> {
64
+ Knockapi::Internal::Type::HashOf[union: Knockapi::Users::BulkSetPreferencesParams::Preferences::Channel]
65
+ },
66
+ nil?: true
67
+
68
+ # @!attribute commercial_subscribed
69
+ # Whether the recipient is subscribed to commercial communications. When false,
70
+ # the recipient will not receive commercial workflow notifications.
71
+ #
72
+ # @return [Boolean, nil]
73
+ optional :commercial_subscribed, Knockapi::Internal::Type::Boolean, nil?: true
74
+
75
+ # @!attribute workflows
76
+ # An object where the key is the workflow key and the values are the preference
77
+ # settings for that workflow.
78
+ #
79
+ # @return [Hash{Symbol=>Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Workflow::PreferenceSetWorkflowCategorySettingObject}, nil]
80
+ optional :workflows,
81
+ -> {
82
+ Knockapi::Internal::Type::HashOf[union: Knockapi::Users::BulkSetPreferencesParams::Preferences::Workflow]
83
+ },
84
+ nil?: true
85
+
86
+ # @!method initialize(id: nil, categories: nil, channel_types: nil, channels: nil, commercial_subscribed: nil, workflows: nil)
87
+ # Some parameter documentations has been truncated, see
88
+ # {Knockapi::Models::Users::BulkSetPreferencesParams::Preferences} for more
89
+ # details.
90
+ #
91
+ # A preference set to apply in a bulk operation. Always replaces existing
92
+ # preferences for the specified set.
93
+ #
94
+ # @param id [String] Identifier for the preference set to update. Can be `default` or a tenant ID.
95
+ #
96
+ # @param categories [Hash{Symbol=>Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Category::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the category and the values are the preference settin
97
+ #
98
+ # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
99
+ #
100
+ # @param channels [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil] Channel preferences.
101
+ #
102
+ # @param commercial_subscribed [Boolean, nil] Whether the recipient is subscribed to commercial communications. When false, th
103
+ #
104
+ # @param workflows [Hash{Symbol=>Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Workflow::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the workflow key and the values are the preference se
105
+
106
+ # Workflow or category preferences within a preference set
107
+ module Category
108
+ extend Knockapi::Internal::Type::Union
109
+
110
+ variant Knockapi::Internal::Type::Boolean
111
+
112
+ # The settings object for a workflow or category, where you can specify channel types or conditions.
113
+ variant -> { Knockapi::Users::BulkSetPreferencesParams::Preferences::Category::PreferenceSetWorkflowCategorySettingObject }
114
+
115
+ class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
116
+ # @!attribute channel_types
117
+ # Channel type preferences.
118
+ #
119
+ # @return [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil]
120
+ optional :channel_types, -> { Knockapi::Recipients::PreferenceSetChannelTypes }, nil?: true
121
+
122
+ # @!attribute channels
123
+ # Channel preferences.
124
+ #
125
+ # @return [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil]
126
+ optional :channels,
127
+ -> do
128
+ Knockapi::Internal::Type::HashOf[
129
+ union: Knockapi::Users::BulkSetPreferencesParams::Preferences::Category::PreferenceSetWorkflowCategorySettingObject::Channel
130
+ ]
131
+ end,
132
+ nil?: true
133
+
134
+ # @!attribute conditions
135
+ # A list of conditions to apply to a channel type.
136
+ #
137
+ # @return [Array<Knockapi::Models::Condition>, nil]
138
+ optional :conditions, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::Condition] }, nil?: true
139
+
140
+ # @!method initialize(channel_types: nil, channels: nil, conditions: nil)
141
+ # The settings object for a workflow or category, where you can specify channel
142
+ # types or conditions.
143
+ #
144
+ # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
145
+ #
146
+ # @param channels [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil] Channel preferences.
147
+ #
148
+ # @param conditions [Array<Knockapi::Models::Condition>, nil] A list of conditions to apply to a channel type.
149
+
150
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
151
+ # or a settings object with conditions.
152
+ module Channel
153
+ extend Knockapi::Internal::Type::Union
154
+
155
+ variant Knockapi::Internal::Type::Boolean
156
+
157
+ # A set of settings for a specific channel. Currently, this can only be a list of conditions to apply.
158
+ variant -> { Knockapi::Recipients::PreferenceSetChannelSetting }
159
+
160
+ # @!method self.variants
161
+ # @return [Array(Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting)]
162
+ end
163
+ end
164
+
165
+ # @!method self.variants
166
+ # @return [Array(Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Category::PreferenceSetWorkflowCategorySettingObject)]
167
+ end
168
+
169
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
170
+ # or a settings object with conditions.
171
+ module Channel
172
+ extend Knockapi::Internal::Type::Union
173
+
174
+ variant Knockapi::Internal::Type::Boolean
175
+
176
+ # A set of settings for a specific channel. Currently, this can only be a list of conditions to apply.
177
+ variant -> { Knockapi::Recipients::PreferenceSetChannelSetting }
178
+
179
+ # @!method self.variants
180
+ # @return [Array(Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting)]
181
+ end
182
+
183
+ # Workflow or category preferences within a preference set
184
+ module Workflow
185
+ extend Knockapi::Internal::Type::Union
186
+
187
+ variant Knockapi::Internal::Type::Boolean
188
+
189
+ # The settings object for a workflow or category, where you can specify channel types or conditions.
190
+ variant -> { Knockapi::Users::BulkSetPreferencesParams::Preferences::Workflow::PreferenceSetWorkflowCategorySettingObject }
191
+
192
+ class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
193
+ # @!attribute channel_types
194
+ # Channel type preferences.
195
+ #
196
+ # @return [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil]
197
+ optional :channel_types, -> { Knockapi::Recipients::PreferenceSetChannelTypes }, nil?: true
198
+
199
+ # @!attribute channels
200
+ # Channel preferences.
201
+ #
202
+ # @return [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil]
203
+ optional :channels,
204
+ -> do
205
+ Knockapi::Internal::Type::HashOf[
206
+ union: Knockapi::Users::BulkSetPreferencesParams::Preferences::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel
207
+ ]
208
+ end,
209
+ nil?: true
210
+
211
+ # @!attribute conditions
212
+ # A list of conditions to apply to a channel type.
213
+ #
214
+ # @return [Array<Knockapi::Models::Condition>, nil]
215
+ optional :conditions, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::Condition] }, nil?: true
216
+
217
+ # @!method initialize(channel_types: nil, channels: nil, conditions: nil)
218
+ # The settings object for a workflow or category, where you can specify channel
219
+ # types or conditions.
220
+ #
221
+ # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
222
+ #
223
+ # @param channels [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting}, nil] Channel preferences.
224
+ #
225
+ # @param conditions [Array<Knockapi::Models::Condition>, nil] A list of conditions to apply to a channel type.
226
+
227
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
228
+ # or a settings object with conditions.
229
+ module Channel
230
+ extend Knockapi::Internal::Type::Union
231
+
232
+ variant Knockapi::Internal::Type::Boolean
233
+
234
+ # A set of settings for a specific channel. Currently, this can only be a list of conditions to apply.
235
+ variant -> { Knockapi::Recipients::PreferenceSetChannelSetting }
236
+
237
+ # @!method self.variants
238
+ # @return [Array(Boolean, Knockapi::Models::Recipients::PreferenceSetChannelSetting)]
239
+ end
240
+ end
241
+
242
+ # @!method self.variants
243
+ # @return [Array(Boolean, Knockapi::Models::Users::BulkSetPreferencesParams::Preferences::Workflow::PreferenceSetWorkflowCategorySettingObject)]
244
+ end
245
+ end
29
246
  end
30
247
  end
31
248
  end
@@ -88,6 +88,12 @@ module Knockapi
88
88
  # @return [String, nil]
89
89
  optional :channel_id, String
90
90
 
91
+ # @!attribute dashboard_url
92
+ # URL to this guide in the Knock dashboard
93
+ #
94
+ # @return [String, nil]
95
+ optional :dashboard_url, String
96
+
91
97
  # @!attribute inserted_at
92
98
  #
93
99
  # @return [Time, nil]
@@ -121,7 +127,7 @@ module Knockapi
121
127
  # @return [Time, nil]
122
128
  optional :updated_at, Time
123
129
 
124
- # @!method initialize(id: nil, _typename: nil, activation_url_patterns: nil, activation_url_rules: nil, active: nil, bypass_global_group_limit: nil, channel_id: nil, inserted_at: nil, key: nil, semver: nil, steps: nil, type: nil, updated_at: nil)
130
+ # @!method initialize(id: nil, _typename: nil, activation_url_patterns: nil, activation_url_rules: nil, active: nil, bypass_global_group_limit: nil, channel_id: nil, dashboard_url: nil, inserted_at: nil, key: nil, semver: nil, steps: nil, type: nil, updated_at: nil)
125
131
  # Some parameter documentations has been truncated, see
126
132
  # {Knockapi::Models::Users::GuideGetChannelResponse::Entry} for more details.
127
133
  #
@@ -139,6 +145,8 @@ module Knockapi
139
145
  #
140
146
  # @param channel_id [String]
141
147
  #
148
+ # @param dashboard_url [String] URL to this guide in the Knock dashboard
149
+ #
142
150
  # @param inserted_at [Time]
143
151
  #
144
152
  # @param key [String] The key of the guide.
@@ -13,11 +13,11 @@ module Knockapi
13
13
  required :key, String
14
14
 
15
15
  # @!attribute cancellation_key
16
- # An optional key that is used to reference a specific workflow trigger request
17
- # when issuing a [workflow cancellation](/send-notifications/canceling-workflows)
18
- # request. Must be provided while triggering a workflow in order to enable
19
- # subsequent cancellation. Should be unique across trigger requests to avoid
20
- # unintentional cancellations.
16
+ # A key that is used to reference a specific workflow trigger request when issuing
17
+ # a [workflow cancellation](/send-notifications/canceling-workflows) request. Must
18
+ # be provided while triggering a workflow in order to enable subsequent
19
+ # cancellation. Should be unique across trigger requests to avoid unintentional
20
+ # cancellations.
21
21
  #
22
22
  # @return [String]
23
23
  required :cancellation_key, String
@@ -37,7 +37,7 @@ module Knockapi
37
37
  #
38
38
  # @param key [String]
39
39
  #
40
- # @param cancellation_key [String] An optional key that is used to reference a specific workflow trigger request wh
40
+ # @param cancellation_key [String] A key that is used to reference a specific workflow trigger request when issuing
41
41
  #
42
42
  # @param recipients [Array<String, Knockapi::Models::RecipientReference::ObjectReference>, nil] A list of recipients to cancel the notification for. If omitted, cancels for all
43
43
  #
@@ -0,0 +1,193 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Models
5
+ # @see Knockapi::Resources::WorkflowRecipientRuns#list
6
+ class WorkflowRecipientRun < Knockapi::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # The unique identifier for the workflow recipient run (per-recipient).
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute _typename
14
+ # The typename of the schema.
15
+ #
16
+ # @return [String]
17
+ required :_typename, String, api_name: :__typename
18
+
19
+ # @!attribute inserted_at
20
+ # Timestamp when the resource was created.
21
+ #
22
+ # @return [Time]
23
+ required :inserted_at, Time
24
+
25
+ # @!attribute recipient
26
+ # A reference to a recipient, either a user identifier (string) or an object
27
+ # reference (ID, collection).
28
+ #
29
+ # @return [String, Knockapi::Models::RecipientReference::ObjectReference]
30
+ required :recipient, union: -> { Knockapi::RecipientReference }
31
+
32
+ # @!attribute status
33
+ # The current status of the workflow recipient run. One of `queued`, `processing`,
34
+ # `paused`, `completed`, or `cancelled`.
35
+ #
36
+ # @return [Symbol, Knockapi::Models::WorkflowRecipientRun::Status]
37
+ required :status, enum: -> { Knockapi::WorkflowRecipientRun::Status }
38
+
39
+ # @!attribute trigger_source
40
+ # Describes how the workflow was triggered.
41
+ #
42
+ # @return [Knockapi::Models::WorkflowRecipientRun::TriggerSource]
43
+ required :trigger_source, -> { Knockapi::WorkflowRecipientRun::TriggerSource }
44
+
45
+ # @!attribute updated_at
46
+ # The timestamp when the resource was last updated.
47
+ #
48
+ # @return [Time]
49
+ required :updated_at, Time
50
+
51
+ # @!attribute workflow
52
+ # The key of the workflow that was executed.
53
+ #
54
+ # @return [String]
55
+ required :workflow, String
56
+
57
+ # @!attribute workflow_run_id
58
+ # The identifier for the top-level workflow run shared across all recipients in a
59
+ # single trigger.
60
+ #
61
+ # @return [String]
62
+ required :workflow_run_id, String
63
+
64
+ # @!attribute actor
65
+ # A reference to a recipient, either a user identifier (string) or an object
66
+ # reference (ID, collection).
67
+ #
68
+ # @return [String, Knockapi::Models::RecipientReference::ObjectReference, nil]
69
+ optional :actor, union: -> { Knockapi::RecipientReference }, nil?: true
70
+
71
+ # @!attribute error_count
72
+ # The number of errors encountered during the workflow recipient run.
73
+ #
74
+ # @return [Integer, nil]
75
+ optional :error_count, Integer
76
+
77
+ # @!attribute tenant
78
+ # The tenant associated with the workflow recipient run.
79
+ #
80
+ # @return [String, nil]
81
+ optional :tenant, String, nil?: true
82
+
83
+ # @!method initialize(id:, _typename:, inserted_at:, recipient:, status:, trigger_source:, updated_at:, workflow:, workflow_run_id:, actor: nil, error_count: nil, tenant: nil)
84
+ # Some parameter documentations has been truncated, see
85
+ # {Knockapi::Models::WorkflowRecipientRun} for more details.
86
+ #
87
+ # A workflow recipient run represents an individual execution of a workflow for a
88
+ # specific recipient.
89
+ #
90
+ # @param id [String] The unique identifier for the workflow recipient run (per-recipient).
91
+ #
92
+ # @param _typename [String] The typename of the schema.
93
+ #
94
+ # @param inserted_at [Time] Timestamp when the resource was created.
95
+ #
96
+ # @param recipient [String, Knockapi::Models::RecipientReference::ObjectReference] A reference to a recipient, either a user identifier (string) or an object refer
97
+ #
98
+ # @param status [Symbol, Knockapi::Models::WorkflowRecipientRun::Status] The current status of the workflow recipient run. One of `queued`, `processing`,
99
+ #
100
+ # @param trigger_source [Knockapi::Models::WorkflowRecipientRun::TriggerSource] Describes how the workflow was triggered.
101
+ #
102
+ # @param updated_at [Time] The timestamp when the resource was last updated.
103
+ #
104
+ # @param workflow [String] The key of the workflow that was executed.
105
+ #
106
+ # @param workflow_run_id [String] The identifier for the top-level workflow run shared across all recipients in a
107
+ #
108
+ # @param actor [String, Knockapi::Models::RecipientReference::ObjectReference, nil] A reference to a recipient, either a user identifier (string) or an object refer
109
+ #
110
+ # @param error_count [Integer] The number of errors encountered during the workflow recipient run.
111
+ #
112
+ # @param tenant [String, nil] The tenant associated with the workflow recipient run.
113
+
114
+ # The current status of the workflow recipient run. One of `queued`, `processing`,
115
+ # `paused`, `completed`, or `cancelled`.
116
+ #
117
+ # @see Knockapi::Models::WorkflowRecipientRun#status
118
+ module Status
119
+ extend Knockapi::Internal::Type::Enum
120
+
121
+ QUEUED = :queued
122
+ PROCESSING = :processing
123
+ PAUSED = :paused
124
+ COMPLETED = :completed
125
+ CANCELLED = :cancelled
126
+
127
+ # @!method self.values
128
+ # @return [Array<Symbol>]
129
+ end
130
+
131
+ # @see Knockapi::Models::WorkflowRecipientRun#trigger_source
132
+ class TriggerSource < Knockapi::Internal::Type::BaseModel
133
+ # @!attribute type
134
+ # The type of trigger source. One of `api`, `audience`, `schedule`, `broadcast`,
135
+ # `workflow_step`, `integration`, or `rehearsal`.
136
+ #
137
+ # @return [Symbol, Knockapi::Models::WorkflowRecipientRun::TriggerSource::Type]
138
+ required :type, enum: -> { Knockapi::WorkflowRecipientRun::TriggerSource::Type }
139
+
140
+ # @!attribute audience_key
141
+ # The key of the audience that triggered the workflow.
142
+ #
143
+ # @return [String, nil]
144
+ optional :audience_key, String, nil?: true
145
+
146
+ # @!attribute cancellation_key
147
+ # The cancellation key provided when the workflow was triggered via the API.
148
+ #
149
+ # @return [String, nil]
150
+ optional :cancellation_key, String, nil?: true
151
+
152
+ # @!attribute schedule_id
153
+ # The ID of the schedule that triggered the workflow.
154
+ #
155
+ # @return [String, nil]
156
+ optional :schedule_id, String, nil?: true
157
+
158
+ # @!method initialize(type:, audience_key: nil, cancellation_key: nil, schedule_id: nil)
159
+ # Some parameter documentations has been truncated, see
160
+ # {Knockapi::Models::WorkflowRecipientRun::TriggerSource} for more details.
161
+ #
162
+ # Describes how the workflow was triggered.
163
+ #
164
+ # @param type [Symbol, Knockapi::Models::WorkflowRecipientRun::TriggerSource::Type] The type of trigger source. One of `api`, `audience`, `schedule`, `broadcast`, `
165
+ #
166
+ # @param audience_key [String, nil] The key of the audience that triggered the workflow.
167
+ #
168
+ # @param cancellation_key [String, nil] The cancellation key provided when the workflow was triggered via the API.
169
+ #
170
+ # @param schedule_id [String, nil] The ID of the schedule that triggered the workflow.
171
+
172
+ # The type of trigger source. One of `api`, `audience`, `schedule`, `broadcast`,
173
+ # `workflow_step`, `integration`, or `rehearsal`.
174
+ #
175
+ # @see Knockapi::Models::WorkflowRecipientRun::TriggerSource#type
176
+ module Type
177
+ extend Knockapi::Internal::Type::Enum
178
+
179
+ API = :api
180
+ AUDIENCE = :audience
181
+ SCHEDULE = :schedule
182
+ BROADCAST = :broadcast
183
+ WORKFLOW_STEP = :workflow_step
184
+ INTEGRATION = :integration
185
+ REHEARSAL = :rehearsal
186
+
187
+ # @!method self.values
188
+ # @return [Array<Symbol>]
189
+ end
190
+ end
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Models
5
+ # @see Knockapi::Resources::WorkflowRecipientRuns#get
6
+ class WorkflowRecipientRunDetail < Knockapi::Models::WorkflowRecipientRun
7
+ # @!attribute events
8
+ # A list of events that occurred during the workflow recipient run.
9
+ #
10
+ # @return [Array<Knockapi::Models::WorkflowRecipientRunEvent>]
11
+ required :events, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::WorkflowRecipientRunEvent] }
12
+
13
+ # @!method initialize(events:)
14
+ # A single workflow recipient run with its events.
15
+ #
16
+ # @param events [Array<Knockapi::Models::WorkflowRecipientRunEvent>] A list of events that occurred during the workflow recipient run.
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Models
5
+ class WorkflowRecipientRunEvent < Knockapi::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ # The unique identifier for the event.
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute _typename
13
+ # The typename of the schema.
14
+ #
15
+ # @return [String]
16
+ required :_typename, String, api_name: :__typename
17
+
18
+ # @!attribute event
19
+ # The type of event that occurred.
20
+ #
21
+ # @return [String]
22
+ required :event, String
23
+
24
+ # @!attribute inserted_at
25
+ # Timestamp when the resource was created.
26
+ #
27
+ # @return [Time]
28
+ required :inserted_at, Time
29
+
30
+ # @!attribute status
31
+ # Whether the event represents a successful or error state.
32
+ #
33
+ # @return [Symbol, Knockapi::Models::WorkflowRecipientRunEvent::Status]
34
+ required :status, enum: -> { Knockapi::WorkflowRecipientRunEvent::Status }
35
+
36
+ # @!attribute attempt
37
+ # The attempt number of the workflow recipient run event. Increments for each
38
+ # retry.
39
+ #
40
+ # @return [Integer, nil]
41
+ optional :attempt, Integer
42
+
43
+ # @!attribute data
44
+ # Event-specific data associated with the event.
45
+ #
46
+ # @return [Hash{Symbol=>Object}, nil]
47
+ optional :data, Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown], nil?: true
48
+
49
+ # @!attribute step_ref
50
+ # The reference of the workflow step associated with this event.
51
+ #
52
+ # @return [String, nil]
53
+ optional :step_ref, String, nil?: true
54
+
55
+ # @!attribute step_type
56
+ # The type of workflow step associated with this event.
57
+ #
58
+ # @return [String, nil]
59
+ optional :step_type, String, nil?: true
60
+
61
+ # @!method initialize(id:, _typename:, event:, inserted_at:, status:, attempt: nil, data: nil, step_ref: nil, step_type: nil)
62
+ # Some parameter documentations has been truncated, see
63
+ # {Knockapi::Models::WorkflowRecipientRunEvent} for more details.
64
+ #
65
+ # An event that occurred during a workflow recipient run.
66
+ #
67
+ # @param id [String] The unique identifier for the event.
68
+ #
69
+ # @param _typename [String] The typename of the schema.
70
+ #
71
+ # @param event [String] The type of event that occurred.
72
+ #
73
+ # @param inserted_at [Time] Timestamp when the resource was created.
74
+ #
75
+ # @param status [Symbol, Knockapi::Models::WorkflowRecipientRunEvent::Status] Whether the event represents a successful or error state.
76
+ #
77
+ # @param attempt [Integer] The attempt number of the workflow recipient run event. Increments for each retr
78
+ #
79
+ # @param data [Hash{Symbol=>Object}, nil] Event-specific data associated with the event.
80
+ #
81
+ # @param step_ref [String, nil] The reference of the workflow step associated with this event.
82
+ #
83
+ # @param step_type [String, nil] The type of workflow step associated with this event.
84
+
85
+ # Whether the event represents a successful or error state.
86
+ #
87
+ # @see Knockapi::Models::WorkflowRecipientRunEvent#status
88
+ module Status
89
+ extend Knockapi::Internal::Type::Enum
90
+
91
+ OK = :ok
92
+ ERROR = :error
93
+
94
+ # @!method self.values
95
+ # @return [Array<Symbol>]
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Models
5
+ # @see Knockapi::Resources::WorkflowRecipientRuns#get
6
+ class WorkflowRecipientRunGetParams < Knockapi::Internal::Type::BaseModel
7
+ extend Knockapi::Internal::Type::RequestParameters::Converter
8
+ include Knockapi::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!method initialize(id:, request_options: {})
16
+ # @param id [String]
17
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end