knockapi 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05e2af454cc4e2dc3f721acdafcfe91ff2aafaac9a6cdcaeff7a6d0fb3554ded
4
- data.tar.gz: 51f60b06a643f43661372498e05cf0eb236f9b05f290816ecf8c2d36450c84cd
3
+ metadata.gz: 2d5f3a2c6174ea9d6f4a8203b2dc98ec7edfb5374cffd899a0b6b669257a7686
4
+ data.tar.gz: 2b4c45abf3420222039f6caacf508a530c4c8cac4196e325c353f927f60e5b6c
5
5
  SHA512:
6
- metadata.gz: 4664831a9ed4bb37eff4922c9bc1d75d08db467e03e1e70f97b7584ca20f5fd534a90a05c29dca71413c8cf9d782e954b4b6cddab94fba14f68f42820173dc25
7
- data.tar.gz: d9353f602163c8883a97a072755294bde85439126a986dc1c8148daca0f7e92965836e146fe4df9591205284b86b1abf04c1166a97461ecc52887d030c7c7696
6
+ metadata.gz: '0409be38f4fe4c66806657b1821f9bd66f4191a5c631cbbd6110c4ab60a7d3b3613c6fa8909656b85dfd99723f953172a4561d7a5addb8fdc61aa00882ea71a1'
7
+ data.tar.gz: 8bb6ec2864fa22a0482c4600d911fbd4e7d38c6e4b58b0c6f7f71163781d588fb8d1bd674a0bbd4c6dd1e399ed43c5f930b73c407636b5b6fae443dd5e5fbd74
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 (2025-06-04)
4
+
5
+ Full Changelog: [v1.4.0...v1.5.0](https://github.com/knocklabs/knock-ruby/compare/v1.4.0...v1.5.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([b4a8a6f](https://github.com/knocklabs/knock-ruby/commit/b4a8a6f6bd5451fb68be75c19b5b08b7629543cc))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * `to_sorbet_type` should not return branded types ([2fe0597](https://github.com/knocklabs/knock-ruby/commit/2fe05973673d02ced0a04abc32f0ea079ff9313f))
15
+
16
+ ## 1.4.0 (2025-05-29)
17
+
18
+ Full Changelog: [v1.3.0...v1.4.0](https://github.com/knocklabs/knock-ruby/compare/v1.3.0...v1.4.0)
19
+
20
+ ### Features
21
+
22
+ * **api:** api update ([f1d1f0f](https://github.com/knocklabs/knock-ruby/commit/f1d1f0f262a0cecec5f416873be4d3ee6418ec94))
23
+
3
24
  ## 1.3.0 (2025-05-28)
4
25
 
5
26
  Full Changelog: [v1.2.0...v1.3.0](https://github.com/knocklabs/knock-ruby/compare/v1.2.0...v1.3.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "knockapi", "~> 1.3.0"
20
+ gem "knockapi", "~> 1.5.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -91,11 +91,14 @@ module Knockapi
91
91
  #
92
92
  # @return [Object]
93
93
  def to_sorbet_type
94
- case values
94
+ types = values.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
95
+ case types
95
96
  in []
96
97
  T.noreturn
97
- in [value, *_]
98
- T.all(Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(value), self)
98
+ in [type]
99
+ type
100
+ else
101
+ T.any(*types)
99
102
  end
100
103
  end
101
104
 
@@ -206,11 +206,14 @@ module Knockapi
206
206
  #
207
207
  # @return [Object]
208
208
  def to_sorbet_type
209
- case (v = variants)
209
+ types = variants.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
210
+ case types
210
211
  in []
211
212
  T.noreturn
213
+ in [type]
214
+ type
212
215
  else
213
- T.any(*v.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) })
216
+ T.any(*types)
214
217
  end
215
218
  end
216
219
 
@@ -13,18 +13,20 @@ module Knockapi
13
13
  # @return [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>]
14
14
  required :recipients, -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientRequest] }
15
15
 
16
- # @!attribute repeats
17
- # The repeat rule for the schedule.
18
- #
19
- # @return [Array<Knockapi::Models::ScheduleRepeatRule>]
20
- required :repeats, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::ScheduleRepeatRule] }
21
-
22
16
  # @!attribute workflow
