From 958df2f1f8a6032acdb3d41281eb9f569a2952ef Mon Sep 17 00:00:00 2001 From: "Justin \"J.R.\" Hill" Date: Mon, 21 Aug 2023 13:08:24 -0700 Subject: [PATCH] feat(java): Introduce Java SDK --- .github/workflows/main.yml | 26 + .github/workflows/semgrep.yaml | 17 + .openapi-generator-ignore | 8 + .openapi-generator/FILES | 206 ++ .openapi-generator/VERSION | 1 + README.md | 218 +- VERSION.txt | 1 + api/openapi.yaml | 1912 ++++++++++++++ build.gradle | 121 + docs/Any.md | 13 + docs/Assertion.md | 14 + docs/AuthorizationModel.md | 15 + docs/CheckRequest.md | 16 + docs/CheckResponse.md | 14 + docs/Computed.md | 13 + docs/ContextualTupleKeys.md | 13 + docs/CreateStoreRequest.md | 13 + docs/CreateStoreResponse.md | 16 + docs/Difference.md | 14 + docs/ErrorCode.md | 107 + docs/ExpandRequest.md | 14 + docs/ExpandResponse.md | 13 + docs/GetStoreResponse.md | 16 + docs/InternalErrorCode.md | 33 + docs/InternalErrorMessageResponse.md | 14 + docs/Leaf.md | 16 + docs/ListObjectsRequest.md | 17 + docs/ListObjectsResponse.md | 13 + docs/ListStoresResponse.md | 14 + docs/Metadata.md | 13 + docs/Node.md | 17 + docs/Nodes.md | 13 + docs/NotFoundErrorCode.md | 19 + docs/ObjectRelation.md | 14 + docs/OpenFgaApi.md | 2333 +++++++++++++++++ docs/PathUnknownErrorMessageResponse.md | 14 + docs/ReadAssertionsResponse.md | 14 + docs/ReadAuthorizationModelResponse.md | 13 + docs/ReadAuthorizationModelsResponse.md | 14 + docs/ReadChangesResponse.md | 14 + docs/ReadRequest.md | 15 + docs/ReadResponse.md | 14 + docs/RelationMetadata.md | 13 + docs/RelationReference.md | 16 + docs/Status.md | 15 + docs/Store.md | 17 + docs/Tuple.md | 14 + docs/TupleChange.md | 15 + docs/TupleKey.md | 15 + docs/TupleKeys.md | 13 + docs/TupleOperation.md | 15 + docs/TupleToUserset.md | 14 + docs/TypeDefinition.md | 15 + docs/Users.md | 13 + docs/Userset.md | 18 + docs/UsersetTree.md | 14 + docs/UsersetTreeDifference.md | 14 + docs/UsersetTreeTupleToUserset.md | 14 + docs/Usersets.md | 13 + docs/ValidationErrorMessageResponse.md | 14 + docs/WriteAssertionsRequest.md | 13 + docs/WriteAuthorizationModelRequest.md | 14 + docs/WriteAuthorizationModelResponse.md | 13 + docs/WriteRequest.md | 15 + gradle.properties | 0 gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 5 + gradlew | 234 ++ gradlew.bat | 89 + settings.gradle | 1 + .../java/dev/openfga/sdk/api/OpenFgaApi.java | 1666 ++++++++++++ .../sdk/api/client/ApiBearerToken.java | 29 + .../dev/openfga/sdk/api/client/ApiClient.java | 327 +++ .../openfga/sdk/api/client/ApiException.java | 92 + .../openfga/sdk/api/client/ApiResponse.java | 64 + .../sdk/api/client/BaseConfiguration.java | 28 + .../sdk/api/client/ClientCredentials.java | 80 + .../openfga/sdk/api/client/Configuration.java | 179 ++ .../sdk/api/client/CredentialsMethod.java | 41 + .../java/dev/openfga/sdk/api/client/JSON.java | 254 ++ .../java/dev/openfga/sdk/api/client/Pair.java | 58 + .../sdk/api/client/RFC3339DateFormat.java | 55 + .../sdk/api/model/AbstractOpenApiSchema.java | 147 ++ .../java/dev/openfga/sdk/api/model/Any.java | 196 ++ .../dev/openfga/sdk/api/model/Assertion.java | 174 ++ .../sdk/api/model/AuthorizationModel.java | 239 ++ .../openfga/sdk/api/model/CheckRequest.java | 248 ++ .../openfga/sdk/api/model/CheckResponse.java | 179 ++ .../dev/openfga/sdk/api/model/Computed.java | 142 + .../sdk/api/model/ContextualTupleKeys.java | 157 ++ .../sdk/api/model/CreateStoreRequest.java | 142 + .../sdk/api/model/CreateStoreResponse.java | 259 ++ .../dev/openfga/sdk/api/model/Difference.java | 166 ++ .../dev/openfga/sdk/api/model/ErrorCode.java | 159 ++ .../openfga/sdk/api/model/ExpandRequest.java | 176 ++ .../openfga/sdk/api/model/ExpandResponse.java | 135 + .../sdk/api/model/GetStoreResponse.java | 259 ++ .../sdk/api/model/InternalErrorCode.java | 85 + .../model/InternalErrorMessageResponse.java | 180 ++ .../java/dev/openfga/sdk/api/model/Leaf.java | 201 ++ .../sdk/api/model/ListObjectsRequest.java | 295 +++ .../sdk/api/model/ListObjectsResponse.java | 155 ++ .../sdk/api/model/ListStoresResponse.java | 198 ++ .../dev/openfga/sdk/api/model/Metadata.java | 157 ++ .../java/dev/openfga/sdk/api/model/Node.java | 276 ++ .../java/dev/openfga/sdk/api/model/Nodes.java | 157 ++ .../sdk/api/model/NotFoundErrorCode.java | 71 + .../openfga/sdk/api/model/ObjectRelation.java | 179 ++ .../PathUnknownErrorMessageResponse.java | 182 ++ .../sdk/api/model/ReadAssertionsResponse.java | 201 ++ .../model/ReadAuthorizationModelResponse.java | 137 + .../ReadAuthorizationModelsResponse.java | 203 ++ .../sdk/api/model/ReadChangesResponse.java | 198 ++ .../openfga/sdk/api/model/ReadRequest.java | 217 ++ .../openfga/sdk/api/model/ReadResponse.java | 198 ++ .../sdk/api/model/RelationMetadata.java | 159 ++ .../sdk/api/model/RelationReference.java | 220 ++ .../dev/openfga/sdk/api/model/Status.java | 231 ++ .../java/dev/openfga/sdk/api/model/Store.java | 297 +++ .../java/dev/openfga/sdk/api/model/Tuple.java | 174 ++ .../openfga/sdk/api/model/TupleChange.java | 216 ++ .../dev/openfga/sdk/api/model/TupleKey.java | 216 ++ .../dev/openfga/sdk/api/model/TupleKeys.java | 157 ++ .../openfga/sdk/api/model/TupleOperation.java | 67 + .../openfga/sdk/api/model/TupleToUserset.java | 169 ++ .../openfga/sdk/api/model/TypeDefinition.java | 232 ++ .../java/dev/openfga/sdk/api/model/Users.java | 155 ++ .../dev/openfga/sdk/api/model/Userset.java | 313 +++ .../openfga/sdk/api/model/UsersetTree.java | 135 + .../sdk/api/model/UsersetTreeDifference.java | 167 ++ .../api/model/UsersetTreeTupleToUserset.java | 196 ++ .../dev/openfga/sdk/api/model/Usersets.java | 157 ++ .../model/ValidationErrorMessageResponse.java | 182 ++ .../sdk/api/model/WriteAssertionsRequest.java | 157 ++ .../model/WriteAuthorizationModelRequest.java | 201 ++ .../WriteAuthorizationModelResponse.java | 144 + .../openfga/sdk/api/model/WriteRequest.java | 212 ++ .../errors/FgaInvalidParameterException.java | 15 + .../java/dev/openfga/util/StringUtil.java | 34 + .../sdk/api/OpenFgaApiIntegrationTest.java | 331 +++ .../dev/openfga/sdk/api/OpenFgaApiTest.java | 1762 +++++++++++++ .../sdk/api/client/ClientCredentialsTest.java | 112 + .../sdk/api/client/ConfigurationTest.java | 87 + .../dev/openfga/sdk/api/model/AnyTest.java | 38 + .../openfga/sdk/api/model/AssertionTest.java | 46 + .../sdk/api/model/AuthorizationModelTest.java | 54 + .../sdk/api/model/CheckRequestTest.java | 62 + .../sdk/api/model/CheckResponseTest.java | 46 + .../openfga/sdk/api/model/ComputedTest.java | 38 + .../api/model/ContextualTupleKeysTest.java | 38 + .../sdk/api/model/CreateStoreRequestTest.java | 38 + .../api/model/CreateStoreResponseTest.java | 62 + .../openfga/sdk/api/model/DifferenceTest.java | 46 + .../openfga/sdk/api/model/ErrorCodeTest.java | 28 + .../sdk/api/model/ExpandRequestTest.java | 46 + .../sdk/api/model/ExpandResponseTest.java | 38 + .../sdk/api/model/GetStoreResponseTest.java | 62 + .../sdk/api/model/InternalErrorCodeTest.java | 28 + .../InternalErrorMessageResponseTest.java | 46 + .../dev/openfga/sdk/api/model/LeafTest.java | 54 + .../sdk/api/model/ListObjectsRequestTest.java | 70 + .../api/model/ListObjectsResponseTest.java | 38 + .../sdk/api/model/ListStoresResponseTest.java | 46 + .../openfga/sdk/api/model/MetadataTest.java | 38 + .../dev/openfga/sdk/api/model/NodeTest.java | 70 + .../dev/openfga/sdk/api/model/NodesTest.java | 38 + .../sdk/api/model/NotFoundErrorCodeTest.java | 28 + .../sdk/api/model/ObjectRelationTest.java | 46 + .../PathUnknownErrorMessageResponseTest.java | 46 + .../api/model/ReadAssertionsResponseTest.java | 46 + .../ReadAuthorizationModelResponseTest.java | 38 + .../ReadAuthorizationModelsResponseTest.java | 46 + .../api/model/ReadChangesResponseTest.java | 46 + .../sdk/api/model/ReadRequestTest.java | 54 + .../sdk/api/model/ReadResponseTest.java | 46 + .../sdk/api/model/RelationMetadataTest.java | 38 + .../sdk/api/model/RelationReferenceTest.java | 54 + .../dev/openfga/sdk/api/model/StatusTest.java | 54 + .../dev/openfga/sdk/api/model/StoreTest.java | 70 + .../sdk/api/model/TupleChangeTest.java | 54 + .../openfga/sdk/api/model/TupleKeyTest.java | 54 + .../openfga/sdk/api/model/TupleKeysTest.java | 38 + .../sdk/api/model/TupleOperationTest.java | 28 + .../dev/openfga/sdk/api/model/TupleTest.java | 46 + .../sdk/api/model/TupleToUsersetTest.java | 46 + .../sdk/api/model/TypeDefinitionTest.java | 54 + .../dev/openfga/sdk/api/model/UsersTest.java | 38 + .../openfga/sdk/api/model/UsersetTest.java | 78 + .../api/model/UsersetTreeDifferenceTest.java | 46 + .../sdk/api/model/UsersetTreeTest.java | 38 + .../model/UsersetTreeTupleToUsersetTest.java | 46 + .../openfga/sdk/api/model/UsersetsTest.java | 38 + .../ValidationErrorMessageResponseTest.java | 46 + .../api/model/WriteAssertionsRequestTest.java | 38 + .../WriteAuthorizationModelRequestTest.java | 46 + .../WriteAuthorizationModelResponseTest.java | 38 + .../sdk/api/model/WriteRequestTest.java | 54 + .../java/dev/openfga/util/StringUtilTest.java | 50 + 198 files changed, 23850 insertions(+), 208 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/semgrep.yaml create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 VERSION.txt create mode 100644 api/openapi.yaml create mode 100644 build.gradle create mode 100644 docs/Any.md create mode 100644 docs/Assertion.md create mode 100644 docs/AuthorizationModel.md create mode 100644 docs/CheckRequest.md create mode 100644 docs/CheckResponse.md create mode 100644 docs/Computed.md create mode 100644 docs/ContextualTupleKeys.md create mode 100644 docs/CreateStoreRequest.md create mode 100644 docs/CreateStoreResponse.md create mode 100644 docs/Difference.md create mode 100644 docs/ErrorCode.md create mode 100644 docs/ExpandRequest.md create mode 100644 docs/ExpandResponse.md create mode 100644 docs/GetStoreResponse.md create mode 100644 docs/InternalErrorCode.md create mode 100644 docs/InternalErrorMessageResponse.md create mode 100644 docs/Leaf.md create mode 100644 docs/ListObjectsRequest.md create mode 100644 docs/ListObjectsResponse.md create mode 100644 docs/ListStoresResponse.md create mode 100644 docs/Metadata.md create mode 100644 docs/Node.md create mode 100644 docs/Nodes.md create mode 100644 docs/NotFoundErrorCode.md create mode 100644 docs/ObjectRelation.md create mode 100644 docs/OpenFgaApi.md create mode 100644 docs/PathUnknownErrorMessageResponse.md create mode 100644 docs/ReadAssertionsResponse.md create mode 100644 docs/ReadAuthorizationModelResponse.md create mode 100644 docs/ReadAuthorizationModelsResponse.md create mode 100644 docs/ReadChangesResponse.md create mode 100644 docs/ReadRequest.md create mode 100644 docs/ReadResponse.md create mode 100644 docs/RelationMetadata.md create mode 100644 docs/RelationReference.md create mode 100644 docs/Status.md create mode 100644 docs/Store.md create mode 100644 docs/Tuple.md create mode 100644 docs/TupleChange.md create mode 100644 docs/TupleKey.md create mode 100644 docs/TupleKeys.md create mode 100644 docs/TupleOperation.md create mode 100644 docs/TupleToUserset.md create mode 100644 docs/TypeDefinition.md create mode 100644 docs/Users.md create mode 100644 docs/Userset.md create mode 100644 docs/UsersetTree.md create mode 100644 docs/UsersetTreeDifference.md create mode 100644 docs/UsersetTreeTupleToUserset.md create mode 100644 docs/Usersets.md create mode 100644 docs/ValidationErrorMessageResponse.md create mode 100644 docs/WriteAssertionsRequest.md create mode 100644 docs/WriteAuthorizationModelRequest.md create mode 100644 docs/WriteAuthorizationModelResponse.md create mode 100644 docs/WriteRequest.md create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle create mode 100644 src/main/java/dev/openfga/sdk/api/OpenFgaApi.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/ApiBearerToken.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/ApiClient.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/ApiException.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/ApiResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/BaseConfiguration.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/ClientCredentials.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/Configuration.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/CredentialsMethod.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/JSON.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/Pair.java create mode 100644 src/main/java/dev/openfga/sdk/api/client/RFC3339DateFormat.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Any.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Assertion.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/AuthorizationModel.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/CheckRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/CheckResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Computed.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Difference.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ErrorCode.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ExpandRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ExpandResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/GetStoreResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/InternalErrorCode.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/InternalErrorMessageResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Leaf.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ListObjectsRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ListObjectsResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ListStoresResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Metadata.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Node.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Nodes.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadChangesResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ReadResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/RelationMetadata.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/RelationReference.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Status.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Store.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Tuple.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TupleChange.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TupleKey.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TupleKeys.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TupleOperation.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TupleToUserset.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/TypeDefinition.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Users.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Userset.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/UsersetTree.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/UsersetTreeDifference.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUserset.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/Usersets.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/WriteAssertionsRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequest.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponse.java create mode 100644 src/main/java/dev/openfga/sdk/api/model/WriteRequest.java create mode 100644 src/main/java/dev/openfga/sdk/errors/FgaInvalidParameterException.java create mode 100644 src/main/java/dev/openfga/util/StringUtil.java create mode 100644 src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/client/ClientCredentialsTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/client/ConfigurationTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/AnyTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/AssertionTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/AuthorizationModelTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/CheckRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/CheckResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ComputedTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ContextualTupleKeysTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/CreateStoreRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/CreateStoreResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/DifferenceTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ErrorCodeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ExpandRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ExpandResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/GetStoreResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/InternalErrorCodeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/InternalErrorMessageResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/LeafTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ListObjectsRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ListObjectsResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ListStoresResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/MetadataTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/NodeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/NodesTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/NotFoundErrorCodeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ObjectRelationTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadAssertionsResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadChangesResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ReadResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/RelationMetadataTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/RelationReferenceTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/StatusTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/StoreTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleChangeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleKeyTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleKeysTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleOperationTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TupleToUsersetTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/TypeDefinitionTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersetTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersetTreeDifferenceTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersetTreeTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUsersetTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/UsersetsTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/WriteAssertionsRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequestTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponseTest.java create mode 100644 src/test/java/dev/openfga/sdk/api/model/WriteRequestTest.java create mode 100644 src/test/java/dev/openfga/util/StringUtilTest.java diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3404612 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,26 @@ +name: Java CI with Gradle + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Build OpenFGA + runs-on: ubuntu-latest + strategy: + matrix: + java: [ '11', '17' ] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: gradle + - name: Build with Gradle + run: | + ./gradlew build diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml new file mode 100644 index 0000000..66e24d3 --- /dev/null +++ b/.github/workflows/semgrep.yaml @@ -0,0 +1,17 @@ +name: Semgrep +on: + push: + branches: + - main +jobs: + semgrep: + name: Scan + runs-on: ubuntu-latest + container: + image: returntocorp/semgrep + if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') + steps: + - uses: actions/checkout@v3 + - run: semgrep ci + env: + SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..f50ab21 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,8 @@ +**/ServerConfiguration.java +**/ServerVariable.java +src/main/AndroidManifest.xml +build.sbt +pom.xml +.github/workflows/maven.yml +git_push.sh +.travis.yml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..503fc48 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,206 @@ +.fossa.yml +.github/CODEOWNERS +.github/ISSUE_TEMPLATE/bug_report.md +.github/ISSUE_TEMPLATE/feature_request.md +.github/workflows/main.yml +.github/workflows/semgrep.yaml +.gitignore +CHANGELOG.md +CONTRIBUTING.md +LICENSE +NOTICE.txt +README.md +VERSION.txt +api/openapi.yaml +build.gradle +docs/Any.md +docs/Assertion.md +docs/AuthorizationModel.md +docs/CheckRequest.md +docs/CheckResponse.md +docs/Computed.md +docs/ContextualTupleKeys.md +docs/CreateStoreRequest.md +docs/CreateStoreResponse.md +docs/Difference.md +docs/ErrorCode.md +docs/ExpandRequest.md +docs/ExpandResponse.md +docs/GetStoreResponse.md +docs/InternalErrorCode.md +docs/InternalErrorMessageResponse.md +docs/Leaf.md +docs/ListObjectsRequest.md +docs/ListObjectsResponse.md +docs/ListStoresResponse.md +docs/Metadata.md +docs/Node.md +docs/Nodes.md +docs/NotFoundErrorCode.md +docs/ObjectRelation.md +docs/OpenFgaApi.md +docs/PathUnknownErrorMessageResponse.md +docs/ReadAssertionsResponse.md +docs/ReadAuthorizationModelResponse.md +docs/ReadAuthorizationModelsResponse.md +docs/ReadChangesResponse.md +docs/ReadRequest.md +docs/ReadResponse.md +docs/RelationMetadata.md +docs/RelationReference.md +docs/Status.md +docs/Store.md +docs/Tuple.md +docs/TupleChange.md +docs/TupleKey.md +docs/TupleKeys.md +docs/TupleOperation.md +docs/TupleToUserset.md +docs/TypeDefinition.md +docs/Users.md +docs/Userset.md +docs/UsersetTree.md +docs/UsersetTreeDifference.md +docs/UsersetTreeTupleToUserset.md +docs/Usersets.md +docs/ValidationErrorMessageResponse.md +docs/WriteAssertionsRequest.md +docs/WriteAuthorizationModelRequest.md +docs/WriteAuthorizationModelResponse.md +docs/WriteRequest.md +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle +src/main/java/dev/openfga/sdk/api/OpenFgaApi.java +src/main/java/dev/openfga/sdk/api/client/ApiBearerToken.java +src/main/java/dev/openfga/sdk/api/client/ApiClient.java +src/main/java/dev/openfga/sdk/api/client/ApiException.java +src/main/java/dev/openfga/sdk/api/client/ApiResponse.java +src/main/java/dev/openfga/sdk/api/client/BaseConfiguration.java +src/main/java/dev/openfga/sdk/api/client/ClientCredentials.java +src/main/java/dev/openfga/sdk/api/client/Configuration.java +src/main/java/dev/openfga/sdk/api/client/Configuration.java +src/main/java/dev/openfga/sdk/api/client/CredentialsMethod.java +src/main/java/dev/openfga/sdk/api/client/JSON.java +src/main/java/dev/openfga/sdk/api/client/Pair.java +src/main/java/dev/openfga/sdk/api/client/RFC3339DateFormat.java +src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java +src/main/java/dev/openfga/sdk/api/model/Any.java +src/main/java/dev/openfga/sdk/api/model/Assertion.java +src/main/java/dev/openfga/sdk/api/model/AuthorizationModel.java +src/main/java/dev/openfga/sdk/api/model/CheckRequest.java +src/main/java/dev/openfga/sdk/api/model/CheckResponse.java +src/main/java/dev/openfga/sdk/api/model/Computed.java +src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java +src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java +src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java +src/main/java/dev/openfga/sdk/api/model/Difference.java +src/main/java/dev/openfga/sdk/api/model/ErrorCode.java +src/main/java/dev/openfga/sdk/api/model/ExpandRequest.java +src/main/java/dev/openfga/sdk/api/model/ExpandResponse.java +src/main/java/dev/openfga/sdk/api/model/GetStoreResponse.java +src/main/java/dev/openfga/sdk/api/model/InternalErrorCode.java +src/main/java/dev/openfga/sdk/api/model/InternalErrorMessageResponse.java +src/main/java/dev/openfga/sdk/api/model/Leaf.java +src/main/java/dev/openfga/sdk/api/model/ListObjectsRequest.java +src/main/java/dev/openfga/sdk/api/model/ListObjectsResponse.java +src/main/java/dev/openfga/sdk/api/model/ListStoresResponse.java +src/main/java/dev/openfga/sdk/api/model/Metadata.java +src/main/java/dev/openfga/sdk/api/model/Node.java +src/main/java/dev/openfga/sdk/api/model/Nodes.java +src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java +src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java +src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java +src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java +src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponse.java +src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponse.java +src/main/java/dev/openfga/sdk/api/model/ReadChangesResponse.java +src/main/java/dev/openfga/sdk/api/model/ReadRequest.java +src/main/java/dev/openfga/sdk/api/model/ReadResponse.java +src/main/java/dev/openfga/sdk/api/model/RelationMetadata.java +src/main/java/dev/openfga/sdk/api/model/RelationReference.java +src/main/java/dev/openfga/sdk/api/model/Status.java +src/main/java/dev/openfga/sdk/api/model/Store.java +src/main/java/dev/openfga/sdk/api/model/Tuple.java +src/main/java/dev/openfga/sdk/api/model/TupleChange.java +src/main/java/dev/openfga/sdk/api/model/TupleKey.java +src/main/java/dev/openfga/sdk/api/model/TupleKeys.java +src/main/java/dev/openfga/sdk/api/model/TupleOperation.java +src/main/java/dev/openfga/sdk/api/model/TupleToUserset.java +src/main/java/dev/openfga/sdk/api/model/TypeDefinition.java +src/main/java/dev/openfga/sdk/api/model/Users.java +src/main/java/dev/openfga/sdk/api/model/Userset.java +src/main/java/dev/openfga/sdk/api/model/UsersetTree.java +src/main/java/dev/openfga/sdk/api/model/UsersetTreeDifference.java +src/main/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUserset.java +src/main/java/dev/openfga/sdk/api/model/Usersets.java +src/main/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponse.java +src/main/java/dev/openfga/sdk/api/model/WriteAssertionsRequest.java +src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequest.java +src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponse.java +src/main/java/dev/openfga/sdk/api/model/WriteRequest.java +src/main/java/dev/openfga/sdk/errors/FgaInvalidParameterException.java +src/main/java/dev/openfga/util/StringUtil.java +src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java +src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java +src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java +src/test/java/dev/openfga/sdk/api/client/ClientCredentialsTest.java +src/test/java/dev/openfga/sdk/api/client/ConfigurationTest.java +src/test/java/dev/openfga/sdk/api/model/AnyTest.java +src/test/java/dev/openfga/sdk/api/model/AssertionTest.java +src/test/java/dev/openfga/sdk/api/model/AuthorizationModelTest.java +src/test/java/dev/openfga/sdk/api/model/CheckRequestTest.java +src/test/java/dev/openfga/sdk/api/model/CheckResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ComputedTest.java +src/test/java/dev/openfga/sdk/api/model/ContextualTupleKeysTest.java +src/test/java/dev/openfga/sdk/api/model/CreateStoreRequestTest.java +src/test/java/dev/openfga/sdk/api/model/CreateStoreResponseTest.java +src/test/java/dev/openfga/sdk/api/model/DifferenceTest.java +src/test/java/dev/openfga/sdk/api/model/ErrorCodeTest.java +src/test/java/dev/openfga/sdk/api/model/ExpandRequestTest.java +src/test/java/dev/openfga/sdk/api/model/ExpandResponseTest.java +src/test/java/dev/openfga/sdk/api/model/GetStoreResponseTest.java +src/test/java/dev/openfga/sdk/api/model/InternalErrorCodeTest.java +src/test/java/dev/openfga/sdk/api/model/InternalErrorMessageResponseTest.java +src/test/java/dev/openfga/sdk/api/model/LeafTest.java +src/test/java/dev/openfga/sdk/api/model/ListObjectsRequestTest.java +src/test/java/dev/openfga/sdk/api/model/ListObjectsResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ListStoresResponseTest.java +src/test/java/dev/openfga/sdk/api/model/MetadataTest.java +src/test/java/dev/openfga/sdk/api/model/NodeTest.java +src/test/java/dev/openfga/sdk/api/model/NodesTest.java +src/test/java/dev/openfga/sdk/api/model/NotFoundErrorCodeTest.java +src/test/java/dev/openfga/sdk/api/model/ObjectRelationTest.java +src/test/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ReadAssertionsResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ReadChangesResponseTest.java +src/test/java/dev/openfga/sdk/api/model/ReadRequestTest.java +src/test/java/dev/openfga/sdk/api/model/ReadResponseTest.java +src/test/java/dev/openfga/sdk/api/model/RelationMetadataTest.java +src/test/java/dev/openfga/sdk/api/model/RelationReferenceTest.java +src/test/java/dev/openfga/sdk/api/model/StatusTest.java +src/test/java/dev/openfga/sdk/api/model/StoreTest.java +src/test/java/dev/openfga/sdk/api/model/TupleChangeTest.java +src/test/java/dev/openfga/sdk/api/model/TupleKeyTest.java +src/test/java/dev/openfga/sdk/api/model/TupleKeysTest.java +src/test/java/dev/openfga/sdk/api/model/TupleOperationTest.java +src/test/java/dev/openfga/sdk/api/model/TupleTest.java +src/test/java/dev/openfga/sdk/api/model/TupleToUsersetTest.java +src/test/java/dev/openfga/sdk/api/model/TypeDefinitionTest.java +src/test/java/dev/openfga/sdk/api/model/UsersTest.java +src/test/java/dev/openfga/sdk/api/model/UsersetTest.java +src/test/java/dev/openfga/sdk/api/model/UsersetTreeDifferenceTest.java +src/test/java/dev/openfga/sdk/api/model/UsersetTreeTest.java +src/test/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUsersetTest.java +src/test/java/dev/openfga/sdk/api/model/UsersetsTest.java +src/test/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponseTest.java +src/test/java/dev/openfga/sdk/api/model/WriteAssertionsRequestTest.java +src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequestTest.java +src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponseTest.java +src/test/java/dev/openfga/sdk/api/model/WriteRequestTest.java +src/test/java/dev/openfga/util/StringUtilTest.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..c0be8a7 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.4.0 \ No newline at end of file diff --git a/README.md b/README.md index 395c95d..5610756 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# .NET SDK for OpenFGA +# Java SDK for OpenFGA [![Release](https://img.shields.io/github/v/release/openfga/java-sdk?sort=semver&color=green)](https://github.com/openfga/java-sdk/releases) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fjava-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fjava-sdk?ref=badge_shield) -[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.com/channels/759188666072825867/930524706854031421) +[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.gg/8naAwJfWN6) [![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga) -This is an autogenerated SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api). +This is an autogenerated java SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api). ## Table of Contents @@ -65,28 +65,14 @@ OpenFGA is designed to make it easy for application builders to model their perm ## Installation + + ## Getting Started ### Initializing the API Client [Learn how to initialize your SDK](https://openfga.dev/docs/getting-started/setup-sdk-client) -> The SdkClient will by default retry API requests up to 15 times on 429 and 5xx errors. - -#### No Credentials - -```java -``` - -#### API Token - -```java -``` - -#### Client Credentials - -```java -``` ### Get your Store ID @@ -97,201 +83,16 @@ If your server is configured with [authentication enabled](https://openfga.dev/d ### Calling the API -#### Stores - -##### List Stores - -Get a paginated list of stores. - -[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/ListStores) - -```java -``` - -##### Create Store - -Initialize a store. - -[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/CreateStore) - -```java -``` - -##### Get Store - -Get information about the current store. - -[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/GetStore) - -> Requires a client initialized with a storeId - -```java -``` - -##### Delete Store - -Delete a store. - -[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/DeleteStore) - -> Requires a client initialized with a storeId - -```java -``` - -#### Authorization Models - -##### Read Authorization Models - -Read all authorization models in the store. - -[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModels) - -```java -``` - -##### Write Authorization Model - -Create a new authorization model. - -[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/WriteAuthorizationModel) - -> Note: To learn how to build your authorization model, check the Docs at https://openfga.dev/docs. - -> Learn more about [the OpenFGA configuration language](https://openfga.dev/docs/configuration-language). - -> You can use the [OpenFGA Syntax Transformer](https://github.com/openfga/syntax-transformer) to convert between the friendly DSL and the JSON authorization model. - -```java -``` - -#### Read a Single Authorization Model - -Read a particular authorization model. - -[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel) - -```java -``` - -##### Read the Latest Authorization Model - -Reads the latest authorization model (note: this ignores the model id in configuration). - -[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel) - -```java -``` - -#### Relationship Tuples -##### Read Relationship Tuple Changes (Watch) -Reads the list of historical relationship tuple writes and deletes. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/ReadChanges) - -```java -``` - -##### Read Relationship Tuples - -Reads the relationship tuples stored in the database. It does not evaluate nor exclude invalid tuples according to the authorization model. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Read) - -```java -``` - -##### Write (Create and Delete) Relationship Tuples - -Create and/or delete relationship tuples to update the system state. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Write) - -###### Transaction mode (default) - -By default, write runs in a transaction mode where any invalid operation (deleting a non-existing tuple, creating an existing tuple, one of the tuples was invalid) or a server error will fail the entire operation. - -```java -``` - -Convenience `WriteTuples` and `DeleteTuples` methods are also available. - -###### Non-transaction mode - -The SDK will split the writes into separate requests and send them sequentially to avoid violating rate limits. - -```java -``` - -#### Relationship Queries - -##### Check - -Check if a user has a particular relation with an object. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Check) - -```java -``` - -##### Batch Check - -Run a set of [checks](#check). Batch Check will return `allowed: false` if it encounters an error, and will return the error in the body. -If 429s or 5xxs are encountered, the underlying check will retry up to 15 times before giving up. - -```java -``` - -##### Expand - -Expands the relationships in userset tree format. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Expand) - -```java -``` - -#### List Objects - -List the objects of a particular type a user has access to. - -[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/ListObjects) - -```java -``` - -#### List Relations - -List the relations a user has on an object. - -```java -``` - -### Assertions - -#### Read Assertions - -Read assertions for a particular authorization model. - -[API Documentation](https://openfga.dev/api/service#/Assertions/Read%20Assertions) - -```java -``` - -#### Write Assertions +### API Endpoints -Update the assertions for a particular authorization model. -[API Documentation](https://openfga.dev/api/service#/Assertions/Write%20Assertions) -```java -``` +### Models -### API Endpoints +[Models](https://github.com/openfga/java-sdk/blob/main/apiModel.ts) -### Models ## Contributing @@ -311,4 +112,5 @@ All changes made to this repo will be overwritten on the next generation, so we This project is licensed under the Apache-2.0 license. See the [LICENSE](https://github.com/openfga/java-sdk/blob/main/LICENSE) file for more info. -The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [java template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/Java), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). \ No newline at end of file +The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [Java template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/Java), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). + diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +0.0.1 diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..8507247 --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,1912 @@ +openapi: 3.0.1 +info: + contact: + email: community@openfga.dev + name: OpenFGA + url: https://openfga.dev + description: A high performance and flexible authorization/permission engine built + for developers and inspired by Google Zanzibar. + license: + name: Apache-2.0 + url: https://github.com/openfga/openfga/blob/main/LICENSE + title: OpenFGA + version: "0.1" +servers: +- url: / +tags: +- name: OpenFga +paths: + /stores: + get: + description: | + Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. + The continuation token will be empty if there are no more stores. + operationId: ListStores + parameters: + - in: query + name: page_size + schema: + format: int32 + type: integer + - in: query + name: continuation_token + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListStoresResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: List all stores + tags: + - OpenFga + x-accepts: application/json + post: + description: Create a unique OpenFGA store which will be used to store authorization + models and relationship tuples. + operationId: CreateStore + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateStoreRequest' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateStoreResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Create a store + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}: + delete: + description: "Delete an OpenFGA store. This does not delete the data associated\ + \ with the store, like tuples or authorization models." + operationId: DeleteStore + parameters: + - in: path + name: store_id + required: true + schema: + type: string + responses: + "204": + content: {} + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Delete a store + tags: + - OpenFga + x-accepts: application/json + get: + description: Returns an OpenFGA store by its identifier + operationId: GetStore + parameters: + - in: path + name: store_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GetStoreResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Get a store + tags: + - OpenFga + x-accepts: application/json + /stores/{store_id}/assertions/{authorization_model_id}: + get: + description: "The ReadAssertions API will return, for a given authorization\ + \ model id, all the assertions stored for it. An assertion is an object that\ + \ contains a tuple key, and the expectation of whether a call to the Check\ + \ API of that tuple key will return true or false. " + operationId: ReadAssertions + parameters: + - in: path + name: store_id + required: true + schema: + type: string + - in: path + name: authorization_model_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadAssertionsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Read assertions for an authorization model ID + tags: + - OpenFga + x-accepts: application/json + put: + description: "The WriteAssertions API will upsert new assertions for an authorization\ + \ model id, or overwrite the existing ones. An assertion is an object that\ + \ contains a tuple key, and the expectation of whether a call to the Check\ + \ API of that tuple key will return true or false. " + operationId: WriteAssertions + parameters: + - in: path + name: store_id + required: true + schema: + type: string + - in: path + name: authorization_model_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WriteAssertions_request' + required: true + responses: + "204": + content: {} + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Upsert assertions for an authorization model ID + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/authorization-models: + get: + description: | + The ReadAuthorizationModels API will return all the authorization models for a certain store. + OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. + + ## Example + Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: + ```json + { + "authorization_models": [ + { + "id": "01G50QVV17PECNVAHX1GG4Y5NC", + "type_definitions": [...] + }, + { + "id": "01G4ZW8F4A07AKQ8RHSVG9RW04", + "type_definitions": [...] + }, + ], + "continuation_token": "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==" + } + ``` + If there are no more authorization models available, the `continuation_token` field will be empty + ```json + { + "authorization_models": [ + { + "id": "01G50QVV17PECNVAHX1GG4Y5NC", + "type_definitions": [...] + }, + { + "id": "01G4ZW8F4A07AKQ8RHSVG9RW04", + "type_definitions": [...] + }, + ], + "continuation_token": "" + } + ``` + operationId: ReadAuthorizationModels + parameters: + - in: path + name: store_id + required: true + schema: + type: string + - in: query + name: page_size + schema: + format: int32 + type: integer + - in: query + name: continuation_token + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadAuthorizationModelsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Return all the authorization models for a particular store + tags: + - OpenFga + x-accepts: application/json + post: + description: "The WriteAuthorizationModel API will add a new authorization model\ + \ to a store.\nEach item in the `type_definitions` array is a type definition\ + \ as specified in the field `type_definition`.\nThe response will return the\ + \ authorization model's ID in the `id` field.\n\n## Example\nTo add an authorization\ + \ model with `user` and `document` type definitions, call POST authorization-models\ + \ API with the body: \n```json\n{\n \"type_definitions\":[\n {\n \ + \ \"type\":\"user\"\n },\n {\n \"type\":\"document\",\n \"\ + relations\":{\n \"reader\":{\n \"union\":{\n \"\ + child\":[\n {\n \"this\":{}\n },\n\ + \ {\n \"computedUserset\":{\n \ + \ \"object\":\"\",\n \"relation\":\"writer\"\n \ + \ }\n }\n ]\n }\n },\n \ + \ \"writer\":{\n \"this\":{}\n }\n }\n }\n ]\n\ + }\n```\nOpenFGA's response will include the version id for this authorization\ + \ model, which will look like \n```\n{\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"\ + }\n```\n" + operationId: WriteAuthorizationModel + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WriteAuthorizationModel_request' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/WriteAuthorizationModelResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Create a new authorization model + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/authorization-models/{id}: + get: + description: |- + The ReadAuthorizationModel API returns an authorization model by its identifier. + The response will return the authorization model for the particular version. + + ## Example + To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: + ```json + { + "authorization_model":{ + "id":"01G5JAVJ41T49E9TT3SKVS7X1J", + "type_definitions":[ + { + "type":"user" + }, + { + "type":"document", + "relations":{ + "reader":{ + "union":{ + "child":[ + { + "this":{} + }, + { + "computedUserset":{ + "object":"", + "relation":"writer" + } + } + ] + } + }, + "writer":{ + "this":{} + } + } + } + ] + } + } + ``` + In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`). + operationId: ReadAuthorizationModel + parameters: + - in: path + name: store_id + required: true + schema: + type: string + - in: path + name: id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadAuthorizationModelResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Return a particular version of an authorization model + tags: + - OpenFga + x-accepts: application/json + /stores/{store_id}/changes: + get: + description: | + The ReadChanges API will return a paginated list of tuple changes (additions and deletions) that occurred in a given store, sorted by ascending time. The response will include a continuation token that is used to get the next set of changes. If there are no changes after the provided continuation token, the same token will be returned in order for it to be used when new changes are recorded. If the store never had any tuples added or removed, this token will be empty. + You can use the `type` parameter to only get the list of tuple changes that affect objects of that type. + operationId: ReadChanges + parameters: + - in: path + name: store_id + required: true + schema: + type: string + - in: query + name: type + schema: + type: string + - in: query + name: page_size + schema: + format: int32 + type: integer + - in: query + name: continuation_token + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadChangesResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Return a list of all the tuple changes + tags: + - OpenFga + x-accepts: application/json + /stores/{store_id}/check: + post: + description: |- + The Check API queries to check if the user has a certain relationship with an object in a certain store. + A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. + You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. + The response will return whether the relationship exists in the field `allowed`. + + ## Example + In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple + ```json + { + "user": "user:anne", + "relation": "member", + "object": "time_slot:office_hours" + } + ``` + the Check API can be used with the following request body: + ```json + { + "tuple_key": { + "user": "user:anne", + "relation": "reader", + "object": "document:2021-budget" + }, + "contextual_tuples": { + "tuple_keys": [ + { + "user": "user:anne", + "relation": "member", + "object": "time_slot:office_hours" + } + ] + }, + "authorization_model_id": "01G50QVV17PECNVAHX1GG4Y5NC" + } + ``` + OpenFGA's response will include `{ "allowed": true }` if there is a relationship and `{ "allowed": false }` if there isn't. + operationId: Check + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Check_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CheckResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Check whether a user is authorized to access an object + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/expand: + post: + description: |- + The Expand API will return all users and usersets that have certain relationship with an object in a certain store. + This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. + Body parameters `tuple_key.object` and `tuple_key.relation` are all required. + The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. + + ## Example + To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body + ```json + { + "tuple_key": { + "object": "document:2021-budget", + "relation": "reader" + }, + "authorization_model_id": "01G50QVV17PECNVAHX1GG4Y5NC" + } + ``` + OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. + ```json + { + "tree":{ + "root":{ + "type":"document:2021-budget#reader", + "union":{ + "nodes":[ + { + "type":"document:2021-budget#reader", + "leaf":{ + "users":{ + "users":[ + "user:bob" + ] + } + } + }, + { + "type":"document:2021-budget#reader", + "leaf":{ + "computed":{ + "userset":"document:2021-budget#writer" + } + } + } + ] + } + } + } + } + ``` + The caller can then call expand API for the `writer` relationship for the `document:2021-budget`. + operationId: Expand + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Expand_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ExpandResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: "Expand all relationships in userset tree format, and following userset\ + \ rewrite rules. Useful to reason about and debug a certain relationship" + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/list-objects: + post: + description: |- + The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. + An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. + You may also specify `contextual_tuples` that will be treated as regular tuples. + The response will contain the related objects in an array in the "objects" field of the response and they will be strings in the object format `:` (e.g. "document:roadmap"). + The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. + operationId: ListObjects + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ListObjects_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListObjectsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: List all objects of the given type that the user has a relation with + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/read: + post: + description: "The Read API will return the tuples for a certain store that match\ + \ a query filter specified in the body of the request. It is different from\ + \ the `/stores/{store_id}/expand` API in that it only returns relationship\ + \ tuples that are stored in the system and satisfy the query. \nIn the body:\n\ + 1. `tuple_key` is optional. If not specified, it will return all tuples in\ + \ the store.\n2. `tuple_key.object` is mandatory if `tuple_key` is specified.\ + \ It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`).\n\ + 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the\ + \ `tuple_key.object` is a type only.\n## Examples\n### Query for all objects\ + \ in a type definition\nTo query for all objects that `user:bob` has `reader`\ + \ relationship in the `document` type definition, call read API with body\ + \ of\n```json\n{\n \"tuple_key\": {\n \"user\": \"user:bob\",\n \"\ + relation\": \"reader\",\n \"object\": \"document:\"\n }\n}\n```\nThe\ + \ API will return tuples and a continuation token, something like\n```json\n\ + {\n \"tuples\": [\n {\n \"key\": {\n \"user\": \"user:bob\"\ + ,\n \"relation\": \"reader\",\n \"object\": \"document:2021-budget\"\ + \n },\n \"timestamp\": \"2021-10-06T15:32:11.128Z\"\n }\n ],\n\ + \ \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"\ + \n}\n```\nThis means that `user:bob` has a `reader` relationship with 1 document\ + \ `document:2021-budget`. Note that this API, unlike the List Objects API,\ + \ does not evaluate the tuples in the store.\nThe continuation token will\ + \ be empty if there are no more tuples to query.### Query for all stored relationship\ + \ tuples that have a particular relation and object\nTo query for all users\ + \ that have `reader` relationship with `document:2021-budget`, call read API\ + \ with body of \n```json\n{\n \"tuple_key\": {\n \"object\": \"document:2021-budget\"\ + ,\n \"relation\": \"reader\"\n }\n}\n```\nThe API will return something\ + \ like \n```json\n{\n \"tuples\": [\n {\n \"key\": {\n \"\ + user\": \"user:bob\",\n \"relation\": \"reader\",\n \"object\"\ + : \"document:2021-budget\"\n },\n \"timestamp\": \"2021-10-06T15:32:11.128Z\"\ + \n }\n ],\n \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"\ + \n}\n```\nThis means that `document:2021-budget` has 1 `reader` (`user:bob`).\ + \ Note that, even if the model said that all `writers` are also `readers`,\ + \ the API will not return writers such as `user:anne` because it only returns\ + \ tuples and does not evaluate them.\n### Query for all users with all relationships\ + \ for a particular document\nTo query for all users that have any relationship\ + \ with `document:2021-budget`, call read API with body of \n```json\n{\n \ + \ \"tuple_key\": {\n \"object\": \"document:2021-budget\"\n }\n}\n\ + ```\nThe API will return something like \n```json\n{\n \"tuples\": [\n \ + \ {\n \"key\": {\n \"user\": \"user:anne\",\n \"relation\"\ + : \"writer\",\n \"object\": \"document:2021-budget\"\n },\n \ + \ \"timestamp\": \"2021-10-05T13:42:12.356Z\"\n },\n {\n \"\ + key\": {\n \"user\": \"user:bob\",\n \"relation\": \"reader\"\ + ,\n \"object\": \"document:2021-budget\"\n },\n \"timestamp\"\ + : \"2021-10-06T15:32:11.128Z\"\n }\n ],\n \"continuation_token\": \"\ + eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"\ + \n}\n```\nThis means that `document:2021-budget` has 1 `reader` (`user:bob`)\ + \ and 1 `writer` (`user:anne`).\n" + operationId: Read + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Read_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReadResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: "Get tuples from the store that matches a query, without following\ + \ userset rewrite rules" + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json + /stores/{store_id}/write: + post: + description: "The Write API will update the tuples for a certain store. Tuples\ + \ and type definitions allow OpenFGA to determine whether a relationship exists\ + \ between an object and an user.\nIn the body, `writes` adds new tuples while\ + \ `deletes` removes existing tuples. The API is not idempotent: if, later\ + \ on, you try to add the same tuple, or if you try to delete a non-existing\ + \ tuple, it will throw an error.\nAn `authorization_model_id` may be specified\ + \ in the body. If it is, it will be used to assert that each written tuple\ + \ (not deleted) is valid for the model specified. If it is not specified,\ + \ the latest authorization model ID will be used.\n## Example\n### Adding\ + \ relationships\nTo add `user:anne` as a `writer` for `document:2021-budget`,\ + \ call write API with the following \n```json\n{\n \"writes\": {\n \"\ + tuple_keys\": [\n {\n \"user\": \"user:anne\",\n \"relation\"\ + : \"writer\",\n \"object\": \"document:2021-budget\"\n }\n \ + \ ]\n },\n \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"\n\ + }\n```\n### Removing relationships\nTo remove `user:bob` as a `reader` for\ + \ `document:2021-budget`, call write API with the following \n```json\n{\n\ + \ \"deletes\": {\n \"tuple_keys\": [\n {\n \"user\": \"user:bob\"\ + ,\n \"relation\": \"reader\",\n \"object\": \"document:2021-budget\"\ + \n }\n ]\n }\n}\n```\n" + operationId: Write + parameters: + - in: path + name: store_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Write_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/WriteResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationErrorMessageResponse' + description: Request failed due to invalid input. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/PathUnknownErrorMessageResponse' + description: Request failed due to incorrect path. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/InternalErrorMessageResponse' + description: Request failed due to internal server error. + summary: Add or delete tuples from the store + tags: + - OpenFga + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: application/json +components: + schemas: + Any: + additionalProperties: + type: object + properties: + '@type': + type: string + type: object + Assertion: + example: + tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + expectation: true + properties: + tuple_key: + $ref: '#/components/schemas/TupleKey' + expectation: + type: boolean + required: + - expectation + - tuple_key + type: object + AuthorizationModel: + example: + schema_version: schema_version + type_definitions: + - type: user + - type: document + relations: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + metadata: + relations: + reader: + directly_related_user_types: + - type: user + writer: + directly_related_user_types: + - type: user + id: 01G5JAVJ41T49E9TT3SKVS7X1J + properties: + id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + schema_version: + type: string + type_definitions: + example: + - type: user + - type: document + relations: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + metadata: + relations: + reader: + directly_related_user_types: + - type: user + writer: + directly_related_user_types: + - type: user + items: + $ref: '#/components/schemas/TypeDefinition' + type: array + required: + - schema_version + type: object + CheckResponse: + example: + allowed: true + resolution: resolution + properties: + allowed: + example: true + type: boolean + resolution: + description: For internal use only. + type: string + type: object + Computed: + example: + userset: userset + properties: + userset: + type: string + type: object + ContextualTupleKeys: + properties: + tuple_keys: + items: + $ref: '#/components/schemas/TupleKey' + type: array + required: + - tuple_keys + type: object + CreateStoreRequest: + example: + name: my-store-name + properties: + name: + example: my-store-name + type: string + required: + - name + type: object + CreateStoreResponse: + example: + updated_at: 2000-01-23T04:56:07.000+00:00 + name: name + created_at: 2000-01-23T04:56:07.000+00:00 + id: 01YCP46JKYM8FJCQ37NMBYHE5X + properties: + id: + example: 01YCP46JKYM8FJCQ37NMBYHE5X + type: string + name: + type: string + created_at: + format: date-time + type: string + updated_at: + format: date-time + type: string + type: object + DeleteStoreResponse: + type: object + DirectUserset: + description: |- + A DirectUserset is a sentinel message for referencing + the direct members specified by an object/relation mapping. + type: object + ErrorCode: + default: no_error + enum: + - no_error + - validation_error + - authorization_model_not_found + - authorization_model_resolution_too_complex + - invalid_write_input + - cannot_allow_duplicate_tuples_in_one_request + - cannot_allow_duplicate_types_in_one_request + - cannot_allow_multiple_references_to_one_relation + - invalid_continuation_token + - invalid_tuple_set + - invalid_check_input + - invalid_expand_input + - unsupported_user_set + - invalid_object_format + - write_failed_due_to_invalid_input + - authorization_model_assertions_not_found + - latest_authorization_model_not_found + - type_not_found + - relation_not_found + - empty_relation_definition + - invalid_user + - invalid_tuple + - unknown_relation + - store_id_invalid_length + - assertions_too_many_items + - id_too_long + - authorization_model_id_too_long + - tuple_key_value_not_specified + - tuple_keys_too_many_or_too_few_items + - page_size_invalid + - param_missing_value + - difference_base_missing_value + - subtract_base_missing_value + - object_too_long + - relation_too_long + - type_definitions_too_few_items + - type_invalid_length + - type_invalid_pattern + - relations_too_few_items + - relations_too_long + - relations_invalid_pattern + - object_invalid_pattern + - query_string_type_continuation_token_mismatch + - exceeded_entity_limit + - invalid_contextual_tuple + - duplicate_contextual_tuple + - invalid_authorization_model + - unsupported_schema_version + type: string + ExpandResponse: + example: + tree: + root: + intersection: + nodes: + - null + - null + name: name + difference: + subtract: null + base: null + union: + nodes: + - null + - null + leaf: + computed: + userset: userset + tupleToUserset: + computed: + - userset: userset + - userset: userset + tupleset: tupleset + users: + users: + - users + - users + properties: + tree: + $ref: '#/components/schemas/UsersetTree' + type: object + GetStoreResponse: + example: + updated_at: 2000-01-23T04:56:07.000+00:00 + name: name + created_at: 2000-01-23T04:56:07.000+00:00 + id: 01YCP46JKYM8FJCQ37NMBYHE5X + properties: + id: + example: 01YCP46JKYM8FJCQ37NMBYHE5X + type: string + name: + type: string + created_at: + format: date-time + type: string + updated_at: + format: date-time + type: string + type: object + InternalErrorCode: + default: no_internal_error + enum: + - no_internal_error + - internal_error + - cancelled + - deadline_exceeded + - already_exists + - resource_exhausted + - failed_precondition + - aborted + - out_of_range + - unavailable + - data_loss + type: string + InternalErrorMessageResponse: + example: + code: internal_error + message: Internal Server Error + properties: + code: + $ref: '#/components/schemas/InternalErrorCode' + message: + type: string + type: object + Leaf: + description: |- + A leaf node contains either + - a set of users (which may be individual users, or usersets + referencing other relations) + - a computed node, which is the result of a computed userset + value in the authorization model + - a tupleToUserset nodes, containing the result of expanding + a tupleToUserset value in a authorization model. + example: + computed: + userset: userset + tupleToUserset: + computed: + - userset: userset + - userset: userset + tupleset: tupleset + users: + users: + - users + - users + properties: + users: + $ref: '#/components/schemas/Users' + computed: + $ref: '#/components/schemas/Computed' + tupleToUserset: + $ref: '#/components/schemas/UsersetTree.TupleToUserset' + type: object + ListObjectsResponse: + example: + objects: + - document:roadmap + - document:planning + properties: + objects: + example: + - document:roadmap + - document:planning + items: + type: string + type: array + type: object + ListStoresResponse: + example: + continuation_token: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + stores: + - updated_at: 2000-01-23T04:56:07.000+00:00 + name: name + created_at: 2000-01-23T04:56:07.000+00:00 + id: id + deleted_at: 2000-01-23T04:56:07.000+00:00 + - updated_at: 2000-01-23T04:56:07.000+00:00 + name: name + created_at: 2000-01-23T04:56:07.000+00:00 + id: id + deleted_at: 2000-01-23T04:56:07.000+00:00 + properties: + stores: + items: + $ref: '#/components/schemas/Store' + type: array + continuation_token: + description: The continuation token will be empty if there are no more stores. + example: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + type: string + type: object + Metadata: + properties: + relations: + additionalProperties: + $ref: '#/components/schemas/RelationMetadata' + type: object + type: object + Node: + example: + intersection: + nodes: + - null + - null + name: name + difference: + subtract: null + base: null + union: + nodes: + - null + - null + leaf: + computed: + userset: userset + tupleToUserset: + computed: + - userset: userset + - userset: userset + tupleset: tupleset + users: + users: + - users + - users + properties: + name: + type: string + leaf: + $ref: '#/components/schemas/Leaf' + difference: + $ref: '#/components/schemas/UsersetTree.Difference' + union: + $ref: '#/components/schemas/Nodes' + intersection: + $ref: '#/components/schemas/Nodes' + type: object + Nodes: + example: + nodes: + - null + - null + properties: + nodes: + items: + $ref: '#/components/schemas/Node' + type: array + type: object + NotFoundErrorCode: + default: no_not_found_error + enum: + - no_not_found_error + - undefined_endpoint + - store_id_not_found + - unimplemented + type: string + ObjectRelation: + properties: + object: + type: string + relation: + type: string + type: object + PathUnknownErrorMessageResponse: + example: + code: undefined_endpoint + message: Endpoint not enabled + properties: + code: + $ref: '#/components/schemas/NotFoundErrorCode' + message: + type: string + type: object + ReadAssertionsResponse: + example: + assertions: + - tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + expectation: true + - tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + expectation: true + authorization_model_id: 01G5JAVJ41T49E9TT3SKVS7X1J + properties: + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + assertions: + items: + $ref: '#/components/schemas/Assertion' + type: array + type: object + ReadAuthorizationModelResponse: + example: + authorization_model: + schema_version: schema_version + type_definitions: + - type: user + - type: document + relations: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + metadata: + relations: + reader: + directly_related_user_types: + - type: user + writer: + directly_related_user_types: + - type: user + id: 01G5JAVJ41T49E9TT3SKVS7X1J + properties: + authorization_model: + $ref: '#/components/schemas/AuthorizationModel' + type: object + ReadAuthorizationModelsResponse: + example: + continuation_token: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + authorization_models: + - schema_version: schema_version + type_definitions: + - type: user + - type: document + relations: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + metadata: + relations: + reader: + directly_related_user_types: + - type: user + writer: + directly_related_user_types: + - type: user + id: 01G5JAVJ41T49E9TT3SKVS7X1J + - schema_version: schema_version + type_definitions: + - type: user + - type: document + relations: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + metadata: + relations: + reader: + directly_related_user_types: + - type: user + writer: + directly_related_user_types: + - type: user + id: 01G5JAVJ41T49E9TT3SKVS7X1J + properties: + authorization_models: + items: + $ref: '#/components/schemas/AuthorizationModel' + type: array + continuation_token: + description: The continuation token will be empty if there are no more models. + example: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + type: string + type: object + ReadChangesResponse: + example: + continuation_token: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + changes: + - tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + operation: null + timestamp: 2000-01-23T04:56:07.000+00:00 + - tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + operation: null + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + changes: + items: + $ref: '#/components/schemas/TupleChange' + type: array + continuation_token: + description: The continuation token will be identical if there are no new + changes. + example: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + type: string + type: object + ReadResponse: + example: + continuation_token: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + tuples: + - key: + user: user:anne + object: document:2021-budget + relation: reader + timestamp: 2000-01-23T04:56:07.000+00:00 + - key: + user: user:anne + object: document:2021-budget + relation: reader + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + tuples: + items: + $ref: '#/components/schemas/Tuple' + type: array + continuation_token: + description: The continuation token will be empty if there are no more tuples. + example: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + type: string + type: object + RelationMetadata: + properties: + directly_related_user_types: + items: + $ref: '#/components/schemas/RelationReference' + type: array + type: object + RelationReference: + description: RelationReference represents a relation of a particular object + type (e.g. 'document#viewer'). + properties: + type: + example: group + type: string + relation: + example: member + type: string + wildcard: + type: object + required: + - type + type: object + Status: + properties: + code: + format: int32 + type: integer + message: + type: string + details: + items: + $ref: '#/components/schemas/Any' + type: array + type: object + Store: + example: + updated_at: 2000-01-23T04:56:07.000+00:00 + name: name + created_at: 2000-01-23T04:56:07.000+00:00 + id: id + deleted_at: 2000-01-23T04:56:07.000+00:00 + properties: + id: + type: string + name: + type: string + created_at: + format: date-time + type: string + updated_at: + format: date-time + type: string + deleted_at: + format: date-time + type: string + type: object + Tuple: + example: + key: + user: user:anne + object: document:2021-budget + relation: reader + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + key: + $ref: '#/components/schemas/TupleKey' + timestamp: + format: date-time + type: string + type: object + TupleChange: + example: + tuple_key: + user: user:anne + object: document:2021-budget + relation: reader + operation: null + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + tuple_key: + $ref: '#/components/schemas/TupleKey' + operation: + $ref: '#/components/schemas/TupleOperation' + timestamp: + format: date-time + type: string + type: object + TupleKey: + example: + user: user:anne + object: document:2021-budget + relation: reader + properties: + object: + example: document:2021-budget + maxLength: 256 + type: string + relation: + example: reader + maxLength: 50 + type: string + user: + example: user:anne + maxLength: 512 + type: string + type: object + TupleKeys: + properties: + tuple_keys: + items: + $ref: '#/components/schemas/TupleKey' + type: array + required: + - tuple_keys + type: object + TupleOperation: + default: TUPLE_OPERATION_WRITE + enum: + - TUPLE_OPERATION_WRITE + - TUPLE_OPERATION_DELETE + title: buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + type: string + TypeDefinition: + properties: + type: + example: document + type: string + relations: + additionalProperties: + $ref: '#/components/schemas/Userset' + example: + reader: + union: + child: + - this: {} + - computedUserset: + object: "" + relation: writer + writer: + this: {} + type: object + metadata: + $ref: '#/components/schemas/Metadata' + required: + - type + type: object + Users: + example: + users: + - users + - users + properties: + users: + items: + type: string + type: array + type: object + Userset: + properties: + this: + description: |- + A DirectUserset is a sentinel message for referencing + the direct members specified by an object/relation mapping. + type: object + computedUserset: + $ref: '#/components/schemas/ObjectRelation' + tupleToUserset: + $ref: '#/components/schemas/TupleToUserset' + union: + $ref: '#/components/schemas/Usersets' + intersection: + $ref: '#/components/schemas/Usersets' + difference: + $ref: '#/components/schemas/Difference' + type: object + UsersetTree: + description: A UsersetTree contains the result of an Expansion. + example: + root: + intersection: + nodes: + - null + - null + name: name + difference: + subtract: null + base: null + union: + nodes: + - null + - null + leaf: + computed: + userset: userset + tupleToUserset: + computed: + - userset: userset + - userset: userset + tupleset: tupleset + users: + users: + - users + - users + properties: + root: + $ref: '#/components/schemas/Node' + type: object + UsersetTree.Difference: + example: + subtract: null + base: null + properties: + base: + $ref: '#/components/schemas/Node' + subtract: + $ref: '#/components/schemas/Node' + type: object + UsersetTree.TupleToUserset: + example: + computed: + - userset: userset + - userset: userset + tupleset: tupleset + properties: + tupleset: + type: string + computed: + items: + $ref: '#/components/schemas/Computed' + type: array + type: object + Usersets: + properties: + child: + items: + $ref: '#/components/schemas/Userset' + type: array + type: object + ValidationErrorMessageResponse: + example: + code: validation_error + message: Generic validation error + properties: + code: + $ref: '#/components/schemas/ErrorCode' + message: + type: string + type: object + Wildcard: + type: object + WriteAssertionsResponse: + type: object + WriteAuthorizationModelResponse: + example: + authorization_model_id: 01G5JAVJ41T49E9TT3SKVS7X1J + properties: + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + type: object + WriteResponse: + type: object + Difference: + properties: + base: + $ref: '#/components/schemas/Userset' + subtract: + $ref: '#/components/schemas/Userset' + required: + - base + - subtract + type: object + TupleToUserset: + properties: + tupleset: + $ref: '#/components/schemas/ObjectRelation' + computedUserset: + $ref: '#/components/schemas/ObjectRelation' + type: object + WriteAssertions_request: + properties: + assertions: + items: + $ref: '#/components/schemas/Assertion' + type: array + required: + - assertions + type: object + WriteAuthorizationModel_request: + properties: + type_definitions: + items: + $ref: '#/components/schemas/TypeDefinition' + type: array + schema_version: + type: string + required: + - type_definitions + type: object + Check_request: + properties: + tuple_key: + $ref: '#/components/schemas/TupleKey' + contextual_tuples: + $ref: '#/components/schemas/ContextualTupleKeys' + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + trace: + description: Defaults to false. Making it true has performance implications. + example: false + readOnly: true + type: boolean + required: + - tuple_key + type: object + Expand_request: + properties: + tuple_key: + $ref: '#/components/schemas/TupleKey' + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + required: + - tuple_key + type: object + ListObjects_request: + properties: + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + type: + example: document + type: string + relation: + example: reader + type: string + user: + example: user:anne + maxLength: 512 + minLength: 1 + type: string + contextual_tuples: + $ref: '#/components/schemas/ContextualTupleKeys' + required: + - relation + - type + - user + type: object + Read_request: + properties: + tuple_key: + $ref: '#/components/schemas/TupleKey' + page_size: + example: 50 + format: int32 + type: integer + continuation_token: + example: eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ== + type: string + type: object + Write_request: + properties: + writes: + $ref: '#/components/schemas/TupleKeys' + deletes: + $ref: '#/components/schemas/TupleKeys' + authorization_model_id: + example: 01G5JAVJ41T49E9TT3SKVS7X1J + type: string + type: object +x-original-swagger-version: "2.0" + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9da6117 --- /dev/null +++ b/build.gradle @@ -0,0 +1,121 @@ +plugins { + id 'java' + id 'jvm-test-suite' + id 'maven-publish' + id 'idea' + id 'eclipse' + id 'com.diffplug.spotless' version '6.20.0' +} + +group = 'dev.openfga' +version = '0.1' + +repositories { + mavenCentral() +} + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openfga-sdk' + from components.java + } + } +} + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + + withJavadocJar() + withSourcesJar() +} + +javadoc { + // Ignore warnings. + options.addStringOption('Xdoclint:none', '-quiet') +} + +ext { + jackson_version = "2.14.1" + jakarta_annotation_version = "1.3.5" + junit_version = "5.7.1" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:0.2.1" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" +} + +testing { + suites { + test { + useJUnitJupiter() + + dependencies { + implementation project() + implementation "org.junit.jupiter:junit-jupiter:$junit_version" + implementation "org.mockito:mockito-core:3.+" + runtimeOnly "org.junit.platform:junit-platform-launcher" + + // This test-only dependency is convenient but not widely used. + // Review project activity before updating the version here. + // See also: https://github.com/PGSSoft/HttpClientMock/issues/3 + implementation "com.pgs-soft:HttpClientMock:1.0.0" + } + } + integration(JvmTestSuite) { + testType = TestSuiteType.INTEGRATION_TEST + useJUnitJupiter() + + dependencies { + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation project() + } + + sources { + java { + srcDirs = ['src/test-integration/java'] + } + } + } + } +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + palantirJavaFormat() + removeUnusedImports() + importOrder() + } +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +tasks.register('fmt') { + dependsOn 'spotlessApply' +} + +tasks.register('test-integration') { + dependsOn testing.suites.integration +} diff --git a/docs/Any.md b/docs/Any.md new file mode 100644 index 0000000..4d330a7 --- /dev/null +++ b/docs/Any.md @@ -0,0 +1,13 @@ + + +# Any + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**atType** | **String** | | [optional] | + + + diff --git a/docs/Assertion.md b/docs/Assertion.md new file mode 100644 index 0000000..3b41516 --- /dev/null +++ b/docs/Assertion.md @@ -0,0 +1,14 @@ + + +# Assertion + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKey** | [**TupleKey**](TupleKey.md) | | | +|**expectation** | **Boolean** | | | + + + diff --git a/docs/AuthorizationModel.md b/docs/AuthorizationModel.md new file mode 100644 index 0000000..88ffd2b --- /dev/null +++ b/docs/AuthorizationModel.md @@ -0,0 +1,15 @@ + + +# AuthorizationModel + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**schemaVersion** | **String** | | | +|**typeDefinitions** | [**List<TypeDefinition>**](TypeDefinition.md) | | [optional] | + + + diff --git a/docs/CheckRequest.md b/docs/CheckRequest.md new file mode 100644 index 0000000..bdce51d --- /dev/null +++ b/docs/CheckRequest.md @@ -0,0 +1,16 @@ + + +# CheckRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKey** | [**TupleKey**](TupleKey.md) | | | +|**contextualTuples** | [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional] | +|**authorizationModelId** | **String** | | [optional] | +|**trace** | **Boolean** | Defaults to false. Making it true has performance implications. | [optional] [readonly] | + + + diff --git a/docs/CheckResponse.md b/docs/CheckResponse.md new file mode 100644 index 0000000..c9434da --- /dev/null +++ b/docs/CheckResponse.md @@ -0,0 +1,14 @@ + + +# CheckResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**allowed** | **Boolean** | | [optional] | +|**resolution** | **String** | For internal use only. | [optional] | + + + diff --git a/docs/Computed.md b/docs/Computed.md new file mode 100644 index 0000000..5d388e9 --- /dev/null +++ b/docs/Computed.md @@ -0,0 +1,13 @@ + + +# Computed + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**userset** | **String** | | [optional] | + + + diff --git a/docs/ContextualTupleKeys.md b/docs/ContextualTupleKeys.md new file mode 100644 index 0000000..0935cfa --- /dev/null +++ b/docs/ContextualTupleKeys.md @@ -0,0 +1,13 @@ + + +# ContextualTupleKeys + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKeys** | [**List<TupleKey>**](TupleKey.md) | | | + + + diff --git a/docs/CreateStoreRequest.md b/docs/CreateStoreRequest.md new file mode 100644 index 0000000..8ae7b55 --- /dev/null +++ b/docs/CreateStoreRequest.md @@ -0,0 +1,13 @@ + + +# CreateStoreRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | + + + diff --git a/docs/CreateStoreResponse.md b/docs/CreateStoreResponse.md new file mode 100644 index 0000000..0a080bb --- /dev/null +++ b/docs/CreateStoreResponse.md @@ -0,0 +1,16 @@ + + +# CreateStoreResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**createdAt** | **OffsetDateTime** | | [optional] | +|**updatedAt** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/Difference.md b/docs/Difference.md new file mode 100644 index 0000000..0b9203b --- /dev/null +++ b/docs/Difference.md @@ -0,0 +1,14 @@ + + +# Difference + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**base** | [**Userset**](Userset.md) | | | +|**subtract** | [**Userset**](Userset.md) | | | + + + diff --git a/docs/ErrorCode.md b/docs/ErrorCode.md new file mode 100644 index 0000000..995351b --- /dev/null +++ b/docs/ErrorCode.md @@ -0,0 +1,107 @@ + + +# ErrorCode + +## Enum + + +* `NO_ERROR` (value: `"no_error"`) + +* `VALIDATION_ERROR` (value: `"validation_error"`) + +* `AUTHORIZATION_MODEL_NOT_FOUND` (value: `"authorization_model_not_found"`) + +* `AUTHORIZATION_MODEL_RESOLUTION_TOO_COMPLEX` (value: `"authorization_model_resolution_too_complex"`) + +* `INVALID_WRITE_INPUT` (value: `"invalid_write_input"`) + +* `CANNOT_ALLOW_DUPLICATE_TUPLES_IN_ONE_REQUEST` (value: `"cannot_allow_duplicate_tuples_in_one_request"`) + +* `CANNOT_ALLOW_DUPLICATE_TYPES_IN_ONE_REQUEST` (value: `"cannot_allow_duplicate_types_in_one_request"`) + +* `CANNOT_ALLOW_MULTIPLE_REFERENCES_TO_ONE_RELATION` (value: `"cannot_allow_multiple_references_to_one_relation"`) + +* `INVALID_CONTINUATION_TOKEN` (value: `"invalid_continuation_token"`) + +* `INVALID_TUPLE_SET` (value: `"invalid_tuple_set"`) + +* `INVALID_CHECK_INPUT` (value: `"invalid_check_input"`) + +* `INVALID_EXPAND_INPUT` (value: `"invalid_expand_input"`) + +* `UNSUPPORTED_USER_SET` (value: `"unsupported_user_set"`) + +* `INVALID_OBJECT_FORMAT` (value: `"invalid_object_format"`) + +* `WRITE_FAILED_DUE_TO_INVALID_INPUT` (value: `"write_failed_due_to_invalid_input"`) + +* `AUTHORIZATION_MODEL_ASSERTIONS_NOT_FOUND` (value: `"authorization_model_assertions_not_found"`) + +* `LATEST_AUTHORIZATION_MODEL_NOT_FOUND` (value: `"latest_authorization_model_not_found"`) + +* `TYPE_NOT_FOUND` (value: `"type_not_found"`) + +* `RELATION_NOT_FOUND` (value: `"relation_not_found"`) + +* `EMPTY_RELATION_DEFINITION` (value: `"empty_relation_definition"`) + +* `INVALID_USER` (value: `"invalid_user"`) + +* `INVALID_TUPLE` (value: `"invalid_tuple"`) + +* `UNKNOWN_RELATION` (value: `"unknown_relation"`) + +* `STORE_ID_INVALID_LENGTH` (value: `"store_id_invalid_length"`) + +* `ASSERTIONS_TOO_MANY_ITEMS` (value: `"assertions_too_many_items"`) + +* `ID_TOO_LONG` (value: `"id_too_long"`) + +* `AUTHORIZATION_MODEL_ID_TOO_LONG` (value: `"authorization_model_id_too_long"`) + +* `TUPLE_KEY_VALUE_NOT_SPECIFIED` (value: `"tuple_key_value_not_specified"`) + +* `TUPLE_KEYS_TOO_MANY_OR_TOO_FEW_ITEMS` (value: `"tuple_keys_too_many_or_too_few_items"`) + +* `PAGE_SIZE_INVALID` (value: `"page_size_invalid"`) + +* `PARAM_MISSING_VALUE` (value: `"param_missing_value"`) + +* `DIFFERENCE_BASE_MISSING_VALUE` (value: `"difference_base_missing_value"`) + +* `SUBTRACT_BASE_MISSING_VALUE` (value: `"subtract_base_missing_value"`) + +* `OBJECT_TOO_LONG` (value: `"object_too_long"`) + +* `RELATION_TOO_LONG` (value: `"relation_too_long"`) + +* `TYPE_DEFINITIONS_TOO_FEW_ITEMS` (value: `"type_definitions_too_few_items"`) + +* `TYPE_INVALID_LENGTH` (value: `"type_invalid_length"`) + +* `TYPE_INVALID_PATTERN` (value: `"type_invalid_pattern"`) + +* `RELATIONS_TOO_FEW_ITEMS` (value: `"relations_too_few_items"`) + +* `RELATIONS_TOO_LONG` (value: `"relations_too_long"`) + +* `RELATIONS_INVALID_PATTERN` (value: `"relations_invalid_pattern"`) + +* `OBJECT_INVALID_PATTERN` (value: `"object_invalid_pattern"`) + +* `QUERY_STRING_TYPE_CONTINUATION_TOKEN_MISMATCH` (value: `"query_string_type_continuation_token_mismatch"`) + +* `EXCEEDED_ENTITY_LIMIT` (value: `"exceeded_entity_limit"`) + +* `INVALID_CONTEXTUAL_TUPLE` (value: `"invalid_contextual_tuple"`) + +* `DUPLICATE_CONTEXTUAL_TUPLE` (value: `"duplicate_contextual_tuple"`) + +* `INVALID_AUTHORIZATION_MODEL` (value: `"invalid_authorization_model"`) + +* `UNSUPPORTED_SCHEMA_VERSION` (value: `"unsupported_schema_version"`) + +* `UNKNOWN_DEFAULT_OPEN_API` (value: `"unknown_default_open_api"`) + + + diff --git a/docs/ExpandRequest.md b/docs/ExpandRequest.md new file mode 100644 index 0000000..c5b6442 --- /dev/null +++ b/docs/ExpandRequest.md @@ -0,0 +1,14 @@ + + +# ExpandRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKey** | [**TupleKey**](TupleKey.md) | | | +|**authorizationModelId** | **String** | | [optional] | + + + diff --git a/docs/ExpandResponse.md b/docs/ExpandResponse.md new file mode 100644 index 0000000..c01fbb1 --- /dev/null +++ b/docs/ExpandResponse.md @@ -0,0 +1,13 @@ + + +# ExpandResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tree** | [**UsersetTree**](UsersetTree.md) | | [optional] | + + + diff --git a/docs/GetStoreResponse.md b/docs/GetStoreResponse.md new file mode 100644 index 0000000..d802015 --- /dev/null +++ b/docs/GetStoreResponse.md @@ -0,0 +1,16 @@ + + +# GetStoreResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**createdAt** | **OffsetDateTime** | | [optional] | +|**updatedAt** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/InternalErrorCode.md b/docs/InternalErrorCode.md new file mode 100644 index 0000000..0b14c21 --- /dev/null +++ b/docs/InternalErrorCode.md @@ -0,0 +1,33 @@ + + +# InternalErrorCode + +## Enum + + +* `NO_INTERNAL_ERROR` (value: `"no_internal_error"`) + +* `INTERNAL_ERROR` (value: `"internal_error"`) + +* `CANCELLED` (value: `"cancelled"`) + +* `DEADLINE_EXCEEDED` (value: `"deadline_exceeded"`) + +* `ALREADY_EXISTS` (value: `"already_exists"`) + +* `RESOURCE_EXHAUSTED` (value: `"resource_exhausted"`) + +* `FAILED_PRECONDITION` (value: `"failed_precondition"`) + +* `ABORTED` (value: `"aborted"`) + +* `OUT_OF_RANGE` (value: `"out_of_range"`) + +* `UNAVAILABLE` (value: `"unavailable"`) + +* `DATA_LOSS` (value: `"data_loss"`) + +* `UNKNOWN_DEFAULT_OPEN_API` (value: `"unknown_default_open_api"`) + + + diff --git a/docs/InternalErrorMessageResponse.md b/docs/InternalErrorMessageResponse.md new file mode 100644 index 0000000..258ac23 --- /dev/null +++ b/docs/InternalErrorMessageResponse.md @@ -0,0 +1,14 @@ + + +# InternalErrorMessageResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **InternalErrorCode** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/docs/Leaf.md b/docs/Leaf.md new file mode 100644 index 0000000..46664c5 --- /dev/null +++ b/docs/Leaf.md @@ -0,0 +1,16 @@ + + +# Leaf + +A leaf node contains either - a set of users (which may be individual users, or usersets referencing other relations) - a computed node, which is the result of a computed userset value in the authorization model - a tupleToUserset nodes, containing the result of expanding a tupleToUserset value in a authorization model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**users** | [**Users**](Users.md) | | [optional] | +|**computed** | [**Computed**](Computed.md) | | [optional] | +|**tupleToUserset** | [**UsersetTreeTupleToUserset**](UsersetTreeTupleToUserset.md) | | [optional] | + + + diff --git a/docs/ListObjectsRequest.md b/docs/ListObjectsRequest.md new file mode 100644 index 0000000..2919fe3 --- /dev/null +++ b/docs/ListObjectsRequest.md @@ -0,0 +1,17 @@ + + +# ListObjectsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorizationModelId** | **String** | | [optional] | +|**type** | **String** | | | +|**relation** | **String** | | | +|**user** | **String** | | | +|**contextualTuples** | [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional] | + + + diff --git a/docs/ListObjectsResponse.md b/docs/ListObjectsResponse.md new file mode 100644 index 0000000..68a8566 --- /dev/null +++ b/docs/ListObjectsResponse.md @@ -0,0 +1,13 @@ + + +# ListObjectsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**objects** | **List<String>** | | [optional] | + + + diff --git a/docs/ListStoresResponse.md b/docs/ListStoresResponse.md new file mode 100644 index 0000000..3088fb4 --- /dev/null +++ b/docs/ListStoresResponse.md @@ -0,0 +1,14 @@ + + +# ListStoresResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stores** | [**List<Store>**](Store.md) | | [optional] | +|**continuationToken** | **String** | The continuation token will be empty if there are no more stores. | [optional] | + + + diff --git a/docs/Metadata.md b/docs/Metadata.md new file mode 100644 index 0000000..f3c8d45 --- /dev/null +++ b/docs/Metadata.md @@ -0,0 +1,13 @@ + + +# Metadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**relations** | [**Map<String, RelationMetadata>**](RelationMetadata.md) | | [optional] | + + + diff --git a/docs/Node.md b/docs/Node.md new file mode 100644 index 0000000..6f89e9e --- /dev/null +++ b/docs/Node.md @@ -0,0 +1,17 @@ + + +# Node + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**leaf** | [**Leaf**](Leaf.md) | | [optional] | +|**difference** | [**UsersetTreeDifference**](UsersetTreeDifference.md) | | [optional] | +|**union** | [**Nodes**](Nodes.md) | | [optional] | +|**intersection** | [**Nodes**](Nodes.md) | | [optional] | + + + diff --git a/docs/Nodes.md b/docs/Nodes.md new file mode 100644 index 0000000..d637207 --- /dev/null +++ b/docs/Nodes.md @@ -0,0 +1,13 @@ + + +# Nodes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nodes** | [**List<Node>**](Node.md) | | [optional] | + + + diff --git a/docs/NotFoundErrorCode.md b/docs/NotFoundErrorCode.md new file mode 100644 index 0000000..5ff45b1 --- /dev/null +++ b/docs/NotFoundErrorCode.md @@ -0,0 +1,19 @@ + + +# NotFoundErrorCode + +## Enum + + +* `NO_NOT_FOUND_ERROR` (value: `"no_not_found_error"`) + +* `UNDEFINED_ENDPOINT` (value: `"undefined_endpoint"`) + +* `STORE_ID_NOT_FOUND` (value: `"store_id_not_found"`) + +* `UNIMPLEMENTED` (value: `"unimplemented"`) + +* `UNKNOWN_DEFAULT_OPEN_API` (value: `"unknown_default_open_api"`) + + + diff --git a/docs/ObjectRelation.md b/docs/ObjectRelation.md new file mode 100644 index 0000000..d73bd14 --- /dev/null +++ b/docs/ObjectRelation.md @@ -0,0 +1,14 @@ + + +# ObjectRelation + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_object** | **String** | | [optional] | +|**relation** | **String** | | [optional] | + + + diff --git a/docs/OpenFgaApi.md b/docs/OpenFgaApi.md new file mode 100644 index 0000000..9b9fc08 --- /dev/null +++ b/docs/OpenFgaApi.md @@ -0,0 +1,2333 @@ +# OpenFgaApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**check**](OpenFgaApi.md#check) | **POST** /stores/{store_id}/check | Check whether a user is authorized to access an object | +| [**checkWithHttpInfo**](OpenFgaApi.md#checkWithHttpInfo) | **POST** /stores/{store_id}/check | Check whether a user is authorized to access an object | +| [**createStore**](OpenFgaApi.md#createStore) | **POST** /stores | Create a store | +| [**createStoreWithHttpInfo**](OpenFgaApi.md#createStoreWithHttpInfo) | **POST** /stores | Create a store | +| [**deleteStore**](OpenFgaApi.md#deleteStore) | **DELETE** /stores/{store_id} | Delete a store | +| [**deleteStoreWithHttpInfo**](OpenFgaApi.md#deleteStoreWithHttpInfo) | **DELETE** /stores/{store_id} | Delete a store | +| [**expand**](OpenFgaApi.md#expand) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship | +| [**expandWithHttpInfo**](OpenFgaApi.md#expandWithHttpInfo) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship | +| [**getStore**](OpenFgaApi.md#getStore) | **GET** /stores/{store_id} | Get a store | +| [**getStoreWithHttpInfo**](OpenFgaApi.md#getStoreWithHttpInfo) | **GET** /stores/{store_id} | Get a store | +| [**listObjects**](OpenFgaApi.md#listObjects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with | +| [**listObjectsWithHttpInfo**](OpenFgaApi.md#listObjectsWithHttpInfo) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with | +| [**listStores**](OpenFgaApi.md#listStores) | **GET** /stores | List all stores | +| [**listStoresWithHttpInfo**](OpenFgaApi.md#listStoresWithHttpInfo) | **GET** /stores | List all stores | +| [**read**](OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules | +| [**readWithHttpInfo**](OpenFgaApi.md#readWithHttpInfo) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules | +| [**readAssertions**](OpenFgaApi.md#readAssertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID | +| [**readAssertionsWithHttpInfo**](OpenFgaApi.md#readAssertionsWithHttpInfo) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID | +| [**readAuthorizationModel**](OpenFgaApi.md#readAuthorizationModel) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model | +| [**readAuthorizationModelWithHttpInfo**](OpenFgaApi.md#readAuthorizationModelWithHttpInfo) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model | +| [**readAuthorizationModels**](OpenFgaApi.md#readAuthorizationModels) | **GET** /stores/{store_id}/authorization-models | Return all the authorization models for a particular store | +| [**readAuthorizationModelsWithHttpInfo**](OpenFgaApi.md#readAuthorizationModelsWithHttpInfo) | **GET** /stores/{store_id}/authorization-models | Return all the authorization models for a particular store | +| [**readChanges**](OpenFgaApi.md#readChanges) | **GET** /stores/{store_id}/changes | Return a list of all the tuple changes | +| [**readChangesWithHttpInfo**](OpenFgaApi.md#readChangesWithHttpInfo) | **GET** /stores/{store_id}/changes | Return a list of all the tuple changes | +| [**write**](OpenFgaApi.md#write) | **POST** /stores/{store_id}/write | Add or delete tuples from the store | +| [**writeWithHttpInfo**](OpenFgaApi.md#writeWithHttpInfo) | **POST** /stores/{store_id}/write | Add or delete tuples from the store | +| [**writeAssertions**](OpenFgaApi.md#writeAssertions) | **PUT** /stores/{store_id}/assertions/{authorization_model_id} | Upsert assertions for an authorization model ID | +| [**writeAssertionsWithHttpInfo**](OpenFgaApi.md#writeAssertionsWithHttpInfo) | **PUT** /stores/{store_id}/assertions/{authorization_model_id} | Upsert assertions for an authorization model ID | +| [**writeAuthorizationModel**](OpenFgaApi.md#writeAuthorizationModel) | **POST** /stores/{store_id}/authorization-models | Create a new authorization model | +| [**writeAuthorizationModelWithHttpInfo**](OpenFgaApi.md#writeAuthorizationModelWithHttpInfo) | **POST** /stores/{store_id}/authorization-models | Create a new authorization model | + + + +## check + +> CompletableFuture check(storeId, body) + +Check whether a user is authorized to access an object + +The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + CheckRequest body = new CheckRequest(); // CheckRequest | + try { + CompletableFuture result = apiInstance.check(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#check"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**CheckRequest**](CheckRequest.md)| | | + +### Return type + +CompletableFuture<[**CheckResponse**](CheckResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## checkWithHttpInfo + +> CompletableFuture> check checkWithHttpInfo(storeId, body) + +Check whether a user is authorized to access an object + +The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + CheckRequest body = new CheckRequest(); // CheckRequest | + try { + CompletableFuture> response = apiInstance.checkWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#check"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#check"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**CheckRequest**](CheckRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## createStore + +> CompletableFuture createStore(body) + +Create a store + +Create a unique OpenFGA store which will be used to store authorization models and relationship tuples. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + CreateStoreRequest body = new CreateStoreRequest(); // CreateStoreRequest | + try { + CompletableFuture result = apiInstance.createStore(body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#createStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**CreateStoreRequest**](CreateStoreRequest.md)| | | + +### Return type + +CompletableFuture<[**CreateStoreResponse**](CreateStoreResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## createStoreWithHttpInfo + +> CompletableFuture> createStore createStoreWithHttpInfo(body) + +Create a store + +Create a unique OpenFGA store which will be used to store authorization models and relationship tuples. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + CreateStoreRequest body = new CreateStoreRequest(); // CreateStoreRequest | + try { + CompletableFuture> response = apiInstance.createStoreWithHttpInfo(body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#createStore"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#createStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**CreateStoreRequest**](CreateStoreRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## deleteStore + +> CompletableFuture deleteStore(storeId) + +Delete a store + +Delete an OpenFGA store. This does not delete the data associated with the store, like tuples or authorization models. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + try { + CompletableFuture result = apiInstance.deleteStore(storeId); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#deleteStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | + +### Return type + + +CompletableFuture (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## deleteStoreWithHttpInfo + +> CompletableFuture> deleteStore deleteStoreWithHttpInfo(storeId) + +Delete a store + +Delete an OpenFGA store. This does not delete the data associated with the store, like tuples or authorization models. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + try { + CompletableFuture> response = apiInstance.deleteStoreWithHttpInfo(storeId); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#deleteStore"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#deleteStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | + +### Return type + + +CompletableFuture> + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## expand + +> CompletableFuture expand(storeId, body) + +Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship + +The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ExpandRequest body = new ExpandRequest(); // ExpandRequest | + try { + CompletableFuture result = apiInstance.expand(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#expand"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ExpandRequest**](ExpandRequest.md)| | | + +### Return type + +CompletableFuture<[**ExpandResponse**](ExpandResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## expandWithHttpInfo + +> CompletableFuture> expand expandWithHttpInfo(storeId, body) + +Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship + +The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ExpandRequest body = new ExpandRequest(); // ExpandRequest | + try { + CompletableFuture> response = apiInstance.expandWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#expand"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#expand"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ExpandRequest**](ExpandRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## getStore + +> CompletableFuture getStore(storeId) + +Get a store + +Returns an OpenFGA store by its identifier + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + try { + CompletableFuture result = apiInstance.getStore(storeId); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#getStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | + +### Return type + +CompletableFuture<[**GetStoreResponse**](GetStoreResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## getStoreWithHttpInfo + +> CompletableFuture> getStore getStoreWithHttpInfo(storeId) + +Get a store + +Returns an OpenFGA store by its identifier + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + try { + CompletableFuture> response = apiInstance.getStoreWithHttpInfo(storeId); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#getStore"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#getStore"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## listObjects + +> CompletableFuture listObjects(storeId, body) + +List all objects of the given type that the user has a relation with + +The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ListObjectsRequest body = new ListObjectsRequest(); // ListObjectsRequest | + try { + CompletableFuture result = apiInstance.listObjects(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#listObjects"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ListObjectsRequest**](ListObjectsRequest.md)| | | + +### Return type + +CompletableFuture<[**ListObjectsResponse**](ListObjectsResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## listObjectsWithHttpInfo + +> CompletableFuture> listObjects listObjectsWithHttpInfo(storeId, body) + +List all objects of the given type that the user has a relation with + +The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ListObjectsRequest body = new ListObjectsRequest(); // ListObjectsRequest | + try { + CompletableFuture> response = apiInstance.listObjectsWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#listObjects"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#listObjects"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ListObjectsRequest**](ListObjectsRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## listStores + +> CompletableFuture listStores(pageSize, continuationToken) + +List all stores + +Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture result = apiInstance.listStores(pageSize, continuationToken); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#listStores"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture<[**ListStoresResponse**](ListStoresResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## listStoresWithHttpInfo + +> CompletableFuture> listStores listStoresWithHttpInfo(pageSize, continuationToken) + +List all stores + +Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture> response = apiInstance.listStoresWithHttpInfo(pageSize, continuationToken); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#listStores"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#listStores"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## read + +> CompletableFuture read(storeId, body) + +Get tuples from the store that matches a query, without following userset rewrite rules + +The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ReadRequest body = new ReadRequest(); // ReadRequest | + try { + CompletableFuture result = apiInstance.read(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#read"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ReadRequest**](ReadRequest.md)| | | + +### Return type + +CompletableFuture<[**ReadResponse**](ReadResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## readWithHttpInfo + +> CompletableFuture> read readWithHttpInfo(storeId, body) + +Get tuples from the store that matches a query, without following userset rewrite rules + +The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + ReadRequest body = new ReadRequest(); // ReadRequest | + try { + CompletableFuture> response = apiInstance.readWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#read"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#read"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**ReadRequest**](ReadRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## readAssertions + +> CompletableFuture readAssertions(storeId, authorizationModelId) + +Read assertions for an authorization model ID + +The ReadAssertions API will return, for a given authorization model id, all the assertions stored for it. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String authorizationModelId = "authorizationModelId_example"; // String | + try { + CompletableFuture result = apiInstance.readAssertions(storeId, authorizationModelId); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAssertions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **authorizationModelId** | **String**| | | + +### Return type + +CompletableFuture<[**ReadAssertionsResponse**](ReadAssertionsResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## readAssertionsWithHttpInfo + +> CompletableFuture> readAssertions readAssertionsWithHttpInfo(storeId, authorizationModelId) + +Read assertions for an authorization model ID + +The ReadAssertions API will return, for a given authorization model id, all the assertions stored for it. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String authorizationModelId = "authorizationModelId_example"; // String | + try { + CompletableFuture> response = apiInstance.readAssertionsWithHttpInfo(storeId, authorizationModelId); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#readAssertions"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAssertions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **authorizationModelId** | **String**| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## readAuthorizationModel + +> CompletableFuture readAuthorizationModel(storeId, id) + +Return a particular version of an authorization model + +The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`). + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String id = "id_example"; // String | + try { + CompletableFuture result = apiInstance.readAuthorizationModel(storeId, id); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **id** | **String**| | | + +### Return type + +CompletableFuture<[**ReadAuthorizationModelResponse**](ReadAuthorizationModelResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## readAuthorizationModelWithHttpInfo + +> CompletableFuture> readAuthorizationModel readAuthorizationModelWithHttpInfo(storeId, id) + +Return a particular version of an authorization model + +The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`). + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String id = "id_example"; // String | + try { + CompletableFuture> response = apiInstance.readAuthorizationModelWithHttpInfo(storeId, id); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModel"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **id** | **String**| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## readAuthorizationModels + +> CompletableFuture readAuthorizationModels(storeId, pageSize, continuationToken) + +Return all the authorization models for a particular store + +The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture result = apiInstance.readAuthorizationModels(storeId, pageSize, continuationToken); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModels"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture<[**ReadAuthorizationModelsResponse**](ReadAuthorizationModelsResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## readAuthorizationModelsWithHttpInfo + +> CompletableFuture> readAuthorizationModels readAuthorizationModelsWithHttpInfo(storeId, pageSize, continuationToken) + +Return all the authorization models for a particular store + +The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture> response = apiInstance.readAuthorizationModelsWithHttpInfo(storeId, pageSize, continuationToken); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModels"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readAuthorizationModels"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## readChanges + +> CompletableFuture readChanges(storeId, type, pageSize, continuationToken) + +Return a list of all the tuple changes + +The ReadChanges API will return a paginated list of tuple changes (additions and deletions) that occurred in a given store, sorted by ascending time. The response will include a continuation token that is used to get the next set of changes. If there are no changes after the provided continuation token, the same token will be returned in order for it to be used when new changes are recorded. If the store never had any tuples added or removed, this token will be empty. You can use the `type` parameter to only get the list of tuple changes that affect objects of that type. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String type = "type_example"; // String | + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture result = apiInstance.readChanges(storeId, type, pageSize, continuationToken); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readChanges"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **type** | **String**| | [optional] | +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture<[**ReadChangesResponse**](ReadChangesResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## readChangesWithHttpInfo + +> CompletableFuture> readChanges readChangesWithHttpInfo(storeId, type, pageSize, continuationToken) + +Return a list of all the tuple changes + +The ReadChanges API will return a paginated list of tuple changes (additions and deletions) that occurred in a given store, sorted by ascending time. The response will include a continuation token that is used to get the next set of changes. If there are no changes after the provided continuation token, the same token will be returned in order for it to be used when new changes are recorded. If the store never had any tuples added or removed, this token will be empty. You can use the `type` parameter to only get the list of tuple changes that affect objects of that type. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String type = "type_example"; // String | + Integer pageSize = 56; // Integer | + String continuationToken = "continuationToken_example"; // String | + try { + CompletableFuture> response = apiInstance.readChangesWithHttpInfo(storeId, type, pageSize, continuationToken); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#readChanges"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#readChanges"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **type** | **String**| | [optional] | +| **pageSize** | **Integer**| | [optional] | +| **continuationToken** | **String**| | [optional] | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## write + +> CompletableFuture write(storeId, body) + +Add or delete tuples from the store + +The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + WriteRequest body = new WriteRequest(); // WriteRequest | + try { + CompletableFuture result = apiInstance.write(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#write"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**WriteRequest**](WriteRequest.md)| | | + +### Return type + +CompletableFuture<**Object**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## writeWithHttpInfo + +> CompletableFuture> write writeWithHttpInfo(storeId, body) + +Add or delete tuples from the store + +The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + WriteRequest body = new WriteRequest(); // WriteRequest | + try { + CompletableFuture> response = apiInstance.writeWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#write"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#write"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**WriteRequest**](WriteRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## writeAssertions + +> CompletableFuture writeAssertions(storeId, authorizationModelId, body) + +Upsert assertions for an authorization model ID + +The WriteAssertions API will upsert new assertions for an authorization model id, or overwrite the existing ones. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String authorizationModelId = "authorizationModelId_example"; // String | + WriteAssertionsRequest body = new WriteAssertionsRequest(); // WriteAssertionsRequest | + try { + CompletableFuture result = apiInstance.writeAssertions(storeId, authorizationModelId, body); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#writeAssertions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **authorizationModelId** | **String**| | | +| **body** | [**WriteAssertionsRequest**](WriteAssertionsRequest.md)| | | + +### Return type + + +CompletableFuture (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## writeAssertionsWithHttpInfo + +> CompletableFuture> writeAssertions writeAssertionsWithHttpInfo(storeId, authorizationModelId, body) + +Upsert assertions for an authorization model ID + +The WriteAssertions API will upsert new assertions for an authorization model id, or overwrite the existing ones. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + String authorizationModelId = "authorizationModelId_example"; // String | + WriteAssertionsRequest body = new WriteAssertionsRequest(); // WriteAssertionsRequest | + try { + CompletableFuture> response = apiInstance.writeAssertionsWithHttpInfo(storeId, authorizationModelId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#writeAssertions"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#writeAssertions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **authorizationModelId** | **String**| | | +| **body** | [**WriteAssertionsRequest**](WriteAssertionsRequest.md)| | | + +### Return type + + +CompletableFuture> + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + + +## writeAuthorizationModel + +> CompletableFuture writeAuthorizationModel(storeId, body) + +Create a new authorization model + +The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + WriteAuthorizationModelRequest body = new WriteAuthorizationModelRequest(); // WriteAuthorizationModelRequest | + try { + CompletableFuture result = apiInstance.writeAuthorizationModel(storeId, body); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#writeAuthorizationModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**WriteAuthorizationModelRequest**](WriteAuthorizationModelRequest.md)| | | + +### Return type + +CompletableFuture<[**WriteAuthorizationModelResponse**](WriteAuthorizationModelResponse.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + +## writeAuthorizationModelWithHttpInfo + +> CompletableFuture> writeAuthorizationModel writeAuthorizationModelWithHttpInfo(storeId, body) + +Create a new authorization model + +The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ``` + +### Example + +```java +// Import classes: +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.models.*; +import dev.openfga.sdk.api.OpenFgaApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + OpenFgaApi apiInstance = new OpenFgaApi(defaultClient); + String storeId = "storeId_example"; // String | + WriteAuthorizationModelRequest body = new WriteAuthorizationModelRequest(); // WriteAuthorizationModelRequest | + try { + CompletableFuture> response = apiInstance.writeAuthorizationModelWithHttpInfo(storeId, body); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling OpenFgaApi#writeAuthorizationModel"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling OpenFgaApi#writeAuthorizationModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **storeId** | **String**| | | +| **body** | [**WriteAuthorizationModelRequest**](WriteAuthorizationModelRequest.md)| | | + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | A successful response. | - | +| **400** | Request failed due to invalid input. | - | +| **404** | Request failed due to incorrect path. | - | +| **500** | Request failed due to internal server error. | - | + diff --git a/docs/PathUnknownErrorMessageResponse.md b/docs/PathUnknownErrorMessageResponse.md new file mode 100644 index 0000000..4958e74 --- /dev/null +++ b/docs/PathUnknownErrorMessageResponse.md @@ -0,0 +1,14 @@ + + +# PathUnknownErrorMessageResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **NotFoundErrorCode** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/docs/ReadAssertionsResponse.md b/docs/ReadAssertionsResponse.md new file mode 100644 index 0000000..48c60ad --- /dev/null +++ b/docs/ReadAssertionsResponse.md @@ -0,0 +1,14 @@ + + +# ReadAssertionsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorizationModelId** | **String** | | [optional] | +|**assertions** | [**List<Assertion>**](Assertion.md) | | [optional] | + + + diff --git a/docs/ReadAuthorizationModelResponse.md b/docs/ReadAuthorizationModelResponse.md new file mode 100644 index 0000000..b2d7dd7 --- /dev/null +++ b/docs/ReadAuthorizationModelResponse.md @@ -0,0 +1,13 @@ + + +# ReadAuthorizationModelResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorizationModel** | [**AuthorizationModel**](AuthorizationModel.md) | | [optional] | + + + diff --git a/docs/ReadAuthorizationModelsResponse.md b/docs/ReadAuthorizationModelsResponse.md new file mode 100644 index 0000000..616b47c --- /dev/null +++ b/docs/ReadAuthorizationModelsResponse.md @@ -0,0 +1,14 @@ + + +# ReadAuthorizationModelsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorizationModels** | [**List<AuthorizationModel>**](AuthorizationModel.md) | | [optional] | +|**continuationToken** | **String** | The continuation token will be empty if there are no more models. | [optional] | + + + diff --git a/docs/ReadChangesResponse.md b/docs/ReadChangesResponse.md new file mode 100644 index 0000000..fca87b4 --- /dev/null +++ b/docs/ReadChangesResponse.md @@ -0,0 +1,14 @@ + + +# ReadChangesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**changes** | [**List<TupleChange>**](TupleChange.md) | | [optional] | +|**continuationToken** | **String** | The continuation token will be identical if there are no new changes. | [optional] | + + + diff --git a/docs/ReadRequest.md b/docs/ReadRequest.md new file mode 100644 index 0000000..f8f7047 --- /dev/null +++ b/docs/ReadRequest.md @@ -0,0 +1,15 @@ + + +# ReadRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKey** | [**TupleKey**](TupleKey.md) | | [optional] | +|**pageSize** | **Integer** | | [optional] | +|**continuationToken** | **String** | | [optional] | + + + diff --git a/docs/ReadResponse.md b/docs/ReadResponse.md new file mode 100644 index 0000000..55c981b --- /dev/null +++ b/docs/ReadResponse.md @@ -0,0 +1,14 @@ + + +# ReadResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tuples** | [**List<Tuple>**](Tuple.md) | | [optional] | +|**continuationToken** | **String** | The continuation token will be empty if there are no more tuples. | [optional] | + + + diff --git a/docs/RelationMetadata.md b/docs/RelationMetadata.md new file mode 100644 index 0000000..428f9b0 --- /dev/null +++ b/docs/RelationMetadata.md @@ -0,0 +1,13 @@ + + +# RelationMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**directlyRelatedUserTypes** | [**List<RelationReference>**](RelationReference.md) | | [optional] | + + + diff --git a/docs/RelationReference.md b/docs/RelationReference.md new file mode 100644 index 0000000..ed98991 --- /dev/null +++ b/docs/RelationReference.md @@ -0,0 +1,16 @@ + + +# RelationReference + +RelationReference represents a relation of a particular object type (e.g. 'document#viewer'). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | | +|**relation** | **String** | | [optional] | +|**wildcard** | **Object** | | [optional] | + + + diff --git a/docs/Status.md b/docs/Status.md new file mode 100644 index 0000000..f2905b6 --- /dev/null +++ b/docs/Status.md @@ -0,0 +1,15 @@ + + +# Status + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**message** | **String** | | [optional] | +|**details** | **List<Any>** | | [optional] | + + + diff --git a/docs/Store.md b/docs/Store.md new file mode 100644 index 0000000..b2b74ca --- /dev/null +++ b/docs/Store.md @@ -0,0 +1,17 @@ + + +# Store + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**createdAt** | **OffsetDateTime** | | [optional] | +|**updatedAt** | **OffsetDateTime** | | [optional] | +|**deletedAt** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/Tuple.md b/docs/Tuple.md new file mode 100644 index 0000000..04d434b --- /dev/null +++ b/docs/Tuple.md @@ -0,0 +1,14 @@ + + +# Tuple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**key** | [**TupleKey**](TupleKey.md) | | [optional] | +|**timestamp** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/TupleChange.md b/docs/TupleChange.md new file mode 100644 index 0000000..f6751f6 --- /dev/null +++ b/docs/TupleChange.md @@ -0,0 +1,15 @@ + + +# TupleChange + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKey** | [**TupleKey**](TupleKey.md) | | [optional] | +|**operation** | **TupleOperation** | | [optional] | +|**timestamp** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/TupleKey.md b/docs/TupleKey.md new file mode 100644 index 0000000..fc35d4b --- /dev/null +++ b/docs/TupleKey.md @@ -0,0 +1,15 @@ + + +# TupleKey + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_object** | **String** | | [optional] | +|**relation** | **String** | | [optional] | +|**user** | **String** | | [optional] | + + + diff --git a/docs/TupleKeys.md b/docs/TupleKeys.md new file mode 100644 index 0000000..72dbe13 --- /dev/null +++ b/docs/TupleKeys.md @@ -0,0 +1,13 @@ + + +# TupleKeys + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleKeys** | [**List<TupleKey>**](TupleKey.md) | | | + + + diff --git a/docs/TupleOperation.md b/docs/TupleOperation.md new file mode 100644 index 0000000..fa6a9f6 --- /dev/null +++ b/docs/TupleOperation.md @@ -0,0 +1,15 @@ + + +# TupleOperation + +## Enum + + +* `WRITE` (value: `"TUPLE_OPERATION_WRITE"`) + +* `DELETE` (value: `"TUPLE_OPERATION_DELETE"`) + +* `UNKNOWN_DEFAULT_OPEN_API` (value: `"unknown_default_open_api"`) + + + diff --git a/docs/TupleToUserset.md b/docs/TupleToUserset.md new file mode 100644 index 0000000..40802b3 --- /dev/null +++ b/docs/TupleToUserset.md @@ -0,0 +1,14 @@ + + +# TupleToUserset + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleset** | [**ObjectRelation**](ObjectRelation.md) | | [optional] | +|**computedUserset** | [**ObjectRelation**](ObjectRelation.md) | | [optional] | + + + diff --git a/docs/TypeDefinition.md b/docs/TypeDefinition.md new file mode 100644 index 0000000..f384cc4 --- /dev/null +++ b/docs/TypeDefinition.md @@ -0,0 +1,15 @@ + + +# TypeDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | | +|**relations** | [**Map<String, Userset>**](Userset.md) | | [optional] | +|**metadata** | [**Metadata**](Metadata.md) | | [optional] | + + + diff --git a/docs/Users.md b/docs/Users.md new file mode 100644 index 0000000..5fa6b79 --- /dev/null +++ b/docs/Users.md @@ -0,0 +1,13 @@ + + +# Users + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**users** | **List<String>** | | [optional] | + + + diff --git a/docs/Userset.md b/docs/Userset.md new file mode 100644 index 0000000..a5a04c3 --- /dev/null +++ b/docs/Userset.md @@ -0,0 +1,18 @@ + + +# Userset + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_this** | **Object** | A DirectUserset is a sentinel message for referencing the direct members specified by an object/relation mapping. | [optional] | +|**computedUserset** | [**ObjectRelation**](ObjectRelation.md) | | [optional] | +|**tupleToUserset** | [**TupleToUserset**](TupleToUserset.md) | | [optional] | +|**union** | [**Usersets**](Usersets.md) | | [optional] | +|**intersection** | [**Usersets**](Usersets.md) | | [optional] | +|**difference** | [**Difference**](Difference.md) | | [optional] | + + + diff --git a/docs/UsersetTree.md b/docs/UsersetTree.md new file mode 100644 index 0000000..f97d8d3 --- /dev/null +++ b/docs/UsersetTree.md @@ -0,0 +1,14 @@ + + +# UsersetTree + +A UsersetTree contains the result of an Expansion. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**root** | [**Node**](Node.md) | | [optional] | + + + diff --git a/docs/UsersetTreeDifference.md b/docs/UsersetTreeDifference.md new file mode 100644 index 0000000..4370408 --- /dev/null +++ b/docs/UsersetTreeDifference.md @@ -0,0 +1,14 @@ + + +# UsersetTreeDifference + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**base** | [**Node**](Node.md) | | [optional] | +|**subtract** | [**Node**](Node.md) | | [optional] | + + + diff --git a/docs/UsersetTreeTupleToUserset.md b/docs/UsersetTreeTupleToUserset.md new file mode 100644 index 0000000..3cf3f37 --- /dev/null +++ b/docs/UsersetTreeTupleToUserset.md @@ -0,0 +1,14 @@ + + +# UsersetTreeTupleToUserset + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tupleset** | **String** | | [optional] | +|**computed** | [**List<Computed>**](Computed.md) | | [optional] | + + + diff --git a/docs/Usersets.md b/docs/Usersets.md new file mode 100644 index 0000000..6ddd670 --- /dev/null +++ b/docs/Usersets.md @@ -0,0 +1,13 @@ + + +# Usersets + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**child** | [**List<Userset>**](Userset.md) | | [optional] | + + + diff --git a/docs/ValidationErrorMessageResponse.md b/docs/ValidationErrorMessageResponse.md new file mode 100644 index 0000000..de28998 --- /dev/null +++ b/docs/ValidationErrorMessageResponse.md @@ -0,0 +1,14 @@ + + +# ValidationErrorMessageResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **ErrorCode** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/docs/WriteAssertionsRequest.md b/docs/WriteAssertionsRequest.md new file mode 100644 index 0000000..0b655f1 --- /dev/null +++ b/docs/WriteAssertionsRequest.md @@ -0,0 +1,13 @@ + + +# WriteAssertionsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**assertions** | [**List<Assertion>**](Assertion.md) | | | + + + diff --git a/docs/WriteAuthorizationModelRequest.md b/docs/WriteAuthorizationModelRequest.md new file mode 100644 index 0000000..a99da15 --- /dev/null +++ b/docs/WriteAuthorizationModelRequest.md @@ -0,0 +1,14 @@ + + +# WriteAuthorizationModelRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**typeDefinitions** | [**List<TypeDefinition>**](TypeDefinition.md) | | | +|**schemaVersion** | **String** | | [optional] | + + + diff --git a/docs/WriteAuthorizationModelResponse.md b/docs/WriteAuthorizationModelResponse.md new file mode 100644 index 0000000..5ba44eb --- /dev/null +++ b/docs/WriteAuthorizationModelResponse.md @@ -0,0 +1,13 @@ + + +# WriteAuthorizationModelResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorizationModelId** | **String** | | [optional] | + + + diff --git a/docs/WriteRequest.md b/docs/WriteRequest.md new file mode 100644 index 0000000..4b6b36c --- /dev/null +++ b/docs/WriteRequest.md @@ -0,0 +1,15 @@ + + +# WriteRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**writes** | [**TupleKeys**](TupleKeys.md) | | [optional] | +|**deletes** | [**TupleKeys**](TupleKeys.md) | | [optional] | +|**authorizationModelId** | **String** | | [optional] | + + + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..033e24c4cdf41af1ab109bc7f253b2b887023340 GIT binary patch literal 63375 zcmb5VV{~QRw)Y#`wrv{~+qP{x72B%VwzFc}c2cp;N~)5ZbDrJayPv(!dGEd-##*zr z)#n-$y^sH|_dchh3@8{H5D*j;5D<{i*8l5IFJ|DjL!e)upfGNX(kojugZ3I`oH1PvW`wFW_ske0j@lB9bX zO;2)`y+|!@X(fZ1<2n!Qx*)_^Ai@Cv-dF&(vnudG?0CsddG_&Wtae(n|K59ew)6St z#dj7_(Cfwzh$H$5M!$UDd8=4>IQsD3xV=lXUq($;(h*$0^yd+b{qq63f0r_de#!o_ zXDngc>zy`uor)4A^2M#U*DC~i+dc<)Tb1Tv&~Ev@oM)5iJ4Sn#8iRw16XXuV50BS7 zdBL5Mefch(&^{luE{*5qtCZk$oFr3RH=H!c3wGR=HJ(yKc_re_X9pD` zJ;uxPzUfVpgU>DSq?J;I@a+10l0ONXPcDkiYcihREt5~T5Gb}sT0+6Q;AWHl`S5dV>lv%-p9l#xNNy7ZCr%cyqHY%TZ8Q4 zbp&#ov1*$#grNG#1vgfFOLJCaNG@K|2!W&HSh@3@Y%T?3YI75bJp!VP*$*!< z;(ffNS_;@RJ`=c7yX04!u3JP*<8jeqLHVJu#WV&v6wA!OYJS4h<_}^QI&97-;=ojW zQ-1t)7wnxG*5I%U4)9$wlv5Fr;cIizft@&N+32O%B{R1POm$oap@&f| zh+5J{>U6ftv|vAeKGc|zC=kO(+l7_cLpV}-D#oUltScw})N>~JOZLU_0{Ka2e1evz z{^a*ZrLr+JUj;)K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_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..6a68175 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..a9ad0d1 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'openfga-sdk' \ No newline at end of file diff --git a/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java b/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java new file mode 100644 index 0000000..0192838 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java @@ -0,0 +1,1666 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import dev.openfga.sdk.api.client.ApiClient; +import dev.openfga.sdk.api.client.ApiException; +import dev.openfga.sdk.api.client.ApiResponse; +import dev.openfga.sdk.api.client.Configuration; +import dev.openfga.sdk.api.client.Pair; +import dev.openfga.sdk.api.model.CheckRequest; +import dev.openfga.sdk.api.model.CheckResponse; +import dev.openfga.sdk.api.model.CreateStoreRequest; +import dev.openfga.sdk.api.model.CreateStoreResponse; +import dev.openfga.sdk.api.model.ExpandRequest; +import dev.openfga.sdk.api.model.ExpandResponse; +import dev.openfga.sdk.api.model.GetStoreResponse; +import dev.openfga.sdk.api.model.ListObjectsRequest; +import dev.openfga.sdk.api.model.ListObjectsResponse; +import dev.openfga.sdk.api.model.ListStoresResponse; +import dev.openfga.sdk.api.model.ReadAssertionsResponse; +import dev.openfga.sdk.api.model.ReadAuthorizationModelResponse; +import dev.openfga.sdk.api.model.ReadAuthorizationModelsResponse; +import dev.openfga.sdk.api.model.ReadChangesResponse; +import dev.openfga.sdk.api.model.ReadRequest; +import dev.openfga.sdk.api.model.ReadResponse; +import dev.openfga.sdk.api.model.WriteAssertionsRequest; +import dev.openfga.sdk.api.model.WriteAuthorizationModelRequest; +import dev.openfga.sdk.api.model.WriteAuthorizationModelResponse; +import dev.openfga.sdk.api.model.WriteRequest; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.StringJoiner; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class OpenFgaApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final Configuration memberVarConfiguration; + private final String memberVarBaseUri; + private final Duration memberVarReadTimeout; + private final Consumer memberVarInterceptor; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public OpenFgaApi(ApiClient apiClient, Configuration configuration) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarConfiguration = configuration; + memberVarBaseUri = configuration.getApiUrl(); + memberVarReadTimeout = configuration.getReadTimeout(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + private ApiException getApiException(String operationId, HttpResponse response) { + String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); + return new ApiException(response.statusCode(), message, response.headers(), response.body()); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Check whether a user is authorized to access an object + * The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<CheckResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture check(String storeId, CheckRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = checkRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("check", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Check whether a user is authorized to access an object + * The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<CheckResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> checkWithHttpInfo(String storeId, CheckRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = checkRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("check", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder checkRequestBuilder(String storeId, CheckRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling check"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling check"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/check".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Create a store + * Create a unique OpenFGA store which will be used to store authorization models and relationship tuples. + * @param body (required) + * @return CompletableFuture<CreateStoreResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture createStore(CreateStoreRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = createStoreRequestBuilder(body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("createStore", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Create a store + * Create a unique OpenFGA store which will be used to store authorization models and relationship tuples. + * @param body (required) + * @return CompletableFuture<ApiResponse<CreateStoreResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> createStoreWithHttpInfo(CreateStoreRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = createStoreRequestBuilder(body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("createStore", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder createStoreRequestBuilder(CreateStoreRequest body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createStore"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Delete a store + * Delete an OpenFGA store. This does not delete the data associated with the store, like tuples or authorization models. + * @param storeId (required) + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deleteStore(String storeId) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = deleteStoreRequestBuilder(storeId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("deleteStore", localVarResponse)); + } + return CompletableFuture.completedFuture(null); + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Delete a store + * Delete an OpenFGA store. This does not delete the data associated with the store, like tuples or authorization models. + * @param storeId (required) + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deleteStoreWithHttpInfo(String storeId) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = deleteStoreRequestBuilder(storeId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("deleteStore", localVarResponse)); + } + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null)); + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder deleteStoreRequestBuilder(String storeId) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling deleteStore"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship + * The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ExpandResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture expand(String storeId, ExpandRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = expandRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("expand", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship + * The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ExpandResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> expandWithHttpInfo(String storeId, ExpandRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = expandRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("expand", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder expandRequestBuilder(String storeId, ExpandRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling expand"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling expand"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = + "/stores/{store_id}/expand".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Get a store + * Returns an OpenFGA store by its identifier + * @param storeId (required) + * @return CompletableFuture<GetStoreResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture getStore(String storeId) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = getStoreRequestBuilder(storeId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("getStore", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Get a store + * Returns an OpenFGA store by its identifier + * @param storeId (required) + * @return CompletableFuture<ApiResponse<GetStoreResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> getStoreWithHttpInfo(String storeId) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = getStoreRequestBuilder(storeId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("getStore", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder getStoreRequestBuilder(String storeId) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling getStore"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * List all objects of the given type that the user has a relation with + * The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ListObjectsResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture listObjects(String storeId, ListObjectsRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = listObjectsRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("listObjects", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * List all objects of the given type that the user has a relation with + * The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\"). The number of objects in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_OBJECTS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_OBJECTS_MAX_RESULTS, whichever is hit first. + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ListObjectsResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> listObjectsWithHttpInfo( + String storeId, ListObjectsRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = listObjectsRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("listObjects", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder listObjectsRequestBuilder(String storeId, ListObjectsRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling listObjects"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling listObjects"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = + "/stores/{store_id}/list-objects".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * List all stores + * Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ListStoresResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture listStores(Integer pageSize, String continuationToken) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = listStoresRequestBuilder(pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("listStores", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * List all stores + * Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores. + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ApiResponse<ListStoresResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> listStoresWithHttpInfo( + Integer pageSize, String continuationToken) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = listStoresRequestBuilder(pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("listStores", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder listStoresRequestBuilder(Integer pageSize, String continuationToken) + throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "page_size"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("page_size", pageSize)); + localVarQueryParameterBaseName = "continuation_token"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("continuation_token", continuationToken)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Get tuples from the store that matches a query, without following userset rewrite rules + * The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ReadResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture read(String storeId, ReadRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("read", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Get tuples from the store that matches a query, without following userset rewrite rules + * The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`). + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ReadResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> readWithHttpInfo(String storeId, ReadRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("read", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder readRequestBuilder(String storeId, ReadRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling read"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling read"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/read".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Read assertions for an authorization model ID + * The ReadAssertions API will return, for a given authorization model id, all the assertions stored for it. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + * @param storeId (required) + * @param authorizationModelId (required) + * @return CompletableFuture<ReadAssertionsResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture readAssertions(String storeId, String authorizationModelId) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readAssertionsRequestBuilder(storeId, authorizationModelId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("readAssertions", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Read assertions for an authorization model ID + * The ReadAssertions API will return, for a given authorization model id, all the assertions stored for it. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + * @param storeId (required) + * @param authorizationModelId (required) + * @return CompletableFuture<ApiResponse<ReadAssertionsResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> readAssertionsWithHttpInfo( + String storeId, String authorizationModelId) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readAssertionsRequestBuilder(storeId, authorizationModelId); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("readAssertions", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder readAssertionsRequestBuilder(String storeId, String authorizationModelId) + throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling readAssertions"); + } + // verify the required parameter 'authorizationModelId' is set + if (authorizationModelId == null) { + throw new ApiException( + 400, "Missing the required parameter 'authorizationModelId' when calling readAssertions"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/assertions/{authorization_model_id}" + .replace("{store_id}", ApiClient.urlEncode(storeId.toString())) + .replace("{authorization_model_id}", ApiClient.urlEncode(authorizationModelId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Return a particular version of an authorization model + * The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`). + * @param storeId (required) + * @param id (required) + * @return CompletableFuture<ReadAuthorizationModelResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture readAuthorizationModel(String storeId, String id) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readAuthorizationModelRequestBuilder(storeId, id); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("readAuthorizationModel", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Return a particular version of an authorization model + * The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`). + * @param storeId (required) + * @param id (required) + * @return CompletableFuture<ApiResponse<ReadAuthorizationModelResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> readAuthorizationModelWithHttpInfo( + String storeId, String id) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = readAuthorizationModelRequestBuilder(storeId, id); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("readAuthorizationModel", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder readAuthorizationModelRequestBuilder(String storeId, String id) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling readAuthorizationModel"); + } + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling readAuthorizationModel"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/authorization-models/{id}" + .replace("{store_id}", ApiClient.urlEncode(storeId.toString())) + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Return all the authorization models for a particular store + * The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` + * @param storeId (required) + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ReadAuthorizationModelsResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture readAuthorizationModels( + String storeId, Integer pageSize, String continuationToken) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + readAuthorizationModelsRequestBuilder(storeId, pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("readAuthorizationModels", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Return all the authorization models for a particular store + * The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ``` + * @param storeId (required) + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ApiResponse<ReadAuthorizationModelsResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> readAuthorizationModelsWithHttpInfo( + String storeId, Integer pageSize, String continuationToken) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + readAuthorizationModelsRequestBuilder(storeId, pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("readAuthorizationModels", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder readAuthorizationModelsRequestBuilder( + String storeId, Integer pageSize, String continuationToken) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException( + 400, "Missing the required parameter 'storeId' when calling readAuthorizationModels"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/authorization-models" + .replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "page_size"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("page_size", pageSize)); + localVarQueryParameterBaseName = "continuation_token"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("continuation_token", continuationToken)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Return a list of all the tuple changes + * The ReadChanges API will return a paginated list of tuple changes (additions and deletions) that occurred in a given store, sorted by ascending time. The response will include a continuation token that is used to get the next set of changes. If there are no changes after the provided continuation token, the same token will be returned in order for it to be used when new changes are recorded. If the store never had any tuples added or removed, this token will be empty. You can use the `type` parameter to only get the list of tuple changes that affect objects of that type. + * @param storeId (required) + * @param type (optional) + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ReadChangesResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture readChanges( + String storeId, String type, Integer pageSize, String continuationToken) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + readChangesRequestBuilder(storeId, type, pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("readChanges", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Return a list of all the tuple changes + * The ReadChanges API will return a paginated list of tuple changes (additions and deletions) that occurred in a given store, sorted by ascending time. The response will include a continuation token that is used to get the next set of changes. If there are no changes after the provided continuation token, the same token will be returned in order for it to be used when new changes are recorded. If the store never had any tuples added or removed, this token will be empty. You can use the `type` parameter to only get the list of tuple changes that affect objects of that type. + * @param storeId (required) + * @param type (optional) + * @param pageSize (optional) + * @param continuationToken (optional) + * @return CompletableFuture<ApiResponse<ReadChangesResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> readChangesWithHttpInfo( + String storeId, String type, Integer pageSize, String continuationToken) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + readChangesRequestBuilder(storeId, type, pageSize, continuationToken); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("readChanges", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder readChangesRequestBuilder( + String storeId, String type, Integer pageSize, String continuationToken) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling readChanges"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = + "/stores/{store_id}/changes".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "type"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("type", type)); + localVarQueryParameterBaseName = "page_size"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("page_size", pageSize)); + localVarQueryParameterBaseName = "continuation_token"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("continuation_token", continuationToken)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Add or delete tuples from the store + * The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ``` + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<Object> + * @throws ApiException if fails to make API call + */ + public CompletableFuture write(String storeId, WriteRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = writeRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("write", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Add or delete tuples from the store + * The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ``` + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Object>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> writeWithHttpInfo(String storeId, WriteRequest body) + throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = writeRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("write", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder writeRequestBuilder(String storeId, WriteRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling write"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling write"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/write".replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Upsert assertions for an authorization model ID + * The WriteAssertions API will upsert new assertions for an authorization model id, or overwrite the existing ones. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + * @param storeId (required) + * @param authorizationModelId (required) + * @param body (required) + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture writeAssertions( + String storeId, String authorizationModelId, WriteAssertionsRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + writeAssertionsRequestBuilder(storeId, authorizationModelId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("writeAssertions", localVarResponse)); + } + return CompletableFuture.completedFuture(null); + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Upsert assertions for an authorization model ID + * The WriteAssertions API will upsert new assertions for an authorization model id, or overwrite the existing ones. An assertion is an object that contains a tuple key, and the expectation of whether a call to the Check API of that tuple key will return true or false. + * @param storeId (required) + * @param authorizationModelId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> writeAssertionsWithHttpInfo( + String storeId, String authorizationModelId, WriteAssertionsRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = + writeAssertionsRequestBuilder(storeId, authorizationModelId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture(getApiException("writeAssertions", localVarResponse)); + } + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null)); + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder writeAssertionsRequestBuilder( + String storeId, String authorizationModelId, WriteAssertionsRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException(400, "Missing the required parameter 'storeId' when calling writeAssertions"); + } + // verify the required parameter 'authorizationModelId' is set + if (authorizationModelId == null) { + throw new ApiException( + 400, "Missing the required parameter 'authorizationModelId' when calling writeAssertions"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling writeAssertions"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/assertions/{authorization_model_id}" + .replace("{store_id}", ApiClient.urlEncode(storeId.toString())) + .replace("{authorization_model_id}", ApiClient.urlEncode(authorizationModelId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * Create a new authorization model + * The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ``` + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<WriteAuthorizationModelResponse> + * @throws ApiException if fails to make API call + */ + public CompletableFuture writeAuthorizationModel( + String storeId, WriteAuthorizationModelRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = writeAuthorizationModelRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("writeAuthorizationModel", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {})); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Create a new authorization model + * The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ``` + * @param storeId (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<WriteAuthorizationModelResponse>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> writeAuthorizationModelWithHttpInfo( + String storeId, WriteAuthorizationModelRequest body) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = writeAuthorizationModelRequestBuilder(storeId, body); + return memberVarHttpClient + .sendAsync(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofString()) + .thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode() / 100 != 2) { + return CompletableFuture.failedFuture( + getApiException("writeAuthorizationModel", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture(new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() + ? null + : memberVarObjectMapper.readValue( + responseBody, + new TypeReference() {}))); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder writeAuthorizationModelRequestBuilder( + String storeId, WriteAuthorizationModelRequest body) throws ApiException { + // verify the required parameter 'storeId' is set + if (storeId == null) { + throw new ApiException( + 400, "Missing the required parameter 'storeId' when calling writeAuthorizationModel"); + } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling writeAuthorizationModel"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/stores/{store_id}/authorization-models" + .replace("{store_id}", ApiClient.urlEncode(storeId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/ApiBearerToken.java b/src/main/java/dev/openfga/sdk/api/client/ApiBearerToken.java new file mode 100644 index 0000000..03108eb --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/ApiBearerToken.java @@ -0,0 +1,29 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +public class ApiBearerToken { + private String token; + + public ApiBearerToken(String token) { + this.token = token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getToken() { + return this.token; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/ApiClient.java b/src/main/java/dev/openfga/sdk/api/client/ApiClient.java new file mode 100644 index 0000000..82d76f2 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/ApiClient.java @@ -0,0 +1,327 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.InputStream; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import org.openapitools.jackson.nullable.JsonNullableModule; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ApiClient { + + private HttpClient.Builder builder; + private ObjectMapper mapper; + private Consumer interceptor; + private Consumer> responseInterceptor; + private Consumer> asyncResponseInterceptor; + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + interceptor = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + *

