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
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Models
5
+ # @see Knockapi::Resources::WorkflowRecipientRuns#list
6
+ class WorkflowRecipientRunListParams < Knockapi::Internal::Type::BaseModel
7
+ extend Knockapi::Internal::Type::RequestParameters::Converter
8
+ include Knockapi::Internal::Type::RequestParameters
9
+
10
+ # @!attribute after
11
+ # The cursor to fetch entries after.
12
+ #
13
+ # @return [String, nil]
14
+ optional :after, String
15
+
16
+ # @!attribute before
17
+ # The cursor to fetch entries before.
18
+ #
19
+ # @return [String, nil]
20
+ optional :before, String
21
+
22
+ # @!attribute ending_at
23
+ # Limits the results to workflow recipient runs started before the given date.
24
+ #
25
+ # @return [Time, nil]
26
+ optional :ending_at, Time
27
+
28
+ # @!attribute has_errors
29
+ # Limits the results to workflow recipient runs that have errors.
30
+ #
31
+ # @return [Boolean, nil]
32
+ optional :has_errors, Knockapi::Internal::Type::Boolean
33
+
34
+ # @!attribute page_size
35
+ # The number of items per page (defaults to 50).
36
+ #
37
+ # @return [Integer, nil]
38
+ optional :page_size, Integer
39
+
40
+ # @!attribute recipient
41
+ # Limits the results to workflow recipient runs for the given recipient. Accepts a
42
+ # user ID string or an object reference with `id` and `collection`.
43
+ #
44
+ # @return [String, Knockapi::Models::RecipientReference::ObjectReference, nil]
45
+ optional :recipient, union: -> { Knockapi::RecipientReference }
46
+
47
+ # @!attribute starting_at
48
+ # Limits the results to workflow recipient runs started after the given date.
49
+ #
50
+ # @return [Time, nil]
51
+ optional :starting_at, Time
52
+
53
+ # @!attribute status
54
+ # Limits the results to workflow recipient runs with the given status.
55
+ #
56
+ # @return [Array<Symbol, Knockapi::Models::WorkflowRecipientRunListParams::Status>, nil]
57
+ optional :status,
58
+ -> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::WorkflowRecipientRunListParams::Status] }
59
+
60
+ # @!attribute tenant
61
+ # Limits the results to workflow recipient runs for the given tenant.
62
+ #
63
+ # @return [String, nil]
64
+ optional :tenant, String
65
+
66
+ # @!attribute workflow
67
+ # Limits the results to workflow recipient runs for the given workflow key.
68
+ #
69
+ # @return [String, nil]
70
+ optional :workflow, String
71
+
72
+ # @!method initialize(after: nil, before: nil, ending_at: nil, has_errors: nil, page_size: nil, recipient: nil, starting_at: nil, status: nil, tenant: nil, workflow: nil, request_options: {})
73
+ # Some parameter documentations has been truncated, see
74
+ # {Knockapi::Models::WorkflowRecipientRunListParams} for more details.
75
+ #
76
+ # @param after [String] The cursor to fetch entries after.
77
+ #
78
+ # @param before [String] The cursor to fetch entries before.
79
+ #
80
+ # @param ending_at [Time] Limits the results to workflow recipient runs started before the given date.
81
+ #
82
+ # @param has_errors [Boolean] Limits the results to workflow recipient runs that have errors.
83
+ #
84
+ # @param page_size [Integer] The number of items per page (defaults to 50).
85
+ #
86
+ # @param recipient [String, Knockapi::Models::RecipientReference::ObjectReference] Limits the results to workflow recipient runs for the given recipient. Accepts a
87
+ #
88
+ # @param starting_at [Time] Limits the results to workflow recipient runs started after the given date.
89
+ #
90
+ # @param status [Array<Symbol, Knockapi::Models::WorkflowRecipientRunListParams::Status>] Limits the results to workflow recipient runs with the given status.
91
+ #
92
+ # @param tenant [String] Limits the results to workflow recipient runs for the given tenant.
93
+ #
94
+ # @param workflow [String] Limits the results to workflow recipient runs for the given workflow key.
95
+ #
96
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]
97
+
98
+ module Status
99
+ extend Knockapi::Internal::Type::Enum
100
+
101
+ QUEUED = :queued
102
+ PROCESSING = :processing
103
+ PAUSED = :paused
104
+ COMPLETED = :completed
105
+ CANCELLED = :cancelled
106
+
107
+ # @!method self.values
108
+ # @return [Array<Symbol>]
109
+ end
110
+ end
111
+ end
112
+ end
@@ -28,11 +28,11 @@ module Knockapi
28
28
  optional :actor, union: -> { Knockapi::RecipientRequest }, nil?: true