23
17
  # The key of the workflow.
24
18
  #
25
19
  # @return [String]
26
20
  required :workflow, String
27
21
 
22
+ # @!attribute actor
23
+ # Specifies a recipient in a request. This can either be a user identifier
24
+ # (string), an inline user request (object), or an inline object request, which is
25
+ # determined by the presence of a `collection` property.
26
+ #
27
+ # @return [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil]
28
+ optional :actor, union: -> { Knockapi::RecipientRequest }, nil?: true
29
+
28
30
  # @!attribute data
29
31
  # An optional map of data to pass into the workflow execution. There is a 1024
30
32
  # byte limit on the size of any single string value (with the exception of
@@ -40,6 +42,12 @@ module Knockapi
40
42
  # @return [Time, nil]
41
43
  optional :ending_at, Time, nil?: true
42
44
 
45
+ # @!attribute repeats
46
+ # The repeat rule for the schedule.
47
+ #
48
+ # @return [Array<Knockapi::Models::ScheduleRepeatRule>, nil]
49
+ optional :repeats, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::ScheduleRepeatRule] }
50
+
43
51
  # @!attribute scheduled_at
44
52
  # The starting date and time for the schedule.
45
53
  #
@@ -52,20 +60,22 @@ module Knockapi
52
60
  # @return [String, Knockapi::Models::TenantRequest, nil]
53
61
  optional :tenant, union: -> { Knockapi::InlineTenantRequest }, nil?: true
54
62
 
55
- # @!method initialize(recipients:, repeats:, workflow:, data: nil, ending_at: nil, scheduled_at: nil, tenant: nil, request_options: {})
63
+ # @!method initialize(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {})
56
64
  # Some parameter documentations has been truncated, see
57
65
  # {Knockapi::Models::ScheduleCreateParams} for more details.
58
66
  #
59
67
  # @param recipients [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>] The recipients to set the schedule for. Limited to 100 recipients per request.
60
68
  #
61
- # @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
62
- #
63
69
  # @param workflow [String] The key of the workflow.
64
70
  #
71
+ # @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
72
+ #
65
73
  # @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 1024 byt
66
74
  #
67
75
  # @param ending_at [Time, nil] The ending date and time for the schedule.
68
76
  #
77
+ # @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
78
+ #
69
79
  # @param scheduled_at [Time, nil] The starting date and time for the schedule.
70
80
  #
71
81
  # @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
@@ -11,16 +11,16 @@ module Knockapi
11
11
  mod.constants.each do |name|
12
12
  case mod.const_get(name)
13
13
  in true | false
14
- mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
15
  mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
16
  in Integer
17
- mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
18
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
19
  in Float
20
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
21
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
22
  in Symbol
23
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
24
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
25
  else
26
26
  end
@@ -15,18 +15,20 @@ module Knockapi
15
15
  # [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
16
16
  # for the `actor`, `recipient`, and `tenant` fields.
17
17
  #
18
- # @overload create(recipients:, repeats:, workflow:, data: nil, ending_at: nil, scheduled_at: nil, tenant: nil, request_options: {})
18
+ # @overload create(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {})
19
19
  #
20
20
  # @param recipients [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>] The recipients to set the schedule for. Limited to 100 recipients per request.
21
21
  #
22
- # @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
23
- #
24
22
  # @param workflow [String] The key of the workflow.
25
23
  #
24
+ # @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
25
+ #
26
26
  # @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 1024 byt
27
27
  #
28
28
  # @param ending_at [Time, nil] The ending date and time for the schedule.
29
29
  #
