permify 0.0.1 → 1.5.4

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 (309) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +6 -1
  3. data/README.md +241 -16
  4. data/Rakefile +7 -7
  5. data/generator/generate-sdk.sh +157 -0
  6. data/generator/openapi-generator-cli.jar +0 -0
  7. data/generator/openapi.json +3699 -0
  8. data/lib/permify/api/bundle_api.rb +238 -0
  9. data/lib/permify/api/data_api.rb +526 -0
  10. data/lib/permify/api/permission_api.rb +528 -0
  11. data/lib/permify/api/schema_api.rb +310 -0
  12. data/lib/permify/api/tenancy_api.rb +215 -0
  13. data/lib/permify/api/watch_api.rb +94 -0
  14. data/lib/permify/api_client.rb +394 -0
  15. data/lib/permify/api_error.rb +58 -0
  16. data/lib/permify/configuration.rb +298 -0
  17. data/lib/permify/models/abstract_type.rb +228 -0
  18. data/lib/permify/models/any.rb +216 -0
  19. data/lib/permify/models/argument.rb +215 -0
  20. data/lib/permify/models/attribute.rb +233 -0
  21. data/lib/permify/models/attribute_definition.rb +247 -0
  22. data/lib/permify/models/attribute_filter.rb +226 -0
  23. data/lib/permify/models/attribute_read_request_metadata.rb +216 -0
  24. data/lib/permify/models/attribute_read_response.rb +228 -0
  25. data/lib/permify/models/attribute_type.rb +46 -0
  26. data/lib/permify/models/bulk_check_body.rb +248 -0
  27. data/lib/permify/models/bundle_delete_body.rb +216 -0
  28. data/lib/permify/models/bundle_delete_response.rb +214 -0
  29. data/lib/permify/models/bundle_read_body.rb +214 -0
  30. data/lib/permify/models/bundle_read_response.rb +214 -0
  31. data/lib/permify/models/bundle_run_response.rb +216 -0
  32. data/lib/permify/models/bundle_write_body.rb +218 -0
  33. data/lib/permify/models/bundle_write_response.rb +218 -0
  34. data/lib/permify/models/check_body.rb +264 -0
  35. data/lib/permify/models/check_result.rb +40 -0
  36. data/lib/permify/models/checked_expr.rb +258 -0
  37. data/lib/permify/models/child.rb +224 -0
  38. data/lib/permify/models/component.rb +41 -0
  39. data/lib/permify/models/comprehension.rb +281 -0
  40. data/lib/permify/models/computed_attribute.rb +215 -0
  41. data/lib/permify/models/computed_user_set.rb +215 -0
  42. data/lib/permify/models/constant.rb +317 -0
  43. data/lib/permify/models/context.rb +240 -0
  44. data/lib/permify/models/create_list.rb +230 -0
  45. data/lib/permify/models/create_struct.rb +228 -0
  46. data/lib/permify/models/data_bundle.rb +240 -0
  47. data/lib/permify/models/data_change.rb +255 -0
  48. data/lib/permify/models/data_change_operation.rb +40 -0
  49. data/lib/permify/models/data_changes.rb +228 -0
  50. data/lib/permify/models/data_delete_body.rb +224 -0
  51. data/lib/permify/models/data_delete_response.rb +216 -0
  52. data/lib/permify/models/data_write_body.rb +239 -0
  53. data/lib/permify/models/data_write_request_metadata.rb +216 -0
  54. data/lib/permify/models/data_write_response.rb +216 -0
  55. data/lib/permify/models/delete_relationships_body.rb +214 -0
  56. data/lib/permify/models/entity.rb +224 -0
  57. data/lib/permify/models/entity_definition.rb +264 -0
  58. data/lib/permify/models/entity_definition_reference.rb +41 -0
  59. data/lib/permify/models/entity_filter.rb +226 -0
  60. data/lib/permify/models/entry.rb +254 -0
  61. data/lib/permify/models/expand_leaf.rb +233 -0
  62. data/lib/permify/models/expand_tree_node.rb +248 -0
  63. data/lib/permify/models/expand_tree_node_operation.rb +41 -0
  64. data/lib/permify/models/expr.rb +279 -0
  65. data/lib/permify/models/expr_call.rb +237 -0
  66. data/lib/permify/models/extension.rb +236 -0
  67. data/lib/permify/models/function_type.rb +227 -0
  68. data/lib/permify/models/ident.rb +216 -0
  69. data/lib/permify/models/leaf.rb +242 -0
  70. data/lib/permify/models/list_type.rb +215 -0
  71. data/lib/permify/models/lookup_entity_body.rb +285 -0
  72. data/lib/permify/models/lookup_entity_stream_body.rb +285 -0
  73. data/lib/permify/models/lookup_subject_body.rb +284 -0
  74. data/lib/permify/models/map_type.rb +224 -0
  75. data/lib/permify/models/partial_write_body.rb +225 -0
  76. data/lib/permify/models/partials.rb +238 -0
  77. data/lib/permify/models/permission_bulk_check_request_item.rb +233 -0
  78. data/lib/permify/models/permission_bulk_check_response.rb +218 -0
  79. data/lib/permify/models/permission_check_request_metadata.rb +236 -0
  80. data/lib/permify/models/permission_check_response.rb +246 -0
  81. data/lib/permify/models/permission_check_response_metadata.rb +216 -0
  82. data/lib/permify/models/permission_definition.rb +225 -0
  83. data/lib/permify/models/permission_expand_body.rb +255 -0
  84. data/lib/permify/models/permission_expand_request_metadata.rb +226 -0
  85. data/lib/permify/models/permission_expand_response.rb +215 -0
  86. data/lib/permify/models/permission_lookup_entity_request_metadata.rb +236 -0
  87. data/lib/permify/models/permission_lookup_entity_response.rb +228 -0
  88. data/lib/permify/models/permission_lookup_entity_stream_response.rb +226 -0
  89. data/lib/permify/models/permission_lookup_subject_request_metadata.rb +236 -0
  90. data/lib/permify/models/permission_lookup_subject_response.rb +228 -0
  91. data/lib/permify/models/permission_subject_permission_request_metadata.rb +246 -0
  92. data/lib/permify/models/permission_subject_permission_response.rb +218 -0
  93. data/lib/permify/models/primitive_type.rb +44 -0
  94. data/lib/permify/models/read_attributes_body.rb +244 -0
  95. data/lib/permify/models/read_relationships_body.rb +244 -0
  96. data/lib/permify/models/relation_definition.rb +228 -0
  97. data/lib/permify/models/relation_reference.rb +226 -0
  98. data/lib/permify/models/relationship_delete_response.rb +215 -0
  99. data/lib/permify/models/relationship_read_request_metadata.rb +216 -0
  100. data/lib/permify/models/relationship_read_response.rb +228 -0
  101. data/lib/permify/models/relationship_write_request_metadata.rb +214 -0
  102. data/lib/permify/models/relationship_write_response.rb +215 -0
  103. data/lib/permify/models/rewrite.rb +249 -0
  104. data/lib/permify/models/rewrite_operation.rb +41 -0
  105. data/lib/permify/models/rule_definition.rb +237 -0
  106. data/lib/permify/models/run_bundle_body.rb +228 -0
  107. data/lib/permify/models/schema_definition.rb +242 -0
  108. data/lib/permify/models/schema_definition_reference.rb +40 -0
  109. data/lib/permify/models/schema_list.rb +223 -0
  110. data/lib/permify/models/schema_list_body.rb +226 -0
  111. data/lib/permify/models/schema_list_response.rb +235 -0
  112. data/lib/permify/models/schema_partial_write_request_metadata.rb +216 -0
  113. data/lib/permify/models/schema_partial_write_response.rb +216 -0
  114. data/lib/permify/models/schema_read_body.rb +215 -0
  115. data/lib/permify/models/schema_read_request_metadata.rb +216 -0
  116. data/lib/permify/models/schema_read_response.rb +215 -0
  117. data/lib/permify/models/schema_write_body.rb +216 -0
  118. data/lib/permify/models/schema_write_response.rb +216 -0
  119. data/lib/permify/models/select.rb +235 -0
  120. data/lib/permify/models/source_info.rb +274 -0
  121. data/lib/permify/models/status.rb +234 -0
  122. data/lib/permify/models/stream_result_of_permission_lookup_entity_stream_response.rb +223 -0
  123. data/lib/permify/models/stream_result_of_watch_response.rb +223 -0
  124. data/lib/permify/models/string_array_value.rb +218 -0
  125. data/lib/permify/models/subject.rb +233 -0
  126. data/lib/permify/models/subject_filter.rb +235 -0
  127. data/lib/permify/models/subject_permission_body.rb +242 -0
  128. data/lib/permify/models/subjects.rb +218 -0
  129. data/lib/permify/models/tenant.rb +236 -0
  130. data/lib/permify/models/tenant_create_request.rb +226 -0
  131. data/lib/permify/models/tenant_create_response.rb +215 -0
  132. data/lib/permify/models/tenant_delete_response.rb +216 -0
  133. data/lib/permify/models/tenant_list_request.rb +226 -0
  134. data/lib/permify/models/tenant_list_response.rb +228 -0
  135. data/lib/permify/models/tuple.rb +233 -0
  136. data/lib/permify/models/tuple_filter.rb +233 -0
  137. data/lib/permify/models/tuple_set.rb +215 -0
  138. data/lib/permify/models/tuple_to_user_set.rb +224 -0
  139. data/lib/permify/models/v1_call.rb +226 -0
  140. data/lib/permify/models/v1_expand.rb +255 -0
  141. data/lib/permify/models/v1_operation.rb +254 -0
  142. data/lib/permify/models/v1alpha1_reference.rb +237 -0
  143. data/lib/permify/models/v1alpha1_type.rb +350 -0
  144. data/lib/permify/models/values.rb +216 -0
  145. data/lib/permify/models/version.rb +225 -0
  146. data/lib/permify/models/watch_body.rb +216 -0
  147. data/lib/permify/models/watch_response.rb +215 -0
  148. data/lib/permify/models/well_known_type.rb +41 -0
  149. data/lib/permify/models/write_relationships_body.rb +227 -0
  150. data/lib/permify/version.rb +13 -1
  151. data/lib/permify.rb +175 -15
  152. data/permify-ruby.gemspec +39 -0
  153. data/permify.gemspec +38 -27
  154. data/spec/api/bundle_api_spec.rb +71 -0
  155. data/spec/api/data_api_spec.rb +119 -0
  156. data/spec/api/permission_api_spec.rb +120 -0
  157. data/spec/api/schema_api_spec.rb +83 -0
  158. data/spec/api/tenancy_api_spec.rb +68 -0
  159. data/spec/api/watch_api_spec.rb +47 -0
  160. data/spec/models/abstract_type_spec.rb +42 -0
  161. data/spec/models/any_spec.rb +36 -0
  162. data/spec/models/argument_spec.rb +36 -0
  163. data/spec/models/attribute_definition_spec.rb +42 -0
  164. data/spec/models/attribute_filter_spec.rb +42 -0
  165. data/spec/models/attribute_read_request_metadata_spec.rb +36 -0
  166. data/spec/models/attribute_read_response_spec.rb +42 -0
  167. data/spec/models/attribute_spec.rb +48 -0
  168. data/spec/models/attribute_type_spec.rb +30 -0
  169. data/spec/models/bulk_check_body_spec.rb +54 -0
  170. data/spec/models/bundle_delete_body_spec.rb +36 -0
  171. data/spec/models/bundle_delete_response_spec.rb +36 -0
  172. data/spec/models/bundle_read_body_spec.rb +36 -0
  173. data/spec/models/bundle_read_response_spec.rb +36 -0
  174. data/spec/models/bundle_run_response_spec.rb +36 -0
  175. data/spec/models/bundle_write_body_spec.rb +36 -0
  176. data/spec/models/bundle_write_response_spec.rb +36 -0
  177. data/spec/models/check_body_spec.rb +66 -0
  178. data/spec/models/check_result_spec.rb +30 -0
  179. data/spec/models/checked_expr_spec.rb +60 -0
  180. data/spec/models/child_spec.rb +42 -0
  181. data/spec/models/component_spec.rb +30 -0
  182. data/spec/models/comprehension_spec.rb +78 -0
  183. data/spec/models/computed_attribute_spec.rb +36 -0
  184. data/spec/models/computed_user_set_spec.rb +36 -0
  185. data/spec/models/constant_spec.rb +84 -0
  186. data/spec/models/context_spec.rb +48 -0
  187. data/spec/models/create_list_spec.rb +42 -0
  188. data/spec/models/create_struct_spec.rb +42 -0
  189. data/spec/models/data_bundle_spec.rb +48 -0
  190. data/spec/models/data_change_operation_spec.rb +30 -0
  191. data/spec/models/data_change_spec.rb +48 -0
  192. data/spec/models/data_changes_spec.rb +42 -0
  193. data/spec/models/data_delete_body_spec.rb +42 -0
  194. data/spec/models/data_delete_response_spec.rb +36 -0
  195. data/spec/models/data_write_body_spec.rb +48 -0
  196. data/spec/models/data_write_request_metadata_spec.rb +36 -0
  197. data/spec/models/data_write_response_spec.rb +36 -0
  198. data/spec/models/delete_relationships_body_spec.rb +36 -0
  199. data/spec/models/entity_definition_reference_spec.rb +30 -0
  200. data/spec/models/entity_definition_spec.rb +60 -0
  201. data/spec/models/entity_filter_spec.rb +42 -0
  202. data/spec/models/entity_spec.rb +42 -0
  203. data/spec/models/entry_spec.rb +60 -0
  204. data/spec/models/expand_leaf_spec.rb +48 -0
  205. data/spec/models/expand_tree_node_operation_spec.rb +30 -0
  206. data/spec/models/expand_tree_node_spec.rb +42 -0
  207. data/spec/models/expr_call_spec.rb +48 -0
  208. data/spec/models/expr_spec.rb +78 -0
  209. data/spec/models/extension_spec.rb +48 -0
  210. data/spec/models/function_type_spec.rb +42 -0
  211. data/spec/models/ident_spec.rb +36 -0
  212. data/spec/models/leaf_spec.rb +54 -0
  213. data/spec/models/list_type_spec.rb +36 -0
  214. data/spec/models/lookup_entity_body_spec.rb +78 -0
  215. data/spec/models/lookup_entity_stream_body_spec.rb +78 -0
  216. data/spec/models/lookup_subject_body_spec.rb +78 -0
  217. data/spec/models/map_type_spec.rb +42 -0
  218. data/spec/models/partial_write_body_spec.rb +42 -0
  219. data/spec/models/partials_spec.rb +48 -0
  220. data/spec/models/permission_bulk_check_request_item_spec.rb +48 -0
  221. data/spec/models/permission_bulk_check_response_spec.rb +36 -0
  222. data/spec/models/permission_check_request_metadata_spec.rb +48 -0
  223. data/spec/models/permission_check_response_metadata_spec.rb +36 -0
  224. data/spec/models/permission_check_response_spec.rb +42 -0
  225. data/spec/models/permission_definition_spec.rb +42 -0
  226. data/spec/models/permission_expand_body_spec.rb +60 -0
  227. data/spec/models/permission_expand_request_metadata_spec.rb +42 -0
  228. data/spec/models/permission_expand_response_spec.rb +36 -0
  229. data/spec/models/permission_lookup_entity_request_metadata_spec.rb +48 -0
  230. data/spec/models/permission_lookup_entity_response_spec.rb +42 -0
  231. data/spec/models/permission_lookup_entity_stream_response_spec.rb +42 -0
  232. data/spec/models/permission_lookup_subject_request_metadata_spec.rb +48 -0
  233. data/spec/models/permission_lookup_subject_response_spec.rb +42 -0
  234. data/spec/models/permission_subject_permission_request_metadata_spec.rb +54 -0
  235. data/spec/models/permission_subject_permission_response_spec.rb +36 -0
  236. data/spec/models/primitive_type_spec.rb +30 -0
  237. data/spec/models/read_attributes_body_spec.rb +54 -0
  238. data/spec/models/read_relationships_body_spec.rb +54 -0
  239. data/spec/models/relation_definition_spec.rb +42 -0
  240. data/spec/models/relation_reference_spec.rb +42 -0
  241. data/spec/models/relationship_delete_response_spec.rb +36 -0
  242. data/spec/models/relationship_read_request_metadata_spec.rb +36 -0
  243. data/spec/models/relationship_read_response_spec.rb +42 -0
  244. data/spec/models/relationship_write_request_metadata_spec.rb +36 -0
  245. data/spec/models/relationship_write_response_spec.rb +36 -0
  246. data/spec/models/rewrite_operation_spec.rb +30 -0
  247. data/spec/models/rewrite_spec.rb +42 -0
  248. data/spec/models/rule_definition_spec.rb +48 -0
  249. data/spec/models/run_bundle_body_spec.rb +42 -0
  250. data/spec/models/schema_definition_reference_spec.rb +30 -0
  251. data/spec/models/schema_definition_spec.rb +48 -0
  252. data/spec/models/schema_list_body_spec.rb +42 -0
  253. data/spec/models/schema_list_response_spec.rb +48 -0
  254. data/spec/models/schema_list_spec.rb +42 -0
  255. data/spec/models/schema_partial_write_request_metadata_spec.rb +36 -0
  256. data/spec/models/schema_partial_write_response_spec.rb +36 -0
  257. data/spec/models/schema_read_body_spec.rb +36 -0
  258. data/spec/models/schema_read_request_metadata_spec.rb +36 -0
  259. data/spec/models/schema_read_response_spec.rb +36 -0
  260. data/spec/models/schema_write_body_spec.rb +36 -0
  261. data/spec/models/schema_write_response_spec.rb +36 -0
  262. data/spec/models/select_spec.rb +48 -0
  263. data/spec/models/source_info_spec.rb +66 -0
  264. data/spec/models/status_spec.rb +48 -0
  265. data/spec/models/stream_result_of_permission_lookup_entity_stream_response_spec.rb +42 -0
  266. data/spec/models/stream_result_of_watch_response_spec.rb +42 -0
  267. data/spec/models/string_array_value_spec.rb +36 -0
  268. data/spec/models/subject_filter_spec.rb +48 -0
  269. data/spec/models/subject_permission_body_spec.rb +54 -0
  270. data/spec/models/subject_spec.rb +48 -0
  271. data/spec/models/subjects_spec.rb +36 -0
  272. data/spec/models/tenant_create_request_spec.rb +42 -0
  273. data/spec/models/tenant_create_response_spec.rb +36 -0
  274. data/spec/models/tenant_delete_response_spec.rb +36 -0
  275. data/spec/models/tenant_list_request_spec.rb +42 -0
  276. data/spec/models/tenant_list_response_spec.rb +42 -0
  277. data/spec/models/tenant_spec.rb +48 -0
  278. data/spec/models/tuple_filter_spec.rb +48 -0
  279. data/spec/models/tuple_set_spec.rb +36 -0
  280. data/spec/models/tuple_spec.rb +48 -0
  281. data/spec/models/tuple_to_user_set_spec.rb +42 -0
  282. data/spec/models/v1_call_spec.rb +42 -0
  283. data/spec/models/v1_expand_spec.rb +60 -0
  284. data/spec/models/v1_operation_spec.rb +54 -0
  285. data/spec/models/v1alpha1_reference_spec.rb +48 -0
  286. data/spec/models/v1alpha1_type_spec.rb +108 -0
  287. data/spec/models/values_spec.rb +36 -0
  288. data/spec/models/version_spec.rb +42 -0
  289. data/spec/models/watch_body_spec.rb +36 -0
  290. data/spec/models/watch_response_spec.rb +36 -0
  291. data/spec/models/well_known_type_spec.rb +30 -0
  292. data/spec/models/write_relationships_body_spec.rb +42 -0
  293. data/spec/spec_helper.rb +101 -3
  294. metadata +449 -85
  295. data/.gitignore +0 -17
  296. data/.rspec +0 -2
  297. data/LICENSE.txt +0 -22
  298. data/lib/permify/authorization.rb +0 -17
  299. data/lib/permify/clearance.rb +0 -29
  300. data/lib/permify/permission/combination/any.rb +0 -13
  301. data/lib/permify/permission/combination.rb +0 -4
  302. data/lib/permify/permission/combination_map.rb +0 -23
  303. data/lib/permify/permission/dynamic.rb +0 -13
  304. data/lib/permify/permission/null.rb +0 -7
  305. data/lib/permify/permission/static.rb +0 -7
  306. data/lib/permify/permission.rb +0 -10
  307. data/lib/permify/permission_map.rb +0 -32
  308. data/lib/permify/repository.rb +0 -68
  309. data/spec/integration_spec.rb +0 -114
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Permify API
3
+
4
+ #Permify is an open source authorization service for creating fine-grained and scalable authorization systems.
5
+
6
+ The version of the OpenAPI document: v1.5.4
7
+ Contact: hello@permify.co
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Permify
17
+ # Entity represents an entity with a type and an identifier.
18
+ class Entity
19
+ attr_accessor :type
20
+
21
+ attr_accessor :id
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'type' => :'type',
27
+ :'id' => :'id'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'type' => :'String',
40
+ :'id' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Permify::Entity` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Permify::Entity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'type')
66
+ self.type = attributes[:'type']
67
+ end
68
+
69
+ if attributes.key?(:'id')
70
+ self.id = attributes[:'id']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ type == o.type &&
95
+ id == o.id
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [type, id].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ attributes = attributes.transform_keys(&:to_sym)
116
+ transformed_hash = {}
117
+ openapi_types.each_pair do |key, type|
118
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
119
+ transformed_hash["#{key}"] = nil
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[attribute_map[key]].is_a?(Array)
124
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
125
+ end
126
+ elsif !attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
128
+ end
129
+ end
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = Permify.const_get(type)
172
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -0,0 +1,264 @@
1
+ =begin
2
+ #Permify API
3
+
4
+ #Permify is an open source authorization service for creating fine-grained and scalable authorization systems.
5
+
6
+ The version of the OpenAPI document: v1.5.4
7
+ Contact: hello@permify.co
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Permify
17
+ # The EntityDefinition message provides detailed information about a specific entity.
18
+ class EntityDefinition
19
+ # The name of the entity, which follows a specific string pattern and has a maximum byte size.
20
+ attr_accessor :name
21
+
22
+ # Map of relation definitions within this entity. The key is the relation name, and the value is the RelationDefinition.
23
+ attr_accessor :relations
24
+
25
+ # Map of permission definitions within this entity. The key is the permission name, and the value is the PermissionDefinition.
26
+ attr_accessor :permissions
27
+
28
+ # Map of attribute definitions within this entity. The key is the attribute name, and the value is the AttributeDefinition.
29
+ attr_accessor :attributes
30
+
31
+ # Map of references indicating whether a string pertains to a relation, permission, or attribute.
32
+ attr_accessor :references
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'name' => :'name',
38
+ :'relations' => :'relations',
39
+ :'permissions' => :'permissions',
40
+ :'attributes' => :'attributes',
41
+ :'references' => :'references'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'name' => :'String',
54
+ :'relations' => :'Hash<String, RelationDefinition>',
55
+ :'permissions' => :'Hash<String, PermissionDefinition>',
56
+ :'attributes' => :'Hash<String, AttributeDefinition>',
57
+ :'references' => :'Hash<String, EntityDefinitionReference>'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Permify::EntityDefinition` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Permify::EntityDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'relations')
87
+ if (value = attributes[:'relations']).is_a?(Hash)
88
+ self.relations = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'permissions')
93
+ if (value = attributes[:'permissions']).is_a?(Hash)
94
+ self.permissions = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'attributes')
99
+ if (value = attributes[:'attributes']).is_a?(Hash)
100
+ self.attributes = value
101
+ end
102
+ end
103
+
104
+ if attributes.key?(:'references')
105
+ if (value = attributes[:'references']).is_a?(Hash)
106
+ self.references = value
107
+ end
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
+ invalid_properties = Array.new
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
+ true
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ name == o.name &&
132
+ relations == o.relations &&
133
+ permissions == o.permissions &&
134
+ attributes == o.attributes &&
135
+ references == o.references
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [name, relations, permissions, attributes, references].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
165
+ end
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
168
+ end
169
+ end
170
+ new(transformed_hash)
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def self._deserialize(type, value)
178
+ case type.to_sym
179
+ when :Time
180
+ Time.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ # models (e.g. Pet) or oneOf
211
+ klass = Permify.const_get(type)
212
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Permify API
3
+
4
+ #Permify is an open source authorization service for creating fine-grained and scalable authorization systems.
5
+
6
+ The version of the OpenAPI document: v1.5.4
7
+ Contact: hello@permify.co
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Permify
17
+ class EntityDefinitionReference
18
+ RELATION = "REFERENCE_RELATION".freeze
19
+ PERMISSION = "REFERENCE_PERMISSION".freeze
20
+ ATTRIBUTE = "REFERENCE_ATTRIBUTE".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [RELATION, PERMISSION, ATTRIBUTE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if EntityDefinitionReference.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #EntityDefinitionReference"
39
+ end
40
+ end
41
+ end