prelude-sdk 0.1.0.pre.alpha.2 → 0.1.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +74 -0
  3. data/README.md +29 -1
  4. data/lib/prelude_sdk/client.rb +4 -0
  5. data/lib/prelude_sdk/errors.rb +25 -11
  6. data/lib/prelude_sdk/file_part.rb +10 -7
  7. data/lib/prelude_sdk/internal/transport/base_client.rb +29 -11
  8. data/lib/prelude_sdk/internal/transport/pooled_net_requester.rb +41 -42
  9. data/lib/prelude_sdk/internal/type/array_of.rb +1 -0
  10. data/lib/prelude_sdk/internal/type/base_model.rb +4 -9
  11. data/lib/prelude_sdk/internal/type/base_page.rb +1 -1
  12. data/lib/prelude_sdk/internal/type/converter.rb +27 -0
  13. data/lib/prelude_sdk/internal/type/file_input.rb +7 -4
  14. data/lib/prelude_sdk/internal/type/hash_of.rb +1 -0
  15. data/lib/prelude_sdk/internal/type/union.rb +9 -7
  16. data/lib/prelude_sdk/internal/util.rb +9 -8
  17. data/lib/prelude_sdk/models/transactional_send_params.rb +41 -3
  18. data/lib/prelude_sdk/models/transactional_send_response.rb +7 -2
  19. data/lib/prelude_sdk/models/verification_check_response.rb +6 -1
  20. data/lib/prelude_sdk/models/verification_create_params.rb +57 -20
  21. data/lib/prelude_sdk/models/verification_create_response.rb +65 -12
  22. data/lib/prelude_sdk/models/verification_management_delete_phone_number_params.rb +32 -0
  23. data/lib/prelude_sdk/models/verification_management_delete_phone_number_response.rb +17 -0
  24. data/lib/prelude_sdk/models/verification_management_list_phone_numbers_params.rb +24 -0
  25. data/lib/prelude_sdk/models/verification_management_list_phone_numbers_response.rb +37 -0
  26. data/lib/prelude_sdk/models/verification_management_list_sender_ids_params.rb +14 -0
  27. data/lib/prelude_sdk/models/verification_management_list_sender_ids_response.rb +65 -0
  28. data/lib/prelude_sdk/models/verification_management_set_phone_number_params.rb +32 -0
  29. data/lib/prelude_sdk/models/verification_management_set_phone_number_response.rb +17 -0
  30. data/lib/prelude_sdk/models/verification_management_submit_sender_id_params.rb +22 -0
  31. data/lib/prelude_sdk/models/verification_management_submit_sender_id_response.rb +59 -0
  32. data/lib/prelude_sdk/models/watch_predict_params.rb +17 -3
  33. data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +18 -3
  34. data/lib/prelude_sdk/models.rb +14 -0
  35. data/lib/prelude_sdk/resources/transactional.rb +8 -3
  36. data/lib/prelude_sdk/resources/verification_management.rb +140 -0
  37. data/lib/prelude_sdk/version.rb +1 -1
  38. data/lib/prelude_sdk.rb +12 -0
  39. data/manifest.yaml +1 -0
  40. data/rbi/prelude_sdk/client.rbi +3 -0
  41. data/rbi/prelude_sdk/errors.rbi +31 -4
  42. data/rbi/prelude_sdk/file_part.rbi +1 -1
  43. data/rbi/prelude_sdk/internal/transport/base_client.rbi +10 -6
  44. data/rbi/prelude_sdk/internal/transport/pooled_net_requester.rbi +6 -2
  45. data/rbi/prelude_sdk/internal/type/base_model.rbi +8 -4
  46. data/rbi/prelude_sdk/internal/type/base_page.rbi +1 -1
  47. data/rbi/prelude_sdk/internal/type/converter.rbi +54 -0
  48. data/rbi/prelude_sdk/internal/type/union.rbi +9 -2
  49. data/rbi/prelude_sdk/internal/util.rbi +1 -1
  50. data/rbi/prelude_sdk/models/transactional_send_params.rbi +91 -2
  51. data/rbi/prelude_sdk/models/transactional_send_response.rbi +6 -2
  52. data/rbi/prelude_sdk/models/verification_check_response.rbi +7 -1
  53. data/rbi/prelude_sdk/models/verification_create_params.rbi +107 -23
  54. data/rbi/prelude_sdk/models/verification_create_response.rbi +160 -15
  55. data/rbi/prelude_sdk/models/verification_management_delete_phone_number_params.rbi +77 -0
  56. data/rbi/prelude_sdk/models/verification_management_delete_phone_number_response.rbi +30 -0
  57. data/rbi/prelude_sdk/models/verification_management_list_phone_numbers_params.rbi +64 -0
  58. data/rbi/prelude_sdk/models/verification_management_list_phone_numbers_response.rbi +87 -0
  59. data/rbi/prelude_sdk/models/verification_management_list_sender_ids_params.rbi +30 -0
  60. data/rbi/prelude_sdk/models/verification_management_list_sender_ids_response.rbi +175 -0
  61. data/rbi/prelude_sdk/models/verification_management_set_phone_number_params.rbi +77 -0
  62. data/rbi/prelude_sdk/models/verification_management_set_phone_number_response.rbi +30 -0
  63. data/rbi/prelude_sdk/models/verification_management_submit_sender_id_params.rbi +43 -0
  64. data/rbi/prelude_sdk/models/verification_management_submit_sender_id_response.rbi +117 -0
  65. data/rbi/prelude_sdk/models/watch_predict_params.rbi +19 -2
  66. data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +19 -2
  67. data/rbi/prelude_sdk/models.rbi +15 -0
  68. data/rbi/prelude_sdk/resources/transactional.rbi +17 -2
  69. data/rbi/prelude_sdk/resources/verification_management.rbi +112 -0
  70. data/sig/prelude_sdk/client.rbs +2 -0
  71. data/sig/prelude_sdk/errors.rbs +7 -0
  72. data/sig/prelude_sdk/file_part.rbs +1 -1
  73. data/sig/prelude_sdk/internal/transport/base_client.rbs +3 -1
  74. data/sig/prelude_sdk/internal/transport/pooled_net_requester.rbs +4 -1
  75. data/sig/prelude_sdk/internal/type/converter.rbs +17 -0
  76. data/sig/prelude_sdk/internal/type/union.rbs +2 -2
  77. data/sig/prelude_sdk/models/transactional_send_params.rbs +21 -0
  78. data/sig/prelude_sdk/models/verification_create_params.rbs +35 -16
  79. data/sig/prelude_sdk/models/verification_create_response.rbs +41 -16
  80. data/sig/prelude_sdk/models/verification_management_delete_phone_number_params.rbs +34 -0
  81. data/sig/prelude_sdk/models/verification_management_delete_phone_number_response.rbs +14 -0
  82. data/sig/prelude_sdk/models/verification_management_list_phone_numbers_params.rbs +26 -0
  83. data/sig/prelude_sdk/models/verification_management_list_phone_numbers_response.rbs +32 -0
  84. data/sig/prelude_sdk/models/verification_management_list_sender_ids_params.rbs +15 -0
  85. data/sig/prelude_sdk/models/verification_management_list_sender_ids_response.rbs +64 -0
  86. data/sig/prelude_sdk/models/verification_management_set_phone_number_params.rbs +34 -0
  87. data/sig/prelude_sdk/models/verification_management_set_phone_number_response.rbs +14 -0
  88. data/sig/prelude_sdk/models/verification_management_submit_sender_id_params.rbs +23 -0
  89. data/sig/prelude_sdk/models/verification_management_submit_sender_id_response.rbs +44 -0
  90. data/sig/prelude_sdk/models/watch_predict_params.rbs +7 -0
  91. data/sig/prelude_sdk/models/watch_send_feedbacks_params.rbs +7 -0
  92. data/sig/prelude_sdk/models.rbs +10 -0
  93. data/sig/prelude_sdk/resources/transactional.rbs +1 -0
  94. data/sig/prelude_sdk/resources/verification_management.rbs +33 -0
  95. metadata +37 -4