30
+ # @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
31
+ #
30
32
  # @param scheduled_at [Time, nil] The starting date and time for the schedule.
31
33
  #
32
34
  # @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
@@ -344,7 +344,9 @@ module Knockapi
344
344
  )
345
345
  end
346
346
 
347
- # Updates or creates channel data for a specific user and channel ID.
347
+ # Updates or creates channel data for a specific user and channel ID. If no user
348
+ # exists in the current environment for the given `user_id`, Knock will create the
349
+ # user entry as part of this request.
348
350
  #
349
351
  # @overload set_channel_data(user_id, channel_id, data:, request_options: {})
350
352
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Knockapi
4
- VERSION = "1.3.0"
4
+ VERSION = "1.5.0"
5
5
  end
@@ -25,14 +25,26 @@ module Knockapi
25
25
  end
26
26
  attr_accessor :recipients
27
27
 
28
- # The repeat rule for the schedule.
29
- sig { returns(T::Array[Knockapi::ScheduleRepeatRule]) }
30
- attr_accessor :repeats
31
-
32
28
  # The key of the workflow.
33
29
  sig { returns(String) }
34
30
  attr_accessor :workflow
35
31
 
32
+ # Specifies a recipient in a request. This can either be a user identifier
33
+ # (string), an inline user request (object), or an inline object request, which is
34
+ # determined by the presence of a `collection` property.
35
+ sig do
36
+ returns(
37
+ T.nilable(
38
+ T.any(
39
+ String,
40
+ Knockapi::InlineIdentifyUserRequest,
41
+ Knockapi::InlineObjectRequest
42
+ )
43
+ )
44
+ )
45
+ end
46
+ attr_accessor :actor
47
+
36
48
  # An optional map of data to pass into the workflow execution. There is a 1024
37
49
  # byte limit on the size of any single string value (with the exception of
38
50
  # [email attachments](/integrations/email/attachments)), and a 10MB limit on the
@@ -44,6 +56,15 @@ module Knockapi
44
56
  sig { returns(T.nilable(Time)) }
45
57
  attr_accessor :ending_at
46
58
 
59
+ # The repeat rule for the schedule.
60
+ sig { returns(T.nilable(T::Array[Knockapi::ScheduleRepeatRule])) }
61
+ attr_reader :repeats
62
+
63
+ sig do
64
+ params(repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash]).void
65
+ end
66
+ attr_writer :repeats
67
+
47
68
  # The starting date and time for the schedule.
48
69
  sig { returns(T.nilable(Time)) }
49
70
  attr_accessor :scheduled_at
@@ -62,10 +83,18 @@ module Knockapi
62
83
  Knockapi::InlineObjectRequest::OrHash
63
84
  )
64
85
  ],
65
- repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
66
86
  workflow: String,
87
+ actor:
88
+ T.nilable(
89
+ T.any(
90
+ String,
91
+ Knockapi::InlineIdentifyUserRequest::OrHash,
92
+ Knockapi::InlineObjectRequest::OrHash
93
+ )
94
+ ),
67
95
  data: T.nilable(T::Hash[Symbol, T.anything]),
68
96
  ending_at: T.nilable(Time),
97
+ repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
69
98
  scheduled_at: T.nilable(Time),
70
99
  tenant: T.nilable(T.any(String, Knockapi::TenantRequest::OrHash)),
71
100
  request_options: Knockapi::RequestOptions::OrHash
