passageidentity 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +21 -0
  4. data/docs/generated/{GithubSocialConnection.md → AppleUserSocialConnection.md} +2 -2
  5. data/docs/generated/{GoogleSocialConnection.md → GithubUserSocialConnection.md} +2 -2
  6. data/docs/generated/GoogleUserSocialConnection.md +24 -0
  7. data/docs/generated/Link.md +18 -0
  8. data/docs/generated/ListPaginatedUsersItem.md +38 -0
  9. data/docs/generated/ListPaginatedUsersResponse.md +28 -0
  10. data/docs/generated/Model403Error.md +20 -0
  11. data/docs/generated/Nonce.md +18 -0
  12. data/docs/generated/PaginatedLinks.md +26 -0
  13. data/docs/generated/README.md +12 -6
  14. data/docs/generated/UserEventStatus.md +15 -0
  15. data/docs/generated/UserInfo.md +1 -1
  16. data/docs/generated/{UserEventInfo.md → UserRecentEvent.md} +6 -2
  17. data/docs/generated/UserSocialConnections.md +6 -4
  18. data/docs/generated/UsersApi.md +94 -0
  19. data/lib/openapi_client/api/users_api.rb +96 -0
  20. data/lib/openapi_client/models/{github_social_connection.rb → apple_user_social_connection.rb} +3 -3
  21. data/lib/openapi_client/models/{google_social_connection.rb → github_user_social_connection.rb} +3 -3
  22. data/lib/openapi_client/models/google_user_social_connection.rb +271 -0
  23. data/lib/openapi_client/models/link.rb +221 -0
  24. data/lib/openapi_client/models/list_paginated_users_item.rb +399 -0
  25. data/lib/openapi_client/models/list_paginated_users_response.rb +305 -0
  26. data/lib/openapi_client/models/magic_link_auth_method.rb +0 -7
  27. data/lib/openapi_client/models/model401_error.rb +2 -2
  28. data/lib/openapi_client/models/model403_error.rb +271 -0
  29. data/lib/openapi_client/models/nonce.rb +222 -0
  30. data/lib/openapi_client/models/otp_auth_method.rb +3 -10
  31. data/lib/openapi_client/models/paginated_links.rb +285 -0
  32. data/lib/openapi_client/models/passkeys_auth_method.rb +0 -7
  33. data/lib/openapi_client/models/ttl_display_unit.rb +1 -1
  34. data/lib/openapi_client/models/user_event_status.rb +40 -0
  35. data/lib/openapi_client/models/user_info.rb +1 -1
  36. data/lib/openapi_client/models/{user_event_info.rb → user_recent_event.rb} +54 -4
  37. data/lib/openapi_client/models/user_social_connections.rb +19 -10
  38. data/lib/openapi_client.rb +14 -6
  39. data/lib/passageidentity/user_api.rb +40 -0
  40. data/lib/passageidentity/version.rb +1 -1
  41. data/tests/user_api_test.rb +41 -0
  42. metadata +27 -14
  43. data/docs/generated/UpdateMagicLinkAuthMethod.md +0 -22
  44. data/docs/generated/UpdateOtpAuthMethod.md +0 -22
  45. data/docs/generated/UpdatePasskeysAuthMethod.md +0 -18
  46. /data/lib/{openapi_client/models → models}/update_magic_link_auth_method.rb +0 -0
  47. /data/lib/{openapi_client/models → models}/update_otp_auth_method.rb +0 -0
  48. /data/lib/{openapi_client/models → models}/update_passkeys_auth_method.rb +0 -0