29
29
 
30
30
  # @!attribute cancellation_key
31
- # An optional key that is used to reference a specific workflow trigger request
32
- # when issuing a [workflow cancellation](/send-notifications/canceling-workflows)
33
- # request. Must be provided while triggering a workflow in order to enable
34
- # subsequent cancellation. Should be unique across trigger requests to avoid
35
- # unintentional cancellations.
31
+ # A key that is used to reference a specific workflow trigger request when issuing
32
+ # a [workflow cancellation](/send-notifications/canceling-workflows) request. Must
33
+ # be provided while triggering a workflow in order to enable subsequent
34
+ # cancellation. Should be unique across trigger requests to avoid unintentional
35
+ # cancellations.
36
36
  #
37
37
  # @return [String, nil]
38
38
  optional :cancellation_key, String, nil?: true
@@ -46,13 +46,19 @@ module Knockapi
46
46
  # @return [Hash{Symbol=>Object}, nil]
47
47
  optional :data, Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown], nil?: true
48
48
 
49
+ # @!attribute settings
50
+ # Optional settings that control how this workflow trigger is executed.
51
+ #
52
+ # @return [Knockapi::Models::WorkflowTriggerParams::Settings, nil]
53
+ optional :settings, -> { Knockapi::WorkflowTriggerParams::Settings }, nil?: true
54
+
49
55
  # @!attribute tenant
50
56
  # An request to set a tenant inline.
51
57
  #
52
58
  # @return [String, Knockapi::Models::TenantRequest, nil]
53
59
  optional :tenant, union: -> { Knockapi::InlineTenantRequest }, nil?: true
54
60
 
55
- # @!method initialize(key:, recipients:, actor: nil, cancellation_key: nil, data: nil, tenant: nil, request_options: {})
61
+ # @!method initialize(key:, recipients:, actor: nil, cancellation_key: nil, data: nil, settings: nil, tenant: nil, request_options: {})
56
62
  # Some parameter documentations has been truncated, see
57
63
  # {Knockapi::Models::WorkflowTriggerParams} for more details.
58
64
  #
@@ -62,13 +68,42 @@ module Knockapi
62
68
  #
63
69
  # @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
64
70
  #
65
- # @param cancellation_key [String, nil] An optional key that is used to reference a specific workflow trigger request wh
71
+ # @param cancellation_key [String, nil] A key that is used to reference a specific workflow trigger request when issuing
66
72
  #
67
73
  # @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 10MB lim
68
74
  #
75
+ # @param settings [Knockapi::Models::WorkflowTriggerParams::Settings, nil] Optional settings that control how this workflow trigger is executed.
76
+ #
69
77
  # @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
70
78
  #
71
79
  # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]
80
+
81
+ class Settings < Knockapi::Internal::Type::BaseModel
82
+ # @!attribute sandbox_mode
83
+ # When set to true, overrides the sandbox mode for all channels in this workflow
84
+ # run, messages are not delivered to the underlying providers. If false or not
85
+ # set, the workflow delivers messages normally.
86
+ #
87
+ # @return [Boolean, nil]
88
+ optional :sandbox_mode, Knockapi::Internal::Type::Boolean, nil?: true
89
+
90
+ # @!attribute skip_delay
91
+ # When set to true, skips all delay steps in the workflow for this trigger
92
+ # request. If false or not set, delay steps execute normally.
93
+ #
94
+ # @return [Boolean, nil]
95
+ optional :skip_delay, Knockapi::Internal::Type::Boolean, nil?: true
96
+
97
+ # @!method initialize(sandbox_mode: nil, skip_delay: nil)
98
+ # Some parameter documentations has been truncated, see
99
+ # {Knockapi::Models::WorkflowTriggerParams::Settings} for more details.
100
+ #
101
+ # Optional settings that control how this workflow trigger is executed.
102
+ #
103
+ # @param sandbox_mode [Boolean, nil] When set to true, overrides the sandbox mode for all channels in this workflow r
104
+ #
105
+ # @param skip_delay [Boolean, nil] When set to true, skips all delay steps in the workflow for this trigger request
106
+ end
72
107
  end
73
108
  end
74
109
  end