@@ -74,10 +103,12 @@ module Knockapi
74
103
  def self.new(
75
104
  # The recipients to set the schedule for. Limited to 100 recipients per request.
76
105
  recipients:,
77
- # The repeat rule for the schedule.
78
- repeats:,
79
106
  # The key of the workflow.
80
107
  workflow:,
108
+ # Specifies a recipient in a request. This can either be a user identifier
109
+ # (string), an inline user request (object), or an inline object request, which is
110
+ # determined by the presence of a `collection` property.
111
+ actor: nil,
81
112
  # An optional map of data to pass into the workflow execution. There is a 1024
82
113
  # byte limit on the size of any single string value (with the exception of
83
114
  # [email attachments](/integrations/email/attachments)), and a 10MB limit on the
@@ -85,6 +116,8 @@ module Knockapi
85
116
  data: nil,
86
117
  # The ending date and time for the schedule.
87
118
  ending_at: nil,
119
+ # The repeat rule for the schedule.
120
+ repeats: nil,
88
121
  # The starting date and time for the schedule.
89
122
  scheduled_at: nil,
90
123
  # An request to set a tenant inline.
@@ -104,10 +137,18 @@ module Knockapi
104
137
  Knockapi::InlineObjectRequest
105
138
  )
106
139
  ],
107
- repeats: T::Array[Knockapi::ScheduleRepeatRule],
108
140
  workflow: String,
141
+ actor:
142
+ T.nilable(
143
+ T.any(
144
+ String,
145
+ Knockapi::InlineIdentifyUserRequest,
146
+ Knockapi::InlineObjectRequest
147
+ )
148
+ ),
109
149
  data: T.nilable(T::Hash[Symbol, T.anything]),
110
150
  ending_at: T.nilable(Time),
151
+ repeats: T::Array[Knockapi::ScheduleRepeatRule],
111
152
  scheduled_at: T.nilable(Time),
112
153
  tenant: T.nilable(T.any(String, Knockapi::TenantRequest)),
113
154
  request_options: Knockapi::RequestOptions
@@ -21,10 +21,18 @@ module Knockapi
21
21
  Knockapi::InlineObjectRequest::OrHash
22
22
  )
23
23
  ],
24
- repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
25
24
  workflow: String,
25
+ actor:
26
+ T.nilable(
27
+ T.any(
28
+ String,
29
+ Knockapi::InlineIdentifyUserRequest::OrHash,
30
+ Knockapi::InlineObjectRequest::OrHash
31
+ )
32
+ ),
26
33
  data: T.nilable(T::Hash[Symbol, T.anything]),
27
34
  ending_at: T.nilable(Time),
35
+ repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
28
36
  scheduled_at: T.nilable(Time),
29
37
  tenant: T.nilable(T.any(String, Knockapi::TenantRequest::OrHash)),
30
38
  request_options: Knockapi::RequestOptions::OrHash
@@ -33,10 +41,12 @@ module Knockapi
33
41
  def create(
34
42
  # The recipients to set the schedule for. Limited to 100 recipients per request.
35
43
  recipients:,
36
- # The repeat rule for the schedule.
37
- repeats:,
38
44
  # The key of the workflow.
39
45
  workflow:,
46
+ # Specifies a recipient in a request. This can either be a user identifier
47
+ # (string), an inline user request (object), or an inline object request, which is
48
+ # determined by the presence of a `collection` property.
49
+ actor: nil,
40
50
  # An optional map of data to pass into the workflow execution. There is a 1024
41
51
  # byte limit on the size of any single string value (with the exception of
42
52
  # [email attachments](/integrations/email/attachments)), and a 10MB limit on the
@@ -44,6 +54,8 @@ module Knockapi
44
54
  data: nil,
45
55
  # The ending date and time for the schedule.
46
56
  ending_at: nil,
57
+ # The repeat rule for the schedule.
58
+ repeats: nil,
47
59
  # The starting date and time for the schedule.
48
60
  scheduled_at: nil,
49
61
  # An request to set a tenant inline.
@@ -325,7 +325,9 @@ module Knockapi
325
325
  )
326
326
  end
327
327
 
328
- # Updates or creates channel data for a specific user and channel ID.
328
+ # Updates or creates channel data for a specific user and channel ID. If no user
329
+ # exists in the current environment for the given `user_id`, Knock will create the
330
+ # user entry as part of this request.
329
331
  sig do
