torii-backend 0.0.7 → 0.0.9

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/spec/server-v1.json +1 -1
  3. data/src/torii/backend/generated/lib/torii_backend_generated/api/invitations_api.rb +336 -0
  4. data/src/torii/backend/generated/lib/torii_backend_generated/api/server_impersonation_api.rb +96 -0
  5. data/src/torii/backend/generated/lib/torii_backend_generated/api/server_users_api.rb +4 -4
  6. data/src/torii/backend/generated/lib/torii_backend_generated/models/create_environment_invitation_server_request.rb +240 -0
  7. data/src/torii/backend/generated/lib/torii_backend_generated/models/create_user_request.rb +3 -3
  8. data/src/torii/backend/generated/lib/torii_backend_generated/models/cursor_page_response_environment_invitation_response.rb +206 -0
  9. data/src/torii/backend/generated/lib/torii_backend_generated/models/environment_invitation_response.rb +338 -0
  10. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_impersonation_token_request.rb +257 -0
  11. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_impersonation_token_response.rb +204 -0
  12. data/src/torii/backend/generated/lib/torii_backend_generated/models/server_user_search_request.rb +27 -3
  13. data/src/torii/backend/generated/lib/torii_backend_generated/models/update_user_metadata_request.rb +3 -3
  14. data/src/torii/backend/generated/lib/torii_backend_generated/models/update_user_request.rb +1 -1
  15. data/src/torii/backend/generated/lib/torii_backend_generated.rb +7 -0
  16. data/src/torii/backend/generated/spec/api/invitations_api_spec.rb +93 -0
  17. data/src/torii/backend/generated/spec/api/server_impersonation_api_spec.rb +48 -0
  18. data/src/torii/backend/generated/spec/models/create_environment_invitation_server_request_spec.rb +60 -0
  19. data/src/torii/backend/generated/spec/models/cursor_page_response_environment_invitation_response_spec.rb +48 -0
  20. data/src/torii/backend/generated/spec/models/environment_invitation_response_spec.rb +82 -0
  21. data/src/torii/backend/generated/spec/models/server_impersonation_token_request_spec.rb +48 -0
  22. data/src/torii/backend/generated/spec/models/server_impersonation_token_response_spec.rb +42 -0
  23. data/src/torii/backend/version.rb +1 -1
  24. metadata +16 -2