@@ -135,6 +135,8 @@ module Knockapi
135
135
 
136
136
  ObjectUnsetChannelDataParams = Knockapi::Models::ObjectUnsetChannelDataParams
137
137
 
138
+ ObjectUnsetPreferencesParams = Knockapi::Models::ObjectUnsetPreferencesParams
139
+
138
140
  PageInfo = Knockapi::Models::PageInfo
139
141
 
140
142
  Providers = Knockapi::Models::Providers
@@ -205,9 +207,21 @@ module Knockapi
205
207
 
206
208
  UserUnsetChannelDataParams = Knockapi::Models::UserUnsetChannelDataParams
207
209
 
210
+ UserUnsetPreferencesParams = Knockapi::Models::UserUnsetPreferencesParams
211
+
208
212
  UserUpdateParams = Knockapi::Models::UserUpdateParams
209
213
 
210
214
  WorkflowCancelParams = Knockapi::Models::WorkflowCancelParams
211
215
 
216
+ WorkflowRecipientRun = Knockapi::Models::WorkflowRecipientRun
217
+
218
+ WorkflowRecipientRunDetail = Knockapi::Models::WorkflowRecipientRunDetail
219
+
220
+ WorkflowRecipientRunEvent = Knockapi::Models::WorkflowRecipientRunEvent
221
+
222
+ WorkflowRecipientRunGetParams = Knockapi::Models::WorkflowRecipientRunGetParams
223
+
224
+ WorkflowRecipientRunListParams = Knockapi::Models::WorkflowRecipientRunListParams
225
+
212
226
  WorkflowTriggerParams = Knockapi::Models::WorkflowTriggerParams
213
227
  end
@@ -503,6 +503,30 @@ module Knockapi
503
503
  )
504
504
  end
505
505
 
506
+ # Unsets the preference set for the object, removing it entirely.
507
+ #
508
+ # @overload unset_preferences(collection, object_id_, id, request_options: {})
509
+ #
510
+ # @param collection [String] The collection this object belongs to.
511
+ #
512
+ # @param object_id_ [String] Unique identifier for the object.
513
+ #
514
+ # @param id [String] Unique identifier for the preference set.
515
+ #
516
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
517
+ #
518
+ # @return [nil]
519
+ #
520
+ # @see Knockapi::Models::ObjectUnsetPreferencesParams
521
+ def unset_preferences(collection, object_id_, id, params = {})
522
+ @client.request(
523
+ method: :delete,
524
+ path: ["v1/objects/%1$s/%2$s/preferences/%3$s", collection, object_id_, id],
525
+ model: NilClass,
526
+ options: params[:request_options]
527
+ )
528
+ end
529
+
506
530
  # @api private
507
531
  #
508
532
  # @param client [Knockapi::Client]
@@ -52,6 +52,9 @@ module Knockapi
52
52
  )
53
53
  end
54
54
 
55
+ # Some parameter documentations has been truncated, see
56
+ # {Knockapi::Models::Users::BulkSetPreferencesParams} for more details.
57
+ #
55
58
  # Bulk sets the preferences for up to 1,000 users at a time. The preference
56
59
  # set `:id` can be either `default` or a `tenant.id`. Learn more
57
60
  # about [per-tenant preferences](/preferences/tenant-preferences). Note that this
@@ -60,7 +63,7 @@ module Knockapi
60
63
  #
61
64
  # @overload set_preferences(preferences:, user_ids:, request_options: {})
62
65
  #
63
- # @param preferences [Knockapi::Models::Recipients::PreferenceSetRequest] A request to set a preference set for a recipient.
66
+ # @param preferences [Knockapi::Models::Users::BulkSetPreferencesParams::Preferences] A preference set to apply in a bulk operation. Always replaces existing preferen
64
67
  #
65
68
  # @param user_ids [Array<String>] A list of user IDs.
66
69
  #
@@ -449,6 +449,28 @@ module Knockapi
449
449
  )
450
450
  end
451
451
 
452
+ # Unsets the preference set for the user, removing it entirely.
453
+ #
454
+ # @overload unset_preferences(user_id, id, request_options: {})
455
+ #
456
+ # @param user_id [String] The unique identifier of the user.
457
+ #
458
+ # @param id [String] Unique identifier for the preference set.
459
+ #
460
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
461
+ #
462
+ # @return [nil]
463
+ #
464
+ # @see Knockapi::Models::UserUnsetPreferencesParams
465
+ def unset_preferences(user_id, id, params = {})
466
+ @client.request(
467
+ method: :delete,
468
+ path: ["v1/users/%1$s/preferences/%2$s", user_id, id],
469
+ model: NilClass,
470
+ options: params[:request_options]
471
+ )
472
+ end
473
+
452
474
  # @api private