@@ -168,6 +168,7 @@ module PreludeSDK
168
168
  # @option spec [Boolean] :"nil?"
169
169
  def initialize(type_info, spec = {})
170
170
  @item_type_fn = PreludeSDK::Internal::Type::Converter.type_info(type_info || spec)
171
+ @meta = PreludeSDK::Internal::Type::Converter.meta_info(type_info, spec)
171
172
  @nilable = spec.fetch(:nil?, false)
172
173
  end
173
174
 
@@ -12,20 +12,20 @@ module PreludeSDK
12
12
  #
13
13
  # All of the specified variant info for this union.
14
14
  #
15
- # @return [Array<Array(Symbol, Proc)>]
15
+ # @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
16
16
  private def known_variants = (@known_variants ||= [])
17
17
 
18
18
  # @api private
19
19
  #
20
- # @return [Array<Array(Symbol, Object)>]
20
+ # @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
21
21
  protected def derefed_variants
22
- known_variants.map { |key, variant_fn| [key, variant_fn.call] }
22
+ known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
23
23
  end
24
24
 
25
25
  # All of the specified variants for this union.
26
26
  #
27
27
  # @return [Array<Object>]
28
- def variants = derefed_variants.map(&:last)
28
+ def variants = derefed_variants.map { _2 }
29
29
 
30
30
  # @api private
31
31
  #
@@ -51,12 +51,13 @@ module PreludeSDK
51
51
  #
52
52
  # @option spec [Boolean] :"nil?"