@@ -0,0 +1,285 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class PaginatedLinks
18
+ attr_accessor :first
19
+
20
+ attr_accessor :last
21
+
22
+ attr_accessor :_next
23
+
24
+ attr_accessor :previous
25
+
26
+ attr_accessor :_self
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'first' => :'first',
32
+ :'last' => :'last',
33
+ :'_next' => :'next',
34
+ :'previous' => :'previous',
35
+ :'_self' => :'self'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'first' => :'Link',
48
+ :'last' => :'Link',
49
+ :'_next' => :'Link',
50
+ :'previous' => :'Link',
51
+ :'_self' => :'Link'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PaginatedLinks` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PaginatedLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'first')
77
+ self.first = attributes[:'first']
78
+ else
79
+ self.first = nil
80
+ end
81
+
82
+ if attributes.key?(:'last')
83
+ self.last = attributes[:'last']
84
+ else
85
+ self.last = nil
86
+ end
87
+
88
+ if attributes.key?(:'_next')
89
+ self._next = attributes[:'_next']
90
+ else
91
+ self._next = nil
92
+ end
93
+
94
+ if attributes.key?(:'previous')
95
+ self.previous = attributes[:'previous']
96
+ else
97
+ self.previous = nil
98
+ end
99
+
100
+ if attributes.key?(:'_self')
101
+ self._self = attributes[:'_self']
102
+ else
103
+ self._self = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @first.nil?
113
+ invalid_properties.push('invalid value for "first", first cannot be nil.')
114
+ end
115
+
116
+ if @last.nil?
117
+ invalid_properties.push('invalid value for "last", last cannot be nil.')
118
+ end
119
+
120
+ if @_next.nil?
121
+ invalid_properties.push('invalid value for "_next", _next cannot be nil.')
122
+ end
123
+
124
+ if @previous.nil?
125
+ invalid_properties.push('invalid value for "previous", previous cannot be nil.')
126
+ end
127
+
128
+ if @_self.nil?
129
+ invalid_properties.push('invalid value for "_self", _self cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ return false if @first.nil?
140
+ return false if @last.nil?
141
+ return false if @_next.nil?
142
+ return false if @previous.nil?
143
+ return false if @_self.nil?
144
+ true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ first == o.first &&
153
+ last == o.last &&
154
+ _next == o._next &&
155
+ previous == o.previous &&
156
+ _self == o._self
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [first, last, _next, previous, _self].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ transformed_hash = {}
178
+ openapi_types.each_pair do |key, type|
179
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = nil
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[attribute_map[key]].is_a?(Array)
185
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+ new(transformed_hash)
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def self._deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = OpenapiClient.const_get(type)
233
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+
285
+ end
@@ -42,13 +42,6 @@ module OpenapiClient
42
42
  ])
43
43
  end
44
44
 
45
- # List of class defined in allOf (OpenAPI v3)
46
- def self.openapi_all_of
47
- [
48
- :'UpdatePasskeysAuthMethod'
49
- ]
50
- end
51
-
52
45
  # Initializes the object
53
46
  # @param [Hash] attributes Model attributes in the form of hash
54
47
  def initialize(attributes = {})
@@ -35,7 +35,7 @@ module OpenapiClient
35
35
  # @param [String] The enum value in the form of the string
36
36
  # @return [String] The enum value
37
37
  def build_from_hash(value)
38
- return value if TtlDisplayUnit.all_vars.include?(value) || value == ""
38
+ return value if TtlDisplayUnit.all_vars.include?(value)
39
39
  raise "Invalid ENUM value #{value} for class #TtlDisplayUnit"
40
40
  end
41
41
  end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class UserEventStatus
18
+ COMPLETE = "complete".freeze
19
+ INCOMPLETE = "incomplete".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [COMPLETE, INCOMPLETE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if UserEventStatus.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #UserEventStatus"
38
+ end
39
+ end
40
+ end
@@ -108,7 +108,7 @@ module OpenapiClient
108
108
  :'login_count' => :'Integer',
109
109
  :'phone' => :'String',
110
110
  :'phone_verified' => :'Boolean',
111
- :'recent_events' => :'Array<UserEventInfo>',
111
+ :'recent_events' => :'Array<UserRecentEvent>',
112
112
  :'social_connections' => :'UserSocialConnections',
113
113
  :'status' => :'UserStatus',
114
114
  :'updated_at' => :'Time',
@@ -14,23 +14,51 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- class UserEventInfo
17
+ class UserRecentEvent
18
18
  attr_accessor :created_at
19
19
 
20
+ attr_accessor :completed_at
21
+
20
22
  attr_accessor :id
21
23
 
22
24
  attr_accessor :ip_addr
23
25
 
26
+ attr_accessor :status
27
+
24
28
  attr_accessor :type
25
29
 
26
30
  attr_accessor :user_agent
27
31
 
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
28
54
  # Attribute mapping from ruby-style variable name to JSON key.
29
55
  def self.attribute_map
30
56
  {
31
57
  :'created_at' => :'created_at',
58
+ :'completed_at' => :'completed_at',
32
59
  :'id' => :'id',
33
60
  :'ip_addr' => :'ip_addr',
61
+ :'status' => :'status',
34
62
  :'type' => :'type',
35
63
  :'user_agent' => :'user_agent'
36
64
  }
@@ -45,8 +73,10 @@ module OpenapiClient
45
73
  def self.openapi_types
46
74
  {
47
75
  :'created_at' => :'Time',
76
+ :'completed_at' => :'Time',
48
77
  :'id' => :'String',
49
78
  :'ip_addr' => :'String',
79
+ :'status' => :'UserEventStatus',
50
80
  :'type' => :'String',
51
81
  :'user_agent' => :'String'
52
82
  }
@@ -55,6 +85,7 @@ module OpenapiClient
55
85
  # List of attributes with nullable: true
56
86
  def self.openapi_nullable
57
87
  Set.new([
88
+ :'completed_at',
58
89
  ])
59
90
  end
60
91
 
@@ -62,13 +93,13 @@ module OpenapiClient
62
93
  # @param [Hash] attributes Model attributes in the form of hash
63
94
  def initialize(attributes = {})
64
95
  if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UserEventInfo` initialize method"
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UserRecentEvent` initialize method"
66
97
  end
67
98
 
68
99
  # check to see if the attribute exists and convert string to symbol for hash key
69
100
  attributes = attributes.each_with_object({}) { |(k, v), h|
70
101
  if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UserEventInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UserRecentEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
103
  end
73
104
  h[k.to_sym] = v
74
105
  }
@@ -79,6 +110,12 @@ module OpenapiClient
79
110
  self.created_at = nil
80
111
  end
81
112
 
113
+ if attributes.key?(:'completed_at')
114
+ self.completed_at = attributes[:'completed_at']
115
+ else
116
+ self.completed_at = nil
117
+ end
118
+
82
119
  if attributes.key?(:'id')
83
120
  self.id = attributes[:'id']
84
121
  else
@@ -91,6 +128,12 @@ module OpenapiClient
91
128
  self.ip_addr = nil
92
129
  end
93
130
 
131
+ if attributes.key?(:'status')
132
+ self.status = attributes[:'status']
133
+ else
134
+ self.status = nil
135
+ end
136
+
94
137
  if attributes.key?(:'type')
95
138
  self.type = attributes[:'type']
96
139
  else
@@ -121,6 +164,10 @@ module OpenapiClient
121
164
  invalid_properties.push('invalid value for "ip_addr", ip_addr cannot be nil.')
122
165
  end
123
166
 
167
+ if @status.nil?
168
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
169
+ end
170
+
124
171
  if @type.nil?
125
172
  invalid_properties.push('invalid value for "type", type cannot be nil.')
126
173
  end
@@ -139,6 +186,7 @@ module OpenapiClient
139
186
  return false if @created_at.nil?
140
187
  return false if @id.nil?
141
188
  return false if @ip_addr.nil?
189
+ return false if @status.nil?
142
190
  return false if @type.nil?
143
191
  return false if @user_agent.nil?
144
192
  true
@@ -150,8 +198,10 @@ module OpenapiClient
150
198
  return true if self.equal?(o)
151
199
  self.class == o.class &&
152
200
  created_at == o.created_at &&
201
+ completed_at == o.completed_at &&
153
202
  id == o.id &&
154
203
  ip_addr == o.ip_addr &&
204
+ status == o.status &&
155
205
  type == o.type &&
156
206
  user_agent == o.user_agent
157
207
  end
@@ -165,7 +215,7 @@ module OpenapiClient
165
215
  # Calculates hash code according to all attributes.
166
216
  # @return [Integer] Hash code
167
217
  def hash
168
- [created_at, id, ip_addr, type, user_agent].hash
218
+ [created_at, completed_at, id, ip_addr, status, type, user_agent].hash
169
219
  end
170
220
 
171
221
  # Builds the object from hash
@@ -15,15 +15,18 @@ require 'time'
15
15
 
16
16
  module OpenapiClient
17
17
  class UserSocialConnections
18
- attr_accessor :google
18
+ attr_accessor :apple
19
19
 
20
20
  attr_accessor :github
21
21
 
22
+ attr_accessor :google
23
+
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
- :'google' => :'google',
26
- :'github' => :'github'
27
+ :'apple' => :'apple',
28
+ :'github' => :'github',
29
+ :'google' => :'google'
27
30
  }
28
31
  end
29
32
 
@@ -35,8 +38,9 @@ module OpenapiClient
35
38
  # Attribute type mapping.
36
39
  def self.openapi_types
37
40
  {
38
- :'google' => :'GoogleSocialConnection',
39
- :'github' => :'GithubSocialConnection'
41
+ :'apple' => :'AppleUserSocialConnection',
42
+ :'github' => :'GithubUserSocialConnection',
43
+ :'google' => :'GoogleUserSocialConnection'
40
44
  }
41
45
  end
42
46
 
@@ -61,13 +65,17 @@ module OpenapiClient
61
65
  h[k.to_sym] = v
62
66
  }
63
67
 
64
- if attributes.key?(:'google')
65
- self.google = attributes[:'google']
68
+ if attributes.key?(:'apple')
69
+ self.apple = attributes[:'apple']
66
70
  end
67
71
 
68
72
  if attributes.key?(:'github')
69
73
  self.github = attributes[:'github']
70
74
  end
75
+
76
+ if attributes.key?(:'google')
77
+ self.google = attributes[:'google']
78
+ end
71
79
  end
72
80
 
73
81
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -90,8 +98,9 @@ module OpenapiClient
90
98
  def ==(o)
91
99
  return true if self.equal?(o)
92
100
  self.class == o.class &&
93
- google == o.google &&
94
- github == o.github
101
+ apple == o.apple &&
102
+ github == o.github &&
103
+ google == o.google
95
104
  end
96
105
 
97
106
  # @see the `==` method
@@ -103,7 +112,7 @@ module OpenapiClient
103
112
  # Calculates hash code according to all attributes.
104
113
  # @return [Integer] Hash code
105
114
  def hash
106
- [google, github].hash
115
+ [apple, github, google].hash
107
116
  end
108
117
 
109
118
  # Builds the object from hash
@@ -19,16 +19,20 @@ require_relative 'openapi_client/configuration'
19
19
  # Models
20
20
  require_relative 'openapi_client/models/app_info'
21
21
  require_relative 'openapi_client/models/app_response'
22
+ require_relative 'openapi_client/models/apple_user_social_connection'
22
23
  require_relative 'openapi_client/models/auth_methods'
23
24
  require_relative 'openapi_client/models/create_magic_link_request'
24
25
  require_relative 'openapi_client/models/create_user_request'
25
26
  require_relative 'openapi_client/models/element_customization'
26
27
  require_relative 'openapi_client/models/font_family'
27
- require_relative 'openapi_client/models/github_social_connection'
28
- require_relative 'openapi_client/models/google_social_connection'
28
+ require_relative 'openapi_client/models/github_user_social_connection'
29
+ require_relative 'openapi_client/models/google_user_social_connection'
29
30
  require_relative 'openapi_client/models/layout_config'
30
31
  require_relative 'openapi_client/models/layouts'
32
+ require_relative 'openapi_client/models/link'
31
33
  require_relative 'openapi_client/models/list_devices_response'
34
+ require_relative 'openapi_client/models/list_paginated_users_item'
35
+ require_relative 'openapi_client/models/list_paginated_users_response'
32
36
  require_relative 'openapi_client/models/magic_link'
33
37
  require_relative 'openapi_client/models/magic_link_auth_method'
34
38
  require_relative 'openapi_client/models/magic_link_channel'
@@ -36,20 +40,24 @@ require_relative 'openapi_client/models/magic_link_response'
36
40
  require_relative 'openapi_client/models/magic_link_type'
37
41
  require_relative 'openapi_client/models/model400_error'
38
42
  require_relative 'openapi_client/models/model401_error'
43
+ require_relative 'openapi_client/models/model403_error'
39
44
  require_relative 'openapi_client/models/model404_error'
40
45
  require_relative 'openapi_client/models/model500_error'
46
+ require_relative 'openapi_client/models/nonce'
41
47
  require_relative 'openapi_client/models/otp_auth_method'
48
+ require_relative 'openapi_client/models/paginated_links'
42
49
  require_relative 'openapi_client/models/passkeys_auth_method'
43
50
  require_relative 'openapi_client/models/technologies'
44
51
  require_relative 'openapi_client/models/ttl_display_unit'
45
- require_relative 'openapi_client/models/update_magic_link_auth_method'
46
- require_relative 'openapi_client/models/update_otp_auth_method'
47
- require_relative 'openapi_client/models/update_passkeys_auth_method'
52
+ require_relative 'models/update_magic_link_auth_method'
53
+ require_relative 'models/update_otp_auth_method'
54
+ require_relative 'models/update_passkeys_auth_method'
48
55
  require_relative 'openapi_client/models/update_user_request'
49
- require_relative 'openapi_client/models/user_event_info'
56
+ require_relative 'openapi_client/models/user_event_status'
50
57
  require_relative 'openapi_client/models/user_info'
51
58
  require_relative 'openapi_client/models/user_metadata_field'
52
59
  require_relative 'openapi_client/models/user_metadata_field_type'
60
+ require_relative 'openapi_client/models/user_recent_event'
53
61
  require_relative 'openapi_client/models/user_response'
54
62
  require_relative 'openapi_client/models/user_social_connections'
55
63
  require_relative 'openapi_client/models/user_status'
@@ -42,6 +42,40 @@ module Passage
42
42
  end
43
43
  end
44
44
 
45
+ def get_by_identifier(user_identifier:)
46
+ identifier_exists?(user_identifier)
47
+
48
+ begin
49
+ @req_opts[:limit] = 1
50
+ @req_opts[:identifier] = user_identifier.downcase
51
+ response = @user_client.list_paginated_users(@app_id, @req_opts)
52
+ users = response.users
53
+
54
+ if users.length() == 0
55
+ raise PassageError.new(
56
+ message: "Passage User with identifer \"#{user_identifier}\" does not exist",
57
+ status_code: 404,
58
+ body: "user_not_found"
59
+ )
60
+ end
61
+ return get(user_id: users.first().id)
62
+ rescue Faraday::Error => e
63
+ if e.is_a? Faraday::ResourceNotFound
64
+ raise PassageError.new(
65
+ message: "Passage User with identifer \"#{user_identifier}\" does not exist",
66
+ status_code: e.response[:status],
67
+ body: e.response[:body]
68
+ )
69
+ else
70
+ raise PassageError.new(
71
+ message: "failed to get Passage User.",
72
+ status_code: e.response[:status],
73
+ body: e.response[:body]
74
+ )
75
+ end
76
+ end
77
+ end
78
+
45
79
  def activate(user_id:)
46
80
  user_exists?(user_id)
47
81
 
@@ -210,6 +244,12 @@ module Passage
210
244
  end
211
245
  end
212
246
 
247
+ def identifier_exists?(identifier)
248
+ if identifier.to_s.empty?
249
+ raise PassageError.new(message: "must supply a valid identifier")
250
+ end
251
+ end
252
+
213
253
  def device_exists?(device_id)
214
254
  if device_id.to_s.empty?
215
255
  raise PassageError.new(message: "must supply a valid device_id")