+ * In other contexts, note that any settings in a {@link Configuration} + * will take precedence over equivalent settings in the + * {@link HttpClient.Builder} here. + * + * @param builder Http client builder. + * @param mapper Object mapper. + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper) { + this.builder = builder; + this.mapper = mapper; + interceptor = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + private static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs(String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch (format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + protected ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new JsonNullableModule()); + return mapper; + } + + protected String getDefaultBaseUri() { + return "http://localhost"; + } + + protected HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + *

+ * In other contexts, note that any settings in a {@link Configuration} + * will take precedence over equivalent settings in the + * {@link HttpClient.Builder} here. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/ApiException.java b/src/main/java/dev/openfga/sdk/api/client/ApiException.java new file mode 100644 index 0000000..d08528d --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/ApiException.java @@ -0,0 +1,92 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ApiException extends Exception { + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException( + String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/ApiResponse.java b/src/main/java/dev/openfga/sdk/api/client/ApiResponse.java new file mode 100644 index 0000000..143a9c5 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/ApiResponse.java @@ -0,0 +1,64 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for (Entry> entry : headers.entrySet()) { + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + this.headers = responseHeaders; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/BaseConfiguration.java b/src/main/java/dev/openfga/sdk/api/client/BaseConfiguration.java new file mode 100644 index 0000000..d1f4ce0 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/BaseConfiguration.java @@ -0,0 +1,28 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import dev.openfga.sdk.errors.FgaInvalidParameterException; +import java.time.Duration; + +public interface BaseConfiguration { + void assertValid() throws FgaInvalidParameterException; + + String getApiUrl(); + + String getUserAgent(); + + Duration getReadTimeout(); + + Duration getConnectTimeout(); +} diff --git a/src/main/java/dev/openfga/sdk/api/client/ClientCredentials.java b/src/main/java/dev/openfga/sdk/api/client/ClientCredentials.java new file mode 100644 index 0000000..dcf859a --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/ClientCredentials.java @@ -0,0 +1,80 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import static dev.openfga.util.StringUtil.isNullOrWhitespace; + +import dev.openfga.sdk.errors.FgaInvalidParameterException; + +public class ClientCredentials { + private String clientId; + private String clientSecret; + private String apiTokenIssuer; + private String apiAudience; + + public ClientCredentials() {} + + public ClientCredentials clientId(String clientId) { + this.clientId = clientId; + return this; + } + + public void assertValid() throws FgaInvalidParameterException { + if (isNullOrWhitespace(clientId)) { + throw new FgaInvalidParameterException("clientId", "ClientCredentials"); + } + + if (isNullOrWhitespace(clientSecret)) { + throw new FgaInvalidParameterException("clientSecret", "ClientCredentials"); + } + + if (isNullOrWhitespace(apiTokenIssuer)) { + throw new FgaInvalidParameterException("apiTokenIssuer", "ClientCredentials"); + } + + if (isNullOrWhitespace(apiAudience)) { + throw new FgaInvalidParameterException("apiAudience", "ClientCredentials"); + } + } + + public String getClientId() { + return this.clientId; + } + + public ClientCredentials clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public String getClientSecret() { + return this.clientSecret; + } + + public ClientCredentials apiTokenIssuer(String apiTokenIssuer) { + this.apiTokenIssuer = apiTokenIssuer; + return this; + } + + public String getApiTokenIssuer() { + return this.apiTokenIssuer; + } + + public ClientCredentials apiAudience(String apiAudience) { + this.apiAudience = apiAudience; + return this; + } + + public String getApiAudience() { + return this.apiAudience; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/Configuration.java b/src/main/java/dev/openfga/sdk/api/client/Configuration.java new file mode 100644 index 0000000..aa9af11 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/Configuration.java @@ -0,0 +1,179 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import static dev.openfga.util.StringUtil.isNullOrWhitespace; + +import dev.openfga.sdk.errors.FgaInvalidParameterException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.time.Duration; + +/** + * Configurations for an ApiClient. + */ +public class Configuration implements BaseConfiguration { + public static final String VERSION = "0.0.1"; + + private static final String DEFAULT_API_URL = "http://localhost:8080"; + private static final String DEFAULT_USER_AGENT = "openfga-sdk java/0.0.1"; + private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(10); + private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(10); + + private String apiUrl; + private String userAgent; + private Duration readTimeout; + private Duration connectTimeout; + + public Configuration(String apiUrl) { + this.apiUrl = apiUrl; + this.userAgent = DEFAULT_USER_AGENT; + this.readTimeout = DEFAULT_READ_TIMEOUT; + this.connectTimeout = DEFAULT_CONNECT_TIMEOUT; + } + + /** + * Assert that the configuration is valid. + */ + @Override + public void assertValid() throws FgaInvalidParameterException { + // If apiUrl is null/empty/whitespace it will resolve to + // DEFAULT_API_URL when getApiUrl is called. + if (!isNullOrWhitespace(apiUrl)) { + URI uri; + + try { + uri = URI.create(apiUrl); + URL _url = uri.toURL(); + } catch (MalformedURLException | IllegalArgumentException cause) { + throw new FgaInvalidParameterException("apiUrl", "Configuration", cause); + } + + if (isNullOrWhitespace(uri.getScheme())) { + throw new FgaInvalidParameterException("scheme", "Configuration"); + } + + if (isNullOrWhitespace(uri.getHost())) { + throw new FgaInvalidParameterException("hostname", "Configuration"); + } + } + } + + /** + * Set the API URL for the http client. + * + * @param apiUrl The URL. + * @return This object. + */ + public BaseConfiguration apiUrl(String apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + /** + * Get the API URL that was set. + * + * @return The url. + */ + @Override + public String getApiUrl() { + if (isNullOrWhitespace(apiUrl)) { + return DEFAULT_API_URL; + } + + return apiUrl; + } + + /** + * Set the user agent. + * + * @param userAgent The user agent. + * @return This object. + */ + public BaseConfiguration userAgent(String userAgent) { + this.userAgent = userAgent; + return this; + } + + /** + * Get the user agent. + * + * @return The user agent. + */ + @Override + public String getUserAgent() { + return userAgent; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public BaseConfiguration readTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + @Override + public Duration getReadTimeout() { + return readTimeout; + } + + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest, BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest, BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * @return This object. + */ + public BaseConfiguration connectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + @Override + public Duration getConnectTimeout() { + return connectTimeout; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/CredentialsMethod.java b/src/main/java/dev/openfga/sdk/api/client/CredentialsMethod.java new file mode 100644 index 0000000..5bec856 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/CredentialsMethod.java @@ -0,0 +1,41 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +/** + * + */ +public enum CredentialsMethod { + NONE, + API_BEARER_TOKEN, + CLIENT_CREDENTIALS; + + private ApiBearerToken apiBearerToken; + private ClientCredentials clientCredentials; + + public static CredentialsMethod none() { + return NONE; + } + + public static CredentialsMethod apiBearerToken(ApiBearerToken apiBearerToken) { + CredentialsMethod it = API_BEARER_TOKEN; + it.apiBearerToken = apiBearerToken; + return it; + } + + public static CredentialsMethod clientCredentials(ClientCredentials clientCredentials) { + CredentialsMethod it = CLIENT_CREDENTIALS; + it.clientCredentials = clientCredentials; + return it; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/JSON.java b/src/main/java/dev/openfga/sdk/api/client/JSON.java new file mode 100644 index 0000000..e4c9f44 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/JSON.java @@ -0,0 +1,254 @@ +package dev.openfga.sdk.api.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import dev.openfga.sdk.api.model.*; +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullableModule; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) + .build(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JavaTimeModule()); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { + return mapper; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator( + Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/Pair.java b/src/main/java/dev/openfga/sdk/api/client/Pair.java new file mode 100644 index 0000000..acf13bb --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/Pair.java @@ -0,0 +1,58 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair(String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/src/main/java/dev/openfga/sdk/api/client/RFC3339DateFormat.java b/src/main/java/dev/openfga/sdk/api/client/RFC3339DateFormat.java new file mode 100644 index 0000000..eb342be --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/client/RFC3339DateFormat.java @@ -0,0 +1,55 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = + new StdDateFormat().withTimeZone(TIMEZONE_Z).withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java b/src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000..d24ecce --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; +import java.util.Objects; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() { + return instance; + } + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) { + this.instance = instance; + } + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema) object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) + && Objects.equals(this.isNullable, a.isNullable) + && Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Any.java b/src/main/java/dev/openfga/sdk/api/model/Any.java new file mode 100644 index 0000000..76a9abc --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Any.java @@ -0,0 +1,196 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Any + */ +@JsonPropertyOrder({Any.JSON_PROPERTY_AT_TYPE}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Any extends HashMap { + public static final String JSON_PROPERTY_AT_TYPE = "@type"; + private String atType; + + public Any() {} + + public Any atType(String atType) { + this.atType = atType; + return this; + } + + /** + * Get atType + * @return atType + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAtType() { + return atType; + } + + @JsonProperty(JSON_PROPERTY_AT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAtType(String atType) { + this.atType = atType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public Any putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this Any object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Any any = (Any) o; + return Objects.equals(this.atType, any.atType) + && Objects.equals(this.additionalProperties, any.additionalProperties) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(atType, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Any {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `@type` to the URL query string + if (getAtType() != null) { + joiner.add(String.format( + "%s@type%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAtType()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Assertion.java b/src/main/java/dev/openfga/sdk/api/model/Assertion.java new file mode 100644 index 0000000..e38c124 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Assertion.java @@ -0,0 +1,174 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Assertion + */ +@JsonPropertyOrder({Assertion.JSON_PROPERTY_TUPLE_KEY, Assertion.JSON_PROPERTY_EXPECTATION}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Assertion { + public static final String JSON_PROPERTY_TUPLE_KEY = "tuple_key"; + private TupleKey tupleKey; + + public static final String JSON_PROPERTY_EXPECTATION = "expectation"; + private Boolean expectation; + + public Assertion() {} + + public Assertion tupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + return this; + } + + /** + * Get tupleKey + * @return tupleKey + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TupleKey getTupleKey() { + return tupleKey; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + } + + public Assertion expectation(Boolean expectation) { + this.expectation = expectation; + return this; + } + + /** + * Get expectation + * @return expectation + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_EXPECTATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getExpectation() { + return expectation; + } + + @JsonProperty(JSON_PROPERTY_EXPECTATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setExpectation(Boolean expectation) { + this.expectation = expectation; + } + + /** + * Return true if this Assertion object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Assertion assertion = (Assertion) o; + return Objects.equals(this.tupleKey, assertion.tupleKey) + && Objects.equals(this.expectation, assertion.expectation); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKey, expectation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Assertion {\n"); + sb.append(" tupleKey: ").append(toIndentedString(tupleKey)).append("\n"); + sb.append(" expectation: ").append(toIndentedString(expectation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_key` to the URL query string + if (getTupleKey() != null) { + joiner.add(getTupleKey().toUrlQueryString(prefix + "tuple_key" + suffix)); + } + + // add `expectation` to the URL query string + if (getExpectation() != null) { + joiner.add(String.format( + "%sexpectation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getExpectation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/AuthorizationModel.java b/src/main/java/dev/openfga/sdk/api/model/AuthorizationModel.java new file mode 100644 index 0000000..1f490eb --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/AuthorizationModel.java @@ -0,0 +1,239 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * AuthorizationModel + */ +@JsonPropertyOrder({ + AuthorizationModel.JSON_PROPERTY_ID, + AuthorizationModel.JSON_PROPERTY_SCHEMA_VERSION, + AuthorizationModel.JSON_PROPERTY_TYPE_DEFINITIONS +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class AuthorizationModel { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_SCHEMA_VERSION = "schema_version"; + private String schemaVersion; + + public static final String JSON_PROPERTY_TYPE_DEFINITIONS = "type_definitions"; + private List typeDefinitions = new ArrayList<>(); + + public AuthorizationModel() {} + + public AuthorizationModel id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + public AuthorizationModel schemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + return this; + } + + /** + * Get schemaVersion + * @return schemaVersion + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_SCHEMA_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSchemaVersion() { + return schemaVersion; + } + + @JsonProperty(JSON_PROPERTY_SCHEMA_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSchemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + } + + public AuthorizationModel typeDefinitions(List typeDefinitions) { + this.typeDefinitions = typeDefinitions; + return this; + } + + public AuthorizationModel addTypeDefinitionsItem(TypeDefinition typeDefinitionsItem) { + if (this.typeDefinitions == null) { + this.typeDefinitions = new ArrayList<>(); + } + this.typeDefinitions.add(typeDefinitionsItem); + return this; + } + + /** + * Get typeDefinitions + * @return typeDefinitions + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE_DEFINITIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTypeDefinitions() { + return typeDefinitions; + } + + @JsonProperty(JSON_PROPERTY_TYPE_DEFINITIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTypeDefinitions(List typeDefinitions) { + this.typeDefinitions = typeDefinitions; + } + + /** + * Return true if this AuthorizationModel object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationModel authorizationModel = (AuthorizationModel) o; + return Objects.equals(this.id, authorizationModel.id) + && Objects.equals(this.schemaVersion, authorizationModel.schemaVersion) + && Objects.equals(this.typeDefinitions, authorizationModel.typeDefinitions); + } + + @Override + public int hashCode() { + return Objects.hash(id, schemaVersion, typeDefinitions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationModel {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" schemaVersion: ").append(toIndentedString(schemaVersion)).append("\n"); + sb.append(" typeDefinitions: ") + .append(toIndentedString(typeDefinitions)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `schema_version` to the URL query string + if (getSchemaVersion() != null) { + joiner.add(String.format( + "%sschema_version%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getSchemaVersion()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `type_definitions` to the URL query string + if (getTypeDefinitions() != null) { + for (int i = 0; i < getTypeDefinitions().size(); i++) { + if (getTypeDefinitions().get(i) != null) { + joiner.add(getTypeDefinitions() + .get(i) + .toUrlQueryString(String.format( + "%stype_definitions%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/CheckRequest.java b/src/main/java/dev/openfga/sdk/api/model/CheckRequest.java new file mode 100644 index 0000000..9647bad --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/CheckRequest.java @@ -0,0 +1,248 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * CheckRequest + */ +@JsonPropertyOrder({ + CheckRequest.JSON_PROPERTY_TUPLE_KEY, + CheckRequest.JSON_PROPERTY_CONTEXTUAL_TUPLES, + CheckRequest.JSON_PROPERTY_AUTHORIZATION_MODEL_ID, + CheckRequest.JSON_PROPERTY_TRACE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class CheckRequest { + public static final String JSON_PROPERTY_TUPLE_KEY = "tuple_key"; + private TupleKey tupleKey; + + public static final String JSON_PROPERTY_CONTEXTUAL_TUPLES = "contextual_tuples"; + private ContextualTupleKeys contextualTuples; + + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public static final String JSON_PROPERTY_TRACE = "trace"; + private Boolean trace; + + public CheckRequest() {} + + @JsonCreator + public CheckRequest(@JsonProperty(JSON_PROPERTY_TRACE) Boolean trace) { + this(); + this.trace = trace; + } + + public CheckRequest tupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + return this; + } + + /** + * Get tupleKey + * @return tupleKey + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TupleKey getTupleKey() { + return tupleKey; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + } + + public CheckRequest contextualTuples(ContextualTupleKeys contextualTuples) { + this.contextualTuples = contextualTuples; + return this; + } + + /** + * Get contextualTuples + * @return contextualTuples + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTEXTUAL_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ContextualTupleKeys getContextualTuples() { + return contextualTuples; + } + + @JsonProperty(JSON_PROPERTY_CONTEXTUAL_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContextualTuples(ContextualTupleKeys contextualTuples) { + this.contextualTuples = contextualTuples; + } + + public CheckRequest authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + /** + * Defaults to false. Making it true has performance implications. + * @return trace + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TRACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getTrace() { + return trace; + } + + /** + * Return true if this Check_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckRequest checkRequest = (CheckRequest) o; + return Objects.equals(this.tupleKey, checkRequest.tupleKey) + && Objects.equals(this.contextualTuples, checkRequest.contextualTuples) + && Objects.equals(this.authorizationModelId, checkRequest.authorizationModelId) + && Objects.equals(this.trace, checkRequest.trace); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKey, contextualTuples, authorizationModelId, trace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckRequest {\n"); + sb.append(" tupleKey: ").append(toIndentedString(tupleKey)).append("\n"); + sb.append(" contextualTuples: ") + .append(toIndentedString(contextualTuples)) + .append("\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append(" trace: ").append(toIndentedString(trace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_key` to the URL query string + if (getTupleKey() != null) { + joiner.add(getTupleKey().toUrlQueryString(prefix + "tuple_key" + suffix)); + } + + // add `contextual_tuples` to the URL query string + if (getContextualTuples() != null) { + joiner.add(getContextualTuples().toUrlQueryString(prefix + "contextual_tuples" + suffix)); + } + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `trace` to the URL query string + if (getTrace() != null) { + joiner.add(String.format( + "%strace%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTrace()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/CheckResponse.java b/src/main/java/dev/openfga/sdk/api/model/CheckResponse.java new file mode 100644 index 0000000..c0bc142 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/CheckResponse.java @@ -0,0 +1,179 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * CheckResponse + */ +@JsonPropertyOrder({CheckResponse.JSON_PROPERTY_ALLOWED, CheckResponse.JSON_PROPERTY_RESOLUTION}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class CheckResponse { + public static final String JSON_PROPERTY_ALLOWED = "allowed"; + private Boolean allowed; + + public static final String JSON_PROPERTY_RESOLUTION = "resolution"; + private String resolution; + + public CheckResponse() {} + + public CheckResponse allowed(Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * Get allowed + * @return allowed + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAllowed() { + return allowed; + } + + @JsonProperty(JSON_PROPERTY_ALLOWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowed(Boolean allowed) { + this.allowed = allowed; + } + + public CheckResponse resolution(String resolution) { + this.resolution = resolution; + return this; + } + + /** + * For internal use only. + * @return resolution + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOLUTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResolution() { + return resolution; + } + + @JsonProperty(JSON_PROPERTY_RESOLUTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setResolution(String resolution) { + this.resolution = resolution; + } + + /** + * Return true if this CheckResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckResponse checkResponse = (CheckResponse) o; + return Objects.equals(this.allowed, checkResponse.allowed) + && Objects.equals(this.resolution, checkResponse.resolution); + } + + @Override + public int hashCode() { + return Objects.hash(allowed, resolution); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckResponse {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).append("\n"); + sb.append(" resolution: ").append(toIndentedString(resolution)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `allowed` to the URL query string + if (getAllowed() != null) { + joiner.add(String.format( + "%sallowed%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAllowed()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `resolution` to the URL query string + if (getResolution() != null) { + joiner.add(String.format( + "%sresolution%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getResolution()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Computed.java b/src/main/java/dev/openfga/sdk/api/model/Computed.java new file mode 100644 index 0000000..b1f3e0d --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Computed.java @@ -0,0 +1,142 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Computed + */ +@JsonPropertyOrder({Computed.JSON_PROPERTY_USERSET}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Computed { + public static final String JSON_PROPERTY_USERSET = "userset"; + private String userset; + + public Computed() {} + + public Computed userset(String userset) { + this.userset = userset; + return this; + } + + /** + * Get userset + * @return userset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUserset() { + return userset; + } + + @JsonProperty(JSON_PROPERTY_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserset(String userset) { + this.userset = userset; + } + + /** + * Return true if this Computed object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Computed computed = (Computed) o; + return Objects.equals(this.userset, computed.userset); + } + + @Override + public int hashCode() { + return Objects.hash(userset); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Computed {\n"); + sb.append(" userset: ").append(toIndentedString(userset)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `userset` to the URL query string + if (getUserset() != null) { + joiner.add(String.format( + "%suserset%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUserset()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java b/src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java new file mode 100644 index 0000000..f8efba5 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ContextualTupleKeys.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ContextualTupleKeys + */ +@JsonPropertyOrder({ContextualTupleKeys.JSON_PROPERTY_TUPLE_KEYS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ContextualTupleKeys { + public static final String JSON_PROPERTY_TUPLE_KEYS = "tuple_keys"; + private List tupleKeys = new ArrayList<>(); + + public ContextualTupleKeys() {} + + public ContextualTupleKeys tupleKeys(List tupleKeys) { + this.tupleKeys = tupleKeys; + return this; + } + + public ContextualTupleKeys addTupleKeysItem(TupleKey tupleKeysItem) { + if (this.tupleKeys == null) { + this.tupleKeys = new ArrayList<>(); + } + this.tupleKeys.add(tupleKeysItem); + return this; + } + + /** + * Get tupleKeys + * @return tupleKeys + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TUPLE_KEYS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTupleKeys() { + return tupleKeys; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEYS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTupleKeys(List tupleKeys) { + this.tupleKeys = tupleKeys; + } + + /** + * Return true if this ContextualTupleKeys object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContextualTupleKeys contextualTupleKeys = (ContextualTupleKeys) o; + return Objects.equals(this.tupleKeys, contextualTupleKeys.tupleKeys); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKeys); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContextualTupleKeys {\n"); + sb.append(" tupleKeys: ").append(toIndentedString(tupleKeys)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_keys` to the URL query string + if (getTupleKeys() != null) { + for (int i = 0; i < getTupleKeys().size(); i++) { + if (getTupleKeys().get(i) != null) { + joiner.add(getTupleKeys() + .get(i) + .toUrlQueryString(String.format( + "%stuple_keys%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java b/src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java new file mode 100644 index 0000000..2de7c01 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/CreateStoreRequest.java @@ -0,0 +1,142 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * CreateStoreRequest + */ +@JsonPropertyOrder({CreateStoreRequest.JSON_PROPERTY_NAME}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class CreateStoreRequest { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CreateStoreRequest() {} + + public CreateStoreRequest name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + /** + * Return true if this CreateStoreRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStoreRequest createStoreRequest = (CreateStoreRequest) o; + return Objects.equals(this.name, createStoreRequest.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateStoreRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java b/src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java new file mode 100644 index 0000000..18e1245 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/CreateStoreResponse.java @@ -0,0 +1,259 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * CreateStoreResponse + */ +@JsonPropertyOrder({ + CreateStoreResponse.JSON_PROPERTY_ID, + CreateStoreResponse.JSON_PROPERTY_NAME, + CreateStoreResponse.JSON_PROPERTY_CREATED_AT, + CreateStoreResponse.JSON_PROPERTY_UPDATED_AT +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class CreateStoreResponse { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public CreateStoreResponse() {} + + public CreateStoreResponse id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + public CreateStoreResponse name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public CreateStoreResponse createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CreateStoreResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * Return true if this CreateStoreResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStoreResponse createStoreResponse = (CreateStoreResponse) o; + return Objects.equals(this.id, createStoreResponse.id) + && Objects.equals(this.name, createStoreResponse.name) + && Objects.equals(this.createdAt, createStoreResponse.createdAt) + && Objects.equals(this.updatedAt, createStoreResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateStoreResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `created_at` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format( + "%screated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCreatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `updated_at` to the URL query string + if (getUpdatedAt() != null) { + joiner.add(String.format( + "%supdated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUpdatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Difference.java b/src/main/java/dev/openfga/sdk/api/model/Difference.java new file mode 100644 index 0000000..5517504 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Difference.java @@ -0,0 +1,166 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Difference + */ +@JsonPropertyOrder({Difference.JSON_PROPERTY_BASE, Difference.JSON_PROPERTY_SUBTRACT}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Difference { + public static final String JSON_PROPERTY_BASE = "base"; + private Userset base; + + public static final String JSON_PROPERTY_SUBTRACT = "subtract"; + private Userset subtract; + + public Difference() {} + + public Difference base(Userset base) { + this.base = base; + return this; + } + + /** + * Get base + * @return base + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_BASE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Userset getBase() { + return base; + } + + @JsonProperty(JSON_PROPERTY_BASE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBase(Userset base) { + this.base = base; + } + + public Difference subtract(Userset subtract) { + this.subtract = subtract; + return this; + } + + /** + * Get subtract + * @return subtract + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_SUBTRACT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Userset getSubtract() { + return subtract; + } + + @JsonProperty(JSON_PROPERTY_SUBTRACT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSubtract(Userset subtract) { + this.subtract = subtract; + } + + /** + * Return true if this Difference object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Difference difference = (Difference) o; + return Objects.equals(this.base, difference.base) && Objects.equals(this.subtract, difference.subtract); + } + + @Override + public int hashCode() { + return Objects.hash(base, subtract); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Difference {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" subtract: ").append(toIndentedString(subtract)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `base` to the URL query string + if (getBase() != null) { + joiner.add(getBase().toUrlQueryString(prefix + "base" + suffix)); + } + + // add `subtract` to the URL query string + if (getSubtract() != null) { + joiner.add(getSubtract().toUrlQueryString(prefix + "subtract" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ErrorCode.java b/src/main/java/dev/openfga/sdk/api/model/ErrorCode.java new file mode 100644 index 0000000..4c1a235 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ErrorCode.java @@ -0,0 +1,159 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets ErrorCode + */ +public enum ErrorCode { + NO_ERROR("no_error"), + + VALIDATION_ERROR("validation_error"), + + AUTHORIZATION_MODEL_NOT_FOUND("authorization_model_not_found"), + + AUTHORIZATION_MODEL_RESOLUTION_TOO_COMPLEX("authorization_model_resolution_too_complex"), + + INVALID_WRITE_INPUT("invalid_write_input"), + + CANNOT_ALLOW_DUPLICATE_TUPLES_IN_ONE_REQUEST("cannot_allow_duplicate_tuples_in_one_request"), + + CANNOT_ALLOW_DUPLICATE_TYPES_IN_ONE_REQUEST("cannot_allow_duplicate_types_in_one_request"), + + CANNOT_ALLOW_MULTIPLE_REFERENCES_TO_ONE_RELATION("cannot_allow_multiple_references_to_one_relation"), + + INVALID_CONTINUATION_TOKEN("invalid_continuation_token"), + + INVALID_TUPLE_SET("invalid_tuple_set"), + + INVALID_CHECK_INPUT("invalid_check_input"), + + INVALID_EXPAND_INPUT("invalid_expand_input"), + + UNSUPPORTED_USER_SET("unsupported_user_set"), + + INVALID_OBJECT_FORMAT("invalid_object_format"), + + WRITE_FAILED_DUE_TO_INVALID_INPUT("write_failed_due_to_invalid_input"), + + AUTHORIZATION_MODEL_ASSERTIONS_NOT_FOUND("authorization_model_assertions_not_found"), + + LATEST_AUTHORIZATION_MODEL_NOT_FOUND("latest_authorization_model_not_found"), + + TYPE_NOT_FOUND("type_not_found"), + + RELATION_NOT_FOUND("relation_not_found"), + + EMPTY_RELATION_DEFINITION("empty_relation_definition"), + + INVALID_USER("invalid_user"), + + INVALID_TUPLE("invalid_tuple"), + + UNKNOWN_RELATION("unknown_relation"), + + STORE_ID_INVALID_LENGTH("store_id_invalid_length"), + + ASSERTIONS_TOO_MANY_ITEMS("assertions_too_many_items"), + + ID_TOO_LONG("id_too_long"), + + AUTHORIZATION_MODEL_ID_TOO_LONG("authorization_model_id_too_long"), + + TUPLE_KEY_VALUE_NOT_SPECIFIED("tuple_key_value_not_specified"), + + TUPLE_KEYS_TOO_MANY_OR_TOO_FEW_ITEMS("tuple_keys_too_many_or_too_few_items"), + + PAGE_SIZE_INVALID("page_size_invalid"), + + PARAM_MISSING_VALUE("param_missing_value"), + + DIFFERENCE_BASE_MISSING_VALUE("difference_base_missing_value"), + + SUBTRACT_BASE_MISSING_VALUE("subtract_base_missing_value"), + + OBJECT_TOO_LONG("object_too_long"), + + RELATION_TOO_LONG("relation_too_long"), + + TYPE_DEFINITIONS_TOO_FEW_ITEMS("type_definitions_too_few_items"), + + TYPE_INVALID_LENGTH("type_invalid_length"), + + TYPE_INVALID_PATTERN("type_invalid_pattern"), + + RELATIONS_TOO_FEW_ITEMS("relations_too_few_items"), + + RELATIONS_TOO_LONG("relations_too_long"), + + RELATIONS_INVALID_PATTERN("relations_invalid_pattern"), + + OBJECT_INVALID_PATTERN("object_invalid_pattern"), + + QUERY_STRING_TYPE_CONTINUATION_TOKEN_MISMATCH("query_string_type_continuation_token_mismatch"), + + EXCEEDED_ENTITY_LIMIT("exceeded_entity_limit"), + + INVALID_CONTEXTUAL_TUPLE("invalid_contextual_tuple"), + + DUPLICATE_CONTEXTUAL_TUPLE("duplicate_contextual_tuple"), + + INVALID_AUTHORIZATION_MODEL("invalid_authorization_model"), + + UNSUPPORTED_SCHEMA_VERSION("unsupported_schema_version"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ErrorCode(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ErrorCode fromValue(String value) { + for (ErrorCode b : ErrorCode.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ExpandRequest.java b/src/main/java/dev/openfga/sdk/api/model/ExpandRequest.java new file mode 100644 index 0000000..2f6ce27 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ExpandRequest.java @@ -0,0 +1,176 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ExpandRequest + */ +@JsonPropertyOrder({ExpandRequest.JSON_PROPERTY_TUPLE_KEY, ExpandRequest.JSON_PROPERTY_AUTHORIZATION_MODEL_ID}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ExpandRequest { + public static final String JSON_PROPERTY_TUPLE_KEY = "tuple_key"; + private TupleKey tupleKey; + + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public ExpandRequest() {} + + public ExpandRequest tupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + return this; + } + + /** + * Get tupleKey + * @return tupleKey + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TupleKey getTupleKey() { + return tupleKey; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + } + + public ExpandRequest authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + /** + * Return true if this Expand_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExpandRequest expandRequest = (ExpandRequest) o; + return Objects.equals(this.tupleKey, expandRequest.tupleKey) + && Objects.equals(this.authorizationModelId, expandRequest.authorizationModelId); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKey, authorizationModelId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExpandRequest {\n"); + sb.append(" tupleKey: ").append(toIndentedString(tupleKey)).append("\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_key` to the URL query string + if (getTupleKey() != null) { + joiner.add(getTupleKey().toUrlQueryString(prefix + "tuple_key" + suffix)); + } + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ExpandResponse.java b/src/main/java/dev/openfga/sdk/api/model/ExpandResponse.java new file mode 100644 index 0000000..520aa69 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ExpandResponse.java @@ -0,0 +1,135 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ExpandResponse + */ +@JsonPropertyOrder({ExpandResponse.JSON_PROPERTY_TREE}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ExpandResponse { + public static final String JSON_PROPERTY_TREE = "tree"; + private UsersetTree tree; + + public ExpandResponse() {} + + public ExpandResponse tree(UsersetTree tree) { + this.tree = tree; + return this; + } + + /** + * Get tree + * @return tree + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TREE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UsersetTree getTree() { + return tree; + } + + @JsonProperty(JSON_PROPERTY_TREE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTree(UsersetTree tree) { + this.tree = tree; + } + + /** + * Return true if this ExpandResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExpandResponse expandResponse = (ExpandResponse) o; + return Objects.equals(this.tree, expandResponse.tree); + } + + @Override + public int hashCode() { + return Objects.hash(tree); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExpandResponse {\n"); + sb.append(" tree: ").append(toIndentedString(tree)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tree` to the URL query string + if (getTree() != null) { + joiner.add(getTree().toUrlQueryString(prefix + "tree" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/GetStoreResponse.java b/src/main/java/dev/openfga/sdk/api/model/GetStoreResponse.java new file mode 100644 index 0000000..d57f06d --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/GetStoreResponse.java @@ -0,0 +1,259 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * GetStoreResponse + */ +@JsonPropertyOrder({ + GetStoreResponse.JSON_PROPERTY_ID, + GetStoreResponse.JSON_PROPERTY_NAME, + GetStoreResponse.JSON_PROPERTY_CREATED_AT, + GetStoreResponse.JSON_PROPERTY_UPDATED_AT +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class GetStoreResponse { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public GetStoreResponse() {} + + public GetStoreResponse id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + public GetStoreResponse name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public GetStoreResponse createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public GetStoreResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * Return true if this GetStoreResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetStoreResponse getStoreResponse = (GetStoreResponse) o; + return Objects.equals(this.id, getStoreResponse.id) + && Objects.equals(this.name, getStoreResponse.name) + && Objects.equals(this.createdAt, getStoreResponse.createdAt) + && Objects.equals(this.updatedAt, getStoreResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetStoreResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `created_at` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format( + "%screated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCreatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `updated_at` to the URL query string + if (getUpdatedAt() != null) { + joiner.add(String.format( + "%supdated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUpdatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/InternalErrorCode.java b/src/main/java/dev/openfga/sdk/api/model/InternalErrorCode.java new file mode 100644 index 0000000..e0b5b0e --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/InternalErrorCode.java @@ -0,0 +1,85 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets InternalErrorCode + */ +public enum InternalErrorCode { + NO_INTERNAL_ERROR("no_internal_error"), + + INTERNAL_ERROR("internal_error"), + + CANCELLED("cancelled"), + + DEADLINE_EXCEEDED("deadline_exceeded"), + + ALREADY_EXISTS("already_exists"), + + RESOURCE_EXHAUSTED("resource_exhausted"), + + FAILED_PRECONDITION("failed_precondition"), + + ABORTED("aborted"), + + OUT_OF_RANGE("out_of_range"), + + UNAVAILABLE("unavailable"), + + DATA_LOSS("data_loss"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + InternalErrorCode(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InternalErrorCode fromValue(String value) { + for (InternalErrorCode b : InternalErrorCode.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/InternalErrorMessageResponse.java b/src/main/java/dev/openfga/sdk/api/model/InternalErrorMessageResponse.java new file mode 100644 index 0000000..65a9a24 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/InternalErrorMessageResponse.java @@ -0,0 +1,180 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * InternalErrorMessageResponse + */ +@JsonPropertyOrder({InternalErrorMessageResponse.JSON_PROPERTY_CODE, InternalErrorMessageResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class InternalErrorMessageResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private InternalErrorCode code = InternalErrorCode.NO_INTERNAL_ERROR; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public InternalErrorMessageResponse() {} + + public InternalErrorMessageResponse code(InternalErrorCode code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public InternalErrorCode getCode() { + return code; + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(InternalErrorCode code) { + this.code = code; + } + + public InternalErrorMessageResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + /** + * Return true if this InternalErrorMessageResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InternalErrorMessageResponse internalErrorMessageResponse = (InternalErrorMessageResponse) o; + return Objects.equals(this.code, internalErrorMessageResponse.code) + && Objects.equals(this.message, internalErrorMessageResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InternalErrorMessageResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format( + "%scode%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCode()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format( + "%smessage%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getMessage()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Leaf.java b/src/main/java/dev/openfga/sdk/api/model/Leaf.java new file mode 100644 index 0000000..d996e0e --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Leaf.java @@ -0,0 +1,201 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * A leaf node contains either - a set of users (which may be individual users, or usersets referencing other relations) - a computed node, which is the result of a computed userset value in the authorization model - a tupleToUserset nodes, containing the result of expanding a tupleToUserset value in a authorization model. + */ +@JsonPropertyOrder({Leaf.JSON_PROPERTY_USERS, Leaf.JSON_PROPERTY_COMPUTED, Leaf.JSON_PROPERTY_TUPLE_TO_USERSET}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Leaf { + public static final String JSON_PROPERTY_USERS = "users"; + private Users users; + + public static final String JSON_PROPERTY_COMPUTED = "computed"; + private Computed computed; + + public static final String JSON_PROPERTY_TUPLE_TO_USERSET = "tupleToUserset"; + private UsersetTreeTupleToUserset tupleToUserset; + + public Leaf() {} + + public Leaf users(Users users) { + this.users = users; + return this; + } + + /** + * Get users + * @return users + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Users getUsers() { + return users; + } + + @JsonProperty(JSON_PROPERTY_USERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsers(Users users) { + this.users = users; + } + + public Leaf computed(Computed computed) { + this.computed = computed; + return this; + } + + /** + * Get computed + * @return computed + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Computed getComputed() { + return computed; + } + + @JsonProperty(JSON_PROPERTY_COMPUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComputed(Computed computed) { + this.computed = computed; + } + + public Leaf tupleToUserset(UsersetTreeTupleToUserset tupleToUserset) { + this.tupleToUserset = tupleToUserset; + return this; + } + + /** + * Get tupleToUserset + * @return tupleToUserset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLE_TO_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UsersetTreeTupleToUserset getTupleToUserset() { + return tupleToUserset; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_TO_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleToUserset(UsersetTreeTupleToUserset tupleToUserset) { + this.tupleToUserset = tupleToUserset; + } + + /** + * Return true if this Leaf object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Leaf leaf = (Leaf) o; + return Objects.equals(this.users, leaf.users) + && Objects.equals(this.computed, leaf.computed) + && Objects.equals(this.tupleToUserset, leaf.tupleToUserset); + } + + @Override + public int hashCode() { + return Objects.hash(users, computed, tupleToUserset); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Leaf {\n"); + sb.append(" users: ").append(toIndentedString(users)).append("\n"); + sb.append(" computed: ").append(toIndentedString(computed)).append("\n"); + sb.append(" tupleToUserset: ") + .append(toIndentedString(tupleToUserset)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `users` to the URL query string + if (getUsers() != null) { + joiner.add(getUsers().toUrlQueryString(prefix + "users" + suffix)); + } + + // add `computed` to the URL query string + if (getComputed() != null) { + joiner.add(getComputed().toUrlQueryString(prefix + "computed" + suffix)); + } + + // add `tupleToUserset` to the URL query string + if (getTupleToUserset() != null) { + joiner.add(getTupleToUserset().toUrlQueryString(prefix + "tupleToUserset" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ListObjectsRequest.java b/src/main/java/dev/openfga/sdk/api/model/ListObjectsRequest.java new file mode 100644 index 0000000..f7d4610 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ListObjectsRequest.java @@ -0,0 +1,295 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ListObjectsRequest + */ +@JsonPropertyOrder({ + ListObjectsRequest.JSON_PROPERTY_AUTHORIZATION_MODEL_ID, + ListObjectsRequest.JSON_PROPERTY_TYPE, + ListObjectsRequest.JSON_PROPERTY_RELATION, + ListObjectsRequest.JSON_PROPERTY_USER, + ListObjectsRequest.JSON_PROPERTY_CONTEXTUAL_TUPLES +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ListObjectsRequest { + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_RELATION = "relation"; + private String relation; + + public static final String JSON_PROPERTY_USER = "user"; + private String user; + + public static final String JSON_PROPERTY_CONTEXTUAL_TUPLES = "contextual_tuples"; + private ContextualTupleKeys contextualTuples; + + public ListObjectsRequest() {} + + public ListObjectsRequest authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + public ListObjectsRequest type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(String type) { + this.type = type; + } + + public ListObjectsRequest relation(String relation) { + this.relation = relation; + return this; + } + + /** + * Get relation + * @return relation + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRelation() { + return relation; + } + + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setRelation(String relation) { + this.relation = relation; + } + + public ListObjectsRequest user(String user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUser() { + return user; + } + + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setUser(String user) { + this.user = user; + } + + public ListObjectsRequest contextualTuples(ContextualTupleKeys contextualTuples) { + this.contextualTuples = contextualTuples; + return this; + } + + /** + * Get contextualTuples + * @return contextualTuples + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTEXTUAL_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ContextualTupleKeys getContextualTuples() { + return contextualTuples; + } + + @JsonProperty(JSON_PROPERTY_CONTEXTUAL_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContextualTuples(ContextualTupleKeys contextualTuples) { + this.contextualTuples = contextualTuples; + } + + /** + * Return true if this ListObjects_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListObjectsRequest listObjectsRequest = (ListObjectsRequest) o; + return Objects.equals(this.authorizationModelId, listObjectsRequest.authorizationModelId) + && Objects.equals(this.type, listObjectsRequest.type) + && Objects.equals(this.relation, listObjectsRequest.relation) + && Objects.equals(this.user, listObjectsRequest.user) + && Objects.equals(this.contextualTuples, listObjectsRequest.contextualTuples); + } + + @Override + public int hashCode() { + return Objects.hash(authorizationModelId, type, relation, user, contextualTuples); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListObjectsRequest {\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" relation: ").append(toIndentedString(relation)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" contextualTuples: ") + .append(toIndentedString(contextualTuples)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format( + "%stype%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `relation` to the URL query string + if (getRelation() != null) { + joiner.add(String.format( + "%srelation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getRelation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `user` to the URL query string + if (getUser() != null) { + joiner.add(String.format( + "%suser%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUser()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `contextual_tuples` to the URL query string + if (getContextualTuples() != null) { + joiner.add(getContextualTuples().toUrlQueryString(prefix + "contextual_tuples" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ListObjectsResponse.java b/src/main/java/dev/openfga/sdk/api/model/ListObjectsResponse.java new file mode 100644 index 0000000..ab4e2c7 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ListObjectsResponse.java @@ -0,0 +1,155 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ListObjectsResponse + */ +@JsonPropertyOrder({ListObjectsResponse.JSON_PROPERTY_OBJECTS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ListObjectsResponse { + public static final String JSON_PROPERTY_OBJECTS = "objects"; + private List objects = new ArrayList<>(); + + public ListObjectsResponse() {} + + public ListObjectsResponse objects(List objects) { + this.objects = objects; + return this; + } + + public ListObjectsResponse addObjectsItem(String objectsItem) { + if (this.objects == null) { + this.objects = new ArrayList<>(); + } + this.objects.add(objectsItem); + return this; + } + + /** + * Get objects + * @return objects + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OBJECTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getObjects() { + return objects; + } + + @JsonProperty(JSON_PROPERTY_OBJECTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjects(List objects) { + this.objects = objects; + } + + /** + * Return true if this ListObjectsResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListObjectsResponse listObjectsResponse = (ListObjectsResponse) o; + return Objects.equals(this.objects, listObjectsResponse.objects); + } + + @Override + public int hashCode() { + return Objects.hash(objects); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListObjectsResponse {\n"); + sb.append(" objects: ").append(toIndentedString(objects)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `objects` to the URL query string + if (getObjects() != null) { + for (int i = 0; i < getObjects().size(); i++) { + joiner.add(String.format( + "%sobjects%s%s=%s", + prefix, + suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getObjects().get(i)), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ListStoresResponse.java b/src/main/java/dev/openfga/sdk/api/model/ListStoresResponse.java new file mode 100644 index 0000000..61fb9a2 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ListStoresResponse.java @@ -0,0 +1,198 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ListStoresResponse + */ +@JsonPropertyOrder({ListStoresResponse.JSON_PROPERTY_STORES, ListStoresResponse.JSON_PROPERTY_CONTINUATION_TOKEN}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ListStoresResponse { + public static final String JSON_PROPERTY_STORES = "stores"; + private List stores = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTINUATION_TOKEN = "continuation_token"; + private String continuationToken; + + public ListStoresResponse() {} + + public ListStoresResponse stores(List stores) { + this.stores = stores; + return this; + } + + public ListStoresResponse addStoresItem(Store storesItem) { + if (this.stores == null) { + this.stores = new ArrayList<>(); + } + this.stores.add(storesItem); + return this; + } + + /** + * Get stores + * @return stores + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getStores() { + return stores; + } + + @JsonProperty(JSON_PROPERTY_STORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStores(List stores) { + this.stores = stores; + } + + public ListStoresResponse continuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * The continuation token will be empty if there are no more stores. + * @return continuationToken + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContinuationToken() { + return continuationToken; + } + + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + } + + /** + * Return true if this ListStoresResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListStoresResponse listStoresResponse = (ListStoresResponse) o; + return Objects.equals(this.stores, listStoresResponse.stores) + && Objects.equals(this.continuationToken, listStoresResponse.continuationToken); + } + + @Override + public int hashCode() { + return Objects.hash(stores, continuationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListStoresResponse {\n"); + sb.append(" stores: ").append(toIndentedString(stores)).append("\n"); + sb.append(" continuationToken: ") + .append(toIndentedString(continuationToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `stores` to the URL query string + if (getStores() != null) { + for (int i = 0; i < getStores().size(); i++) { + if (getStores().get(i) != null) { + joiner.add(getStores() + .get(i) + .toUrlQueryString(String.format( + "%sstores%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `continuation_token` to the URL query string + if (getContinuationToken() != null) { + joiner.add(String.format( + "%scontinuation_token%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getContinuationToken()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Metadata.java b/src/main/java/dev/openfga/sdk/api/model/Metadata.java new file mode 100644 index 0000000..667d413 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Metadata.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Metadata + */ +@JsonPropertyOrder({Metadata.JSON_PROPERTY_RELATIONS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Metadata { + public static final String JSON_PROPERTY_RELATIONS = "relations"; + private Map relations = new HashMap<>(); + + public Metadata() {} + + public Metadata relations(Map relations) { + this.relations = relations; + return this; + } + + public Metadata putRelationsItem(String key, RelationMetadata relationsItem) { + if (this.relations == null) { + this.relations = new HashMap<>(); + } + this.relations.put(key, relationsItem); + return this; + } + + /** + * Get relations + * @return relations + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getRelations() { + return relations; + } + + @JsonProperty(JSON_PROPERTY_RELATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRelations(Map relations) { + this.relations = relations; + } + + /** + * Return true if this Metadata object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Metadata metadata = (Metadata) o; + return Objects.equals(this.relations, metadata.relations); + } + + @Override + public int hashCode() { + return Objects.hash(relations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Metadata {\n"); + sb.append(" relations: ").append(toIndentedString(relations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `relations` to the URL query string + if (getRelations() != null) { + for (String _key : getRelations().keySet()) { + if (getRelations().get(_key) != null) { + joiner.add(getRelations() + .get(_key) + .toUrlQueryString(String.format( + "%srelations%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Node.java b/src/main/java/dev/openfga/sdk/api/model/Node.java new file mode 100644 index 0000000..c1886fd --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Node.java @@ -0,0 +1,276 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Node + */ +@JsonPropertyOrder({ + Node.JSON_PROPERTY_NAME, + Node.JSON_PROPERTY_LEAF, + Node.JSON_PROPERTY_DIFFERENCE, + Node.JSON_PROPERTY_UNION, + Node.JSON_PROPERTY_INTERSECTION +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Node { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_LEAF = "leaf"; + private Leaf leaf; + + public static final String JSON_PROPERTY_DIFFERENCE = "difference"; + private UsersetTreeDifference difference; + + public static final String JSON_PROPERTY_UNION = "union"; + private Nodes union; + + public static final String JSON_PROPERTY_INTERSECTION = "intersection"; + private Nodes intersection; + + public Node() {} + + public Node name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public Node leaf(Leaf leaf) { + this.leaf = leaf; + return this; + } + + /** + * Get leaf + * @return leaf + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LEAF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Leaf getLeaf() { + return leaf; + } + + @JsonProperty(JSON_PROPERTY_LEAF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLeaf(Leaf leaf) { + this.leaf = leaf; + } + + public Node difference(UsersetTreeDifference difference) { + this.difference = difference; + return this; + } + + /** + * Get difference + * @return difference + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DIFFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UsersetTreeDifference getDifference() { + return difference; + } + + @JsonProperty(JSON_PROPERTY_DIFFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDifference(UsersetTreeDifference difference) { + this.difference = difference; + } + + public Node union(Nodes union) { + this.union = union; + return this; + } + + /** + * Get union + * @return union + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UNION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Nodes getUnion() { + return union; + } + + @JsonProperty(JSON_PROPERTY_UNION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUnion(Nodes union) { + this.union = union; + } + + public Node intersection(Nodes intersection) { + this.intersection = intersection; + return this; + } + + /** + * Get intersection + * @return intersection + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTERSECTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Nodes getIntersection() { + return intersection; + } + + @JsonProperty(JSON_PROPERTY_INTERSECTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIntersection(Nodes intersection) { + this.intersection = intersection; + } + + /** + * Return true if this Node object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Node node = (Node) o; + return Objects.equals(this.name, node.name) + && Objects.equals(this.leaf, node.leaf) + && Objects.equals(this.difference, node.difference) + && Objects.equals(this.union, node.union) + && Objects.equals(this.intersection, node.intersection); + } + + @Override + public int hashCode() { + return Objects.hash(name, leaf, difference, union, intersection); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Node {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" leaf: ").append(toIndentedString(leaf)).append("\n"); + sb.append(" difference: ").append(toIndentedString(difference)).append("\n"); + sb.append(" union: ").append(toIndentedString(union)).append("\n"); + sb.append(" intersection: ").append(toIndentedString(intersection)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `leaf` to the URL query string + if (getLeaf() != null) { + joiner.add(getLeaf().toUrlQueryString(prefix + "leaf" + suffix)); + } + + // add `difference` to the URL query string + if (getDifference() != null) { + joiner.add(getDifference().toUrlQueryString(prefix + "difference" + suffix)); + } + + // add `union` to the URL query string + if (getUnion() != null) { + joiner.add(getUnion().toUrlQueryString(prefix + "union" + suffix)); + } + + // add `intersection` to the URL query string + if (getIntersection() != null) { + joiner.add(getIntersection().toUrlQueryString(prefix + "intersection" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Nodes.java b/src/main/java/dev/openfga/sdk/api/model/Nodes.java new file mode 100644 index 0000000..578e8f7 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Nodes.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Nodes + */ +@JsonPropertyOrder({Nodes.JSON_PROPERTY_NODES}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Nodes { + public static final String JSON_PROPERTY_NODES = "nodes"; + private List nodes = new ArrayList<>(); + + public Nodes() {} + + public Nodes nodes(List nodes) { + this.nodes = nodes; + return this; + } + + public Nodes addNodesItem(Node nodesItem) { + if (this.nodes == null) { + this.nodes = new ArrayList<>(); + } + this.nodes.add(nodesItem); + return this; + } + + /** + * Get nodes + * @return nodes + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NODES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNodes() { + return nodes; + } + + @JsonProperty(JSON_PROPERTY_NODES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNodes(List nodes) { + this.nodes = nodes; + } + + /** + * Return true if this Nodes object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Nodes nodes = (Nodes) o; + return Objects.equals(this.nodes, nodes.nodes); + } + + @Override + public int hashCode() { + return Objects.hash(nodes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Nodes {\n"); + sb.append(" nodes: ").append(toIndentedString(nodes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `nodes` to the URL query string + if (getNodes() != null) { + for (int i = 0; i < getNodes().size(); i++) { + if (getNodes().get(i) != null) { + joiner.add(getNodes() + .get(i) + .toUrlQueryString(String.format( + "%snodes%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java b/src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java new file mode 100644 index 0000000..d6cfdab --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java @@ -0,0 +1,71 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets NotFoundErrorCode + */ +public enum NotFoundErrorCode { + NO_NOT_FOUND_ERROR("no_not_found_error"), + + UNDEFINED_ENDPOINT("undefined_endpoint"), + + STORE_ID_NOT_FOUND("store_id_not_found"), + + UNIMPLEMENTED("unimplemented"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + NotFoundErrorCode(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NotFoundErrorCode fromValue(String value) { + for (NotFoundErrorCode b : NotFoundErrorCode.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java b/src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java new file mode 100644 index 0000000..977c887 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java @@ -0,0 +1,179 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ObjectRelation + */ +@JsonPropertyOrder({ObjectRelation.JSON_PROPERTY_OBJECT, ObjectRelation.JSON_PROPERTY_RELATION}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ObjectRelation { + public static final String JSON_PROPERTY_OBJECT = "object"; + private String _object; + + public static final String JSON_PROPERTY_RELATION = "relation"; + private String relation; + + public ObjectRelation() {} + + public ObjectRelation _object(String _object) { + this._object = _object; + return this; + } + + /** + * Get _object + * @return _object + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getObject() { + return _object; + } + + @JsonProperty(JSON_PROPERTY_OBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObject(String _object) { + this._object = _object; + } + + public ObjectRelation relation(String relation) { + this.relation = relation; + return this; + } + + /** + * Get relation + * @return relation + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRelation() { + return relation; + } + + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRelation(String relation) { + this.relation = relation; + } + + /** + * Return true if this ObjectRelation object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectRelation objectRelation = (ObjectRelation) o; + return Objects.equals(this._object, objectRelation._object) + && Objects.equals(this.relation, objectRelation.relation); + } + + @Override + public int hashCode() { + return Objects.hash(_object, relation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectRelation {\n"); + sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); + sb.append(" relation: ").append(toIndentedString(relation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `object` to the URL query string + if (getObject() != null) { + joiner.add(String.format( + "%sobject%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getObject()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `relation` to the URL query string + if (getRelation() != null) { + joiner.add(String.format( + "%srelation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getRelation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java b/src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java new file mode 100644 index 0000000..1dbd369 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java @@ -0,0 +1,182 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * PathUnknownErrorMessageResponse + */ +@JsonPropertyOrder({ + PathUnknownErrorMessageResponse.JSON_PROPERTY_CODE, + PathUnknownErrorMessageResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class PathUnknownErrorMessageResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private NotFoundErrorCode code = NotFoundErrorCode.NO_NOT_FOUND_ERROR; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public PathUnknownErrorMessageResponse() {} + + public PathUnknownErrorMessageResponse code(NotFoundErrorCode code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NotFoundErrorCode getCode() { + return code; + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(NotFoundErrorCode code) { + this.code = code; + } + + public PathUnknownErrorMessageResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + /** + * Return true if this PathUnknownErrorMessageResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PathUnknownErrorMessageResponse pathUnknownErrorMessageResponse = (PathUnknownErrorMessageResponse) o; + return Objects.equals(this.code, pathUnknownErrorMessageResponse.code) + && Objects.equals(this.message, pathUnknownErrorMessageResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PathUnknownErrorMessageResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format( + "%scode%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCode()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format( + "%smessage%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getMessage()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java b/src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java new file mode 100644 index 0000000..31d03da --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java @@ -0,0 +1,201 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadAssertionsResponse + */ +@JsonPropertyOrder({ + ReadAssertionsResponse.JSON_PROPERTY_AUTHORIZATION_MODEL_ID, + ReadAssertionsResponse.JSON_PROPERTY_ASSERTIONS +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadAssertionsResponse { + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public static final String JSON_PROPERTY_ASSERTIONS = "assertions"; + private List assertions = new ArrayList<>(); + + public ReadAssertionsResponse() {} + + public ReadAssertionsResponse authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + public ReadAssertionsResponse assertions(List assertions) { + this.assertions = assertions; + return this; + } + + public ReadAssertionsResponse addAssertionsItem(Assertion assertionsItem) { + if (this.assertions == null) { + this.assertions = new ArrayList<>(); + } + this.assertions.add(assertionsItem); + return this; + } + + /** + * Get assertions + * @return assertions + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSERTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAssertions() { + return assertions; + } + + @JsonProperty(JSON_PROPERTY_ASSERTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAssertions(List assertions) { + this.assertions = assertions; + } + + /** + * Return true if this ReadAssertionsResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadAssertionsResponse readAssertionsResponse = (ReadAssertionsResponse) o; + return Objects.equals(this.authorizationModelId, readAssertionsResponse.authorizationModelId) + && Objects.equals(this.assertions, readAssertionsResponse.assertions); + } + + @Override + public int hashCode() { + return Objects.hash(authorizationModelId, assertions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadAssertionsResponse {\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append(" assertions: ").append(toIndentedString(assertions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `assertions` to the URL query string + if (getAssertions() != null) { + for (int i = 0; i < getAssertions().size(); i++) { + if (getAssertions().get(i) != null) { + joiner.add(getAssertions() + .get(i) + .toUrlQueryString(String.format( + "%sassertions%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponse.java b/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponse.java new file mode 100644 index 0000000..3ba4423 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponse.java @@ -0,0 +1,137 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadAuthorizationModelResponse + */ +@JsonPropertyOrder({ReadAuthorizationModelResponse.JSON_PROPERTY_AUTHORIZATION_MODEL}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadAuthorizationModelResponse { + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL = "authorization_model"; + private AuthorizationModel authorizationModel; + + public ReadAuthorizationModelResponse() {} + + public ReadAuthorizationModelResponse authorizationModel(AuthorizationModel authorizationModel) { + this.authorizationModel = authorizationModel; + return this; + } + + /** + * Get authorizationModel + * @return authorizationModel + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AuthorizationModel getAuthorizationModel() { + return authorizationModel; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModel(AuthorizationModel authorizationModel) { + this.authorizationModel = authorizationModel; + } + + /** + * Return true if this ReadAuthorizationModelResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadAuthorizationModelResponse readAuthorizationModelResponse = (ReadAuthorizationModelResponse) o; + return Objects.equals(this.authorizationModel, readAuthorizationModelResponse.authorizationModel); + } + + @Override + public int hashCode() { + return Objects.hash(authorizationModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadAuthorizationModelResponse {\n"); + sb.append(" authorizationModel: ") + .append(toIndentedString(authorizationModel)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `authorization_model` to the URL query string + if (getAuthorizationModel() != null) { + joiner.add(getAuthorizationModel().toUrlQueryString(prefix + "authorization_model" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponse.java b/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponse.java new file mode 100644 index 0000000..582f6c2 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponse.java @@ -0,0 +1,203 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadAuthorizationModelsResponse + */ +@JsonPropertyOrder({ + ReadAuthorizationModelsResponse.JSON_PROPERTY_AUTHORIZATION_MODELS, + ReadAuthorizationModelsResponse.JSON_PROPERTY_CONTINUATION_TOKEN +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadAuthorizationModelsResponse { + public static final String JSON_PROPERTY_AUTHORIZATION_MODELS = "authorization_models"; + private List authorizationModels = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTINUATION_TOKEN = "continuation_token"; + private String continuationToken; + + public ReadAuthorizationModelsResponse() {} + + public ReadAuthorizationModelsResponse authorizationModels(List authorizationModels) { + this.authorizationModels = authorizationModels; + return this; + } + + public ReadAuthorizationModelsResponse addAuthorizationModelsItem(AuthorizationModel authorizationModelsItem) { + if (this.authorizationModels == null) { + this.authorizationModels = new ArrayList<>(); + } + this.authorizationModels.add(authorizationModelsItem); + return this; + } + + /** + * Get authorizationModels + * @return authorizationModels + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODELS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAuthorizationModels() { + return authorizationModels; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODELS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModels(List authorizationModels) { + this.authorizationModels = authorizationModels; + } + + public ReadAuthorizationModelsResponse continuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * The continuation token will be empty if there are no more models. + * @return continuationToken + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContinuationToken() { + return continuationToken; + } + + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + } + + /** + * Return true if this ReadAuthorizationModelsResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadAuthorizationModelsResponse readAuthorizationModelsResponse = (ReadAuthorizationModelsResponse) o; + return Objects.equals(this.authorizationModels, readAuthorizationModelsResponse.authorizationModels) + && Objects.equals(this.continuationToken, readAuthorizationModelsResponse.continuationToken); + } + + @Override + public int hashCode() { + return Objects.hash(authorizationModels, continuationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadAuthorizationModelsResponse {\n"); + sb.append(" authorizationModels: ") + .append(toIndentedString(authorizationModels)) + .append("\n"); + sb.append(" continuationToken: ") + .append(toIndentedString(continuationToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `authorization_models` to the URL query string + if (getAuthorizationModels() != null) { + for (int i = 0; i < getAuthorizationModels().size(); i++) { + if (getAuthorizationModels().get(i) != null) { + joiner.add(getAuthorizationModels() + .get(i) + .toUrlQueryString(String.format( + "%sauthorization_models%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `continuation_token` to the URL query string + if (getContinuationToken() != null) { + joiner.add(String.format( + "%scontinuation_token%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getContinuationToken()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadChangesResponse.java b/src/main/java/dev/openfga/sdk/api/model/ReadChangesResponse.java new file mode 100644 index 0000000..dd8458b --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadChangesResponse.java @@ -0,0 +1,198 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadChangesResponse + */ +@JsonPropertyOrder({ReadChangesResponse.JSON_PROPERTY_CHANGES, ReadChangesResponse.JSON_PROPERTY_CONTINUATION_TOKEN}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadChangesResponse { + public static final String JSON_PROPERTY_CHANGES = "changes"; + private List changes = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTINUATION_TOKEN = "continuation_token"; + private String continuationToken; + + public ReadChangesResponse() {} + + public ReadChangesResponse changes(List changes) { + this.changes = changes; + return this; + } + + public ReadChangesResponse addChangesItem(TupleChange changesItem) { + if (this.changes == null) { + this.changes = new ArrayList<>(); + } + this.changes.add(changesItem); + return this; + } + + /** + * Get changes + * @return changes + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getChanges() { + return changes; + } + + @JsonProperty(JSON_PROPERTY_CHANGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChanges(List changes) { + this.changes = changes; + } + + public ReadChangesResponse continuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * The continuation token will be identical if there are no new changes. + * @return continuationToken + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContinuationToken() { + return continuationToken; + } + + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + } + + /** + * Return true if this ReadChangesResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadChangesResponse readChangesResponse = (ReadChangesResponse) o; + return Objects.equals(this.changes, readChangesResponse.changes) + && Objects.equals(this.continuationToken, readChangesResponse.continuationToken); + } + + @Override + public int hashCode() { + return Objects.hash(changes, continuationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadChangesResponse {\n"); + sb.append(" changes: ").append(toIndentedString(changes)).append("\n"); + sb.append(" continuationToken: ") + .append(toIndentedString(continuationToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `changes` to the URL query string + if (getChanges() != null) { + for (int i = 0; i < getChanges().size(); i++) { + if (getChanges().get(i) != null) { + joiner.add(getChanges() + .get(i) + .toUrlQueryString(String.format( + "%schanges%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `continuation_token` to the URL query string + if (getContinuationToken() != null) { + joiner.add(String.format( + "%scontinuation_token%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getContinuationToken()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadRequest.java b/src/main/java/dev/openfga/sdk/api/model/ReadRequest.java new file mode 100644 index 0000000..a66f4b5 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadRequest.java @@ -0,0 +1,217 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadRequest + */ +@JsonPropertyOrder({ + ReadRequest.JSON_PROPERTY_TUPLE_KEY, + ReadRequest.JSON_PROPERTY_PAGE_SIZE, + ReadRequest.JSON_PROPERTY_CONTINUATION_TOKEN +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadRequest { + public static final String JSON_PROPERTY_TUPLE_KEY = "tuple_key"; + private TupleKey tupleKey; + + public static final String JSON_PROPERTY_PAGE_SIZE = "page_size"; + private Integer pageSize; + + public static final String JSON_PROPERTY_CONTINUATION_TOKEN = "continuation_token"; + private String continuationToken; + + public ReadRequest() {} + + public ReadRequest tupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + return this; + } + + /** + * Get tupleKey + * @return tupleKey + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleKey getTupleKey() { + return tupleKey; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + } + + public ReadRequest pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getPageSize() { + return pageSize; + } + + @JsonProperty(JSON_PROPERTY_PAGE_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public ReadRequest continuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * Get continuationToken + * @return continuationToken + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContinuationToken() { + return continuationToken; + } + + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + } + + /** + * Return true if this Read_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadRequest readRequest = (ReadRequest) o; + return Objects.equals(this.tupleKey, readRequest.tupleKey) + && Objects.equals(this.pageSize, readRequest.pageSize) + && Objects.equals(this.continuationToken, readRequest.continuationToken); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKey, pageSize, continuationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadRequest {\n"); + sb.append(" tupleKey: ").append(toIndentedString(tupleKey)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" continuationToken: ") + .append(toIndentedString(continuationToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_key` to the URL query string + if (getTupleKey() != null) { + joiner.add(getTupleKey().toUrlQueryString(prefix + "tuple_key" + suffix)); + } + + // add `page_size` to the URL query string + if (getPageSize() != null) { + joiner.add(String.format( + "%spage_size%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getPageSize()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `continuation_token` to the URL query string + if (getContinuationToken() != null) { + joiner.add(String.format( + "%scontinuation_token%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getContinuationToken()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ReadResponse.java b/src/main/java/dev/openfga/sdk/api/model/ReadResponse.java new file mode 100644 index 0000000..c047bb5 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ReadResponse.java @@ -0,0 +1,198 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ReadResponse + */ +@JsonPropertyOrder({ReadResponse.JSON_PROPERTY_TUPLES, ReadResponse.JSON_PROPERTY_CONTINUATION_TOKEN}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ReadResponse { + public static final String JSON_PROPERTY_TUPLES = "tuples"; + private List tuples = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTINUATION_TOKEN = "continuation_token"; + private String continuationToken; + + public ReadResponse() {} + + public ReadResponse tuples(List tuples) { + this.tuples = tuples; + return this; + } + + public ReadResponse addTuplesItem(Tuple tuplesItem) { + if (this.tuples == null) { + this.tuples = new ArrayList<>(); + } + this.tuples.add(tuplesItem); + return this; + } + + /** + * Get tuples + * @return tuples + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTuples() { + return tuples; + } + + @JsonProperty(JSON_PROPERTY_TUPLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTuples(List tuples) { + this.tuples = tuples; + } + + public ReadResponse continuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * The continuation token will be empty if there are no more tuples. + * @return continuationToken + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContinuationToken() { + return continuationToken; + } + + @JsonProperty(JSON_PROPERTY_CONTINUATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + } + + /** + * Return true if this ReadResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadResponse readResponse = (ReadResponse) o; + return Objects.equals(this.tuples, readResponse.tuples) + && Objects.equals(this.continuationToken, readResponse.continuationToken); + } + + @Override + public int hashCode() { + return Objects.hash(tuples, continuationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadResponse {\n"); + sb.append(" tuples: ").append(toIndentedString(tuples)).append("\n"); + sb.append(" continuationToken: ") + .append(toIndentedString(continuationToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuples` to the URL query string + if (getTuples() != null) { + for (int i = 0; i < getTuples().size(); i++) { + if (getTuples().get(i) != null) { + joiner.add(getTuples() + .get(i) + .toUrlQueryString(String.format( + "%stuples%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `continuation_token` to the URL query string + if (getContinuationToken() != null) { + joiner.add(String.format( + "%scontinuation_token%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getContinuationToken()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/RelationMetadata.java b/src/main/java/dev/openfga/sdk/api/model/RelationMetadata.java new file mode 100644 index 0000000..bbeb096 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/RelationMetadata.java @@ -0,0 +1,159 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * RelationMetadata + */ +@JsonPropertyOrder({RelationMetadata.JSON_PROPERTY_DIRECTLY_RELATED_USER_TYPES}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class RelationMetadata { + public static final String JSON_PROPERTY_DIRECTLY_RELATED_USER_TYPES = "directly_related_user_types"; + private List directlyRelatedUserTypes = new ArrayList<>(); + + public RelationMetadata() {} + + public RelationMetadata directlyRelatedUserTypes(List directlyRelatedUserTypes) { + this.directlyRelatedUserTypes = directlyRelatedUserTypes; + return this; + } + + public RelationMetadata addDirectlyRelatedUserTypesItem(RelationReference directlyRelatedUserTypesItem) { + if (this.directlyRelatedUserTypes == null) { + this.directlyRelatedUserTypes = new ArrayList<>(); + } + this.directlyRelatedUserTypes.add(directlyRelatedUserTypesItem); + return this; + } + + /** + * Get directlyRelatedUserTypes + * @return directlyRelatedUserTypes + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DIRECTLY_RELATED_USER_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDirectlyRelatedUserTypes() { + return directlyRelatedUserTypes; + } + + @JsonProperty(JSON_PROPERTY_DIRECTLY_RELATED_USER_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDirectlyRelatedUserTypes(List directlyRelatedUserTypes) { + this.directlyRelatedUserTypes = directlyRelatedUserTypes; + } + + /** + * Return true if this RelationMetadata object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationMetadata relationMetadata = (RelationMetadata) o; + return Objects.equals(this.directlyRelatedUserTypes, relationMetadata.directlyRelatedUserTypes); + } + + @Override + public int hashCode() { + return Objects.hash(directlyRelatedUserTypes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationMetadata {\n"); + sb.append(" directlyRelatedUserTypes: ") + .append(toIndentedString(directlyRelatedUserTypes)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `directly_related_user_types` to the URL query string + if (getDirectlyRelatedUserTypes() != null) { + for (int i = 0; i < getDirectlyRelatedUserTypes().size(); i++) { + if (getDirectlyRelatedUserTypes().get(i) != null) { + joiner.add(getDirectlyRelatedUserTypes() + .get(i) + .toUrlQueryString(String.format( + "%sdirectly_related_user_types%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/RelationReference.java b/src/main/java/dev/openfga/sdk/api/model/RelationReference.java new file mode 100644 index 0000000..0171bea --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/RelationReference.java @@ -0,0 +1,220 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * RelationReference represents a relation of a particular object type (e.g. 'document#viewer'). + */ +@JsonPropertyOrder({ + RelationReference.JSON_PROPERTY_TYPE, + RelationReference.JSON_PROPERTY_RELATION, + RelationReference.JSON_PROPERTY_WILDCARD +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class RelationReference { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_RELATION = "relation"; + private String relation; + + public static final String JSON_PROPERTY_WILDCARD = "wildcard"; + private Object wildcard; + + public RelationReference() {} + + public RelationReference type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(String type) { + this.type = type; + } + + public RelationReference relation(String relation) { + this.relation = relation; + return this; + } + + /** + * Get relation + * @return relation + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRelation() { + return relation; + } + + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRelation(String relation) { + this.relation = relation; + } + + public RelationReference wildcard(Object wildcard) { + this.wildcard = wildcard; + return this; + } + + /** + * Get wildcard + * @return wildcard + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WILDCARD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getWildcard() { + return wildcard; + } + + @JsonProperty(JSON_PROPERTY_WILDCARD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWildcard(Object wildcard) { + this.wildcard = wildcard; + } + + /** + * Return true if this RelationReference object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationReference relationReference = (RelationReference) o; + return Objects.equals(this.type, relationReference.type) + && Objects.equals(this.relation, relationReference.relation) + && Objects.equals(this.wildcard, relationReference.wildcard); + } + + @Override + public int hashCode() { + return Objects.hash(type, relation, wildcard); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationReference {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" relation: ").append(toIndentedString(relation)).append("\n"); + sb.append(" wildcard: ").append(toIndentedString(wildcard)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format( + "%stype%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `relation` to the URL query string + if (getRelation() != null) { + joiner.add(String.format( + "%srelation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getRelation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `wildcard` to the URL query string + if (getWildcard() != null) { + joiner.add(String.format( + "%swildcard%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getWildcard()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Status.java b/src/main/java/dev/openfga/sdk/api/model/Status.java new file mode 100644 index 0000000..d54cccf --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Status.java @@ -0,0 +1,231 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Status + */ +@JsonPropertyOrder({Status.JSON_PROPERTY_CODE, Status.JSON_PROPERTY_MESSAGE, Status.JSON_PROPERTY_DETAILS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Status { + public static final String JSON_PROPERTY_CODE = "code"; + private Integer code; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_DETAILS = "details"; + private List details = new ArrayList<>(); + + public Status() {} + + public Status code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(Integer code) { + this.code = code; + } + + public Status message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + public Status details(List details) { + this.details = details; + return this; + } + + public Status addDetailsItem(Any detailsItem) { + if (this.details == null) { + this.details = new ArrayList<>(); + } + this.details.add(detailsItem); + return this; + } + + /** + * Get details + * @return details + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDetails() { + return details; + } + + @JsonProperty(JSON_PROPERTY_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDetails(List details) { + this.details = details; + } + + /** + * Return true if this Status object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Status status = (Status) o; + return Objects.equals(this.code, status.code) + && Objects.equals(this.message, status.message) + && Objects.equals(this.details, status.details); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, details); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Status {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format( + "%scode%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCode()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format( + "%smessage%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getMessage()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `details` to the URL query string + if (getDetails() != null) { + for (int i = 0; i < getDetails().size(); i++) { + if (getDetails().get(i) != null) { + joiner.add(String.format( + "%sdetails%s%s=%s", + prefix, + suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getDetails().get(i)), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Store.java b/src/main/java/dev/openfga/sdk/api/model/Store.java new file mode 100644 index 0000000..2aa2ae3 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Store.java @@ -0,0 +1,297 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Store + */ +@JsonPropertyOrder({ + Store.JSON_PROPERTY_ID, + Store.JSON_PROPERTY_NAME, + Store.JSON_PROPERTY_CREATED_AT, + Store.JSON_PROPERTY_UPDATED_AT, + Store.JSON_PROPERTY_DELETED_AT +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Store { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_DELETED_AT = "deleted_at"; + private OffsetDateTime deletedAt; + + public Store() {} + + public Store id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(String id) { + this.id = id; + } + + public Store name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + public Store createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Store updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public Store deletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + return this; + } + + /** + * Get deletedAt + * @return deletedAt + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDeletedAt() { + return deletedAt; + } + + @JsonProperty(JSON_PROPERTY_DELETED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + } + + /** + * Return true if this Store object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Store store = (Store) o; + return Objects.equals(this.id, store.id) + && Objects.equals(this.name, store.name) + && Objects.equals(this.createdAt, store.createdAt) + && Objects.equals(this.updatedAt, store.updatedAt) + && Objects.equals(this.deletedAt, store.deletedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, createdAt, updatedAt, deletedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Store {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" deletedAt: ").append(toIndentedString(deletedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format( + "%sid%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format( + "%sname%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `created_at` to the URL query string + if (getCreatedAt() != null) { + joiner.add(String.format( + "%screated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCreatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `updated_at` to the URL query string + if (getUpdatedAt() != null) { + joiner.add(String.format( + "%supdated_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUpdatedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `deleted_at` to the URL query string + if (getDeletedAt() != null) { + joiner.add(String.format( + "%sdeleted_at%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getDeletedAt()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Tuple.java b/src/main/java/dev/openfga/sdk/api/model/Tuple.java new file mode 100644 index 0000000..d48439c --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Tuple.java @@ -0,0 +1,174 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Tuple + */ +@JsonPropertyOrder({Tuple.JSON_PROPERTY_KEY, Tuple.JSON_PROPERTY_TIMESTAMP}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Tuple { + public static final String JSON_PROPERTY_KEY = "key"; + private TupleKey key; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private OffsetDateTime timestamp; + + public Tuple() {} + + public Tuple key(TupleKey key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleKey getKey() { + return key; + } + + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setKey(TupleKey key) { + this.key = key; + } + + public Tuple timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getTimestamp() { + return timestamp; + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + /** + * Return true if this Tuple object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tuple tuple = (Tuple) o; + return Objects.equals(this.key, tuple.key) && Objects.equals(this.timestamp, tuple.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(key, timestamp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tuple {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `key` to the URL query string + if (getKey() != null) { + joiner.add(getKey().toUrlQueryString(prefix + "key" + suffix)); + } + + // add `timestamp` to the URL query string + if (getTimestamp() != null) { + joiner.add(String.format( + "%stimestamp%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTimestamp()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TupleChange.java b/src/main/java/dev/openfga/sdk/api/model/TupleChange.java new file mode 100644 index 0000000..b8fe4fc --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TupleChange.java @@ -0,0 +1,216 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * TupleChange + */ +@JsonPropertyOrder({ + TupleChange.JSON_PROPERTY_TUPLE_KEY, + TupleChange.JSON_PROPERTY_OPERATION, + TupleChange.JSON_PROPERTY_TIMESTAMP +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class TupleChange { + public static final String JSON_PROPERTY_TUPLE_KEY = "tuple_key"; + private TupleKey tupleKey; + + public static final String JSON_PROPERTY_OPERATION = "operation"; + private TupleOperation operation = TupleOperation.WRITE; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private OffsetDateTime timestamp; + + public TupleChange() {} + + public TupleChange tupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + return this; + } + + /** + * Get tupleKey + * @return tupleKey + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleKey getTupleKey() { + return tupleKey; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleKey(TupleKey tupleKey) { + this.tupleKey = tupleKey; + } + + public TupleChange operation(TupleOperation operation) { + this.operation = operation; + return this; + } + + /** + * Get operation + * @return operation + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPERATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleOperation getOperation() { + return operation; + } + + @JsonProperty(JSON_PROPERTY_OPERATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOperation(TupleOperation operation) { + this.operation = operation; + } + + public TupleChange timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getTimestamp() { + return timestamp; + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + /** + * Return true if this TupleChange object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TupleChange tupleChange = (TupleChange) o; + return Objects.equals(this.tupleKey, tupleChange.tupleKey) + && Objects.equals(this.operation, tupleChange.operation) + && Objects.equals(this.timestamp, tupleChange.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKey, operation, timestamp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TupleChange {\n"); + sb.append(" tupleKey: ").append(toIndentedString(tupleKey)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_key` to the URL query string + if (getTupleKey() != null) { + joiner.add(getTupleKey().toUrlQueryString(prefix + "tuple_key" + suffix)); + } + + // add `operation` to the URL query string + if (getOperation() != null) { + joiner.add(String.format( + "%soperation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getOperation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `timestamp` to the URL query string + if (getTimestamp() != null) { + joiner.add(String.format( + "%stimestamp%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTimestamp()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TupleKey.java b/src/main/java/dev/openfga/sdk/api/model/TupleKey.java new file mode 100644 index 0000000..069f509 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TupleKey.java @@ -0,0 +1,216 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * TupleKey + */ +@JsonPropertyOrder({TupleKey.JSON_PROPERTY_OBJECT, TupleKey.JSON_PROPERTY_RELATION, TupleKey.JSON_PROPERTY_USER}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class TupleKey { + public static final String JSON_PROPERTY_OBJECT = "object"; + private String _object; + + public static final String JSON_PROPERTY_RELATION = "relation"; + private String relation; + + public static final String JSON_PROPERTY_USER = "user"; + private String user; + + public TupleKey() {} + + public TupleKey _object(String _object) { + this._object = _object; + return this; + } + + /** + * Get _object + * @return _object + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getObject() { + return _object; + } + + @JsonProperty(JSON_PROPERTY_OBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObject(String _object) { + this._object = _object; + } + + public TupleKey relation(String relation) { + this.relation = relation; + return this; + } + + /** + * Get relation + * @return relation + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRelation() { + return relation; + } + + @JsonProperty(JSON_PROPERTY_RELATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRelation(String relation) { + this.relation = relation; + } + + public TupleKey user(String user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUser() { + return user; + } + + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUser(String user) { + this.user = user; + } + + /** + * Return true if this TupleKey object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TupleKey tupleKey = (TupleKey) o; + return Objects.equals(this._object, tupleKey._object) + && Objects.equals(this.relation, tupleKey.relation) + && Objects.equals(this.user, tupleKey.user); + } + + @Override + public int hashCode() { + return Objects.hash(_object, relation, user); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TupleKey {\n"); + sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); + sb.append(" relation: ").append(toIndentedString(relation)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `object` to the URL query string + if (getObject() != null) { + joiner.add(String.format( + "%sobject%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getObject()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `relation` to the URL query string + if (getRelation() != null) { + joiner.add(String.format( + "%srelation%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getRelation()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `user` to the URL query string + if (getUser() != null) { + joiner.add(String.format( + "%suser%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getUser()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TupleKeys.java b/src/main/java/dev/openfga/sdk/api/model/TupleKeys.java new file mode 100644 index 0000000..1a45990 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TupleKeys.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * TupleKeys + */ +@JsonPropertyOrder({TupleKeys.JSON_PROPERTY_TUPLE_KEYS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class TupleKeys { + public static final String JSON_PROPERTY_TUPLE_KEYS = "tuple_keys"; + private List tupleKeys = new ArrayList<>(); + + public TupleKeys() {} + + public TupleKeys tupleKeys(List tupleKeys) { + this.tupleKeys = tupleKeys; + return this; + } + + public TupleKeys addTupleKeysItem(TupleKey tupleKeysItem) { + if (this.tupleKeys == null) { + this.tupleKeys = new ArrayList<>(); + } + this.tupleKeys.add(tupleKeysItem); + return this; + } + + /** + * Get tupleKeys + * @return tupleKeys + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TUPLE_KEYS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTupleKeys() { + return tupleKeys; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_KEYS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTupleKeys(List tupleKeys) { + this.tupleKeys = tupleKeys; + } + + /** + * Return true if this TupleKeys object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TupleKeys tupleKeys = (TupleKeys) o; + return Objects.equals(this.tupleKeys, tupleKeys.tupleKeys); + } + + @Override + public int hashCode() { + return Objects.hash(tupleKeys); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TupleKeys {\n"); + sb.append(" tupleKeys: ").append(toIndentedString(tupleKeys)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tuple_keys` to the URL query string + if (getTupleKeys() != null) { + for (int i = 0; i < getTupleKeys().size(); i++) { + if (getTupleKeys().get(i) != null) { + joiner.add(getTupleKeys() + .get(i) + .toUrlQueryString(String.format( + "%stuple_keys%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TupleOperation.java b/src/main/java/dev/openfga/sdk/api/model/TupleOperation.java new file mode 100644 index 0000000..b1025ff --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TupleOperation.java @@ -0,0 +1,67 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets TupleOperation + */ +public enum TupleOperation { + WRITE("TUPLE_OPERATION_WRITE"), + + DELETE("TUPLE_OPERATION_DELETE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TupleOperation(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TupleOperation fromValue(String value) { + for (TupleOperation b : TupleOperation.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TupleToUserset.java b/src/main/java/dev/openfga/sdk/api/model/TupleToUserset.java new file mode 100644 index 0000000..8ff7334 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TupleToUserset.java @@ -0,0 +1,169 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * TupleToUserset + */ +@JsonPropertyOrder({TupleToUserset.JSON_PROPERTY_TUPLESET, TupleToUserset.JSON_PROPERTY_COMPUTED_USERSET}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class TupleToUserset { + public static final String JSON_PROPERTY_TUPLESET = "tupleset"; + private ObjectRelation tupleset; + + public static final String JSON_PROPERTY_COMPUTED_USERSET = "computedUserset"; + private ObjectRelation computedUserset; + + public TupleToUserset() {} + + public TupleToUserset tupleset(ObjectRelation tupleset) { + this.tupleset = tupleset; + return this; + } + + /** + * Get tupleset + * @return tupleset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLESET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ObjectRelation getTupleset() { + return tupleset; + } + + @JsonProperty(JSON_PROPERTY_TUPLESET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleset(ObjectRelation tupleset) { + this.tupleset = tupleset; + } + + public TupleToUserset computedUserset(ObjectRelation computedUserset) { + this.computedUserset = computedUserset; + return this; + } + + /** + * Get computedUserset + * @return computedUserset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPUTED_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ObjectRelation getComputedUserset() { + return computedUserset; + } + + @JsonProperty(JSON_PROPERTY_COMPUTED_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComputedUserset(ObjectRelation computedUserset) { + this.computedUserset = computedUserset; + } + + /** + * Return true if this TupleToUserset object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TupleToUserset tupleToUserset = (TupleToUserset) o; + return Objects.equals(this.tupleset, tupleToUserset.tupleset) + && Objects.equals(this.computedUserset, tupleToUserset.computedUserset); + } + + @Override + public int hashCode() { + return Objects.hash(tupleset, computedUserset); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TupleToUserset {\n"); + sb.append(" tupleset: ").append(toIndentedString(tupleset)).append("\n"); + sb.append(" computedUserset: ") + .append(toIndentedString(computedUserset)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tupleset` to the URL query string + if (getTupleset() != null) { + joiner.add(getTupleset().toUrlQueryString(prefix + "tupleset" + suffix)); + } + + // add `computedUserset` to the URL query string + if (getComputedUserset() != null) { + joiner.add(getComputedUserset().toUrlQueryString(prefix + "computedUserset" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/TypeDefinition.java b/src/main/java/dev/openfga/sdk/api/model/TypeDefinition.java new file mode 100644 index 0000000..6d452d8 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/TypeDefinition.java @@ -0,0 +1,232 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * TypeDefinition + */ +@JsonPropertyOrder({ + TypeDefinition.JSON_PROPERTY_TYPE, + TypeDefinition.JSON_PROPERTY_RELATIONS, + TypeDefinition.JSON_PROPERTY_METADATA +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class TypeDefinition { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_RELATIONS = "relations"; + private Map relations = new HashMap<>(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Metadata metadata; + + public TypeDefinition() {} + + public TypeDefinition type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(String type) { + this.type = type; + } + + public TypeDefinition relations(Map relations) { + this.relations = relations; + return this; + } + + public TypeDefinition putRelationsItem(String key, Userset relationsItem) { + if (this.relations == null) { + this.relations = new HashMap<>(); + } + this.relations.put(key, relationsItem); + return this; + } + + /** + * Get relations + * @return relations + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getRelations() { + return relations; + } + + @JsonProperty(JSON_PROPERTY_RELATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRelations(Map relations) { + this.relations = relations; + } + + public TypeDefinition metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Metadata getMetadata() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + /** + * Return true if this TypeDefinition object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeDefinition typeDefinition = (TypeDefinition) o; + return Objects.equals(this.type, typeDefinition.type) + && Objects.equals(this.relations, typeDefinition.relations) + && Objects.equals(this.metadata, typeDefinition.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(type, relations, metadata); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeDefinition {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" relations: ").append(toIndentedString(relations)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `type` to the URL query string + if (getType() != null) { + joiner.add(String.format( + "%stype%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `relations` to the URL query string + if (getRelations() != null) { + for (String _key : getRelations().keySet()) { + if (getRelations().get(_key) != null) { + joiner.add(getRelations() + .get(_key) + .toUrlQueryString(String.format( + "%srelations%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + + // add `metadata` to the URL query string + if (getMetadata() != null) { + joiner.add(getMetadata().toUrlQueryString(prefix + "metadata" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Users.java b/src/main/java/dev/openfga/sdk/api/model/Users.java new file mode 100644 index 0000000..3c9122f --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Users.java @@ -0,0 +1,155 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Users + */ +@JsonPropertyOrder({Users.JSON_PROPERTY_USERS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Users { + public static final String JSON_PROPERTY_USERS = "users"; + private List users = new ArrayList<>(); + + public Users() {} + + public Users users(List users) { + this.users = users; + return this; + } + + public Users addUsersItem(String usersItem) { + if (this.users == null) { + this.users = new ArrayList<>(); + } + this.users.add(usersItem); + return this; + } + + /** + * Get users + * @return users + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getUsers() { + return users; + } + + @JsonProperty(JSON_PROPERTY_USERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsers(List users) { + this.users = users; + } + + /** + * Return true if this Users object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Users users = (Users) o; + return Objects.equals(this.users, users.users); + } + + @Override + public int hashCode() { + return Objects.hash(users); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Users {\n"); + sb.append(" users: ").append(toIndentedString(users)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `users` to the URL query string + if (getUsers() != null) { + for (int i = 0; i < getUsers().size(); i++) { + joiner.add(String.format( + "%susers%s%s=%s", + prefix, + suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getUsers().get(i)), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Userset.java b/src/main/java/dev/openfga/sdk/api/model/Userset.java new file mode 100644 index 0000000..799bced --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Userset.java @@ -0,0 +1,313 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Userset + */ +@JsonPropertyOrder({ + Userset.JSON_PROPERTY_THIS, + Userset.JSON_PROPERTY_COMPUTED_USERSET, + Userset.JSON_PROPERTY_TUPLE_TO_USERSET, + Userset.JSON_PROPERTY_UNION, + Userset.JSON_PROPERTY_INTERSECTION, + Userset.JSON_PROPERTY_DIFFERENCE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Userset { + public static final String JSON_PROPERTY_THIS = "this"; + private Object _this; + + public static final String JSON_PROPERTY_COMPUTED_USERSET = "computedUserset"; + private ObjectRelation computedUserset; + + public static final String JSON_PROPERTY_TUPLE_TO_USERSET = "tupleToUserset"; + private TupleToUserset tupleToUserset; + + public static final String JSON_PROPERTY_UNION = "union"; + private Usersets union; + + public static final String JSON_PROPERTY_INTERSECTION = "intersection"; + private Usersets intersection; + + public static final String JSON_PROPERTY_DIFFERENCE = "difference"; + private Difference difference; + + public Userset() {} + + public Userset _this(Object _this) { + this._this = _this; + return this; + } + + /** + * A DirectUserset is a sentinel message for referencing the direct members specified by an object/relation mapping. + * @return _this + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_THIS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getThis() { + return _this; + } + + @JsonProperty(JSON_PROPERTY_THIS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setThis(Object _this) { + this._this = _this; + } + + public Userset computedUserset(ObjectRelation computedUserset) { + this.computedUserset = computedUserset; + return this; + } + + /** + * Get computedUserset + * @return computedUserset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPUTED_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ObjectRelation getComputedUserset() { + return computedUserset; + } + + @JsonProperty(JSON_PROPERTY_COMPUTED_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComputedUserset(ObjectRelation computedUserset) { + this.computedUserset = computedUserset; + } + + public Userset tupleToUserset(TupleToUserset tupleToUserset) { + this.tupleToUserset = tupleToUserset; + return this; + } + + /** + * Get tupleToUserset + * @return tupleToUserset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLE_TO_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleToUserset getTupleToUserset() { + return tupleToUserset; + } + + @JsonProperty(JSON_PROPERTY_TUPLE_TO_USERSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleToUserset(TupleToUserset tupleToUserset) { + this.tupleToUserset = tupleToUserset; + } + + public Userset union(Usersets union) { + this.union = union; + return this; + } + + /** + * Get union + * @return union + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UNION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Usersets getUnion() { + return union; + } + + @JsonProperty(JSON_PROPERTY_UNION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUnion(Usersets union) { + this.union = union; + } + + public Userset intersection(Usersets intersection) { + this.intersection = intersection; + return this; + } + + /** + * Get intersection + * @return intersection + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTERSECTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Usersets getIntersection() { + return intersection; + } + + @JsonProperty(JSON_PROPERTY_INTERSECTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIntersection(Usersets intersection) { + this.intersection = intersection; + } + + public Userset difference(Difference difference) { + this.difference = difference; + return this; + } + + /** + * Get difference + * @return difference + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DIFFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Difference getDifference() { + return difference; + } + + @JsonProperty(JSON_PROPERTY_DIFFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDifference(Difference difference) { + this.difference = difference; + } + + /** + * Return true if this Userset object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Userset userset = (Userset) o; + return Objects.equals(this._this, userset._this) + && Objects.equals(this.computedUserset, userset.computedUserset) + && Objects.equals(this.tupleToUserset, userset.tupleToUserset) + && Objects.equals(this.union, userset.union) + && Objects.equals(this.intersection, userset.intersection) + && Objects.equals(this.difference, userset.difference); + } + + @Override + public int hashCode() { + return Objects.hash(_this, computedUserset, tupleToUserset, union, intersection, difference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Userset {\n"); + sb.append(" _this: ").append(toIndentedString(_this)).append("\n"); + sb.append(" computedUserset: ") + .append(toIndentedString(computedUserset)) + .append("\n"); + sb.append(" tupleToUserset: ") + .append(toIndentedString(tupleToUserset)) + .append("\n"); + sb.append(" union: ").append(toIndentedString(union)).append("\n"); + sb.append(" intersection: ").append(toIndentedString(intersection)).append("\n"); + sb.append(" difference: ").append(toIndentedString(difference)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `this` to the URL query string + if (getThis() != null) { + joiner.add(String.format( + "%sthis%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getThis()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `computedUserset` to the URL query string + if (getComputedUserset() != null) { + joiner.add(getComputedUserset().toUrlQueryString(prefix + "computedUserset" + suffix)); + } + + // add `tupleToUserset` to the URL query string + if (getTupleToUserset() != null) { + joiner.add(getTupleToUserset().toUrlQueryString(prefix + "tupleToUserset" + suffix)); + } + + // add `union` to the URL query string + if (getUnion() != null) { + joiner.add(getUnion().toUrlQueryString(prefix + "union" + suffix)); + } + + // add `intersection` to the URL query string + if (getIntersection() != null) { + joiner.add(getIntersection().toUrlQueryString(prefix + "intersection" + suffix)); + } + + // add `difference` to the URL query string + if (getDifference() != null) { + joiner.add(getDifference().toUrlQueryString(prefix + "difference" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/UsersetTree.java b/src/main/java/dev/openfga/sdk/api/model/UsersetTree.java new file mode 100644 index 0000000..1cff619 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/UsersetTree.java @@ -0,0 +1,135 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * A UsersetTree contains the result of an Expansion. + */ +@JsonPropertyOrder({UsersetTree.JSON_PROPERTY_ROOT}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class UsersetTree { + public static final String JSON_PROPERTY_ROOT = "root"; + private Node root; + + public UsersetTree() {} + + public UsersetTree root(Node root) { + this.root = root; + return this; + } + + /** + * Get root + * @return root + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ROOT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Node getRoot() { + return root; + } + + @JsonProperty(JSON_PROPERTY_ROOT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setRoot(Node root) { + this.root = root; + } + + /** + * Return true if this UsersetTree object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsersetTree usersetTree = (UsersetTree) o; + return Objects.equals(this.root, usersetTree.root); + } + + @Override + public int hashCode() { + return Objects.hash(root); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsersetTree {\n"); + sb.append(" root: ").append(toIndentedString(root)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `root` to the URL query string + if (getRoot() != null) { + joiner.add(getRoot().toUrlQueryString(prefix + "root" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/UsersetTreeDifference.java b/src/main/java/dev/openfga/sdk/api/model/UsersetTreeDifference.java new file mode 100644 index 0000000..f712e52 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/UsersetTreeDifference.java @@ -0,0 +1,167 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * UsersetTreeDifference + */ +@JsonPropertyOrder({UsersetTreeDifference.JSON_PROPERTY_BASE, UsersetTreeDifference.JSON_PROPERTY_SUBTRACT}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class UsersetTreeDifference { + public static final String JSON_PROPERTY_BASE = "base"; + private Node base; + + public static final String JSON_PROPERTY_SUBTRACT = "subtract"; + private Node subtract; + + public UsersetTreeDifference() {} + + public UsersetTreeDifference base(Node base) { + this.base = base; + return this; + } + + /** + * Get base + * @return base + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Node getBase() { + return base; + } + + @JsonProperty(JSON_PROPERTY_BASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBase(Node base) { + this.base = base; + } + + public UsersetTreeDifference subtract(Node subtract) { + this.subtract = subtract; + return this; + } + + /** + * Get subtract + * @return subtract + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUBTRACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Node getSubtract() { + return subtract; + } + + @JsonProperty(JSON_PROPERTY_SUBTRACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSubtract(Node subtract) { + this.subtract = subtract; + } + + /** + * Return true if this UsersetTree.Difference object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsersetTreeDifference usersetTreeDifference = (UsersetTreeDifference) o; + return Objects.equals(this.base, usersetTreeDifference.base) + && Objects.equals(this.subtract, usersetTreeDifference.subtract); + } + + @Override + public int hashCode() { + return Objects.hash(base, subtract); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsersetTreeDifference {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" subtract: ").append(toIndentedString(subtract)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `base` to the URL query string + if (getBase() != null) { + joiner.add(getBase().toUrlQueryString(prefix + "base" + suffix)); + } + + // add `subtract` to the URL query string + if (getSubtract() != null) { + joiner.add(getSubtract().toUrlQueryString(prefix + "subtract" + suffix)); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUserset.java b/src/main/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUserset.java new file mode 100644 index 0000000..56dc456 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUserset.java @@ -0,0 +1,196 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * UsersetTreeTupleToUserset + */ +@JsonPropertyOrder({UsersetTreeTupleToUserset.JSON_PROPERTY_TUPLESET, UsersetTreeTupleToUserset.JSON_PROPERTY_COMPUTED}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class UsersetTreeTupleToUserset { + public static final String JSON_PROPERTY_TUPLESET = "tupleset"; + private String tupleset; + + public static final String JSON_PROPERTY_COMPUTED = "computed"; + private List computed = new ArrayList<>(); + + public UsersetTreeTupleToUserset() {} + + public UsersetTreeTupleToUserset tupleset(String tupleset) { + this.tupleset = tupleset; + return this; + } + + /** + * Get tupleset + * @return tupleset + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TUPLESET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTupleset() { + return tupleset; + } + + @JsonProperty(JSON_PROPERTY_TUPLESET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTupleset(String tupleset) { + this.tupleset = tupleset; + } + + public UsersetTreeTupleToUserset computed(List computed) { + this.computed = computed; + return this; + } + + public UsersetTreeTupleToUserset addComputedItem(Computed computedItem) { + if (this.computed == null) { + this.computed = new ArrayList<>(); + } + this.computed.add(computedItem); + return this; + } + + /** + * Get computed + * @return computed + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getComputed() { + return computed; + } + + @JsonProperty(JSON_PROPERTY_COMPUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComputed(List computed) { + this.computed = computed; + } + + /** + * Return true if this UsersetTree.TupleToUserset object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsersetTreeTupleToUserset usersetTreeTupleToUserset = (UsersetTreeTupleToUserset) o; + return Objects.equals(this.tupleset, usersetTreeTupleToUserset.tupleset) + && Objects.equals(this.computed, usersetTreeTupleToUserset.computed); + } + + @Override + public int hashCode() { + return Objects.hash(tupleset, computed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsersetTreeTupleToUserset {\n"); + sb.append(" tupleset: ").append(toIndentedString(tupleset)).append("\n"); + sb.append(" computed: ").append(toIndentedString(computed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `tupleset` to the URL query string + if (getTupleset() != null) { + joiner.add(String.format( + "%stupleset%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getTupleset()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `computed` to the URL query string + if (getComputed() != null) { + for (int i = 0; i < getComputed().size(); i++) { + if (getComputed().get(i) != null) { + joiner.add(getComputed() + .get(i) + .toUrlQueryString(String.format( + "%scomputed%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/Usersets.java b/src/main/java/dev/openfga/sdk/api/model/Usersets.java new file mode 100644 index 0000000..21556ab --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/Usersets.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Usersets + */ +@JsonPropertyOrder({Usersets.JSON_PROPERTY_CHILD}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class Usersets { + public static final String JSON_PROPERTY_CHILD = "child"; + private List child = new ArrayList<>(); + + public Usersets() {} + + public Usersets child(List child) { + this.child = child; + return this; + } + + public Usersets addChildItem(Userset childItem) { + if (this.child == null) { + this.child = new ArrayList<>(); + } + this.child.add(childItem); + return this; + } + + /** + * Get child + * @return child + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHILD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getChild() { + return child; + } + + @JsonProperty(JSON_PROPERTY_CHILD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setChild(List child) { + this.child = child; + } + + /** + * Return true if this Usersets object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Usersets usersets = (Usersets) o; + return Objects.equals(this.child, usersets.child); + } + + @Override + public int hashCode() { + return Objects.hash(child); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Usersets {\n"); + sb.append(" child: ").append(toIndentedString(child)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `child` to the URL query string + if (getChild() != null) { + for (int i = 0; i < getChild().size(); i++) { + if (getChild().get(i) != null) { + joiner.add(getChild() + .get(i) + .toUrlQueryString(String.format( + "%schild%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponse.java b/src/main/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponse.java new file mode 100644 index 0000000..0328dcb --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponse.java @@ -0,0 +1,182 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * ValidationErrorMessageResponse + */ +@JsonPropertyOrder({ + ValidationErrorMessageResponse.JSON_PROPERTY_CODE, + ValidationErrorMessageResponse.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class ValidationErrorMessageResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private ErrorCode code = ErrorCode.NO_ERROR; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public ValidationErrorMessageResponse() {} + + public ValidationErrorMessageResponse code(ErrorCode code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ErrorCode getCode() { + return code; + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(ErrorCode code) { + this.code = code; + } + + public ValidationErrorMessageResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + /** + * Return true if this ValidationErrorMessageResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ValidationErrorMessageResponse validationErrorMessageResponse = (ValidationErrorMessageResponse) o; + return Objects.equals(this.code, validationErrorMessageResponse.code) + && Objects.equals(this.message, validationErrorMessageResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidationErrorMessageResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `code` to the URL query string + if (getCode() != null) { + joiner.add(String.format( + "%scode%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getCode()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + // add `message` to the URL query string + if (getMessage() != null) { + joiner.add(String.format( + "%smessage%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getMessage()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/WriteAssertionsRequest.java b/src/main/java/dev/openfga/sdk/api/model/WriteAssertionsRequest.java new file mode 100644 index 0000000..4cd7453 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/WriteAssertionsRequest.java @@ -0,0 +1,157 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * WriteAssertionsRequest + */ +@JsonPropertyOrder({WriteAssertionsRequest.JSON_PROPERTY_ASSERTIONS}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class WriteAssertionsRequest { + public static final String JSON_PROPERTY_ASSERTIONS = "assertions"; + private List assertions = new ArrayList<>(); + + public WriteAssertionsRequest() {} + + public WriteAssertionsRequest assertions(List assertions) { + this.assertions = assertions; + return this; + } + + public WriteAssertionsRequest addAssertionsItem(Assertion assertionsItem) { + if (this.assertions == null) { + this.assertions = new ArrayList<>(); + } + this.assertions.add(assertionsItem); + return this; + } + + /** + * Get assertions + * @return assertions + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_ASSERTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAssertions() { + return assertions; + } + + @JsonProperty(JSON_PROPERTY_ASSERTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAssertions(List assertions) { + this.assertions = assertions; + } + + /** + * Return true if this WriteAssertions_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WriteAssertionsRequest writeAssertionsRequest = (WriteAssertionsRequest) o; + return Objects.equals(this.assertions, writeAssertionsRequest.assertions); + } + + @Override + public int hashCode() { + return Objects.hash(assertions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WriteAssertionsRequest {\n"); + sb.append(" assertions: ").append(toIndentedString(assertions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `assertions` to the URL query string + if (getAssertions() != null) { + for (int i = 0; i < getAssertions().size(); i++) { + if (getAssertions().get(i) != null) { + joiner.add(getAssertions() + .get(i) + .toUrlQueryString(String.format( + "%sassertions%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequest.java b/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequest.java new file mode 100644 index 0000000..26c0993 --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequest.java @@ -0,0 +1,201 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * WriteAuthorizationModelRequest + */ +@JsonPropertyOrder({ + WriteAuthorizationModelRequest.JSON_PROPERTY_TYPE_DEFINITIONS, + WriteAuthorizationModelRequest.JSON_PROPERTY_SCHEMA_VERSION +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class WriteAuthorizationModelRequest { + public static final String JSON_PROPERTY_TYPE_DEFINITIONS = "type_definitions"; + private List typeDefinitions = new ArrayList<>(); + + public static final String JSON_PROPERTY_SCHEMA_VERSION = "schema_version"; + private String schemaVersion; + + public WriteAuthorizationModelRequest() {} + + public WriteAuthorizationModelRequest typeDefinitions(List typeDefinitions) { + this.typeDefinitions = typeDefinitions; + return this; + } + + public WriteAuthorizationModelRequest addTypeDefinitionsItem(TypeDefinition typeDefinitionsItem) { + if (this.typeDefinitions == null) { + this.typeDefinitions = new ArrayList<>(); + } + this.typeDefinitions.add(typeDefinitionsItem); + return this; + } + + /** + * Get typeDefinitions + * @return typeDefinitions + **/ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_TYPE_DEFINITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTypeDefinitions() { + return typeDefinitions; + } + + @JsonProperty(JSON_PROPERTY_TYPE_DEFINITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTypeDefinitions(List typeDefinitions) { + this.typeDefinitions = typeDefinitions; + } + + public WriteAuthorizationModelRequest schemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + return this; + } + + /** + * Get schemaVersion + * @return schemaVersion + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCHEMA_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSchemaVersion() { + return schemaVersion; + } + + @JsonProperty(JSON_PROPERTY_SCHEMA_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSchemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + } + + /** + * Return true if this WriteAuthorizationModel_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WriteAuthorizationModelRequest writeAuthorizationModelRequest = (WriteAuthorizationModelRequest) o; + return Objects.equals(this.typeDefinitions, writeAuthorizationModelRequest.typeDefinitions) + && Objects.equals(this.schemaVersion, writeAuthorizationModelRequest.schemaVersion); + } + + @Override + public int hashCode() { + return Objects.hash(typeDefinitions, schemaVersion); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WriteAuthorizationModelRequest {\n"); + sb.append(" typeDefinitions: ") + .append(toIndentedString(typeDefinitions)) + .append("\n"); + sb.append(" schemaVersion: ").append(toIndentedString(schemaVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `type_definitions` to the URL query string + if (getTypeDefinitions() != null) { + for (int i = 0; i < getTypeDefinitions().size(); i++) { + if (getTypeDefinitions().get(i) != null) { + joiner.add(getTypeDefinitions() + .get(i) + .toUrlQueryString(String.format( + "%stype_definitions%s%s", + prefix, + suffix, + "".equals(suffix) + ? "" + : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `schema_version` to the URL query string + if (getSchemaVersion() != null) { + joiner.add(String.format( + "%sschema_version%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getSchemaVersion()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponse.java b/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponse.java new file mode 100644 index 0000000..7a98b5d --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponse.java @@ -0,0 +1,144 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * WriteAuthorizationModelResponse + */ +@JsonPropertyOrder({WriteAuthorizationModelResponse.JSON_PROPERTY_AUTHORIZATION_MODEL_ID}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class WriteAuthorizationModelResponse { + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public WriteAuthorizationModelResponse() {} + + public WriteAuthorizationModelResponse authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + /** + * Return true if this WriteAuthorizationModelResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WriteAuthorizationModelResponse writeAuthorizationModelResponse = (WriteAuthorizationModelResponse) o; + return Objects.equals(this.authorizationModelId, writeAuthorizationModelResponse.authorizationModelId); + } + + @Override + public int hashCode() { + return Objects.hash(authorizationModelId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WriteAuthorizationModelResponse {\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/api/model/WriteRequest.java b/src/main/java/dev/openfga/sdk/api/model/WriteRequest.java new file mode 100644 index 0000000..8e0c60c --- /dev/null +++ b/src/main/java/dev/openfga/sdk/api/model/WriteRequest.java @@ -0,0 +1,212 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * WriteRequest + */ +@JsonPropertyOrder({ + WriteRequest.JSON_PROPERTY_WRITES, + WriteRequest.JSON_PROPERTY_DELETES, + WriteRequest.JSON_PROPERTY_AUTHORIZATION_MODEL_ID +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2023-08-21T20:03:24.252549Z[Etc/UTC]") +public class WriteRequest { + public static final String JSON_PROPERTY_WRITES = "writes"; + private TupleKeys writes; + + public static final String JSON_PROPERTY_DELETES = "deletes"; + private TupleKeys deletes; + + public static final String JSON_PROPERTY_AUTHORIZATION_MODEL_ID = "authorization_model_id"; + private String authorizationModelId; + + public WriteRequest() {} + + public WriteRequest writes(TupleKeys writes) { + this.writes = writes; + return this; + } + + /** + * Get writes + * @return writes + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WRITES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleKeys getWrites() { + return writes; + } + + @JsonProperty(JSON_PROPERTY_WRITES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWrites(TupleKeys writes) { + this.writes = writes; + } + + public WriteRequest deletes(TupleKeys deletes) { + this.deletes = deletes; + return this; + } + + /** + * Get deletes + * @return deletes + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TupleKeys getDeletes() { + return deletes; + } + + @JsonProperty(JSON_PROPERTY_DELETES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeletes(TupleKeys deletes) { + this.deletes = deletes; + } + + public WriteRequest authorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + return this; + } + + /** + * Get authorizationModelId + * @return authorizationModelId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAuthorizationModelId() { + return authorizationModelId; + } + + @JsonProperty(JSON_PROPERTY_AUTHORIZATION_MODEL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAuthorizationModelId(String authorizationModelId) { + this.authorizationModelId = authorizationModelId; + } + + /** + * Return true if this Write_request object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WriteRequest writeRequest = (WriteRequest) o; + return Objects.equals(this.writes, writeRequest.writes) + && Objects.equals(this.deletes, writeRequest.deletes) + && Objects.equals(this.authorizationModelId, writeRequest.authorizationModelId); + } + + @Override + public int hashCode() { + return Objects.hash(writes, deletes, authorizationModelId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WriteRequest {\n"); + sb.append(" writes: ").append(toIndentedString(writes)).append("\n"); + sb.append(" deletes: ").append(toIndentedString(deletes)).append("\n"); + sb.append(" authorizationModelId: ") + .append(toIndentedString(authorizationModelId)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `writes` to the URL query string + if (getWrites() != null) { + joiner.add(getWrites().toUrlQueryString(prefix + "writes" + suffix)); + } + + // add `deletes` to the URL query string + if (getDeletes() != null) { + joiner.add(getDeletes().toUrlQueryString(prefix + "deletes" + suffix)); + } + + // add `authorization_model_id` to the URL query string + if (getAuthorizationModelId() != null) { + joiner.add(String.format( + "%sauthorization_model_id%s=%s", + prefix, + suffix, + URLEncoder.encode(String.valueOf(getAuthorizationModelId()), StandardCharsets.UTF_8) + .replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} diff --git a/src/main/java/dev/openfga/sdk/errors/FgaInvalidParameterException.java b/src/main/java/dev/openfga/sdk/errors/FgaInvalidParameterException.java new file mode 100644 index 0000000..49ad99d --- /dev/null +++ b/src/main/java/dev/openfga/sdk/errors/FgaInvalidParameterException.java @@ -0,0 +1,15 @@ +package dev.openfga.sdk.errors; + +public class FgaInvalidParameterException extends Exception { + public FgaInvalidParameterException(String paramName, String functionName) { + super(message(paramName, functionName)); + } + + public FgaInvalidParameterException(String paramName, String functionName, Throwable cause) { + super(message(paramName, functionName), cause); + } + + private static String message(String paramName, String functionName) { + return String.format("Required parameter %s was invalid when calling %s.", paramName, functionName); + } +} diff --git a/src/main/java/dev/openfga/util/StringUtil.java b/src/main/java/dev/openfga/util/StringUtil.java new file mode 100644 index 0000000..4528525 --- /dev/null +++ b/src/main/java/dev/openfga/util/StringUtil.java @@ -0,0 +1,34 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.util; + +import java.util.function.Predicate; +import java.util.regex.Pattern; + +public class StringUtil { + private StringUtil() {} // Instantiation prevented for utility class. + + private static final Predicate NULL_OR_WS = + Pattern.compile("^\\s*$").asMatchPredicate(); + + /** + * Returns true when the String is null, empty or contains only whitespace + * characters. + * + * @param str The String being tested. + * @return true iff str is null, empty or contains only whitespace. + */ + public static boolean isNullOrWhitespace(String str) { + return str == null || NULL_OR_WS.test(str); + } +} diff --git a/src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java b/src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java new file mode 100644 index 0000000..82f22d0 --- /dev/null +++ b/src/test-integration/java/dev/openfga/sdk/api/OpenFgaApiIntegrationTest.java @@ -0,0 +1,331 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import dev.openfga.sdk.api.client.*; +import dev.openfga.sdk.api.model.*; +import java.net.http.HttpClient; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class OpenFgaApiIntegrationTest { + private static final ObjectMapper mapper = new ObjectMapper().findAndRegisterModules(); + private static final String DEFAULT_AUTH_MODEL = + "{\"schema_version\":\"1.1\",\"type_definitions\":[{\"type\":\"user\"},{\"type\":\"document\",\"relations\":{\"reader\":{\"this\":{}},\"writer\":{\"this\":{}},\"owner\":{\"this\":{}}},\"metadata\":{\"relations\":{\"reader\":{\"directly_related_user_types\":[{\"type\":\"user\"}]},\"writer\":{\"directly_related_user_types\":[{\"type\":\"user\"}]},\"owner\":{\"directly_related_user_types\":[{\"type\":\"user\"}]}}}}]}"; + private static final String DEFAULT_USER = "user:81684243-9356-4421-8fbf-a4f8d36aa31b"; + private static final String DEFAULT_DOC = "document:2021-budget"; + public static final TupleKey DEFAULT_TUPLE_KEY = + new TupleKey().user(DEFAULT_USER).relation("reader")._object(DEFAULT_DOC); + public static final List DEFAULT_TUPLE_KEYS = List.of(DEFAULT_TUPLE_KEY); + + private OpenFgaApi api; + + @BeforeEach + public void initializeApi() { + Configuration apiConfig = new Configuration("http://localhost:8080"); + ApiClient apiClient = new ApiClient(HttpClient.newBuilder(), mapper); + api = new OpenFgaApi(apiClient, apiConfig); + } + + @Test + public void createStore() throws Exception { + // Given + String storeName = thisTestName(); + CreateStoreRequest createStoreRequest = new CreateStoreRequest().name(storeName); + + // When + CreateStoreResponse response = api.createStore(createStoreRequest).get(); + + // Then + assertEquals("OpenFgaApiIntegrationTest.createStore", response.getName()); + } + + @Test + public void deleteStore() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + + // When + api.deleteStore(storeId).get(); + + // Then + ListStoresResponse response = api.listStores(100, null).get(); + boolean itWasDeleted = response.getStores().stream().map(Store::getId).noneMatch(storeId::equals); + assertTrue(itWasDeleted, String.format("No stores should remain with the id %s.", storeId)); + } + + @Test + public void getStore() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + + // When + GetStoreResponse response = api.getStore(storeId).get(); + + // Then + assertEquals(storeName, response.getName()); + } + + @Test + public void listStores() throws Exception { + // Given + String testName = thisTestName(); + String store1 = testName + "-store1"; + String store2 = testName + "-store2"; + String store3 = testName + "-store3"; + List stores = List.of(store1, store2, store3); + for (String store : stores) { + createStore(store); + } + + // When + ListStoresResponse response = api.listStores(100, null).get(); + + // Then + for (String store : stores) { + boolean exists = response.getStores().stream().map(Store::getName).anyMatch(store::equals); + assertTrue(exists, String.format("Store %s should be in listStores response", store)); + } + } + + @Test + public void readAuthModel() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String authModelId = writeAuthModel(storeId); + + // When + ReadAuthorizationModelResponse response = + api.readAuthorizationModel(storeId, authModelId).get(); + + // Then + AuthorizationModel authModel = response.getAuthorizationModel(); + assertEquals(authModelId, authModel.getId()); + String typeDefsJson = mapper.writeValueAsString(authModel.getTypeDefinitions()); + assertEquals( + "[{\"type\":\"user\",\"relations\":{},\"metadata\":null},{\"type\":\"document\",\"relations\":{\"owner\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null},\"reader\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null},\"writer\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null}},\"metadata\":{\"relations\":{\"owner\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]},\"reader\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]},\"writer\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]}}}}]", + typeDefsJson); + } + + @Test + public void readAuthModels() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String authModelId = writeAuthModel(storeId); + + // When + ReadAuthorizationModelsResponse response = + api.readAuthorizationModels(storeId, 100, null).get(); + + // Then + response.getAuthorizationModels().stream() + .filter(authModel -> authModel.getId().equals(authModelId)) + .forEach(authModel -> { + assertEquals(authModelId, authModel.getId()); + try { + String typeDefsJson = mapper.writeValueAsString(authModel.getTypeDefinitions()); + + assertEquals( + "[{\"type\":\"user\",\"relations\":{},\"metadata\":null},{\"type\":\"document\",\"relations\":{\"owner\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null},\"reader\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null},\"writer\":{\"this\":{},\"computedUserset\":null,\"tupleToUserset\":null,\"union\":null,\"intersection\":null,\"difference\":null}},\"metadata\":{\"relations\":{\"owner\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]},\"reader\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]},\"writer\":{\"directly_related_user_types\":[{\"type\":\"user\",\"relation\":null,\"wildcard\":null}]}}}}]", + typeDefsJson); + } catch (JsonProcessingException ex) { + assertNull(ex); + } + }); + } + + @Test + public void writeAuthModel() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + WriteAuthorizationModelRequest request = + mapper.readValue(DEFAULT_AUTH_MODEL, WriteAuthorizationModelRequest.class); + + // When + WriteAuthorizationModelResponse response = + api.writeAuthorizationModel(storeId, request).get(); + + // Then + assertNotNull(response); + assertNotNull(response.getAuthorizationModelId()); + assertNotEquals("", response.getAuthorizationModelId()); + } + + @Test + public void write_and_read() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String _authModelId = writeAuthModel(storeId); + WriteRequest writeRequest = new WriteRequest().writes(new TupleKeys().tupleKeys(List.of(DEFAULT_TUPLE_KEY))); + ReadRequest readRequest = + new ReadRequest().tupleKey(new TupleKey().user(DEFAULT_USER)._object(DEFAULT_DOC)); + + // When + api.write(storeId, writeRequest).get(); + ReadResponse response = api.read(storeId, readRequest).get(); + + // Then + TupleKey key = response.getTuples().get(0).getKey(); + assertEquals(DEFAULT_USER, key.getUser()); + assertEquals("reader", key.getRelation()); + assertEquals(DEFAULT_DOC, key.getObject()); + } + + @Test + public void write_and_check() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String _authModelId = writeAuthModel(storeId); + WriteRequest writeRequest = new WriteRequest().writes(new TupleKeys().tupleKeys(DEFAULT_TUPLE_KEYS)); + CheckRequest checkRequest = new CheckRequest() + .tupleKey(new TupleKey().user(DEFAULT_USER).relation("reader")._object(DEFAULT_DOC)); + + // When + api.write(storeId, writeRequest).get(); + CheckResponse response = api.check(storeId, checkRequest).get(); + + // Then + assertTrue(response.getAllowed()); + } + + @Test + public void write_and_expand() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String _authModelId = writeAuthModel(storeId); + WriteRequest writeRequest = new WriteRequest().writes(new TupleKeys().tupleKeys(DEFAULT_TUPLE_KEYS)); + ExpandRequest expandRequest = + new ExpandRequest().tupleKey(new TupleKey()._object(DEFAULT_DOC).relation("reader")); + + // When + api.write(storeId, writeRequest).get(); + ExpandResponse response = api.expand(storeId, expandRequest).get(); + + // Then + assertNotNull(response.getTree()); + String responseJson = mapper.writeValueAsString(response); + assertEquals( + "{\"tree\":{\"root\":{\"name\":\"document:2021-budget#reader\",\"leaf\":{\"users\":{\"users\":[\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\"]},\"computed\":null,\"tupleToUserset\":null},\"difference\":null,\"union\":null,\"intersection\":null}}}", + responseJson); + } + + @Test + public void write_and_listObjects() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String _authModelId = writeAuthModel(storeId); + WriteRequest writeRequest = new WriteRequest().writes(new TupleKeys().tupleKeys(DEFAULT_TUPLE_KEYS)); + ListObjectsRequest listObjectsRequest = + new ListObjectsRequest().user(DEFAULT_USER).relation("reader").type("document"); + + // When + api.write(storeId, writeRequest).get(); + ListObjectsResponse response = + api.listObjects(storeId, listObjectsRequest).get(); + + // Then + assertEquals(1, response.getObjects().size()); + assertEquals(DEFAULT_DOC, response.getObjects().get(0)); + } + + @Test + public void write_and_readChanges() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String _authModelId = writeAuthModel(storeId); + WriteRequest writeRequest = new WriteRequest().writes(new TupleKeys().tupleKeys(DEFAULT_TUPLE_KEYS)); + + // When + api.write(storeId, writeRequest).get(); + ReadChangesResponse response = + api.readChanges(storeId, null, null, null).get(); + + // Then + assertEquals(1, response.getChanges().size()); + String firstTupleKeyJson = + mapper.writeValueAsString(response.getChanges().get(0).getTupleKey()); + assertEquals( + "{\"object\":\"document:2021-budget\",\"relation\":\"reader\",\"user\":\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\"}", + firstTupleKeyJson); + } + + @Test + public void write_readAssertions() throws Exception { + // Given + String storeName = thisTestName(); + String storeId = createStore(storeName); + String authModelId = writeAuthModel(storeId); + WriteAssertionsRequest writeRequest = new WriteAssertionsRequest() + .assertions(List.of(new Assertion().tupleKey(DEFAULT_TUPLE_KEY).expectation(true))); + + // When + api.writeAssertions(storeId, authModelId, writeRequest); + ReadAssertionsResponse response = + api.readAssertions(storeId, authModelId).get(); + + // Then + String responseJson = mapper.writeValueAsString(response.getAssertions()); + assertEquals( + "[{\"tuple_key\":{\"object\":\"document:2021-budget\",\"relation\":\"reader\",\"user\":\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\"},\"expectation\":true}]", + responseJson); + } + + /** + * Create a store for a given name. If tests fail here, troubleshoot with the no-arguments + * test method createStore(). + * @return The created Store ID + */ + private String createStore(String storeName) throws Exception { + CreateStoreResponse response = + api.createStore(new CreateStoreRequest().name(storeName)).get(); + return response.getId(); + } + + /** + * Add a default authorization model to a store. If tests fail here, troubleshoot with the + * no-arguments @Test writeAuthModel() method. + * @return The created Authorization Model ID + */ + private String writeAuthModel(String storeId) throws Exception { + WriteAuthorizationModelRequest request = + mapper.readValue(DEFAULT_AUTH_MODEL, WriteAuthorizationModelRequest.class); + WriteAuthorizationModelResponse response = + api.writeAuthorizationModel(storeId, request).get(); + return response.getAuthorizationModelId(); + } + + /** Get the name of the test that invokes this function. Returned in the form: "$class.$fn" */ + private String thisTestName() { + // Tracing the stack gives an array of: + // 0: getStackTrace(), 1: getThisFunctionName(), 2: , 3: ... + StackTraceElement callingFn = Thread.currentThread().getStackTrace()[2]; + String callingClass = callingFn.getClassName().replace("dev.openfga.sdk.api.", ""); + + return String.format("%s.%s", callingClass, callingFn.getMethodName()); + } +} diff --git a/src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java b/src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java new file mode 100644 index 0000000..64826fe --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/OpenFgaApiTest.java @@ -0,0 +1,1762 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api; + +import static org.hamcrest.Matchers.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.pgssoft.httpclient.HttpClientMock; +import dev.openfga.sdk.api.client.*; +import dev.openfga.sdk.api.model.*; +import dev.openfga.sdk.errors.*; +import java.time.Duration; +import java.util.List; +import java.util.concurrent.ExecutionException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * API tests for OpenFgaApi + */ +public class OpenFgaApiTest { + private static final String DEFAULT_STORE_ID = "01YCP46JKYM8FJCQ37NMBYHE5X"; + private static final String DEFAULT_STORE_NAME = "test_store"; + private static final String DEFAULT_AUTH_MODEL_ID = "01G5JAVJ41T49E9TT3SKVS7X1J"; + private static final String DEFAULT_USER = "user:81684243-9356-4421-8fbf-a4f8d36aa31b"; + private static final String DEFAULT_RELATION = "reader"; + private static final String DEFAULT_TYPE = "document"; + private static final String DEFAULT_OBJECT = "document:budget"; + private static final String DEFAULT_SCHEMA_VERSION = "1.1"; + public static final String EMPTY_RESPONSE_BODY = "{}"; + + private final ObjectMapper mapper = new ObjectMapper(); + private OpenFgaApi fga; + private Configuration mockConfiguration; + private ApiClient mockApiClient; + private HttpClientMock mockHttpClient; + + @BeforeEach + public void beforeEachTest() { + mockHttpClient = new HttpClientMock(); + + mockConfiguration = mock(Configuration.class); + when(mockConfiguration.getApiUrl()).thenReturn("https://localhost"); + when(mockConfiguration.getReadTimeout()).thenReturn(Duration.ofMillis(250)); + + mockApiClient = mock(ApiClient.class); + when(mockApiClient.getObjectMapper()).thenReturn(mapper); + when(mockApiClient.getHttpClient()).thenReturn(mockHttpClient); + + fga = new OpenFgaApi(mockApiClient, mockConfiguration); + } + + /** + * List all stores. + */ + @Test + public void listStoresTest() throws Exception { + // Given + String responseBody = + String.format("{\"stores\":[{\"id\":\"%s\",\"name\":\"%s\"}]}", DEFAULT_STORE_ID, DEFAULT_STORE_NAME); + mockHttpClient.onGet("https://localhost/stores").doReturn(200, responseBody); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ListStoresResponse response = + fga.listStores(pageSize, continuationToken).get(); + + // Then + mockHttpClient.verify().get("https://localhost/stores").called(1); + assertNotNull(response.getStores()); + assertEquals(1, response.getStores().size()); + assertEquals(DEFAULT_STORE_ID, response.getStores().get(0).getId()); + assertEquals(DEFAULT_STORE_NAME, response.getStores().get(0).getName()); + } + + @Test + public void listStores_400() { + // Given + mockHttpClient + .onGet("https://localhost/stores") + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listStores(pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void listStores_404() throws Exception { + // Given + mockHttpClient + .onGet("https://localhost/stores") + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listStores(pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void listStores_500() throws Exception { + // Given + mockHttpClient + .onGet("https://localhost/stores") + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listStores(pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Create a store. + */ + @Test + public void createStoreTest() throws Exception { + // Given + String expectedBody = String.format("{\"name\":\"%s\"}", DEFAULT_STORE_NAME); + String requestBody = String.format("{\"id\":\"%s\",\"name\":\"%s\"}", DEFAULT_STORE_ID, DEFAULT_STORE_NAME); + mockHttpClient + .onPost("https://localhost/stores") + .withBody(is(expectedBody)) + .doReturn(201, requestBody); + CreateStoreRequest request = new CreateStoreRequest().name(DEFAULT_STORE_NAME); + + // When + CreateStoreResponse response = fga.createStore(request).get(); + + // Then + mockHttpClient + .verify() + .post("https://localhost/stores") + .withBody(is(expectedBody)) + .called(1); + assertEquals(DEFAULT_STORE_ID, response.getId()); + assertEquals(DEFAULT_STORE_NAME, response.getName()); + } + + @Test + public void createStore_bodyRequired() { + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.createStore(null).get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling createStore", exception.getMessage()); + } + + @Test + public void createStore_400() throws Exception { + // Given + mockHttpClient + .onPost("https://localhost/stores") + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.createStore(new CreateStoreRequest()) + .get()); + + // Then + mockHttpClient.verify().post("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void createStore_404() throws Exception { + // Given + mockHttpClient + .onPost("https://localhost/stores") + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.createStore(new CreateStoreRequest()) + .get()); + + // Then + mockHttpClient.verify().post("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void createStore_500() throws Exception { + // Given + mockHttpClient + .onPost("https://localhost/stores") + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.createStore(new CreateStoreRequest()) + .get()); + + // Then + mockHttpClient.verify().post("https://localhost/stores").called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Get a store. + */ + @Test + public void getStoreTest() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + String responseBody = String.format("{\"id\":\"%s\",\"name\":\"%s\"}", DEFAULT_STORE_ID, DEFAULT_STORE_NAME); + mockHttpClient.onGet(getUrl).doReturn(200, responseBody); + + // When + GetStoreResponse response = fga.getStore(DEFAULT_STORE_ID).get(); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + assertEquals(DEFAULT_STORE_ID, response.getId()); + assertEquals(DEFAULT_STORE_NAME, response.getName()); + } + + @Test + public void getStore_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.getStore(null).get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling getStore", exception.getMessage()); + } + + @Test + public void getStore_400() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onGet(getUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.getStore(DEFAULT_STORE_ID).get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void getStore_404() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onGet(getUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.getStore(DEFAULT_STORE_ID).get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void getStore_500() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onGet(getUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.getStore(DEFAULT_STORE_ID).get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Delete a store. + */ + @Test + public void deleteStoreTest() throws Exception { + // Given + String deleteUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient.onDelete(deleteUrl).doReturn(204, EMPTY_RESPONSE_BODY); + + // When + fga.deleteStore(DEFAULT_STORE_ID); + + // Then + mockHttpClient.verify().delete(deleteUrl).called(1); + } + + @Test + public void deleteStore_storeIdRequired() { + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.deleteStore(null).get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling deleteStore", exception.getMessage()); + } + + @Test + public void deleteStore_400() throws Exception { + // Given + String deleteUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onDelete(deleteUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.deleteStore(DEFAULT_STORE_ID) + .get()); + + // Then + mockHttpClient.verify().delete(deleteUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void deleteStore_404() throws Exception { + // Given + String deleteUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onDelete(deleteUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.deleteStore(DEFAULT_STORE_ID) + .get()); + + // Then + mockHttpClient.verify().delete(deleteUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void deleteStore_500() throws Exception { + // Given + String deleteUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X"; + mockHttpClient + .onDelete(deleteUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.deleteStore(DEFAULT_STORE_ID) + .get()); + + // Then + mockHttpClient.verify().delete(deleteUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Return all the authorization models for a particular store. + */ + @Test + public void readAuthorizationModelsTest() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + String responseBody = String.format( + "{\"authorization_models\":[{\"id\":\"%s\",\"schema_version\":\"%s\"}]}", + DEFAULT_AUTH_MODEL_ID, DEFAULT_SCHEMA_VERSION); + mockHttpClient.onGet(getUrl).doReturn(200, responseBody); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ReadAuthorizationModelsResponse response = fga.readAuthorizationModels( + DEFAULT_STORE_ID, pageSize, continuationToken) + .get(); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + assertNotNull(response.getAuthorizationModels()); + assertEquals(1, response.getAuthorizationModels().size()); + AuthorizationModel authModel = response.getAuthorizationModels().get(0); + assertEquals(DEFAULT_AUTH_MODEL_ID, authModel.getId()); + assertEquals(DEFAULT_SCHEMA_VERSION, authModel.getSchemaVersion()); + } + + @Test + public void readAuthorizationModels_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAuthorizationModels(null, null, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'storeId' when calling readAuthorizationModels", + exception.getMessage()); + } + + @Test + public void readAuthorizationModels_400() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onGet(getUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.readAuthorizationModels( + DEFAULT_STORE_ID, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void readAuthorizationModels_404() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onGet(getUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.readAuthorizationModels( + DEFAULT_STORE_ID, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void readAuthorizationModels_500() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onGet(getUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.readAuthorizationModels( + DEFAULT_STORE_ID, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Create a new authorization model. + */ + @Test + public void writeAuthorizationModelTest() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + String expectedBody = + "{\"type_definitions\":[{\"type\":\"document\",\"relations\":{},\"metadata\":null}],\"schema_version\":\"1.1\"}"; + String responseBody = String.format("{\"authorization_model_id\":\"%s\"}", DEFAULT_AUTH_MODEL_ID); + mockHttpClient.onPost(postUrl).withBody(is(expectedBody)).doReturn(201, responseBody); + WriteAuthorizationModelRequest request = new WriteAuthorizationModelRequest() + .schemaVersion(DEFAULT_SCHEMA_VERSION) + .typeDefinitions(List.of(new TypeDefinition().type(DEFAULT_TYPE))); + + // When + WriteAuthorizationModelResponse response = + fga.writeAuthorizationModel(DEFAULT_STORE_ID, request).get(); + + // Then + mockHttpClient.verify().post(postUrl).withBody(is(expectedBody)).called(1); + assertEquals(DEFAULT_AUTH_MODEL_ID, response.getAuthorizationModelId()); + } + + @Test + public void writeAuthorizationModel_storeIdRequired() { + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.writeAuthorizationModel(null, new WriteAuthorizationModelRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'storeId' when calling writeAuthorizationModel", + exception.getMessage()); + } + + @Test + public void writeAuthorizationModel_bodyRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.writeAuthorizationModel(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'body' when calling writeAuthorizationModel", exception.getMessage()); + } + + @Test + public void writeAuthorizationModel_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAuthorizationModel( + DEFAULT_STORE_ID, new WriteAuthorizationModelRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void writeAuthorizationModel_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAuthorizationModel( + DEFAULT_STORE_ID, new WriteAuthorizationModelRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void writeAuthorizationModel_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAuthorizationModel( + DEFAULT_STORE_ID, new WriteAuthorizationModelRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Return a particular version of an authorization model. + */ + @Test + public void readAuthorizationModelTest() throws Exception { + // Given + String getUrl = + "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J"; + String getResponse = String.format( + "{\"authorization_model\":{\"id\":\"%s\",\"schema_version\":\"%s\"}}", + DEFAULT_AUTH_MODEL_ID, DEFAULT_SCHEMA_VERSION); + mockHttpClient.onGet(getUrl).doReturn(200, getResponse); + + // When + ReadAuthorizationModelResponse response = fga.readAuthorizationModel(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get(); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + assertNotNull(response.getAuthorizationModel()); + assertEquals(DEFAULT_AUTH_MODEL_ID, response.getAuthorizationModel().getId()); + assertEquals(DEFAULT_SCHEMA_VERSION, response.getAuthorizationModel().getSchemaVersion()); + } + + @Test + public void readAuthorizationModel_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAuthorizationModel(null, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'storeId' when calling readAuthorizationModel", exception.getMessage()); + } + + @Test + public void readAuthorizationModel_idRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAuthorizationModel(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'id' when calling readAuthorizationModel", exception.getMessage()); + } + + @Test + public void readAuthorizationModel_400() throws Exception { + // Given + String getUrl = + "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readAuthorizationModel(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void readAuthorizationModel_404() throws Exception { + // Given + String getUrl = + "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readAuthorizationModel(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void readAuthorizationModel_500() throws Exception { + // Given + String getUrl = + "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readAuthorizationModel(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Return a list of all the tuple changes. + */ + @Test + public void readChangesTest() throws Exception { + // Given + String getPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/changes"; + String responseBody = String.format( + "{\"changes\":[{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"}}]}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER); + mockHttpClient.onGet(getPath).doReturn(200, responseBody); + String type = null; // Input is optional + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ReadChangesResponse response = fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken) + .get(); + + // Then + mockHttpClient.verify().get(getPath).called(1); + assertNotNull(response.getChanges()); + assertEquals(1, response.getChanges().size()); + TupleChange change = response.getChanges().get(0); + assertNotNull(change.getTupleKey()); + assertEquals(DEFAULT_OBJECT, change.getTupleKey().getObject()); + assertEquals(DEFAULT_RELATION, change.getTupleKey().getRelation()); + assertEquals(DEFAULT_USER, change.getTupleKey().getUser()); + } + + @Test + public void readChanges_storeIdRequired() throws Exception { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readChanges(null, null, null, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling readChanges", exception.getMessage()); + } + + @Test + public void readChanges_400() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/changes"; + mockHttpClient + .onGet(getUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + String type = null; // Input is optional + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void readChanges_404() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/changes"; + mockHttpClient + .onGet(getUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + String type = null; // Input is optional + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void readChanges_500() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/changes"; + mockHttpClient + .onGet(getUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + String type = null; // Input is optional + Integer pageSize = null; // Input is optional + String continuationToken = null; // Input is optional + + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.readChanges(DEFAULT_STORE_ID, type, pageSize, continuationToken) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Get tuples from the store that matches a query, without following userset rewrite rules. + */ + @Test + public void readTest() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/read"; + String expectedBody = String.format( + "{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"},\"page_size\":null,\"continuation_token\":null}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER); + String responseBody = String.format( + "{\"tuples\":[{\"key\":{\"user\":\"%s\",\"relation\":\"%s\",\"object\":\"%s\"}}]}", + DEFAULT_USER, DEFAULT_RELATION, DEFAULT_OBJECT); + mockHttpClient.onPost(postUrl).withBody(is(expectedBody)).doReturn(200, responseBody); + ReadRequest request = new ReadRequest() + .tupleKey(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)); + + // When + ReadResponse response = fga.read(DEFAULT_STORE_ID, request).get(); + + // Then + mockHttpClient.verify().post(postUrl).withBody(is(expectedBody)).called(1); + assertNotNull(response.getTuples()); + assertEquals(1, response.getTuples().size()); + TupleKey key = response.getTuples().get(0).getKey(); + assertNotNull(key); + assertEquals(DEFAULT_USER, key.getUser()); + assertEquals(DEFAULT_RELATION, key.getRelation()); + assertEquals(DEFAULT_OBJECT, key.getObject()); + } + + @Test + public void read_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.read(null, new ReadRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling read", exception.getMessage()); + } + + @Test + public void read_bodyRequired() { + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.read(DEFAULT_STORE_ID, null).get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling read", exception.getMessage()); + } + + @Test + public void read_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/read"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.read(DEFAULT_STORE_ID, new ReadRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void read_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/read"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.read(DEFAULT_STORE_ID, new ReadRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void read_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/read"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.read(DEFAULT_STORE_ID, new ReadRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Add or delete tuples from the store. + */ + @Test + public void writeTest_writes() throws Exception { + // Given + String postPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/write"; + String expectedBody = String.format( + "{\"writes\":{\"tuple_keys\":[{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"}]},\"deletes\":null,\"authorization_model_id\":\"%s\"}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER, DEFAULT_AUTH_MODEL_ID); + mockHttpClient.onPost(postPath).withBody(is(expectedBody)).doReturn(200, EMPTY_RESPONSE_BODY); + WriteRequest request = new WriteRequest() + .authorizationModelId(DEFAULT_AUTH_MODEL_ID) + .writes(new TupleKeys() + .tupleKeys(List.of(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)))); + + // When + fga.write(DEFAULT_STORE_ID, request); + + // Then + mockHttpClient.verify().post(postPath).withBody(is(expectedBody)).called(1); + } + + /** + * Add or delete tuples from the store. + */ + @Test + public void writeTest_deletes() throws Exception { + // Given + String postPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/write"; + String expectedBody = String.format( + "{\"writes\":null,\"deletes\":{\"tuple_keys\":[{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"}]},\"authorization_model_id\":\"%s\"}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER, DEFAULT_AUTH_MODEL_ID); + mockHttpClient.onPost(postPath).withBody(is(expectedBody)).doReturn(200, EMPTY_RESPONSE_BODY); + WriteRequest request = new WriteRequest() + .authorizationModelId(DEFAULT_AUTH_MODEL_ID) + .deletes(new TupleKeys() + .tupleKeys(List.of(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)))); + + // When + fga.write(DEFAULT_STORE_ID, request); + + // Then + mockHttpClient.verify().post(postPath).withBody(is(expectedBody)).called(1); + } + + @Test + public void write_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.write(null, new WriteRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling write", exception.getMessage()); + } + + @Test + public void write_bodyRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.write(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling write", exception.getMessage()); + } + + @Test + public void write_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/write"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.write(DEFAULT_STORE_ID, new WriteRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void write_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/write"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.write(DEFAULT_STORE_ID, new WriteRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void write_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/write"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.write(DEFAULT_STORE_ID, new WriteRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Check whether a user is authorized to access an object. + */ + @Test + public void check() throws Exception { + // Given + String postPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/check"; + String expectedBody = String.format( + "{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"},\"contextual_tuples\":{\"tuple_keys\":[]},\"authorization_model_id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\",\"trace\":null}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER); + mockHttpClient.onPost(postPath).withBody(is(expectedBody)).doReturn(200, "{\"allowed\":true}"); + CheckRequest request = new CheckRequest() + .tupleKey(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)) + .contextualTuples(new ContextualTupleKeys()) + .authorizationModelId(DEFAULT_AUTH_MODEL_ID); + + // When + CheckResponse response = fga.check(DEFAULT_STORE_ID, request).get(); + + // Then + verify(mockConfiguration).getApiUrl(); + verify(mockConfiguration).getReadTimeout(); + mockHttpClient.verify().post(postPath).withBody(is(expectedBody)).called(1); + assertEquals(Boolean.TRUE, response.getAllowed()); + } + + @Test + public void check_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.check(null, new CheckRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling check", exception.getMessage()); + } + + @Test + public void check_bodyRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.check(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling check", exception.getMessage()); + } + + @Test + public void check_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/check"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.check(DEFAULT_STORE_ID, new CheckRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void check_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/check"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.check(DEFAULT_STORE_ID, new CheckRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void check_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/check"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.check(DEFAULT_STORE_ID, new CheckRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship. + */ + @Test + public void expandTest() throws Exception { + // Given + String postPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/expand"; + String expectedBody = String.format( + "{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"},\"authorization_model_id\":\"%s\"}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER, DEFAULT_AUTH_MODEL_ID); + String responseBody = String.format( + "{\"tree\":{\"root\":{\"union\":{\"nodes\":[{\"leaf\":{\"users\":{\"users\":[\"%s\"]}}}]}}}}", + DEFAULT_USER); + mockHttpClient.onPost(postPath).withBody(is(expectedBody)).doReturn(200, responseBody); + ExpandRequest request = new ExpandRequest() + .authorizationModelId(DEFAULT_AUTH_MODEL_ID) + .tupleKey(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)); + + // When + ExpandResponse response = fga.expand(DEFAULT_STORE_ID, request).get(); + + // Then + mockHttpClient.verify().post(postPath).withBody(is(expectedBody)).called(1); + assertNotNull(response.getTree()); + assertNotNull(response.getTree().getRoot()); + assertNotNull(response.getTree().getRoot().getUnion()); + assertNotNull(response.getTree().getRoot().getUnion().getNodes()); + assertEquals(1, response.getTree().getRoot().getUnion().getNodes().size()); + assertNotNull(response.getTree().getRoot().getUnion().getNodes().get(0)); + Node node = response.getTree().getRoot().getUnion().getNodes().get(0); + assertNotNull(node.getLeaf()); + assertNotNull(node.getLeaf().getUsers()); + assertNotNull(node.getLeaf().getUsers().getUsers()); + assertEquals(1, node.getLeaf().getUsers().getUsers().size()); + assertEquals(DEFAULT_USER, node.getLeaf().getUsers().getUsers().get(0)); + } + + @Test + public void expand_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.expand(null, new ExpandRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling expand", exception.getMessage()); + } + + @Test + public void expand_bodyRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.expand(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling expand", exception.getMessage()); + } + + @Test + public void expand_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/expand"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.expand(DEFAULT_STORE_ID, new ExpandRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void expand_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/expand"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.expand(DEFAULT_STORE_ID, new ExpandRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void expand_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/expand"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.expand(DEFAULT_STORE_ID, new ExpandRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * List all objects of the given type that the user has a relation with. + */ + @Test + public void listObjectsTest() throws Exception { + // Given + String postPath = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/list-objects"; + String expectedBody = String.format( + "{\"authorization_model_id\":\"%s\",\"type\":null,\"relation\":\"%s\",\"user\":\"%s\",\"contextual_tuples\":null}", + DEFAULT_AUTH_MODEL_ID, DEFAULT_RELATION, DEFAULT_USER); + mockHttpClient + .onPost(postPath) + .withBody(is(expectedBody)) + .doReturn(200, String.format("{\"objects\":[\"%s\"]}", DEFAULT_OBJECT)); + ListObjectsRequest request = new ListObjectsRequest() + .authorizationModelId(DEFAULT_AUTH_MODEL_ID) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER); + + // When + ListObjectsResponse response = + fga.listObjects(DEFAULT_STORE_ID, request).get(); + + // Then + mockHttpClient.verify().post(postPath).withBody(is(expectedBody)).called(1); + assertEquals(List.of(DEFAULT_OBJECT), response.getObjects()); + } + + @Test + public void listObjects_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listObjects(null, new ListObjectsRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling listObjects", exception.getMessage()); + } + + @Test + public void listObjects_bodyRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listObjects(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling listObjects", exception.getMessage()); + } + + @Test + public void listObjects_400() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/list-objects"; + mockHttpClient + .onPost(postUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listObjects(DEFAULT_STORE_ID, new ListObjectsRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void listObjects_404() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/list-objects"; + mockHttpClient + .onPost(postUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listObjects(DEFAULT_STORE_ID, new ListObjectsRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void listObjects_500() throws Exception { + // Given + String postUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/list-objects"; + mockHttpClient + .onPost(postUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.listObjects(DEFAULT_STORE_ID, new ListObjectsRequest()) + .get()); + + // Then + mockHttpClient.verify().post(postUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Read assertions for an authorization model ID. + */ + @Test + public void readAssertionsTest() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + String responseBody = String.format( + "{\"assertions\":[{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"},\"expectation\":true}]}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER); + mockHttpClient.onGet(getUrl).doReturn(200, responseBody); + + // When + ReadAssertionsResponse response = + fga.readAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID).get(); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + assertNotNull(response.getAssertions()); + assertEquals(1, response.getAssertions().size()); + Assertion assertion = response.getAssertions().get(0); + assertNotNull(assertion); + assertTrue(assertion.getExpectation()); + assertEquals(DEFAULT_OBJECT, assertion.getTupleKey().getObject()); + assertEquals(DEFAULT_RELATION, assertion.getTupleKey().getRelation()); + assertEquals(DEFAULT_USER, assertion.getTupleKey().getUser()); + } + + @Test + public void readAssertions_storeIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAssertions(null, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling readAssertions", exception.getMessage()); + } + + @Test + public void readAssertions_authModelIdRequired() { + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAssertions(DEFAULT_STORE_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'authorizationModelId' when calling readAssertions", + exception.getMessage()); + } + + @Test + public void readAssertions_400() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void readAssertions_404() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void readAssertions_500() throws Exception { + // Given + String getUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onGet(getUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = + assertThrows(ExecutionException.class, () -> fga.readAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID) + .get()); + + // Then + mockHttpClient.verify().get(getUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } + + /** + * Upsert assertions for an authorization model ID. + */ + @Test + public void writeAssertionsTest() throws Exception { + // Given + String putUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + String expectedBody = String.format( + "{\"assertions\":[{\"tuple_key\":{\"object\":\"%s\",\"relation\":\"%s\",\"user\":\"%s\"},\"expectation\":true}]}", + DEFAULT_OBJECT, DEFAULT_RELATION, DEFAULT_USER); + mockHttpClient.onPut(putUrl).withBody(is(expectedBody)).doReturn(200, EMPTY_RESPONSE_BODY); + WriteAssertionsRequest request = new WriteAssertionsRequest() + .assertions(List.of(new Assertion() + .tupleKey(new TupleKey() + ._object(DEFAULT_OBJECT) + .relation(DEFAULT_RELATION) + .user(DEFAULT_USER)) + .expectation(true))); + + // When + fga.writeAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID, request); + + // Then + mockHttpClient.verify().put(putUrl).withBody(is(expectedBody)).called(1); + } + + @Test + public void writeAssertions_storeIdRequired() { + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAssertions( + null, DEFAULT_AUTH_MODEL_ID, new WriteAssertionsRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'storeId' when calling writeAssertions", exception.getMessage()); + } + + @Test + public void writeAssertions_authModelIdRequired() { + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAssertions( + DEFAULT_STORE_ID, null, new WriteAssertionsRequest()) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals( + "Missing the required parameter 'authorizationModelId' when calling writeAssertions", + exception.getMessage()); + } + + @Test + public void writeAssertions_bodyRequired() { + // When + ExecutionException execException = assertThrows( + ExecutionException.class, () -> fga.writeAssertions(DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID, null) + .get()); + + // Then + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals("Missing the required parameter 'body' when calling writeAssertions", exception.getMessage()); + } + + @Test + public void writeAssertions_400() throws Exception { + // Given + String putUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onPut(putUrl) + .doReturn(400, "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAssertions( + DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID, new WriteAssertionsRequest()) + .get()); + + // Then + mockHttpClient.verify().put(putUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(400, exception.getCode()); + assertEquals( + "{\"code\":\"validation_error\",\"message\":\"Generic validation error\"}", + exception.getResponseBody()); + } + + @Test + public void writeAssertions_404() throws Exception { + // Given + String putUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onPut(putUrl) + .doReturn(404, "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAssertions( + DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID, new WriteAssertionsRequest()) + .get()); + + // Then + mockHttpClient.verify().put(putUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(404, exception.getCode()); + assertEquals( + "{\"code\":\"undefined_endpoint\",\"message\":\"Endpoint not enabled\"}", exception.getResponseBody()); + } + + @Test + public void writeAssertions_500() throws Exception { + // Given + String putUrl = "https://localhost/stores/01YCP46JKYM8FJCQ37NMBYHE5X/assertions/01G5JAVJ41T49E9TT3SKVS7X1J"; + mockHttpClient + .onPut(putUrl) + .doReturn(500, "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}"); + + // When + ExecutionException execException = assertThrows(ExecutionException.class, () -> fga.writeAssertions( + DEFAULT_STORE_ID, DEFAULT_AUTH_MODEL_ID, new WriteAssertionsRequest()) + .get()); + + // Then + mockHttpClient.verify().put(putUrl).called(1); + ApiException exception = assertInstanceOf(ApiException.class, execException.getCause()); + assertEquals(500, exception.getCode()); + assertEquals( + "{\"code\":\"internal_error\",\"message\":\"Internal Server Error\"}", exception.getResponseBody()); + } +} diff --git a/src/test/java/dev/openfga/sdk/api/client/ClientCredentialsTest.java b/src/test/java/dev/openfga/sdk/api/client/ClientCredentialsTest.java new file mode 100644 index 0000000..6ae5606 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/client/ClientCredentialsTest.java @@ -0,0 +1,112 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.client; + +import static org.junit.jupiter.api.Assertions.*; + +import dev.openfga.sdk.errors.FgaInvalidParameterException; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class ClientCredentialsTest { + private static final List INVALID_IDENTIFIERS = Arrays.asList(null, "", "\t\r\n"); + private static final String VALID_CLIENT_ID = "client"; + private static final String VALID_CLIENT_SECRET = "secret"; + private static final String VALID_API_TOKEN_ISSUER = "tokenissuer.fga.example"; + private static final String VALID_API_AUDIENCE = "audience"; + + @Test + public void assertValid_allValid() throws FgaInvalidParameterException { + // When + ClientCredentials creds = new ClientCredentials() + .clientId(VALID_CLIENT_ID) + .clientSecret(VALID_CLIENT_SECRET) + .apiTokenIssuer(VALID_API_TOKEN_ISSUER) + .apiAudience(VALID_API_AUDIENCE); + + // Then + assertEquals(VALID_CLIENT_ID, creds.getClientId()); + assertEquals(VALID_CLIENT_SECRET, creds.getClientSecret()); + assertEquals(VALID_API_TOKEN_ISSUER, creds.getApiTokenIssuer()); + assertEquals(VALID_API_AUDIENCE, creds.getApiAudience()); + } + + @Test + public void assertValid_invalidClientId() { + INVALID_IDENTIFIERS.stream() + // Given + .map(invalid -> new ClientCredentials() + .clientId(invalid) + .clientSecret(VALID_CLIENT_SECRET) + .apiTokenIssuer(VALID_API_TOKEN_ISSUER) + .apiAudience(VALID_API_AUDIENCE)) + // When + .map(creds -> assertThrows(FgaInvalidParameterException.class, creds::assertValid)) + // Then + .forEach(exception -> assertEquals( + "Required parameter clientId was invalid when calling ClientCredentials.", + exception.getMessage())); + } + + @Test + public void assertValid_invalidClientSecret() { + INVALID_IDENTIFIERS.stream() + // Given + .map(invalid -> new ClientCredentials() + .clientId(VALID_CLIENT_ID) + .clientSecret(invalid) + .apiTokenIssuer(VALID_API_TOKEN_ISSUER) + .apiAudience(VALID_API_AUDIENCE)) + // When + .map(creds -> assertThrows(FgaInvalidParameterException.class, creds::assertValid)) + // Then + .forEach(exception -> assertEquals( + "Required parameter clientSecret was invalid when calling ClientCredentials.", + exception.getMessage())); + } + + @Test + public void assertValid_invalidApiTokenIssuer() { + INVALID_IDENTIFIERS.stream() + // Given + .map(invalid -> new ClientCredentials() + .clientId(VALID_CLIENT_ID) + .clientSecret(VALID_CLIENT_SECRET) + .apiTokenIssuer(invalid) + .apiAudience(VALID_API_AUDIENCE)) + // When + .map(creds -> assertThrows(FgaInvalidParameterException.class, creds::assertValid)) + // Then + .forEach(exception -> assertEquals( + "Required parameter apiTokenIssuer was invalid when calling ClientCredentials.", + exception.getMessage())); + } + + @Test + public void assertValid_invalidApiAudience() { + INVALID_IDENTIFIERS.stream() + // Given + .map(invalid -> new ClientCredentials() + .clientId(VALID_CLIENT_ID) + .clientSecret(VALID_CLIENT_SECRET) + .apiTokenIssuer(VALID_API_TOKEN_ISSUER) + .apiAudience(invalid)) + // When + .map(creds -> assertThrows(FgaInvalidParameterException.class, creds::assertValid)) + // Then + .forEach(exception -> assertEquals( + "Required parameter apiAudience was invalid when calling ClientCredentials.", + exception.getMessage())); + } +} diff --git a/src/test/java/dev/openfga/sdk/api/client/ConfigurationTest.java b/src/test/java/dev/openfga/sdk/api/client/ConfigurationTest.java new file mode 100644 index 0000000..6b5c33c --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/client/ConfigurationTest.java @@ -0,0 +1,87 @@ +package dev.openfga.sdk.api.client; + +import static org.junit.jupiter.api.Assertions.*; + +import dev.openfga.sdk.errors.*; +import org.junit.jupiter.api.Test; + +class ConfigurationTest { + @Test + void apiUrl_nullDefaults() throws FgaInvalidParameterException { + // Given + String apiUrl = null; + var config = new Configuration(apiUrl); + + // When + config.assertValid(); + + // Then + assertEquals("http://localhost:8080", config.getApiUrl()); + } + + @Test + void apiUrl_emptyStringDefaults() throws FgaInvalidParameterException { + // Given + String apiUrl = ""; + var config = new Configuration(apiUrl); + + // When + config.assertValid(); + + // Then + assertEquals("http://localhost:8080", config.getApiUrl()); + } + + @Test + void apiUrl_whitespaceStringDefaults() throws FgaInvalidParameterException { + // Given + String apiUrl = " \t\r\n"; + var config = new Configuration(apiUrl); + + // When + config.assertValid(); + + // Then + assertEquals("http://localhost:8080", config.getApiUrl()); + } + + @Test + void apiUrl_stringNoProtocolFails() { + String apiUrl = "localhost:8080"; + FgaInvalidParameterException e = assertThrows(FgaInvalidParameterException.class, () -> { + var config = new Configuration(apiUrl); + config.assertValid(); + }); + assertEquals("Required parameter apiUrl was invalid when calling Configuration.", e.getMessage()); + } + + @Test + void apiUrl_stringInvalidProtocolFails() { + String apiUrl = "zzz://localhost:8080"; + FgaInvalidParameterException e = assertThrows(FgaInvalidParameterException.class, () -> { + var config = new Configuration(apiUrl); + config.assertValid(); + }); + assertEquals("Required parameter apiUrl was invalid when calling Configuration.", e.getMessage()); + } + + @Test + void apiUrl_stringNoHostFails() { + String apiUrl = "http://"; + FgaInvalidParameterException e = assertThrows(FgaInvalidParameterException.class, () -> { + var config = new Configuration(apiUrl); + config.assertValid(); + }); + assertEquals("Required parameter apiUrl was invalid when calling Configuration.", e.getMessage()); + } + + @Test + void apiUrl_stringBadPortFails() { + String apiUrl = "http://localshost:abcd"; + FgaInvalidParameterException e = assertThrows(FgaInvalidParameterException.class, () -> { + var config = new Configuration(apiUrl); + config.assertValid(); + }); + assertEquals("Required parameter apiUrl was invalid when calling Configuration.", e.getMessage()); + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/AnyTest.java b/src/test/java/dev/openfga/sdk/api/model/AnyTest.java new file mode 100644 index 0000000..c01467f --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/AnyTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Any + */ +public class AnyTest { + private final Any model = new Any(); + + /** + * Model tests for Any + */ + @Test + public void testAny() { + // TODO: test Any + } + + /** + * Test the property 'atType' + */ + @Test + public void atTypeTest() { + // TODO: test atType + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/AssertionTest.java b/src/test/java/dev/openfga/sdk/api/model/AssertionTest.java new file mode 100644 index 0000000..c2b1703 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/AssertionTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Assertion + */ +public class AssertionTest { + private final Assertion model = new Assertion(); + + /** + * Model tests for Assertion + */ + @Test + public void testAssertion() { + // TODO: test Assertion + } + + /** + * Test the property 'tupleKey' + */ + @Test + public void tupleKeyTest() { + // TODO: test tupleKey + } + + /** + * Test the property 'expectation' + */ + @Test + public void expectationTest() { + // TODO: test expectation + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/AuthorizationModelTest.java b/src/test/java/dev/openfga/sdk/api/model/AuthorizationModelTest.java new file mode 100644 index 0000000..1500a4e --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/AuthorizationModelTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for AuthorizationModel + */ +public class AuthorizationModelTest { + private final AuthorizationModel model = new AuthorizationModel(); + + /** + * Model tests for AuthorizationModel + */ + @Test + public void testAuthorizationModel() { + // TODO: test AuthorizationModel + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'schemaVersion' + */ + @Test + public void schemaVersionTest() { + // TODO: test schemaVersion + } + + /** + * Test the property 'typeDefinitions' + */ + @Test + public void typeDefinitionsTest() { + // TODO: test typeDefinitions + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/CheckRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/CheckRequestTest.java new file mode 100644 index 0000000..fec5bbd --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/CheckRequestTest.java @@ -0,0 +1,62 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for CheckRequest + */ +public class CheckRequestTest { + private final CheckRequest model = new CheckRequest(); + + /** + * Model tests for CheckRequest + */ + @Test + public void testCheckRequest() { + // TODO: test CheckRequest + } + + /** + * Test the property 'tupleKey' + */ + @Test + public void tupleKeyTest() { + // TODO: test tupleKey + } + + /** + * Test the property 'contextualTuples' + */ + @Test + public void contextualTuplesTest() { + // TODO: test contextualTuples + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } + + /** + * Test the property 'trace' + */ + @Test + public void traceTest() { + // TODO: test trace + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/CheckResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/CheckResponseTest.java new file mode 100644 index 0000000..4d02dfc --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/CheckResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for CheckResponse + */ +public class CheckResponseTest { + private final CheckResponse model = new CheckResponse(); + + /** + * Model tests for CheckResponse + */ + @Test + public void testCheckResponse() { + // TODO: test CheckResponse + } + + /** + * Test the property 'allowed' + */ + @Test + public void allowedTest() { + // TODO: test allowed + } + + /** + * Test the property 'resolution' + */ + @Test + public void resolutionTest() { + // TODO: test resolution + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ComputedTest.java b/src/test/java/dev/openfga/sdk/api/model/ComputedTest.java new file mode 100644 index 0000000..2bc4d98 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ComputedTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Computed + */ +public class ComputedTest { + private final Computed model = new Computed(); + + /** + * Model tests for Computed + */ + @Test + public void testComputed() { + // TODO: test Computed + } + + /** + * Test the property 'userset' + */ + @Test + public void usersetTest() { + // TODO: test userset + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ContextualTupleKeysTest.java b/src/test/java/dev/openfga/sdk/api/model/ContextualTupleKeysTest.java new file mode 100644 index 0000000..5b14e72 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ContextualTupleKeysTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ContextualTupleKeys + */ +public class ContextualTupleKeysTest { + private final ContextualTupleKeys model = new ContextualTupleKeys(); + + /** + * Model tests for ContextualTupleKeys + */ + @Test + public void testContextualTupleKeys() { + // TODO: test ContextualTupleKeys + } + + /** + * Test the property 'tupleKeys' + */ + @Test + public void tupleKeysTest() { + // TODO: test tupleKeys + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/CreateStoreRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/CreateStoreRequestTest.java new file mode 100644 index 0000000..4472a9b --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/CreateStoreRequestTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for CreateStoreRequest + */ +public class CreateStoreRequestTest { + private final CreateStoreRequest model = new CreateStoreRequest(); + + /** + * Model tests for CreateStoreRequest + */ + @Test + public void testCreateStoreRequest() { + // TODO: test CreateStoreRequest + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/CreateStoreResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/CreateStoreResponseTest.java new file mode 100644 index 0000000..143a3cd --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/CreateStoreResponseTest.java @@ -0,0 +1,62 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for CreateStoreResponse + */ +public class CreateStoreResponseTest { + private final CreateStoreResponse model = new CreateStoreResponse(); + + /** + * Model tests for CreateStoreResponse + */ + @Test + public void testCreateStoreResponse() { + // TODO: test CreateStoreResponse + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'createdAt' + */ + @Test + public void createdAtTest() { + // TODO: test createdAt + } + + /** + * Test the property 'updatedAt' + */ + @Test + public void updatedAtTest() { + // TODO: test updatedAt + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/DifferenceTest.java b/src/test/java/dev/openfga/sdk/api/model/DifferenceTest.java new file mode 100644 index 0000000..ca28ecd --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/DifferenceTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Difference + */ +public class DifferenceTest { + private final Difference model = new Difference(); + + /** + * Model tests for Difference + */ + @Test + public void testDifference() { + // TODO: test Difference + } + + /** + * Test the property 'base' + */ + @Test + public void baseTest() { + // TODO: test base + } + + /** + * Test the property 'subtract' + */ + @Test + public void subtractTest() { + // TODO: test subtract + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ErrorCodeTest.java b/src/test/java/dev/openfga/sdk/api/model/ErrorCodeTest.java new file mode 100644 index 0000000..56d0cde --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ErrorCodeTest.java @@ -0,0 +1,28 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ErrorCode + */ +public class ErrorCodeTest { + /** + * Model tests for ErrorCode + */ + @Test + public void testErrorCode() { + // TODO: test ErrorCode + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ExpandRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/ExpandRequestTest.java new file mode 100644 index 0000000..127a496 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ExpandRequestTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ExpandRequest + */ +public class ExpandRequestTest { + private final ExpandRequest model = new ExpandRequest(); + + /** + * Model tests for ExpandRequest + */ + @Test + public void testExpandRequest() { + // TODO: test ExpandRequest + } + + /** + * Test the property 'tupleKey' + */ + @Test + public void tupleKeyTest() { + // TODO: test tupleKey + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ExpandResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ExpandResponseTest.java new file mode 100644 index 0000000..24eeb39 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ExpandResponseTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ExpandResponse + */ +public class ExpandResponseTest { + private final ExpandResponse model = new ExpandResponse(); + + /** + * Model tests for ExpandResponse + */ + @Test + public void testExpandResponse() { + // TODO: test ExpandResponse + } + + /** + * Test the property 'tree' + */ + @Test + public void treeTest() { + // TODO: test tree + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/GetStoreResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/GetStoreResponseTest.java new file mode 100644 index 0000000..aad87d4 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/GetStoreResponseTest.java @@ -0,0 +1,62 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for GetStoreResponse + */ +public class GetStoreResponseTest { + private final GetStoreResponse model = new GetStoreResponse(); + + /** + * Model tests for GetStoreResponse + */ + @Test + public void testGetStoreResponse() { + // TODO: test GetStoreResponse + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'createdAt' + */ + @Test + public void createdAtTest() { + // TODO: test createdAt + } + + /** + * Test the property 'updatedAt' + */ + @Test + public void updatedAtTest() { + // TODO: test updatedAt + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/InternalErrorCodeTest.java b/src/test/java/dev/openfga/sdk/api/model/InternalErrorCodeTest.java new file mode 100644 index 0000000..0a74ca7 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/InternalErrorCodeTest.java @@ -0,0 +1,28 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for InternalErrorCode + */ +public class InternalErrorCodeTest { + /** + * Model tests for InternalErrorCode + */ + @Test + public void testInternalErrorCode() { + // TODO: test InternalErrorCode + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/InternalErrorMessageResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/InternalErrorMessageResponseTest.java new file mode 100644 index 0000000..a08a34d --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/InternalErrorMessageResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for InternalErrorMessageResponse + */ +public class InternalErrorMessageResponseTest { + private final InternalErrorMessageResponse model = new InternalErrorMessageResponse(); + + /** + * Model tests for InternalErrorMessageResponse + */ + @Test + public void testInternalErrorMessageResponse() { + // TODO: test InternalErrorMessageResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/LeafTest.java b/src/test/java/dev/openfga/sdk/api/model/LeafTest.java new file mode 100644 index 0000000..5c2cb5c --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/LeafTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Leaf + */ +public class LeafTest { + private final Leaf model = new Leaf(); + + /** + * Model tests for Leaf + */ + @Test + public void testLeaf() { + // TODO: test Leaf + } + + /** + * Test the property 'users' + */ + @Test + public void usersTest() { + // TODO: test users + } + + /** + * Test the property 'computed' + */ + @Test + public void computedTest() { + // TODO: test computed + } + + /** + * Test the property 'tupleToUserset' + */ + @Test + public void tupleToUsersetTest() { + // TODO: test tupleToUserset + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ListObjectsRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/ListObjectsRequestTest.java new file mode 100644 index 0000000..a2f5337 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ListObjectsRequestTest.java @@ -0,0 +1,70 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ListObjectsRequest + */ +public class ListObjectsRequestTest { + private final ListObjectsRequest model = new ListObjectsRequest(); + + /** + * Model tests for ListObjectsRequest + */ + @Test + public void testListObjectsRequest() { + // TODO: test ListObjectsRequest + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'relation' + */ + @Test + public void relationTest() { + // TODO: test relation + } + + /** + * Test the property 'user' + */ + @Test + public void userTest() { + // TODO: test user + } + + /** + * Test the property 'contextualTuples' + */ + @Test + public void contextualTuplesTest() { + // TODO: test contextualTuples + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ListObjectsResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ListObjectsResponseTest.java new file mode 100644 index 0000000..67d15cd --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ListObjectsResponseTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ListObjectsResponse + */ +public class ListObjectsResponseTest { + private final ListObjectsResponse model = new ListObjectsResponse(); + + /** + * Model tests for ListObjectsResponse + */ + @Test + public void testListObjectsResponse() { + // TODO: test ListObjectsResponse + } + + /** + * Test the property 'objects' + */ + @Test + public void objectsTest() { + // TODO: test objects + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ListStoresResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ListStoresResponseTest.java new file mode 100644 index 0000000..1fb61eb --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ListStoresResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ListStoresResponse + */ +public class ListStoresResponseTest { + private final ListStoresResponse model = new ListStoresResponse(); + + /** + * Model tests for ListStoresResponse + */ + @Test + public void testListStoresResponse() { + // TODO: test ListStoresResponse + } + + /** + * Test the property 'stores' + */ + @Test + public void storesTest() { + // TODO: test stores + } + + /** + * Test the property 'continuationToken' + */ + @Test + public void continuationTokenTest() { + // TODO: test continuationToken + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/MetadataTest.java b/src/test/java/dev/openfga/sdk/api/model/MetadataTest.java new file mode 100644 index 0000000..b85bb35 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/MetadataTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Metadata + */ +public class MetadataTest { + private final Metadata model = new Metadata(); + + /** + * Model tests for Metadata + */ + @Test + public void testMetadata() { + // TODO: test Metadata + } + + /** + * Test the property 'relations' + */ + @Test + public void relationsTest() { + // TODO: test relations + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/NodeTest.java b/src/test/java/dev/openfga/sdk/api/model/NodeTest.java new file mode 100644 index 0000000..e7ca0e8 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/NodeTest.java @@ -0,0 +1,70 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Node + */ +public class NodeTest { + private final Node model = new Node(); + + /** + * Model tests for Node + */ + @Test + public void testNode() { + // TODO: test Node + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'leaf' + */ + @Test + public void leafTest() { + // TODO: test leaf + } + + /** + * Test the property 'difference' + */ + @Test + public void differenceTest() { + // TODO: test difference + } + + /** + * Test the property 'union' + */ + @Test + public void unionTest() { + // TODO: test union + } + + /** + * Test the property 'intersection' + */ + @Test + public void intersectionTest() { + // TODO: test intersection + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/NodesTest.java b/src/test/java/dev/openfga/sdk/api/model/NodesTest.java new file mode 100644 index 0000000..12c0331 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/NodesTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Nodes + */ +public class NodesTest { + private final Nodes model = new Nodes(); + + /** + * Model tests for Nodes + */ + @Test + public void testNodes() { + // TODO: test Nodes + } + + /** + * Test the property 'nodes' + */ + @Test + public void nodesTest() { + // TODO: test nodes + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/NotFoundErrorCodeTest.java b/src/test/java/dev/openfga/sdk/api/model/NotFoundErrorCodeTest.java new file mode 100644 index 0000000..89a6a20 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/NotFoundErrorCodeTest.java @@ -0,0 +1,28 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for NotFoundErrorCode + */ +public class NotFoundErrorCodeTest { + /** + * Model tests for NotFoundErrorCode + */ + @Test + public void testNotFoundErrorCode() { + // TODO: test NotFoundErrorCode + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ObjectRelationTest.java b/src/test/java/dev/openfga/sdk/api/model/ObjectRelationTest.java new file mode 100644 index 0000000..4250939 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ObjectRelationTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectRelation + */ +public class ObjectRelationTest { + private final ObjectRelation model = new ObjectRelation(); + + /** + * Model tests for ObjectRelation + */ + @Test + public void testObjectRelation() { + // TODO: test ObjectRelation + } + + /** + * Test the property '_object' + */ + @Test + public void _objectTest() { + // TODO: test _object + } + + /** + * Test the property 'relation' + */ + @Test + public void relationTest() { + // TODO: test relation + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponseTest.java new file mode 100644 index 0000000..587ba31 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for PathUnknownErrorMessageResponse + */ +public class PathUnknownErrorMessageResponseTest { + private final PathUnknownErrorMessageResponse model = new PathUnknownErrorMessageResponse(); + + /** + * Model tests for PathUnknownErrorMessageResponse + */ + @Test + public void testPathUnknownErrorMessageResponse() { + // TODO: test PathUnknownErrorMessageResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadAssertionsResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadAssertionsResponseTest.java new file mode 100644 index 0000000..521492e --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadAssertionsResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadAssertionsResponse + */ +public class ReadAssertionsResponseTest { + private final ReadAssertionsResponse model = new ReadAssertionsResponse(); + + /** + * Model tests for ReadAssertionsResponse + */ + @Test + public void testReadAssertionsResponse() { + // TODO: test ReadAssertionsResponse + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } + + /** + * Test the property 'assertions' + */ + @Test + public void assertionsTest() { + // TODO: test assertions + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponseTest.java new file mode 100644 index 0000000..845a766 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelResponseTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadAuthorizationModelResponse + */ +public class ReadAuthorizationModelResponseTest { + private final ReadAuthorizationModelResponse model = new ReadAuthorizationModelResponse(); + + /** + * Model tests for ReadAuthorizationModelResponse + */ + @Test + public void testReadAuthorizationModelResponse() { + // TODO: test ReadAuthorizationModelResponse + } + + /** + * Test the property 'authorizationModel' + */ + @Test + public void authorizationModelTest() { + // TODO: test authorizationModel + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponseTest.java new file mode 100644 index 0000000..80d9821 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadAuthorizationModelsResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadAuthorizationModelsResponse + */ +public class ReadAuthorizationModelsResponseTest { + private final ReadAuthorizationModelsResponse model = new ReadAuthorizationModelsResponse(); + + /** + * Model tests for ReadAuthorizationModelsResponse + */ + @Test + public void testReadAuthorizationModelsResponse() { + // TODO: test ReadAuthorizationModelsResponse + } + + /** + * Test the property 'authorizationModels' + */ + @Test + public void authorizationModelsTest() { + // TODO: test authorizationModels + } + + /** + * Test the property 'continuationToken' + */ + @Test + public void continuationTokenTest() { + // TODO: test continuationToken + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadChangesResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadChangesResponseTest.java new file mode 100644 index 0000000..8b11f6c --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadChangesResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadChangesResponse + */ +public class ReadChangesResponseTest { + private final ReadChangesResponse model = new ReadChangesResponse(); + + /** + * Model tests for ReadChangesResponse + */ + @Test + public void testReadChangesResponse() { + // TODO: test ReadChangesResponse + } + + /** + * Test the property 'changes' + */ + @Test + public void changesTest() { + // TODO: test changes + } + + /** + * Test the property 'continuationToken' + */ + @Test + public void continuationTokenTest() { + // TODO: test continuationToken + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadRequestTest.java new file mode 100644 index 0000000..955310a --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadRequestTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadRequest + */ +public class ReadRequestTest { + private final ReadRequest model = new ReadRequest(); + + /** + * Model tests for ReadRequest + */ + @Test + public void testReadRequest() { + // TODO: test ReadRequest + } + + /** + * Test the property 'tupleKey' + */ + @Test + public void tupleKeyTest() { + // TODO: test tupleKey + } + + /** + * Test the property 'pageSize' + */ + @Test + public void pageSizeTest() { + // TODO: test pageSize + } + + /** + * Test the property 'continuationToken' + */ + @Test + public void continuationTokenTest() { + // TODO: test continuationToken + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ReadResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ReadResponseTest.java new file mode 100644 index 0000000..59fb83d --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ReadResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadResponse + */ +public class ReadResponseTest { + private final ReadResponse model = new ReadResponse(); + + /** + * Model tests for ReadResponse + */ + @Test + public void testReadResponse() { + // TODO: test ReadResponse + } + + /** + * Test the property 'tuples' + */ + @Test + public void tuplesTest() { + // TODO: test tuples + } + + /** + * Test the property 'continuationToken' + */ + @Test + public void continuationTokenTest() { + // TODO: test continuationToken + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/RelationMetadataTest.java b/src/test/java/dev/openfga/sdk/api/model/RelationMetadataTest.java new file mode 100644 index 0000000..82763ae --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/RelationMetadataTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for RelationMetadata + */ +public class RelationMetadataTest { + private final RelationMetadata model = new RelationMetadata(); + + /** + * Model tests for RelationMetadata + */ + @Test + public void testRelationMetadata() { + // TODO: test RelationMetadata + } + + /** + * Test the property 'directlyRelatedUserTypes' + */ + @Test + public void directlyRelatedUserTypesTest() { + // TODO: test directlyRelatedUserTypes + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/RelationReferenceTest.java b/src/test/java/dev/openfga/sdk/api/model/RelationReferenceTest.java new file mode 100644 index 0000000..a738757 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/RelationReferenceTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for RelationReference + */ +public class RelationReferenceTest { + private final RelationReference model = new RelationReference(); + + /** + * Model tests for RelationReference + */ + @Test + public void testRelationReference() { + // TODO: test RelationReference + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'relation' + */ + @Test + public void relationTest() { + // TODO: test relation + } + + /** + * Test the property 'wildcard' + */ + @Test + public void wildcardTest() { + // TODO: test wildcard + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/StatusTest.java b/src/test/java/dev/openfga/sdk/api/model/StatusTest.java new file mode 100644 index 0000000..0262f9f --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/StatusTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Status + */ +public class StatusTest { + private final Status model = new Status(); + + /** + * Model tests for Status + */ + @Test + public void testStatus() { + // TODO: test Status + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + + /** + * Test the property 'details' + */ + @Test + public void detailsTest() { + // TODO: test details + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/StoreTest.java b/src/test/java/dev/openfga/sdk/api/model/StoreTest.java new file mode 100644 index 0000000..2ed2f53 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/StoreTest.java @@ -0,0 +1,70 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Store + */ +public class StoreTest { + private final Store model = new Store(); + + /** + * Model tests for Store + */ + @Test + public void testStore() { + // TODO: test Store + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'createdAt' + */ + @Test + public void createdAtTest() { + // TODO: test createdAt + } + + /** + * Test the property 'updatedAt' + */ + @Test + public void updatedAtTest() { + // TODO: test updatedAt + } + + /** + * Test the property 'deletedAt' + */ + @Test + public void deletedAtTest() { + // TODO: test deletedAt + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleChangeTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleChangeTest.java new file mode 100644 index 0000000..43a626f --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleChangeTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TupleChange + */ +public class TupleChangeTest { + private final TupleChange model = new TupleChange(); + + /** + * Model tests for TupleChange + */ + @Test + public void testTupleChange() { + // TODO: test TupleChange + } + + /** + * Test the property 'tupleKey' + */ + @Test + public void tupleKeyTest() { + // TODO: test tupleKey + } + + /** + * Test the property 'operation' + */ + @Test + public void operationTest() { + // TODO: test operation + } + + /** + * Test the property 'timestamp' + */ + @Test + public void timestampTest() { + // TODO: test timestamp + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleKeyTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleKeyTest.java new file mode 100644 index 0000000..ef9e315 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleKeyTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TupleKey + */ +public class TupleKeyTest { + private final TupleKey model = new TupleKey(); + + /** + * Model tests for TupleKey + */ + @Test + public void testTupleKey() { + // TODO: test TupleKey + } + + /** + * Test the property '_object' + */ + @Test + public void _objectTest() { + // TODO: test _object + } + + /** + * Test the property 'relation' + */ + @Test + public void relationTest() { + // TODO: test relation + } + + /** + * Test the property 'user' + */ + @Test + public void userTest() { + // TODO: test user + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleKeysTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleKeysTest.java new file mode 100644 index 0000000..a57d57b --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleKeysTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TupleKeys + */ +public class TupleKeysTest { + private final TupleKeys model = new TupleKeys(); + + /** + * Model tests for TupleKeys + */ + @Test + public void testTupleKeys() { + // TODO: test TupleKeys + } + + /** + * Test the property 'tupleKeys' + */ + @Test + public void tupleKeysTest() { + // TODO: test tupleKeys + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleOperationTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleOperationTest.java new file mode 100644 index 0000000..4bc1458 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleOperationTest.java @@ -0,0 +1,28 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TupleOperation + */ +public class TupleOperationTest { + /** + * Model tests for TupleOperation + */ + @Test + public void testTupleOperation() { + // TODO: test TupleOperation + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleTest.java new file mode 100644 index 0000000..c56c98c --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tuple + */ +public class TupleTest { + private final Tuple model = new Tuple(); + + /** + * Model tests for Tuple + */ + @Test + public void testTuple() { + // TODO: test Tuple + } + + /** + * Test the property 'key' + */ + @Test + public void keyTest() { + // TODO: test key + } + + /** + * Test the property 'timestamp' + */ + @Test + public void timestampTest() { + // TODO: test timestamp + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TupleToUsersetTest.java b/src/test/java/dev/openfga/sdk/api/model/TupleToUsersetTest.java new file mode 100644 index 0000000..00d0944 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TupleToUsersetTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TupleToUserset + */ +public class TupleToUsersetTest { + private final TupleToUserset model = new TupleToUserset(); + + /** + * Model tests for TupleToUserset + */ + @Test + public void testTupleToUserset() { + // TODO: test TupleToUserset + } + + /** + * Test the property 'tupleset' + */ + @Test + public void tuplesetTest() { + // TODO: test tupleset + } + + /** + * Test the property 'computedUserset' + */ + @Test + public void computedUsersetTest() { + // TODO: test computedUserset + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/TypeDefinitionTest.java b/src/test/java/dev/openfga/sdk/api/model/TypeDefinitionTest.java new file mode 100644 index 0000000..f0b4f6b --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/TypeDefinitionTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for TypeDefinition + */ +public class TypeDefinitionTest { + private final TypeDefinition model = new TypeDefinition(); + + /** + * Model tests for TypeDefinition + */ + @Test + public void testTypeDefinition() { + // TODO: test TypeDefinition + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'relations' + */ + @Test + public void relationsTest() { + // TODO: test relations + } + + /** + * Test the property 'metadata' + */ + @Test + public void metadataTest() { + // TODO: test metadata + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersTest.java new file mode 100644 index 0000000..a3fb034 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Users + */ +public class UsersTest { + private final Users model = new Users(); + + /** + * Model tests for Users + */ + @Test + public void testUsers() { + // TODO: test Users + } + + /** + * Test the property 'users' + */ + @Test + public void usersTest() { + // TODO: test users + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersetTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersetTest.java new file mode 100644 index 0000000..819e997 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersetTest.java @@ -0,0 +1,78 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Userset + */ +public class UsersetTest { + private final Userset model = new Userset(); + + /** + * Model tests for Userset + */ + @Test + public void testUserset() { + // TODO: test Userset + } + + /** + * Test the property '_this' + */ + @Test + public void _thisTest() { + // TODO: test _this + } + + /** + * Test the property 'computedUserset' + */ + @Test + public void computedUsersetTest() { + // TODO: test computedUserset + } + + /** + * Test the property 'tupleToUserset' + */ + @Test + public void tupleToUsersetTest() { + // TODO: test tupleToUserset + } + + /** + * Test the property 'union' + */ + @Test + public void unionTest() { + // TODO: test union + } + + /** + * Test the property 'intersection' + */ + @Test + public void intersectionTest() { + // TODO: test intersection + } + + /** + * Test the property 'difference' + */ + @Test + public void differenceTest() { + // TODO: test difference + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersetTreeDifferenceTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeDifferenceTest.java new file mode 100644 index 0000000..43a13ac --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeDifferenceTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for UsersetTreeDifference + */ +public class UsersetTreeDifferenceTest { + private final UsersetTreeDifference model = new UsersetTreeDifference(); + + /** + * Model tests for UsersetTreeDifference + */ + @Test + public void testUsersetTreeDifference() { + // TODO: test UsersetTreeDifference + } + + /** + * Test the property 'base' + */ + @Test + public void baseTest() { + // TODO: test base + } + + /** + * Test the property 'subtract' + */ + @Test + public void subtractTest() { + // TODO: test subtract + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTest.java new file mode 100644 index 0000000..9aea5c0 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for UsersetTree + */ +public class UsersetTreeTest { + private final UsersetTree model = new UsersetTree(); + + /** + * Model tests for UsersetTree + */ + @Test + public void testUsersetTree() { + // TODO: test UsersetTree + } + + /** + * Test the property 'root' + */ + @Test + public void rootTest() { + // TODO: test root + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUsersetTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUsersetTest.java new file mode 100644 index 0000000..d730491 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersetTreeTupleToUsersetTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for UsersetTreeTupleToUserset + */ +public class UsersetTreeTupleToUsersetTest { + private final UsersetTreeTupleToUserset model = new UsersetTreeTupleToUserset(); + + /** + * Model tests for UsersetTreeTupleToUserset + */ + @Test + public void testUsersetTreeTupleToUserset() { + // TODO: test UsersetTreeTupleToUserset + } + + /** + * Test the property 'tupleset' + */ + @Test + public void tuplesetTest() { + // TODO: test tupleset + } + + /** + * Test the property 'computed' + */ + @Test + public void computedTest() { + // TODO: test computed + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/UsersetsTest.java b/src/test/java/dev/openfga/sdk/api/model/UsersetsTest.java new file mode 100644 index 0000000..b9fa799 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/UsersetsTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for Usersets + */ +public class UsersetsTest { + private final Usersets model = new Usersets(); + + /** + * Model tests for Usersets + */ + @Test + public void testUsersets() { + // TODO: test Usersets + } + + /** + * Test the property 'child' + */ + @Test + public void childTest() { + // TODO: test child + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponseTest.java new file mode 100644 index 0000000..43f6bd1 --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/ValidationErrorMessageResponseTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for ValidationErrorMessageResponse + */ +public class ValidationErrorMessageResponseTest { + private final ValidationErrorMessageResponse model = new ValidationErrorMessageResponse(); + + /** + * Model tests for ValidationErrorMessageResponse + */ + @Test + public void testValidationErrorMessageResponse() { + // TODO: test ValidationErrorMessageResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/WriteAssertionsRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/WriteAssertionsRequestTest.java new file mode 100644 index 0000000..feb1e5c --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/WriteAssertionsRequestTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for WriteAssertionsRequest + */ +public class WriteAssertionsRequestTest { + private final WriteAssertionsRequest model = new WriteAssertionsRequest(); + + /** + * Model tests for WriteAssertionsRequest + */ + @Test + public void testWriteAssertionsRequest() { + // TODO: test WriteAssertionsRequest + } + + /** + * Test the property 'assertions' + */ + @Test + public void assertionsTest() { + // TODO: test assertions + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequestTest.java new file mode 100644 index 0000000..de5bbcd --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelRequestTest.java @@ -0,0 +1,46 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for WriteAuthorizationModelRequest + */ +public class WriteAuthorizationModelRequestTest { + private final WriteAuthorizationModelRequest model = new WriteAuthorizationModelRequest(); + + /** + * Model tests for WriteAuthorizationModelRequest + */ + @Test + public void testWriteAuthorizationModelRequest() { + // TODO: test WriteAuthorizationModelRequest + } + + /** + * Test the property 'typeDefinitions' + */ + @Test + public void typeDefinitionsTest() { + // TODO: test typeDefinitions + } + + /** + * Test the property 'schemaVersion' + */ + @Test + public void schemaVersionTest() { + // TODO: test schemaVersion + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponseTest.java b/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponseTest.java new file mode 100644 index 0000000..815f06f --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/WriteAuthorizationModelResponseTest.java @@ -0,0 +1,38 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for WriteAuthorizationModelResponse + */ +public class WriteAuthorizationModelResponseTest { + private final WriteAuthorizationModelResponse model = new WriteAuthorizationModelResponse(); + + /** + * Model tests for WriteAuthorizationModelResponse + */ + @Test + public void testWriteAuthorizationModelResponse() { + // TODO: test WriteAuthorizationModelResponse + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } +} diff --git a/src/test/java/dev/openfga/sdk/api/model/WriteRequestTest.java b/src/test/java/dev/openfga/sdk/api/model/WriteRequestTest.java new file mode 100644 index 0000000..85966ca --- /dev/null +++ b/src/test/java/dev/openfga/sdk/api/model/WriteRequestTest.java @@ -0,0 +1,54 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.sdk.api.model; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for WriteRequest + */ +public class WriteRequestTest { + private final WriteRequest model = new WriteRequest(); + + /** + * Model tests for WriteRequest + */ + @Test + public void testWriteRequest() { + // TODO: test WriteRequest + } + + /** + * Test the property 'writes' + */ + @Test + public void writesTest() { + // TODO: test writes + } + + /** + * Test the property 'deletes' + */ + @Test + public void deletesTest() { + // TODO: test deletes + } + + /** + * Test the property 'authorizationModelId' + */ + @Test + public void authorizationModelIdTest() { + // TODO: test authorizationModelId + } +} diff --git a/src/test/java/dev/openfga/util/StringUtilTest.java b/src/test/java/dev/openfga/util/StringUtilTest.java new file mode 100644 index 0000000..0a92d00 --- /dev/null +++ b/src/test/java/dev/openfga/util/StringUtilTest.java @@ -0,0 +1,50 @@ +/* + * OpenFGA + * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. + * + * The version of the OpenAPI document: 0.1 + * Contact: community@openfga.dev + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package dev.openfga.util; + +import static dev.openfga.util.StringUtil.isNullOrWhitespace; +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class StringUtilTest { + @Test + public void isNullOrWhitespace_someContent_false() { + assertFalse(isNullOrWhitespace("abc")); + } + + @Test + public void isNullOrWhitespace_null_true() { + assertTrue(isNullOrWhitespace(null)); + } + + @Test + public void isNullOrWhitespace_empty_true() { + assertTrue(isNullOrWhitespace("")); + } + + @Test + public void isNullOrWhitespace_singleSpace_true() { + assertTrue(isNullOrWhitespace(" ")); + } + + @Test + public void isNullOrWhitespace_multipleSpace_true() { + assertTrue(isNullOrWhitespace(" ")); + } + + @Test + public void isNullOrWhitespace_multipleOtherWhitespace_true() { + assertTrue(isNullOrWhitespace(" \t\r\n")); + } +}