53
53
  private def variant(key, spec = nil)
54
+ meta = PreludeSDK::Internal::Type::Converter.meta_info(nil, spec)
54
55
  variant_info =
55
56
  case key
56
57
  in Symbol
57
- [key, PreludeSDK::Internal::Type::Converter.type_info(spec)]
58
+ [key, PreludeSDK::Internal::Type::Converter.type_info(spec), meta]
58
59
  in Proc | PreludeSDK::Internal::Type::Converter | Class | Hash
59
- [nil, PreludeSDK::Internal::Type::Converter.type_info(key)]
60
+ [nil, PreludeSDK::Internal::Type::Converter.type_info(key), meta]
60
61
  end
61
62
 
62
63
  known_variants << variant_info
@@ -79,7 +80,8 @@ module PreludeSDK
79
80
  return nil if key == PreludeSDK::Internal::OMIT
80
81
 
81
82
  key = key.to_sym if key.is_a?(String)
82
- known_variants.find { |k,| k == key }&.last&.call
83
+ _, found = known_variants.find { |k,| k == key }
84
+ found&.call
83
85
  else
84
86
  nil
85
87
  end
@@ -244,7 +244,7 @@ module PreludeSDK
244
244
  #
245
245
  # @return [String]
246
246
  def uri_origin(uri)
247
- "#{uri.scheme}://#{uri.host}#{uri.port == uri.default_port ? '' : ":#{uri.port}"}"
247
+ "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
248
  end
249
249
 
250
250
  # @api private
@@ -346,8 +346,9 @@ module PreludeSDK
346
346
  base_path, base_query = lhs.fetch_values(:path, :query)
347
347
  slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"
348
348
 
349
- parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
350
- override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
349
+ merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
350
+ parsed_path, parsed_query = merged.fetch_values(:path, :query)
351
+ override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)
351
352
 
352
353
  joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