330
332
  params(
331
333
  user_id: String,
@@ -3,10 +3,11 @@ module Knockapi
3
3
  type schedule_create_params =
4
4
  {
5
5
  recipients: ::Array[Knockapi::Models::recipient_request],
6
- repeats: ::Array[Knockapi::ScheduleRepeatRule],
7
6
  workflow: String,
7
+ actor: Knockapi::Models::recipient_request?,
8
8
  data: ::Hash[Symbol, top]?,
9
9
  ending_at: Time?,
10
+ repeats: ::Array[Knockapi::ScheduleRepeatRule],
10
11
  scheduled_at: Time?,
11
12
  tenant: Knockapi::Models::inline_tenant_request?
12
13
  }
@@ -18,24 +19,31 @@ module Knockapi
18
19
 
19
20
  attr_accessor recipients: ::Array[Knockapi::Models::recipient_request]
20
21
 
21
- attr_accessor repeats: ::Array[Knockapi::ScheduleRepeatRule]
22
-
23
22
  attr_accessor workflow: String
24
23
 
24
+ attr_accessor actor: Knockapi::Models::recipient_request?
25
+
25
26
  attr_accessor data: ::Hash[Symbol, top]?
26
27
 
27
28
  attr_accessor ending_at: Time?
28
29
 
30
+ attr_reader repeats: ::Array[Knockapi::ScheduleRepeatRule]?
31
+
32
+ def repeats=: (
33
+ ::Array[Knockapi::ScheduleRepeatRule]
34
+ ) -> ::Array[Knockapi::ScheduleRepeatRule]
35
+
29
36
  attr_accessor scheduled_at: Time?
30
37
 
31
38
  attr_accessor tenant: Knockapi::Models::inline_tenant_request?
32
39
 
33
40
  def initialize: (
34
41
  recipients: ::Array[Knockapi::Models::recipient_request],
35
- repeats: ::Array[Knockapi::ScheduleRepeatRule],
36
42
  workflow: String,
43
+ ?actor: Knockapi::Models::recipient_request?,
37
44
  ?data: ::Hash[Symbol, top]?,
38
45
  ?ending_at: Time?,
46
+ ?repeats: ::Array[Knockapi::ScheduleRepeatRule],
39
47
  ?scheduled_at: Time?,
40
48
  ?tenant: Knockapi::Models::inline_tenant_request?,
41
49
  ?request_options: Knockapi::request_opts
@@ -43,10 +51,11 @@ module Knockapi
43
51
 
44
52
  def to_hash: -> {
45
53
  recipients: ::Array[Knockapi::Models::recipient_request],
46
- repeats: ::Array[Knockapi::ScheduleRepeatRule],
47
54
  workflow: String,
55
+ actor: Knockapi::Models::recipient_request?,
48
56
  data: ::Hash[Symbol, top]?,
49
57
  ending_at: Time?,
58
+ repeats: ::Array[Knockapi::ScheduleRepeatRule],
50
59
  scheduled_at: Time?,
51
60
  tenant: Knockapi::Models::inline_tenant_request?,
52
61
  request_options: Knockapi::RequestOptions
@@ -5,10 +5,11 @@ module Knockapi
5
5
 
6
6
  def create: (
7
7
  recipients: ::Array[Knockapi::Models::recipient_request],
8
- repeats: ::Array[Knockapi::ScheduleRepeatRule],
9
8
  workflow: String,
9
+ ?actor: Knockapi::Models::recipient_request?,
10
10
  ?data: ::Hash[Symbol, top]?,
11
11
  ?ending_at: Time?,
12
+ ?repeats: ::Array[Knockapi::ScheduleRepeatRule],
12
13
  ?scheduled_at: Time?,
13
14
  ?tenant: Knockapi::Models::inline_tenant_request?,
14
15
  ?request_options: Knockapi::request_opts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knockapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Knock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-29 00:00:00.000000000 Z
11
+ date: 2025-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool