kinde_sdk 1.6.6 → 1.7.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/kinde_sdk/auth_controller.rb +96 -13
  3. data/kinde_api/lib/kinde_api/api/frontend/billing_api.rb +148 -0
  4. data/kinde_api/lib/kinde_api/api/frontend/feature_flags_api.rb +85 -0
  5. data/kinde_api/lib/kinde_api/api/frontend/o_auth_api.rb +241 -0
  6. data/kinde_api/lib/kinde_api/api/frontend/permissions_api.rb +85 -0
  7. data/kinde_api/lib/kinde_api/api/frontend/properties_api.rb +85 -0
  8. data/kinde_api/lib/kinde_api/api/frontend/roles_api.rb +85 -0
  9. data/kinde_api/lib/kinde_api/api/frontend/self_serve_portal_api.rb +89 -0
  10. data/kinde_api/lib/kinde_api/models/frontend/error.rb +230 -0
  11. data/kinde_api/lib/kinde_api/models/frontend/error_response.rb +221 -0
  12. data/kinde_api/lib/kinde_api/models/frontend/get_entitlement_response.rb +228 -0
  13. data/kinde_api/lib/kinde_api/models/frontend/get_entitlement_response_data.rb +229 -0
  14. data/kinde_api/lib/kinde_api/models/frontend/get_entitlement_response_data_entitlement.rb +295 -0
  15. data/kinde_api/lib/kinde_api/models/frontend/get_entitlements_response.rb +228 -0
  16. data/kinde_api/lib/kinde_api/models/frontend/get_entitlements_response_data.rb +244 -0
  17. data/kinde_api/lib/kinde_api/models/frontend/get_entitlements_response_data_entitlements_inner.rb +294 -0
  18. data/kinde_api/lib/kinde_api/models/frontend/get_entitlements_response_data_plans_inner.rb +240 -0
  19. data/kinde_api/lib/kinde_api/models/frontend/get_entitlements_response_metadata.rb +230 -0
  20. data/kinde_api/lib/kinde_api/models/frontend/get_feature_flags_response.rb +219 -0
  21. data/kinde_api/lib/kinde_api/models/frontend/get_feature_flags_response_data.rb +222 -0
  22. data/kinde_api/lib/kinde_api/models/frontend/get_feature_flags_response_data_feature_flags_inner.rb +259 -0
  23. data/kinde_api/lib/kinde_api/models/frontend/get_feature_flags_response_data_feature_flags_inner_value.rb +108 -0
  24. data/kinde_api/lib/kinde_api/models/frontend/get_user_permissions_response.rb +228 -0
  25. data/kinde_api/lib/kinde_api/models/frontend/get_user_permissions_response_data.rb +232 -0
  26. data/kinde_api/lib/kinde_api/models/frontend/get_user_permissions_response_data_permissions_inner.rb +240 -0
  27. data/kinde_api/lib/kinde_api/models/frontend/get_user_permissions_response_metadata.rb +230 -0
  28. data/kinde_api/lib/kinde_api/models/frontend/get_user_properties_response.rb +228 -0
  29. data/kinde_api/lib/kinde_api/models/frontend/get_user_properties_response_data.rb +222 -0
  30. data/kinde_api/lib/kinde_api/models/frontend/get_user_properties_response_data_properties_inner.rb +249 -0
  31. data/kinde_api/lib/kinde_api/models/frontend/get_user_properties_response_data_properties_inner_value.rb +107 -0
  32. data/kinde_api/lib/kinde_api/models/frontend/get_user_properties_response_metadata.rb +230 -0
  33. data/kinde_api/lib/kinde_api/models/frontend/get_user_roles_response.rb +228 -0
  34. data/kinde_api/lib/kinde_api/models/frontend/get_user_roles_response_data.rb +232 -0
  35. data/kinde_api/lib/kinde_api/models/frontend/get_user_roles_response_data_roles_inner.rb +240 -0
  36. data/kinde_api/lib/kinde_api/models/frontend/get_user_roles_response_metadata.rb +230 -0
  37. data/kinde_api/lib/kinde_api/models/frontend/portal_link.rb +220 -0
  38. data/kinde_api/lib/kinde_api/models/frontend/token_error_response.rb +230 -0
  39. data/kinde_api/lib/kinde_api/models/frontend/token_introspect.rb +262 -0
  40. data/kinde_api/lib/kinde_api/models/frontend/user_profile_v2.rb +323 -0
  41. data/kinde_api/lib/kinde_api.rb +28 -0
  42. data/lib/kinde_sdk/client/entitlements.rb +86 -0
  43. data/lib/kinde_sdk/client/feature_flags.rb +246 -10
  44. data/lib/kinde_sdk/client/permissions.rb +197 -6
  45. data/lib/kinde_sdk/client/roles.rb +218 -0
  46. data/lib/kinde_sdk/client.rb +242 -3
  47. data/lib/kinde_sdk/configuration.rb +2 -0
  48. data/lib/kinde_sdk/errors.rb +7 -0
  49. data/lib/kinde_sdk/internal/frontend_client.rb +111 -0
  50. data/lib/kinde_sdk/version.rb +1 -1
  51. data/lib/kinde_sdk.rb +9 -2
  52. metadata +54 -12
@@ -0,0 +1,295 @@
1
+ =begin
2
+ #Kinde Account API
3
+
4
+ # Provides endpoints to operate on an authenticated user. ## Intro ## How to use 1. Get a user access token - this can be obtained when a user signs in via the methods you've setup in Kinde (e.g. Google, passwordless, etc). 2. Call one of the endpoints below using the user access token in the Authorization header as a Bearer token. Typically, you can use the `getToken` command in the relevant SDK.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@kinde.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module KindeApi::Frontend
17
+ # The entitlement data
18
+ class GetEntitlementResponseDataEntitlement
19
+ # The friendly ID of an entitlement
20
+ attr_accessor :id
21
+
22
+ # The price charged if this is an entitlement for a fixed charged
23
+ attr_accessor :fixed_charge
24
+
25
+ # The name of the price associated with the entitlement
26
+ attr_accessor :price_name
27
+
28
+ # The price charged for this entitlement in cents
29
+ attr_accessor :unit_amount
30
+
31
+ # The key of the feature corresponding to this entitlement
32
+ attr_accessor :feature_key
33
+
34
+ # The name of the feature corresponding to this entitlement
35
+ attr_accessor :feature_name
36
+
37
+ # The maximum number of units of the feature the customer is entitled to
38
+ attr_accessor :entitlement_limit_max
39
+
40
+ # The minimum number of units of the feature the customer is entitled to
41
+ attr_accessor :entitlement_limit_min
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'id' => :'id',
47
+ :'fixed_charge' => :'fixed_charge',
48
+ :'price_name' => :'price_name',
49
+ :'unit_amount' => :'unit_amount',
50
+ :'feature_key' => :'feature_key',
51
+ :'feature_name' => :'feature_name',
52
+ :'entitlement_limit_max' => :'entitlement_limit_max',
53
+ :'entitlement_limit_min' => :'entitlement_limit_min'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'id' => :'String',
66
+ :'fixed_charge' => :'Integer',
67
+ :'price_name' => :'String',
68
+ :'unit_amount' => :'Integer',
69
+ :'feature_key' => :'String',
70
+ :'feature_name' => :'String',
71
+ :'entitlement_limit_max' => :'Integer',
72
+ :'entitlement_limit_min' => :'Integer'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'fixed_charge',
80
+ :'unit_amount',
81
+ :'entitlement_limit_max',
82
+ :'entitlement_limit_min'
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KindeApi::Frontend::GetEntitlementResponseDataEntitlement` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KindeApi::Frontend::GetEntitlementResponseDataEntitlement`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'fixed_charge')
106
+ self.fixed_charge = attributes[:'fixed_charge']
107
+ end
108
+
109
+ if attributes.key?(:'price_name')
110
+ self.price_name = attributes[:'price_name']
111
+ end
112
+
113
+ if attributes.key?(:'unit_amount')
114
+ self.unit_amount = attributes[:'unit_amount']
115
+ end
116
+
117
+ if attributes.key?(:'feature_key')
118
+ self.feature_key = attributes[:'feature_key']
119
+ end
120
+
121
+ if attributes.key?(:'feature_name')
122
+ self.feature_name = attributes[:'feature_name']
123
+ end
124
+
125
+ if attributes.key?(:'entitlement_limit_max')
126
+ self.entitlement_limit_max = attributes[:'entitlement_limit_max']
127
+ end
128
+
129
+ if attributes.key?(:'entitlement_limit_min')
130
+ self.entitlement_limit_min = attributes[:'entitlement_limit_min']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
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
+ id == o.id &&
153
+ fixed_charge == o.fixed_charge &&
154
+ price_name == o.price_name &&
155
+ unit_amount == o.unit_amount &&
156
+ feature_key == o.feature_key &&
157
+ feature_name == o.feature_name &&
158
+ entitlement_limit_max == o.entitlement_limit_max &&
159
+ entitlement_limit_min == o.entitlement_limit_min
160
+ end
161
+
162
+ # @see the `==` method
163
+ # @param [Object] Object to be compared
164
+ def eql?(o)
165
+ self == o
166
+ end
167
+
168
+ # Calculates hash code according to all attributes.
169
+ # @return [Integer] Hash code
170
+ def hash
171
+ [id, fixed_charge, price_name, unit_amount, feature_key, feature_name, entitlement_limit_max, entitlement_limit_min].hash
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def self.build_from_hash(attributes)
178
+ new.build_from_hash(attributes)
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ attributes = attributes.transform_keys(&:to_sym)
187
+ self.class.openapi_types.each_pair do |key, type|
188
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
189
+ self.send("#{key}=", nil)
190
+ elsif type =~ /\AArray<(.*)>/i
191
+ # check to ensure the input is an array given that the attribute
192
+ # is documented as an array but the input is not
193
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
194
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
195
+ end
196
+ elsif !attributes[self.class.attribute_map[key]].nil?
197
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
198
+ end
199
+ end
200
+
201
+ self
202
+ end
203
+
204
+ # Deserializes the data based on type
205
+ # @param string type Data type
206
+ # @param string value Value to be deserialized
207
+ # @return [Object] Deserialized data
208
+ def _deserialize(type, value)
209
+ case type.to_sym
210
+ when :Time
211
+ Time.parse(value)
212
+ when :Date
213
+ Date.parse(value)
214
+ when :String
215
+ value.to_s
216
+ when :Integer
217
+ value.to_i
218
+ when :Float
219
+ value.to_f
220
+ when :Boolean
221
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
222
+ true
223
+ else
224
+ false
225
+ end
226
+ when :Object
227
+ # generic object (usually a Hash), return directly
228
+ value
229
+ when /\AArray<(?<inner_type>.+)>\z/
230
+ inner_type = Regexp.last_match[:inner_type]
231
+ value.map { |v| _deserialize(inner_type, v) }
232
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
233
+ k_type = Regexp.last_match[:k_type]
234
+ v_type = Regexp.last_match[:v_type]
235
+ {}.tap do |hash|
236
+ value.each do |k, v|
237
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
238
+ end
239
+ end
240
+ else # model
241
+ # models (e.g. Pet) or oneOf
242
+ klass = KindeFrontendApi.const_get(type)
243
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
244
+ end
245
+ end
246
+
247
+ # Returns the string representation of the object
248
+ # @return [String] String presentation of the object
249
+ def to_s
250
+ to_hash.to_s
251
+ end
252
+
253
+ # to_body is an alias to to_hash (backward compatibility)
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_body
256
+ to_hash
257
+ end
258
+
259
+ # Returns the object in the form of hash
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_hash
262
+ hash = {}
263
+ self.class.attribute_map.each_pair do |attr, param|
264
+ value = self.send(attr)
265
+ if value.nil?
266
+ is_nullable = self.class.openapi_nullable.include?(attr)
267
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
268
+ end
269
+
270
+ hash[param] = _to_hash(value)
271
+ end
272
+ hash
273
+ end
274
+
275
+ # Outputs non-array value in the form of hash
276
+ # For object, use to_hash. Otherwise, just return the value
277
+ # @param [Object] value Any valid value
278
+ # @return [Hash] Returns the value in the form of hash
279
+ def _to_hash(value)
280
+ if value.is_a?(Array)
281
+ value.compact.map { |v| _to_hash(v) }
282
+ elsif value.is_a?(Hash)
283
+ {}.tap do |hash|
284
+ value.each { |k, v| hash[k] = _to_hash(v) }
285
+ end
286
+ elsif value.respond_to? :to_hash
287
+ value.to_hash
288
+ else
289
+ value
290
+ end
291
+ end
292
+
293
+ end
294
+
295
+ end
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #Kinde Account API
3
+
4
+ # Provides endpoints to operate on an authenticated user. ## Intro ## How to use 1. Get a user access token - this can be obtained when a user signs in via the methods you've setup in Kinde (e.g. Google, passwordless, etc). 2. Call one of the endpoints below using the user access token in the Authorization header as a Bearer token. Typically, you can use the `getToken` command in the relevant SDK.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@kinde.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module KindeApi::Frontend
17
+ class GetEntitlementsResponse
18
+ attr_accessor :data
19
+
20
+ attr_accessor :metadata
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'metadata' => :'metadata'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'data' => :'GetEntitlementsResponseData',
39
+ :'metadata' => :'GetEntitlementsResponseMetadata'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KindeApi::Frontend::GetEntitlementsResponse` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KindeApi::Frontend::GetEntitlementsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'data')
65
+ self.data = attributes[:'data']
66
+ end
67
+
68
+ if attributes.key?(:'metadata')
69
+ self.metadata = attributes[:'metadata']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ data == o.data &&
92
+ metadata == o.metadata
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [data, metadata].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = KindeFrontendApi.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end