453
475
  #
454
476
  # @param client [Knockapi::Client]
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Knockapi
4
+ module Resources
5
+ # A workflow run represents an individual execution of a workflow for a specific
6
+ # recipient.
7
+ class WorkflowRecipientRuns
8
+ # Some parameter documentations has been truncated, see
9
+ # {Knockapi::Models::WorkflowRecipientRunListParams} for more details.
10
+ #
11
+ # Returns a paginated list of workflow recipient runs for the current environment.
12
+ #
13
+ # @overload list(after: nil, before: nil, ending_at: nil, has_errors: nil, page_size: nil, recipient: nil, starting_at: nil, status: nil, tenant: nil, workflow: nil, request_options: {})
14
+ #
15
+ # @param after [String] The cursor to fetch entries after.
16
+ #
17
+ # @param before [String] The cursor to fetch entries before.
18
+ #
19
+ # @param ending_at [Time] Limits the results to workflow recipient runs started before the given date.
20
+ #
21
+ # @param has_errors [Boolean] Limits the results to workflow recipient runs that have errors.
22
+ #
23
+ # @param page_size [Integer] The number of items per page (defaults to 50).
24
+ #
25
+ # @param recipient [String, Knockapi::Models::RecipientReference::ObjectReference] Limits the results to workflow recipient runs for the given recipient. Accepts a
26
+ #
27
+ # @param starting_at [Time] Limits the results to workflow recipient runs started after the given date.
28
+ #
29
+ # @param status [Array<Symbol, Knockapi::Models::WorkflowRecipientRunListParams::Status>] Limits the results to workflow recipient runs with the given status.
30
+ #
31
+ # @param tenant [String] Limits the results to workflow recipient runs for the given tenant.
32
+ #
33
+ # @param workflow [String] Limits the results to workflow recipient runs for the given workflow key.
34
+ #
35
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
36
+ #
37
+ # @return [Knockapi::Internal::ItemsCursor<Knockapi::Models::WorkflowRecipientRun>]
38
+ #
39
+ # @see Knockapi::Models::WorkflowRecipientRunListParams
40
+ def list(params = {})
41
+ parsed, options = Knockapi::WorkflowRecipientRunListParams.dump_request(params)
42
+ query = Knockapi::Internal::Util.encode_query_params(parsed)
43
+ @client.request(
44
+ method: :get,
45
+ path: "v1/workflow_recipient_runs",
46
+ query: query,
47
+ page: Knockapi::Internal::ItemsCursor,
48
+ model: Knockapi::WorkflowRecipientRun,
49
+ options: options
50
+ )
51
+ end
52
+
53
+ # Returns a single workflow recipient run with its associated events.
54
+ #
55
+ # @overload get(id, request_options: {})
56
+ #
57
+ # @param id [String] The unique identifier for the workflow recipient run (per-recipient).
58
+ #
59
+ # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
60
+ #
61
+ # @return [Knockapi::Models::WorkflowRecipientRunDetail]
62
+ #
63
+ # @see Knockapi::Models::WorkflowRecipientRunGetParams
64
+ def get(id, params = {})
65
+ @client.request(
66
+ method: :get,
67
+ path: ["v1/workflow_recipient_runs/%1$s", id],
68
+ model: Knockapi::WorkflowRecipientRunDetail,
69
+ options: params[:request_options]
70
+ )
71
+ end
72
+
73
+ # @api private
74
+ #
75
+ # @param client [Knockapi::Client]
76
+ def initialize(client:)
77
+ @client = client
78
+ end
79
+ end
80
+ end
81
+ end
@@ -16,7 +16,7 @@ module Knockapi
16
16
  #
17
17
  # @param key [String] The key of the workflow to cancel.
18
18
  #
19
- # @param cancellation_key [String] An optional key that is used to reference a specific workflow trigger request wh
19
+ # @param cancellation_key [String] A key that is used to reference a specific workflow trigger request when issuing
20
20
  #
21
21
  # @param recipients [Array<String, Knockapi::Models::RecipientReference::ObjectReference>, nil] A list of recipients to cancel the notification for. If omitted, cancels for all
22
22
  #
@@ -45,7 +45,7 @@ module Knockapi
45
45
  # [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