@@ -0,0 +1,338 @@
1
+ =begin
2
+ #Torii Backend API
3
+
4
+ #Server-to-server API (BAPI) for backend SDKs. Authenticated with a secret key (Bearer sk_live_* / sk_test_*).
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ToriiBackendGenerated
17
+ class EnvironmentInvitationResponse < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :environment_id
21
+
22
+ attr_accessor :email
23
+
24
+ attr_accessor :status
25
+
26
+ attr_accessor :expires_at
27
+
28
+ attr_accessor :created_at
29
+
30
+ attr_accessor :accepted_at
31
+
32
+ attr_accessor :revoked_at
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'id' => :'id',
60
+ :'environment_id' => :'environmentId',
61
+ :'email' => :'email',
62
+ :'status' => :'status',
63
+ :'expires_at' => :'expiresAt',
64
+ :'created_at' => :'createdAt',
65
+ :'accepted_at' => :'acceptedAt',
66
+ :'revoked_at' => :'revokedAt'
67
+ }
68
+ end
69
+
70
+ # Returns attribute mapping this model knows about
71
+ def self.acceptable_attribute_map
72
+ attribute_map
73
+ end
74
+
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ acceptable_attribute_map.values
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'id' => :'String',
84
+ :'environment_id' => :'String',
85
+ :'email' => :'String',
86
+ :'status' => :'String',
87
+ :'expires_at' => :'Time',
88
+ :'created_at' => :'Time',
89
+ :'accepted_at' => :'Time',
90
+ :'revoked_at' => :'Time'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ :'accepted_at',
98
+ :'revoked_at'
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::EnvironmentInvitationResponse` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ acceptable_attribute_map = self.class.acceptable_attribute_map
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!acceptable_attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::EnvironmentInvitationResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'id')
119
+ self.id = attributes[:'id']
120
+ else
121
+ self.id = nil
122
+ end
123
+
124
+ if attributes.key?(:'environment_id')
125
+ self.environment_id = attributes[:'environment_id']
126
+ else
127
+ self.environment_id = nil
128
+ end
129
+
130
+ if attributes.key?(:'email')
131
+ self.email = attributes[:'email']
132
+ else
133
+ self.email = nil
134
+ end
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ else
139
+ self.status = nil
140
+ end
141
+
142
+ if attributes.key?(:'expires_at')
143
+ self.expires_at = attributes[:'expires_at']
144
+ else
145
+ self.expires_at = nil
146
+ end
147
+
148
+ if attributes.key?(:'created_at')
149
+ self.created_at = attributes[:'created_at']
150
+ else
151
+ self.created_at = nil
152
+ end
153
+
154
+ if attributes.key?(:'accepted_at')
155
+ self.accepted_at = attributes[:'accepted_at']
156
+ end
157
+
158
+ if attributes.key?(:'revoked_at')
159
+ self.revoked_at = attributes[:'revoked_at']
160
+ end
161
+ end
162
+
163
+ # Show invalid properties with the reasons. Usually used together with valid?
164
+ # @return Array for valid properties with the reasons
165
+ def list_invalid_properties
166
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
167
+ invalid_properties = Array.new
168
+ if @id.nil?
169
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
170
+ end
171
+
172
+ if @environment_id.nil?
173
+ invalid_properties.push('invalid value for "environment_id", environment_id cannot be nil.')
174
+ end
175
+
176
+ if @email.nil?
177
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
178
+ end
179
+
180
+ if @status.nil?
181
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
182
+ end
183
+
184
+ if @expires_at.nil?
185
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
186
+ end
187
+
188
+ if @created_at.nil?
189
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
190
+ end
191
+
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ return false if @id.nil?
200
+ return false if @environment_id.nil?
201
+ return false if @email.nil?
202
+ return false if @status.nil?
203
+ status_validator = EnumAttributeValidator.new('String', ["PENDING", "ACCEPTED", "REVOKED", "EXPIRED"])
204
+ return false unless status_validator.valid?(@status)
205
+ return false if @expires_at.nil?
206
+ return false if @created_at.nil?
207
+ true
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] id Value to be assigned
212
+ def id=(id)
213
+ if id.nil?
214
+ fail ArgumentError, 'id cannot be nil'
215
+ end
216
+
217
+ @id = id
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] environment_id Value to be assigned
222
+ def environment_id=(environment_id)
223
+ if environment_id.nil?
224
+ fail ArgumentError, 'environment_id cannot be nil'
225
+ end
226
+
227
+ @environment_id = environment_id
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] email Value to be assigned
232
+ def email=(email)
233
+ if email.nil?
234
+ fail ArgumentError, 'email cannot be nil'
235
+ end
236
+
237
+ @email = email
238
+ end
239
+
240
+ # Custom attribute writer method checking allowed values (enum).
241
+ # @param [Object] status Object to be assigned
242
+ def status=(status)
243
+ validator = EnumAttributeValidator.new('String', ["PENDING", "ACCEPTED", "REVOKED", "EXPIRED"])
244
+ unless validator.valid?(status)
245
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
246
+ end
247
+ @status = status
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] expires_at Value to be assigned
252
+ def expires_at=(expires_at)
253
+ if expires_at.nil?
254
+ fail ArgumentError, 'expires_at cannot be nil'
255
+ end
256
+
257
+ @expires_at = expires_at
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] created_at Value to be assigned
262
+ def created_at=(created_at)
263
+ if created_at.nil?
264
+ fail ArgumentError, 'created_at cannot be nil'
265
+ end
266
+
267
+ @created_at = created_at
268
+ end
269
+
270
+ # Checks equality by comparing each attribute.
271
+ # @param [Object] Object to be compared
272
+ def ==(o)
273
+ return true if self.equal?(o)
274
+ self.class == o.class &&
275
+ id == o.id &&
276
+ environment_id == o.environment_id &&
277
+ email == o.email &&
278
+ status == o.status &&
279
+ expires_at == o.expires_at &&
280
+ created_at == o.created_at &&
281
+ accepted_at == o.accepted_at &&
282
+ revoked_at == o.revoked_at
283
+ end
284
+
285
+ # @see the `==` method
286
+ # @param [Object] Object to be compared
287
+ def eql?(o)
288
+ self == o
289
+ end
290
+
291
+ # Calculates hash code according to all attributes.
292
+ # @return [Integer] Hash code
293
+ def hash
294
+ [id, environment_id, email, status, expires_at, created_at, accepted_at, revoked_at].hash
295
+ end
296
+
297
+ # Builds the object from hash
298
+ # @param [Hash] attributes Model attributes in the form of hash
299
+ # @return [Object] Returns the model itself
300
+ def self.build_from_hash(attributes)
301
+ return nil unless attributes.is_a?(Hash)
302
+ attributes = attributes.transform_keys(&:to_sym)
303
+ transformed_hash = {}
304
+ openapi_types.each_pair do |key, type|
305
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
306
+ transformed_hash["#{key}"] = nil
307
+ elsif type =~ /\AArray<(.*)>/i
308
+ # check to ensure the input is an array given that the attribute
309
+ # is documented as an array but the input is not
310
+ if attributes[attribute_map[key]].is_a?(Array)
311
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
312
+ end
313
+ elsif !attributes[attribute_map[key]].nil?
314
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
315
+ end
316
+ end
317
+ new(transformed_hash)
318
+ end
319
+
320
+ # Returns the object in the form of hash
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_hash
323
+ hash = {}
324
+ self.class.attribute_map.each_pair do |attr, param|
325
+ value = self.send(attr)
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ end
337
+
338
+ end
@@ -0,0 +1,257 @@
1
+ =begin
2
+ #Torii Backend API
3
+
4
+ #Server-to-server API (BAPI) for backend SDKs. Authenticated with a secret key (Bearer sk_live_* / sk_test_*).
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ToriiBackendGenerated
17
+ # Body for minting an impersonation token.
18
+ class ServerImpersonationTokenRequest < ApiModelBase
19
+ # The principal the impersonation is on behalf of (recorded for accountability). Must be a user in this environment.
20
+ attr_accessor :actor_user_id
21
+
22
+ # Mandatory justification (GDPR purpose limitation); recorded in the audit log on mint and redeem.
23
+ attr_accessor :reason
24
+
25
+ # Optional post-redeem landing URL for the `url` redeem link; its origin must be in the environment's allowed origins. Omit to default to the environment's first non-wildcard allowed origin.
26
+ attr_accessor :redirect_url
27
+
28
+ # Optional token lifetime in seconds, 60..600. Omit for the 600s default.
29
+ attr_accessor :expires_in_seconds
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'actor_user_id' => :'actorUserId',
35
+ :'reason' => :'reason',
36
+ :'redirect_url' => :'redirectUrl',
37
+ :'expires_in_seconds' => :'expiresInSeconds'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'actor_user_id' => :'String',
55
+ :'reason' => :'String',
56
+ :'redirect_url' => :'String',
57
+ :'expires_in_seconds' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'redirect_url',
65
+ :'expires_in_seconds'
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ToriiBackendGenerated::ServerImpersonationTokenRequest` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ acceptable_attribute_map = self.class.acceptable_attribute_map
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!acceptable_attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ToriiBackendGenerated::ServerImpersonationTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'actor_user_id')
86
+ self.actor_user_id = attributes[:'actor_user_id']
87
+ else
88
+ self.actor_user_id = nil
89
+ end
90
+
91
+ if attributes.key?(:'reason')
92
+ self.reason = attributes[:'reason']
93
+ else
94
+ self.reason = nil
95
+ end
96
+
97
+ if attributes.key?(:'redirect_url')
98
+ self.redirect_url = attributes[:'redirect_url']
99
+ end
100
+
101
+ if attributes.key?(:'expires_in_seconds')
102
+ self.expires_in_seconds = attributes[:'expires_in_seconds']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
110
+ invalid_properties = Array.new
111
+ if @actor_user_id.nil?
112
+ invalid_properties.push('invalid value for "actor_user_id", actor_user_id cannot be nil.')
113
+ end
114
+
115
+ if @reason.nil?
116
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
117
+ end
118
+
119
+ if @reason.to_s.length > 500
120
+ invalid_properties.push('invalid value for "reason", the character length must be smaller than or equal to 500.')
121
+ end
122
+
123
+ if @reason.to_s.length < 0
124
+ invalid_properties.push('invalid value for "reason", the character length must be greater than or equal to 0.')
125
+ end
126
+
127
+ if !@expires_in_seconds.nil? && @expires_in_seconds > 600
128
+ invalid_properties.push('invalid value for "expires_in_seconds", must be smaller than or equal to 600.')
129
+ end
130
+
131
+ if !@expires_in_seconds.nil? && @expires_in_seconds < 60
132
+ invalid_properties.push('invalid value for "expires_in_seconds", must be greater than or equal to 60.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ warn '[DEPRECATED] the `valid?` method is obsolete'
142
+ return false if @actor_user_id.nil?
143
+ return false if @reason.nil?
144
+ return false if @reason.to_s.length > 500
145
+ return false if @reason.to_s.length < 0
146
+ return false if !@expires_in_seconds.nil? && @expires_in_seconds > 600
147
+ return false if !@expires_in_seconds.nil? && @expires_in_seconds < 60
148
+ true
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] actor_user_id Value to be assigned
153
+ def actor_user_id=(actor_user_id)
154
+ if actor_user_id.nil?
155
+ fail ArgumentError, 'actor_user_id cannot be nil'
156
+ end
157
+
158
+ @actor_user_id = actor_user_id
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] reason Value to be assigned
163
+ def reason=(reason)
164
+ if reason.nil?
165
+ fail ArgumentError, 'reason cannot be nil'
166
+ end
167
+
168
+ if reason.to_s.length > 500
169
+ fail ArgumentError, 'invalid value for "reason", the character length must be smaller than or equal to 500.'
170
+ end
171
+
172
+ if reason.to_s.length < 0
173
+ fail ArgumentError, 'invalid value for "reason", the character length must be greater than or equal to 0.'
174
+ end
175
+
176
+ @reason = reason
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] expires_in_seconds Value to be assigned
181
+ def expires_in_seconds=(expires_in_seconds)
182
+ if !expires_in_seconds.nil? && expires_in_seconds > 600
183
+ fail ArgumentError, 'invalid value for "expires_in_seconds", must be smaller than or equal to 600.'
184
+ end
185
+
186
+ if !expires_in_seconds.nil? && expires_in_seconds < 60
187
+ fail ArgumentError, 'invalid value for "expires_in_seconds", must be greater than or equal to 60.'
188
+ end
189
+
190
+ @expires_in_seconds = expires_in_seconds
191
+ end
192
+
193
+ # Checks equality by comparing each attribute.
194
+ # @param [Object] Object to be compared
195
+ def ==(o)
196
+ return true if self.equal?(o)
197
+ self.class == o.class &&
198
+ actor_user_id == o.actor_user_id &&
199
+ reason == o.reason &&
200
+ redirect_url == o.redirect_url &&
201
+ expires_in_seconds == o.expires_in_seconds
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Integer] Hash code
212
+ def hash
213
+ [actor_user_id, reason, redirect_url, expires_in_seconds].hash
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def self.build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ attributes = attributes.transform_keys(&:to_sym)
222
+ transformed_hash = {}
223
+ openapi_types.each_pair do |key, type|
224
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = nil
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[attribute_map[key]].is_a?(Array)
230
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
231
+ end
232
+ elsif !attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
234
+ end
235
+ end
236
+ new(transformed_hash)
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ end
256
+
257
+ end