353
354
  query = deep_merge(
@@ -473,10 +474,9 @@ module PreludeSDK
473
474
  # @return [Enumerable<String>]
474
475
  def writable_enum(&blk)
475
476
  Enumerator.new do |y|
476
- buf = String.new
477
477
  y.define_singleton_method(:write) do
478
- self << buf.replace(_1)
479
- buf.bytesize
478
+ self << _1.dup
479
+ _1.bytesize
480
480
  end
481
481
 
482
482
  blk.call(y)
@@ -566,7 +566,8 @@ module PreludeSDK
566
566
  #
567
567
  # @return [Array(String, Enumerable<String>)]
568
568
  private def encode_multipart_streaming(body)
569
- boundary = SecureRandom.urlsafe_base64(60)
569
+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
+ boundary = SecureRandom.urlsafe_base64(46)
570
571
 
571
572
  closing = []
572
573
  strio = writable_enum do |y|
@@ -647,7 +648,7 @@ module PreludeSDK
647
648
  #
648
649
  # Assumes each chunk in stream has `Encoding::BINARY`.
649
650
  #
650
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
651
+ # @param headers [Hash{String=>String}]
651
652
  # @param stream [Enumerable<String>]
652
653
  # @param suppress_error [Boolean]
653
654
  #
@@ -26,7 +26,9 @@ module PreludeSDK
26
26
  optional :callback_url, String
27
27
 
28
28
  # @!attribute correlation_id
29
- # A unique, user-defined identifier that will be included in webhook events.
29
+ # A user-defined identifier to correlate this transactional message with. It is
30
+ # returned in the response and any webhook events that refer to this
31
+ # transactionalmessage.
30
32
  #
31
33
  # @return [String, nil]
32
34
  optional :correlation_id, String
@@ -52,13 +54,27 @@ module PreludeSDK
52
54
  # @return [String, nil]
53
55
  optional :locale, String
54
56
 
57
+ # @!attribute preferred_channel
58
+ # The preferred delivery channel for the message. When specified, the system will
59
+ # prioritize sending via the requested channel if the template is configured for
60
+ # it.
61
+ #
62
+ # If not specified and the template is configured for WhatsApp, the message will
63
+ # be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery
64
+ # is unavailable.
65
+ #
66
+ # Supported channels: `sms`, `rcs`, `whatsapp`.
67
+ #
68
+ # @return [Symbol, PreludeSDK::Models::TransactionalSendParams::PreferredChannel, nil]
69
+ optional :preferred_channel, enum: -> { PreludeSDK::TransactionalSendParams::PreferredChannel }
70
+
55
71
  # @!attribute variables
56
72
  # The variables to be replaced in the template.
57
73
  #
58
74
  # @return [Hash{Symbol=>String}, nil]
59
75
  optional :variables, PreludeSDK::Internal::Type::HashOf[String]
60
76
 
61
- # @!method initialize(template_id:, to:, callback_url: nil, correlation_id: nil, expires_at: nil, from: nil, locale: nil, variables: nil, request_options: {})
77
+ # @!method initialize(template_id:, to:, callback_url: nil, correlation_id: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, variables: nil, request_options: {})
62
78
  # Some parameter documentations has been truncated, see
63
79
  # {PreludeSDK::Models::TransactionalSendParams} for more details.
64
80
  #
@@ -68,7 +84,7 @@ module PreludeSDK
68
84
  #
69
85
  # @param callback_url [String] The callback URL.
70
86
  #
71
- # @param correlation_id [String] A unique, user-defined identifier that will be included in webhook events.
87
+ # @param correlation_id [String] A user-defined identifier to correlate this transactional message with. It is re
72
88
  #
73
89
  # @param expires_at [String] The message expiration date.
74
90
  #
@@ -76,9 +92,31 @@ module PreludeSDK
76
92
  #
77
93
  # @param locale [String] A BCP-47 formatted locale string with the language the text message will be sent
78
94
  #
95
+ # @param preferred_channel [Symbol, PreludeSDK::Models::TransactionalSendParams::PreferredChannel] The preferred delivery channel for the message. When specified, the system will
96
+ #
79
97
  # @param variables [Hash{Symbol=>String}] The variables to be replaced in the template.
80
98
  #
81
99
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
100
+
101
+ # The preferred delivery channel for the message. When specified, the system will
102
+ # prioritize sending via the requested channel if the template is configured for
103
+ # it.
104
+ #
105
+ # If not specified and the template is configured for WhatsApp, the message will
106
+ # be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery
107
+ # is unavailable.
108
+ #
109
+ # Supported channels: `sms`, `rcs`, `whatsapp`.
110
+ module PreferredChannel
111
+ extend PreludeSDK::Internal::Type::Enum
112
+
113
+ SMS = :sms
114
+ RCS = :rcs
115
+ WHATSAPP = :whatsapp
116
+
117
+ # @!method self.values
118
+ # @return [Array<Symbol>]
119
+ end
82
120
  end
83
121
  end
84
122
  end
@@ -47,7 +47,9 @@ module PreludeSDK
47
47
  optional :callback_url, String
48
48
 
49
49
  # @!attribute correlation_id
50
- # A unique, user-defined identifier that will be included in webhook events.
50
+ # A user-defined identifier to correlate this transactional message with. It is
51
+ # returned in the response and any webhook events that refer to this transactional
52
+ # message.
51
53
  #
52
54
  # @return [String, nil]
53
55
  optional :correlation_id, String
@@ -59,6 +61,9 @@ module PreludeSDK
59
61
  optional :from, String
60
62
 
61
63
  # @!method initialize(id:, created_at:, expires_at:, template_id:, to:, variables:, callback_url: nil, correlation_id: nil, from: nil)
64
+ # Some parameter documentations has been truncated, see
65
+ # {PreludeSDK::Models::TransactionalSendResponse} for more details.
66
+ #
62
67
  # @param id [String] The message identifier.
63
68
  #
64
69
  # @param created_at [Time] The message creation date.
@@ -73,7 +78,7 @@ module PreludeSDK
73
78
  #
74
79
  # @param callback_url [String] The callback URL.
75
80
  #
76
- # @param correlation_id [String] A unique, user-defined identifier that will be included in webhook events.
81
+ # @param correlation_id [String] A user-defined identifier to correlate this transactional message with. It is re
77
82
  #
78
83
  # @param from [String] The Sender ID.
79
84
  end
@@ -53,14 +53,19 @@ module PreludeSDK
53
53
  # @see PreludeSDK::Models::VerificationCheckResponse#metadata
54
54
  class Metadata < PreludeSDK::Internal::Type::BaseModel
55
55
  # @!attribute correlation_id
56
+ # A user-defined identifier to correlate this verification with. It is returned in
57
+ # the response and any webhook events that refer to this verification.
56
58
  #
57
59
  # @return [String, nil]
58
60
  optional :correlation_id, String
59
61
 
60
62
  # @!method initialize(correlation_id: nil)
63
+ # Some parameter documentations has been truncated, see
64
+ # {PreludeSDK::Models::VerificationCheckResponse::Metadata} for more details.
65
+ #
61
66
  # The metadata for this verification.
62
67
  #
63
- # @param correlation_id [String]
68
+ # @param correlation_id [String] A user-defined identifier to correlate this verification with. It is returned in
64
69
  end
65
70
  end
66
71
  end
@@ -93,16 +93,20 @@ module PreludeSDK
93
93
 
94
94
  class Metadata < PreludeSDK::Internal::Type::BaseModel
95
95
  # @!attribute correlation_id
96
- # A user-defined identifier to correlate this verification with.
96
+ # A user-defined identifier to correlate this verification with. It is returned in
97
+ # the response and any webhook events that refer to this verification.
97
98
  #
98
99
  # @return [String, nil]
99
100
  optional :correlation_id, String
100
101
 
101
102
  # @!method initialize(correlation_id: nil)
103
+ # Some parameter documentations has been truncated, see
104
+ # {PreludeSDK::Models::VerificationCreateParams::Metadata} for more details.
105
+ #
102
106
  # The metadata for this verification. This object will be returned with every
103
107
  # response or webhook sent that refers to this verification.
104
108
  #
105
- # @param correlation_id [String] A user-defined identifier to correlate this verification with.
109
+ # @param correlation_id [String] A user-defined identifier to correlate this verification with. It is returned in
106
110
  end
107
111
 
108
112
  class Options < PreludeSDK::Internal::Type::BaseModel
@@ -136,6 +140,12 @@ module PreludeSDK
136
140
  # @return [String, nil]
137
141
  optional :custom_code, String
138
142
 
143
+ # @!attribute integration
144
+ # The integration that triggered the verification.
145
+ #
146
+ # @return [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::Integration, nil]
147
+ optional :integration, enum: -> { PreludeSDK::VerificationCreateParams::Options::Integration }
148
+
139
149
  # @!attribute locale
140
150
  # A BCP-47 formatted locale string with the language the text message will be sent
141
151
  # to. If there's no locale set, the language will be determined by the country
@@ -145,27 +155,25 @@ module PreludeSDK
145
155
  # @return [String, nil]
146
156
  optional :locale, String
147
157
 
148
- # @!attribute method_
158
+ # @!attribute verification_method
149
159
  # The method used for verifying this phone number. The 'voice' option provides an
150
160
  # accessible alternative for visually impaired users by delivering the
151
161
  # verification code through a phone call rather than a text message. It also
152
- # allows verification of landline numbers that cannot receive SMS messages.
162
+ # allows verification of landline numbers that cannot receive SMS messages. The
163
+ # 'message' option explicitly requests message delivery (SMS, WhatsApp ...) and
164
+ # skips silent verification, useful for scenarios requiring direct user
165
+ # interaction.
153
166
  #
154
167
  # @return [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::Method, nil]
155
- optional :method_,
156
- enum: -> {
157
- PreludeSDK::VerificationCreateParams::Options::Method
158
- },
168
+ optional :verification_method,
169
+ enum: -> { PreludeSDK::VerificationCreateParams::Options::Method },
159
170
  api_name: :method
160
171
 
161
172
  # @!attribute preferred_channel
162
173
  # The preferred channel to be used in priority for verification.
163
174
  #
164
175
  # @return [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::PreferredChannel, nil]
165
- optional :preferred_channel,
166
- enum: -> {
167
- PreludeSDK::VerificationCreateParams::Options::PreferredChannel
168
- }
176
+ optional :preferred_channel, enum: -> { PreludeSDK::VerificationCreateParams::Options::PreferredChannel }
169
177
 
170
178
  # @!attribute sender_id
171
179
  # The Sender ID to use for this message. The Sender ID needs to be enabled by
@@ -187,7 +195,7 @@ module PreludeSDK
187
195
  # @return [Hash{Symbol=>String}, nil]
188
196
  optional :variables, PreludeSDK::Internal::Type::HashOf[String]
189
197
 
190
- # @!method initialize(app_realm: nil, callback_url: nil, code_size: nil, custom_code: nil, locale: nil, method_: nil, preferred_channel: nil, sender_id: nil, template_id: nil, variables: nil)
198
+ # @!method initialize(app_realm: nil, callback_url: nil, code_size: nil, custom_code: nil, integration: nil, locale: nil, verification_method: nil, preferred_channel: nil, sender_id: nil, template_id: nil, variables: nil)
191
199
  # Some parameter documentations has been truncated, see
192
200
  # {PreludeSDK::Models::VerificationCreateParams::Options} for more details.
193
201
  #
@@ -201,9 +209,11 @@ module PreludeSDK
201
209
  #
202
210
  # @param custom_code [String] The custom code to use for OTP verification. To use the custom code feature, con
203
211
  #
212
+ # @param integration [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::Integration] The integration that triggered the verification.
213
+ #
204
214
  # @param locale [String] A BCP-47 formatted locale string with the language the text message will be sent
205
215
  #
206
- # @param method_ [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::Method] The method used for verifying this phone number. The 'voice' option provides an
216
+ # @param verification_method [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::Method] The method used for verifying this phone number. The 'voice' option provides an
207
217
  #
208
218
  # @param preferred_channel [Symbol, PreludeSDK::Models::VerificationCreateParams::Options::PreferredChannel] The preferred channel to be used in priority for verification.
209
219
  #
@@ -223,7 +233,9 @@ module PreludeSDK
223
233
  required :platform, enum: -> { PreludeSDK::VerificationCreateParams::Options::AppRealm::Platform }
224
234
 
225
235
  # @!attribute value
226
- # The Android SMS Retriever API hash code that identifies your app.
236
+ # The Android SMS Retriever API hash code that identifies your app. For more
237
+ # information, see
238
+ # [Google documentation](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string).
227
239
  #
228
240
  # @return [String]
229
241
  required :value, String
@@ -254,17 +266,34 @@ module PreludeSDK
254
266
  end
255
267
  end
256
268
 
269
+ # The integration that triggered the verification.
270
+ #
271
+ # @see PreludeSDK::Models::VerificationCreateParams::Options#integration
272
+ module Integration
273
+ extend PreludeSDK::Internal::Type::Enum
274
+
275
+ AUTH0 = :auth0
276
+ SUPABASE = :supabase
277
+
278
+ # @!method self.values
279
+ # @return [Array<Symbol>]
280
+ end
281
+
257
282
  # The method used for verifying this phone number. The 'voice' option provides an
258
283
  # accessible alternative for visually impaired users by delivering the
259
284
  # verification code through a phone call rather than a text message. It also
260
- # allows verification of landline numbers that cannot receive SMS messages.
285
+ # allows verification of landline numbers that cannot receive SMS messages. The
286
+ # 'message' option explicitly requests message delivery (SMS, WhatsApp ...) and
287
+ # skips silent verification, useful for scenarios requiring direct user
288
+ # interaction.
261
289
  #
262
- # @see PreludeSDK::Models::VerificationCreateParams::Options#method_
290
+ # @see PreludeSDK::Models::VerificationCreateParams::Options#verification_method
263
291
  module Method
264
292
  extend PreludeSDK::Internal::Type::Enum
265
293
 
266
294
  AUTO = :auto
267
295
  VOICE = :voice
296
+ MESSAGE = :message
268
297
 
269
298
  # @!method self.values
270
299
  # @return [Array<Symbol>]
@@ -282,8 +311,6 @@ module PreludeSDK
282
311
  VIBER = :viber
283
312
  ZALO = :zalo
284
313
  TELEGRAM = :telegram
285
- SILENT = :silent
286
- VOICE = :voice
287
314
 
288
315
  # @!method self.values
289
316
  # @return [Array<Symbol>]
@@ -330,6 +357,14 @@ module PreludeSDK
330
357
  # @return [Boolean, nil]
331
358
  optional :is_trusted_user, PreludeSDK::Internal::Type::Boolean
332
359
 
360
+ # @!attribute ja4_fingerprint
361
+ # The JA4 fingerprint observed for the connection. Prelude will infer it
362
+ # automatically when requests go through our client SDK (which uses Prelude's
363
+ # edge), but you can also provide it explicitly if you terminate TLS yourself.
364
+ #
365
+ # @return [String, nil]
366
+ optional :ja4_fingerprint, String
367
+
333
368
  # @!attribute os_version
334
369
  # The version of the user's device operating system.
335
370
  #
@@ -344,7 +379,7 @@ module PreludeSDK
344
379
  # @return [String, nil]
345
380
  optional :user_agent, String
346
381
 
347
- # @!method initialize(app_version: nil, device_id: nil, device_model: nil, device_platform: nil, ip: nil, is_trusted_user: nil, os_version: nil, user_agent: nil)
382
+ # @!method initialize(app_version: nil, device_id: nil, device_model: nil, device_platform: nil, ip: nil, is_trusted_user: nil, ja4_fingerprint: nil, os_version: nil, user_agent: nil)
348
383
  # Some parameter documentations has been truncated, see
349
384
  # {PreludeSDK::Models::VerificationCreateParams::Signals} for more details.
350
385
  #
@@ -363,6 +398,8 @@ module PreludeSDK
363
398
  #
364
399
  # @param is_trusted_user [Boolean] This signal should provide a higher level of trust, indicating that the user is
365
400
  #
401
+ # @param ja4_fingerprint [String] The JA4 fingerprint observed for the connection. Prelude will infer it automatic
402
+ #
366
403
  # @param os_version [String] The version of the user's device operating system.
367
404
  #
368
405
  # @param user_agent [String] The user agent of the user's device. If the individual fields (os_version, devic
@@ -10,11 +10,13 @@ module PreludeSDK
10
10
  # @return [String]
11
11
  required :id, String
12
12
 
13
- # @!attribute method_
13
+ # @!attribute verification_method
14
14
  # The method used for verifying this phone number.
15
15
  #
16
16
  # @return [Symbol, PreludeSDK::Models::VerificationCreateResponse::Method]
17
- required :method_, enum: -> { PreludeSDK::Models::VerificationCreateResponse::Method }, api_name: :method
17
+ required :verification_method,
18
+ enum: -> { PreludeSDK::Models::VerificationCreateResponse::Method },
19
+ api_name: :method
18
20
 
19
21
  # @!attribute status
20
22
  # The status of the verification.
@@ -25,8 +27,9 @@ module PreludeSDK
25
27
  # @!attribute channels
26
28
  # The ordered sequence of channels to be used for verification
27
29
  #
28
- # @return [Array<String>, nil]
29
- optional :channels, PreludeSDK::Internal::Type::ArrayOf[String]
30
+ # @return [Array<Symbol, PreludeSDK::Models::VerificationCreateResponse::Channel>, nil]
31
+ optional :channels,
32
+ -> { PreludeSDK::Internal::Type::ArrayOf[enum: PreludeSDK::Models::VerificationCreateResponse::Channel] }
30
33
 
31
34
  # @!attribute metadata
32
35
  # The metadata for this verification.
@@ -38,6 +41,19 @@ module PreludeSDK
38
41
  # The reason why the verification was blocked. Only present when status is
39
42
  # "blocked".
40
43
  #
44
+ # - `expired_signature` - The signature of the SDK signals is expired. They should
45
+ # be sent within the hour following their collection.
46
+ # - `in_block_list` - The phone number is part of the configured block list.
47
+ # - `invalid_phone_line` - The phone number is not a valid line number (e.g.
48
+ # landline).
49
+ # - `invalid_phone_number` - The phone number is not a valid phone number (e.g.
50
+ # unallocated range).
51
+ # - `invalid_signature` - The signature of the SDK signals is invalid.
52
+ # - `repeated_attempts` - The phone number has made too many verification
53
+ # attempts.
54
+ # - `suspicious` - The verification attempt was deemed suspicious by the
55
+ # anti-fraud system.
56
+ #
41
57
  # @return [Symbol, PreludeSDK::Models::VerificationCreateResponse::Reason, nil]
42
58
  optional :reason, enum: -> { PreludeSDK::Models::VerificationCreateResponse::Reason }
43
59
 
@@ -52,17 +68,17 @@ module PreludeSDK
52
68
  # @return [PreludeSDK::Models::VerificationCreateResponse::Silent, nil]
53
69
  optional :silent, -> { PreludeSDK::Models::VerificationCreateResponse::Silent }
54
70
 
55
- # @!method initialize(id:, method_:, status:, channels: nil, metadata: nil, reason: nil, request_id: nil, silent: nil)
71
+ # @!method initialize(id:, verification_method:, status:, channels: nil, metadata: nil, reason: nil, request_id: nil, silent: nil)
56
72
  # Some parameter documentations has been truncated, see
57
73
  # {PreludeSDK::Models::VerificationCreateResponse} for more details.
58
74
  #
59
75
  # @param id [String] The verification identifier.
60
76
  #
61
- # @param method_ [Symbol, PreludeSDK::Models::VerificationCreateResponse::Method] The method used for verifying this phone number.
77
+ # @param verification_method [Symbol, PreludeSDK::Models::VerificationCreateResponse::Method] The method used for verifying this phone number.
62
78
  #
63
79
  # @param status [Symbol, PreludeSDK::Models::VerificationCreateResponse::Status] The status of the verification.
64
80
  #
65
- # @param channels [Array<String>] The ordered sequence of channels to be used for verification
81
+ # @param channels [Array<Symbol, PreludeSDK::Models::VerificationCreateResponse::Channel>] The ordered sequence of channels to be used for verification
66
82
  #
67
83
  # @param metadata [PreludeSDK::Models::VerificationCreateResponse::Metadata] The metadata for this verification.
68
84
  #
@@ -74,10 +90,11 @@ module PreludeSDK
74
90
 
75
91
  # The method used for verifying this phone number.
76
92
  #
77
- # @see PreludeSDK::Models::VerificationCreateResponse#method_
93
+ # @see PreludeSDK::Models::VerificationCreateResponse#verification_method
78
94
  module Method
79
95
  extend PreludeSDK::Internal::Type::Enum
80
96
 
97
+ EMAIL = :email
81
98
  MESSAGE = :message
82
99
  SILENT = :silent
83
100
  VOICE = :voice
@@ -100,31 +117,67 @@ module PreludeSDK
100
117
  # @return [Array<Symbol>]
101
118
  end
102
119
 
120
+ module Channel
121
+ extend PreludeSDK::Internal::Type::Enum
122
+
123
+ RCS = :rcs
124
+ SILENT = :silent
125
+ SMS = :sms
126
+ TELEGRAM = :telegram
127
+ VIBER = :viber
128
+ VOICE = :voice
129
+ WHATSAPP = :whatsapp
130
+ ZALO = :zalo
131
+
132
+ # @!method self.values
133
+ # @return [Array<Symbol>]
134
+ end
135
+
103
136
  # @see PreludeSDK::Models::VerificationCreateResponse#metadata
104
137
  class Metadata < PreludeSDK::Internal::Type::BaseModel
105
138
  # @!attribute correlation_id
139
+ # A user-defined identifier to correlate this verification with. It is returned in
140
+ # the response and any webhook events that refer to this verification.
106
141
  #
107
142
  # @return [String, nil]
108
143
  optional :correlation_id, String
109
144
 
110
145
  # @!method initialize(correlation_id: nil)
146
+ # Some parameter documentations has been truncated, see
147
+ # {PreludeSDK::Models::VerificationCreateResponse::Metadata} for more details.
148
+ #
111
149
  # The metadata for this verification.
112
150
  #
113
- # @param correlation_id [String]
151
+ # @param correlation_id [String] A user-defined identifier to correlate this verification with. It is returned in
114
152
  end
115
153
 
116
154
  # The reason why the verification was blocked. Only present when status is
117
155
  # "blocked".
118
156
  #
157
+ # - `expired_signature` - The signature of the SDK signals is expired. They should
158
+ # be sent within the hour following their collection.
159
+ # - `in_block_list` - The phone number is part of the configured block list.
160
+ # - `invalid_phone_line` - The phone number is not a valid line number (e.g.
161
+ # landline).
162
+ # - `invalid_phone_number` - The phone number is not a valid phone number (e.g.
163
+ # unallocated range).
164
+ # - `invalid_signature` - The signature of the SDK signals is invalid.
165
+ # - `repeated_attempts` - The phone number has made too many verification
166
+ # attempts.
167
+ # - `suspicious` - The verification attempt was deemed suspicious by the
168
+ # anti-fraud system.
169
+ #
119
170
  # @see PreludeSDK::Models::VerificationCreateResponse#reason
120
171
  module Reason
121
172
  extend PreludeSDK::Internal::Type::Enum
122
173
 
123
- SUSPICIOUS = :suspicious
124
- REPEATED_ATTEMPTS = :repeated_attempts
174
+ EXPIRED_SIGNATURE = :expired_signature
175
+ IN_BLOCK_LIST = :in_block_list
125
176
  INVALID_PHONE_LINE = :invalid_phone_line
126
177
  INVALID_PHONE_NUMBER = :invalid_phone_number
127
- IN_BLOCK_LIST = :in_block_list
178
+ INVALID_SIGNATURE = :invalid_signature
179
+ REPEATED_ATTEMPTS = :repeated_attempts
180
+ SUSPICIOUS = :suspicious
128
181
 
129
182
  # @!method self.values
130
183
  # @return [Array<Symbol>]
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PreludeSDK
4
+ module Models
5
+ # @see PreludeSDK::Resources::VerificationManagement#delete_phone_number
6
+ class VerificationManagementDeletePhoneNumberParams < PreludeSDK::Internal::Type::BaseModel
7
+ extend PreludeSDK::Internal::Type::RequestParameters::Converter
8
+ include PreludeSDK::Internal::Type::RequestParameters
9
+
10
+ # @!attribute phone_number
11
+ # An E.164 formatted phone number to remove from the list.
12
+ #
13
+ # @return [String]
14
+ required :phone_number, String
15
+
16
+ # @!method initialize(phone_number:, request_options: {})
17
+ # @param phone_number [String] An E.164 formatted phone number to remove from the list.
18
+ #
19
+ # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
20
+
21
+ module Action
22
+ extend PreludeSDK::Internal::Type::Enum
23
+
24
+ ALLOW = :allow
25
+ BLOCK = :block
26
+
27
+ # @!method self.values
28
+ # @return [Array<Symbol>]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PreludeSDK
4
+ module Models
5
+ # @see PreludeSDK::Resources::VerificationManagement#delete_phone_number
6
+ class VerificationManagementDeletePhoneNumberResponse < PreludeSDK::Internal::Type::BaseModel
7
+ # @!attribute phone_number
8
+ # The E.164 formatted phone number that was removed from the list.
9
+ #
10
+ # @return [String]
11
+ required :phone_number, String
12
+
13
+ # @!method initialize(phone_number:)
14
+ # @param phone_number [String] The E.164 formatted phone number that was removed from the list.
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PreludeSDK
4
+ module Models
5
+ # @see PreludeSDK::Resources::VerificationManagement#list_phone_numbers
6
+ class VerificationManagementListPhoneNumbersParams < PreludeSDK::Internal::Type::BaseModel
7
+ extend PreludeSDK::Internal::Type::RequestParameters::Converter
8
+ include PreludeSDK::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
12
+
13
+ module Action
14
+ extend PreludeSDK::Internal::Type::Enum
15
+
16
+ ALLOW = :allow
17
+ BLOCK = :block
18
+
19
+ # @!method self.values
20
+ # @return [Array<Symbol>]
21
+ end
22
+ end
23
+ end
24
+ end