46
46
  # for the `actor`, `recipient`, and `tenant` fields.
47
47
  #
48
- # @overload trigger(key, recipients:, actor: nil, cancellation_key: nil, data: nil, tenant: nil, request_options: {})
48
+ # @overload trigger(key, recipients:, actor: nil, cancellation_key: nil, data: nil, settings: nil, tenant: nil, request_options: {})
49
49
  #
50
50
  # @param key [String] Key of the workflow to trigger.
51
51
  #
@@ -53,10 +53,12 @@ module Knockapi
53
53
  #
54
54
  # @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
55
55
  #
56
- # @param cancellation_key [String, nil] An optional key that is used to reference a specific workflow trigger request wh
56
+ # @param cancellation_key [String, nil] A key that is used to reference a specific workflow trigger request when issuing
57
57
  #
58
58
  # @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 10MB lim
59
59
  #
60
+ # @param settings [Knockapi::Models::WorkflowTriggerParams::Settings, nil] Optional settings that control how this workflow trigger is executed.
61
+ #
60
62
  # @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
61
63
  #
62
64
  # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Knockapi
4
- VERSION = "1.35.0"
4
+ VERSION = "1.36.0"
5
5
  end
data/lib/knockapi.rb CHANGED
@@ -59,6 +59,7 @@ require_relative "knockapi/internal/slack_channels_cursor"
59
59
  require_relative "knockapi/models/recipients/channel_data_request"
60
60
  require_relative "knockapi/models/recipients/preference_set_request"
61
61
  require_relative "knockapi/models/identify_user_request"
62
+ require_relative "knockapi/models/workflow_recipient_run"
62
63
  require_relative "knockapi/models/activity"
63
64
  require_relative "knockapi/models/audience_add_members_params"
64
65
  require_relative "knockapi/models/audience_list_members_params"
@@ -132,6 +133,7 @@ require_relative "knockapi/models/object_set_channel_data_params"
132
133
  require_relative "knockapi/models/object_set_params"
133
134
  require_relative "knockapi/models/object_set_preferences_params"
134
135
  require_relative "knockapi/models/object_unset_channel_data_params"
136
+ require_relative "knockapi/models/object_unset_preferences_params"
135
137
  require_relative "knockapi/models/page_info"
136
138
  require_relative "knockapi/models/providers/ms_team_check_auth_params"
137
139
  require_relative "knockapi/models/providers/ms_team_check_auth_response"
@@ -214,8 +216,13 @@ require_relative "knockapi/models/users/guide_mark_message_as_seen_response"
214
216
  require_relative "knockapi/models/user_set_channel_data_params"
215
217
  require_relative "knockapi/models/user_set_preferences_params"
216
218
  require_relative "knockapi/models/user_unset_channel_data_params"
219
+ require_relative "knockapi/models/user_unset_preferences_params"
217
220
  require_relative "knockapi/models/user_update_params"
218
221
  require_relative "knockapi/models/workflow_cancel_params"
222
+ require_relative "knockapi/models/workflow_recipient_run_detail"
223
+ require_relative "knockapi/models/workflow_recipient_run_event"
224
+ require_relative "knockapi/models/workflow_recipient_run_get_params"
225
+ require_relative "knockapi/models/workflow_recipient_run_list_params"
219
226
  require_relative "knockapi/models/workflow_trigger_params"
220
227
  require_relative "knockapi/models/workflow_trigger_response"
221
228
  require_relative "knockapi/models"
@@ -245,4 +252,5 @@ require_relative "knockapi/resources/users"
245
252
  require_relative "knockapi/resources/users/bulk"
246
253
  require_relative "knockapi/resources/users/feeds"
247
254
  require_relative "knockapi/resources/users/guides"
255
+ require_relative "knockapi/resources/workflow_recipient_runs"
248
256
  require_relative "knockapi/resources/workflows"
@@ -54,6 +54,11 @@ module Knockapi
54
54
  sig { returns(Knockapi::Resources::Workflows) }
55
55
  attr_reader :workflows
56
56
 
57
+ # A workflow run represents an individual execution of a workflow for a specific
58
+ # recipient.
59
+ sig { returns(Knockapi::Resources::WorkflowRecipientRuns) }
60
+ attr_reader :workflow_recipient_runs
61
+
57
62
  # A schedule is a per-recipient, timezone-aware configuration for when to invoke a
58
63
  # workflow.
