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,216 @@
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
+ # `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } // or ... if (any.isSameTypeAs(Foo.getDefaultInstance())) { foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
18
+ class Any
19
+ # A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. As of May 2023, there are no widely used type server implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
20
+ attr_accessor :type
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'type' => :'@type'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'type' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Permify::Any` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Permify::Any`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'type')
63
+ self.type = attributes[:'type']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
+ invalid_properties = Array.new
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ warn '[DEPRECATED] the `valid?` method is obsolete'
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ type == o.type
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Integer] Hash code
98
+ def hash
99
+ [type].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ attributes = attributes.transform_keys(&:to_sym)
108
+ transformed_hash = {}
109
+ openapi_types.each_pair do |key, type|
110
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
111
+ transformed_hash["#{key}"] = nil
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[attribute_map[key]].is_a?(Array)
116
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
+ end
118
+ elsif !attributes[attribute_map[key]].nil?
119
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
120
+ end
121
+ end
122
+ new(transformed_hash)
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def self._deserialize(type, value)
130
+ case type.to_sym
131
+ when :Time
132
+ Time.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ # models (e.g. Pet) or oneOf
163
+ klass = Permify.const_get(type)
164
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+
216
+ end
@@ -0,0 +1,215 @@
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
+ # Argument defines the type of argument in a Call. It can be either a ComputedAttribute or a ContextAttribute.
18
+ class Argument
19
+ attr_accessor :computed_attribute
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'computed_attribute' => :'computedAttribute'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'computed_attribute' => :'ComputedAttribute'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Permify::Argument` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Permify::Argument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'computed_attribute')
62
+ self.computed_attribute = attributes[:'computed_attribute']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ computed_attribute == o.computed_attribute
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [computed_attribute].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
116
+ end
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+ new(transformed_hash)
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def self._deserialize(type, value)
129
+ case type.to_sym
130
+ when :Time
131
+ Time.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ # models (e.g. Pet) or oneOf
162
+ klass = Permify.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end
@@ -0,0 +1,233 @@
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
+ # Attribute represents an attribute of an entity with a specific type and value.
18
+ class Attribute
19
+ attr_accessor :entity
20
+
21
+ attr_accessor :attribute
22
+
23
+ attr_accessor :value
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'entity' => :'entity',
29
+ :'attribute' => :'attribute',
30
+ :'value' => :'value'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'entity' => :'Entity',
43
+ :'attribute' => :'String',
44
+ :'value' => :'Any'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Permify::Attribute` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Permify::Attribute`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'entity')
70
+ self.entity = attributes[:'entity']
71
+ end
72
+
73
+ if attributes.key?(:'attribute')
74
+ self.attribute = attributes[:'attribute']
75
+ end
76
+
77
+ if attributes.key?(:'value')
78
+ self.value = attributes[:'value']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ entity == o.entity &&
103
+ attribute == o.attribute &&
104
+ value == o.value
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [entity, attribute, value].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def self._deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = Permify.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end