59
64
  sig { returns(Knockapi::Resources::Schedules) }
@@ -148,12 +148,20 @@ module Knockapi
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -84,6 +84,8 @@ module Knockapi
84
84
  T.let(:not_exists, Knockapi::Condition::Operator::TaggedSymbol)
85
85
  CONTAINS_ALL =
86
86
  T.let(:contains_all, Knockapi::Condition::Operator::TaggedSymbol)
87
+ NOT_CONTAINS_ALL =
88
+ T.let(:not_contains_all, Knockapi::Condition::Operator::TaggedSymbol)
87
89
  IS_TIMESTAMP =
88
90
  T.let(:is_timestamp, Knockapi::Condition::Operator::TaggedSymbol)
89
91
  IS_NOT_TIMESTAMP =
@@ -108,6 +108,19 @@ module Knockapi
108
108
  sig { returns(T.nilable(Time)) }
109
109
  attr_accessor :read_at
110
110
 
111
+ # Recipient contact information captured at email send time. Null for non-email
112
+ # channels.
113
+ sig { returns(T.nilable(Knockapi::Message::RecipientSnapshot)) }
114
+ attr_reader :recipient_snapshot
115
+
116
+ sig do
117
+ params(
118
+ recipient_snapshot:
119
+ T.nilable(Knockapi::Message::RecipientSnapshot::OrHash)
120
+ ).void
121
+ end
122
+ attr_writer :recipient_snapshot
123
+
111
124
  # Timestamp when the message was scheduled to be sent.
112
125
  sig { returns(T.nilable(Time)) }
113
126
  attr_accessor :scheduled_at
@@ -158,6 +171,8 @@ module Knockapi
158
171
  link_clicked_at: T.nilable(Time),
159
172
  metadata: T.nilable(T::Hash[Symbol, T.anything]),
160
173
  read_at: T.nilable(Time),
174
+ recipient_snapshot:
175
+ T.nilable(Knockapi::Message::RecipientSnapshot::OrHash),
161
176
  scheduled_at: T.nilable(Time),
162
177
  seen_at: T.nilable(Time),
163
178
  tenant: T.nilable(String),
@@ -208,6 +223,9 @@ module Knockapi
208
223
  metadata: nil,
209
224
  # Timestamp when the message was read.
210
225
  read_at: nil,
226
+ # Recipient contact information captured at email send time. Null for non-email
227
+ # channels.
228
+ recipient_snapshot: nil,
211
229
  # Timestamp when the message was scheduled to be sent.
212
230
  scheduled_at: nil,
213
231
  # Timestamp when the message was seen.
@@ -242,6 +260,7 @@ module Knockapi
242
260
  link_clicked_at: T.nilable(Time),
243
261
  metadata: T.nilable(T::Hash[Symbol, T.anything]),
244
262
  read_at: T.nilable(Time),
263
+ recipient_snapshot: T.nilable(Knockapi::Message::RecipientSnapshot),
245
264
  scheduled_at: T.nilable(Time),
246
265
  seen_at: T.nilable(Time),
247
266
  tenant: T.nilable(String),
@@ -534,6 +553,46 @@ module Knockapi
534
553
  end
535
554
  end
536
555
  end
556
+
557
+ class RecipientSnapshot < Knockapi::Internal::Type::BaseModel
558
+ OrHash =
559
+ T.type_alias do
560
+ T.any(
561
+ Knockapi::Message::RecipientSnapshot,
562
+ Knockapi::Internal::AnyHash
563
+ )
564
+ end
565
+
566
+ # The email address the message was delivered to
567
+ sig { returns(T.nilable(String)) }
568
+ attr_reader :email
569
+
570
+ sig { params(email: String).void }
571
+ attr_writer :email
572
+
573
+ # The recipient name at send time
574
+ sig { returns(T.nilable(String)) }
575
+ attr_accessor :name
576
+
577
+ # Recipient contact information captured at email send time. Null for non-email
578
+ # channels.
579
+ sig do
580
+ params(email: String, name: T.nilable(String)).returns(
581
+ T.attached_class
582
+ )
583
+ end
584
+ def self.new(
585
+ # The email address the message was delivered to
586
+ email: nil,
587
+ # The recipient name at send time
588
+ name: nil
589
+ )
590
+ end
591
+
592
+ sig { override.returns({ email: String, name: T.nilable(String) }) }
593
+ def to_hash
594
+ end
595
+ end
537
596
  end
538
597
  end
539
598
  end