├── .editorconfig ├── .fossa.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ ├── config.yaml │ ├── feature_request.yaml │ └── sdk_request.yaml ├── dependabot.yml └── workflows │ ├── main.yaml │ └── semgrep.yaml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── config ├── clients │ ├── dotnet │ │ ├── .openapi-generator-ignore │ │ ├── CHANGELOG.md.mustache │ │ ├── config.overrides.json │ │ ├── generator.txt │ │ ├── template-source.json │ │ └── template │ │ │ ├── .editorconfig │ │ │ ├── .fossa.yml.mustache │ │ │ ├── .github │ │ │ └── dependabot.yaml │ │ │ ├── AbstractOpenAPISchema.mustache │ │ │ ├── ApiClient.mustache │ │ │ ├── ApiException.mustache │ │ │ ├── ApiResponse.mustache │ │ │ ├── AssemblyInfo.mustache │ │ │ ├── Client │ │ │ ├── Client.mustache │ │ │ ├── ClientConfiguration.mustache │ │ │ └── Model │ │ │ │ ├── AuthorizationModelIdOptions.mustache │ │ │ │ ├── ClientBatchCheckOptions.mustache │ │ │ │ ├── ClientBatchCheckResponse.mustache │ │ │ │ ├── ClientBatchCheckResponseTest.mustache │ │ │ │ ├── ClientCheckOptions.mustache │ │ │ │ ├── ClientCheckRequest.mustache │ │ │ │ ├── ClientConsistencyOptions.mustache │ │ │ │ ├── ClientCreateStoreOptions.mustache │ │ │ │ ├── ClientCreateStoreRequest.mustache │ │ │ │ ├── ClientExpandOptions.mustache │ │ │ │ ├── ClientExpandRequest.mustache │ │ │ │ ├── ClientListObjectsOptions.mustache │ │ │ │ ├── ClientListObjectsRequest.mustache │ │ │ │ ├── ClientListRelationsOptions.mustache │ │ │ │ ├── ClientListRelationsRequest.mustache │ │ │ │ ├── ClientListRelationsResponse.mustache │ │ │ │ ├── ClientListStoresOptions.mustache │ │ │ │ ├── ClientListStoresRequest.mustache │ │ │ │ ├── ClientListUsersOptions.mustache │ │ │ │ ├── ClientListUsersRequest.mustache │ │ │ │ ├── ClientPaginationOptions.mustache │ │ │ │ ├── ClientReadAssertionsOptions.mustache │ │ │ │ ├── ClientReadAuthorizaionModelOptions.mustache │ │ │ │ ├── ClientReadAuthorizaionModelsOptions.mustache │ │ │ │ ├── ClientReadChangesOptions.mustache │ │ │ │ ├── ClientReadChangesRequest.mustache │ │ │ │ ├── ClientReadOptions.mustache │ │ │ │ ├── ClientReadRequest.mustache │ │ │ │ ├── ClientRequestOptions.mustache │ │ │ │ ├── ClientRequestOptsWithAuthZModelId.mustache │ │ │ │ ├── ClientRequestOptsWithStoreId.mustache │ │ │ │ ├── ClientTupleKey.mustache │ │ │ │ ├── ClientTupleKeyWithoutCondition.mustache │ │ │ │ ├── ClientWriteAssertionsOptions.mustache │ │ │ │ ├── ClientWriteAssertionsRequest.mustache │ │ │ │ ├── ClientWriteAuthorizationModelRequest.mustache │ │ │ │ ├── ClientWriteOptions.mustache │ │ │ │ ├── ClientWriteRequest.mustache │ │ │ │ ├── ClientWriteResponse.mustache │ │ │ │ ├── ClientWriteStatus.mustache │ │ │ │ ├── RetryParams.mustache │ │ │ │ └── StoreIdOptions.mustache │ │ │ ├── ClientUtils.mustache │ │ │ ├── Client_ApiClient.mustache │ │ │ ├── Client_BaseClient.mustache │ │ │ ├── Client_OAuth2Client.mustache │ │ │ ├── Client_RequestBuilder.mustache │ │ │ ├── Client_Utils.mustache │ │ │ ├── Configuration.mustache │ │ │ ├── Configuration_Configuration.mustache │ │ │ ├── Configuration_Credentials.mustache │ │ │ ├── Configuration_TelemetryConfig.mustache │ │ │ ├── ExceptionFactory.mustache │ │ │ ├── Exceptions_ApiAuthenticationError.mustache │ │ │ ├── Exceptions_ApiError.mustache │ │ │ ├── Exceptions_ApiException.mustache │ │ │ ├── Exceptions_ApiInternalError.mustache │ │ │ ├── Exceptions_ApiNotFoundError.mustache │ │ │ ├── Exceptions_ApiValidationError.mustache │ │ │ ├── Exceptions_GenericError.mustache │ │ │ ├── Exceptions_Parsers_ApiErrorParser.mustache │ │ │ ├── Exceptions_Parsers_RateLimitParser.mustache │ │ │ ├── Exceptions_RateLimitExceededError.mustache │ │ │ ├── Exceptions_RequiredParamError.mustache │ │ │ ├── Exceptions_ValidationError.mustache │ │ │ ├── GlobalConfiguration.mustache │ │ │ ├── HttpSigningConfiguration.mustache │ │ │ ├── IApiAccessor.mustache │ │ │ ├── IAsynchronousClient.mustache │ │ │ ├── IReadableConfiguration.mustache │ │ │ ├── ISynchronousClient.mustache │ │ │ ├── JsonSubTypesTests.mustache │ │ │ ├── Multimap.mustache │ │ │ ├── NOTICE.txt │ │ │ ├── NOTICE_details.mustache │ │ │ ├── OpenAPIDateConverter.mustache │ │ │ ├── OpenFgaClientTests.mustache │ │ │ ├── OpenTelemetry.md.mustache │ │ │ ├── OpenTelemetryDocs_custom.mustache │ │ │ ├── README.mustache │ │ │ ├── README_api_endpoints.mustache │ │ │ ├── README_calling_api.mustache │ │ │ ├── README_custom_badges.mustache │ │ │ ├── README_initializing.mustache │ │ │ ├── README_installation.mustache │ │ │ ├── README_license_disclaimer.mustache │ │ │ ├── README_models.mustache │ │ │ ├── README_retries.mustache │ │ │ ├── ReadOnlyDictionary.mustache │ │ │ ├── RequestOptions.mustache │ │ │ ├── RetryConfiguration.mustache │ │ │ ├── Solution.mustache │ │ │ ├── Telemetry │ │ │ ├── Attributes.cs.mustache │ │ │ ├── Counters.cs.mustache │ │ │ ├── Histograms.cs.mustache │ │ │ ├── Meters.cs.mustache │ │ │ └── Metrics.cs.mustache │ │ │ ├── WebRequestPathBuilder.mustache │ │ │ ├── api.mustache │ │ │ ├── api_doc.mustache │ │ │ ├── api_test.mustache │ │ │ ├── example │ │ │ ├── Example1 │ │ │ │ ├── Example1.cs │ │ │ │ └── Example1.csproj │ │ │ ├── Makefile │ │ │ ├── OpenTelemetryExample │ │ │ │ ├── .env.example │ │ │ │ ├── OpenTelemetryExample.cs │ │ │ │ └── OpenTelemetryExample.csproj │ │ │ └── README.md │ │ │ ├── git_push.sh.mustache │ │ │ ├── gitignore_custom.mustache │ │ │ ├── model.mustache │ │ │ ├── modelAnyOf.mustache │ │ │ ├── modelEnum.mustache │ │ │ ├── modelGeneric.mustache │ │ │ ├── modelInnerEnum.mustache │ │ │ ├── modelJsonStringEnumMemberConverter.mustache │ │ │ ├── modelOneOf.mustache │ │ │ ├── model_doc.mustache │ │ │ ├── models_test.mustache │ │ │ ├── netcore_project.mustache │ │ │ ├── netcore_testproject.mustache │ │ │ ├── nuspec.mustache │ │ │ ├── partial_header.mustache │ │ │ ├── validatable.mustache │ │ │ └── visibility.mustache │ ├── go │ │ ├── .openapi-generator-ignore │ │ ├── CHANGELOG.md.mustache │ │ ├── config.overrides.json │ │ ├── generator.txt │ │ └── template │ │ │ ├── .github │ │ │ └── dependabot.yaml │ │ │ ├── .golangci.yaml │ │ │ ├── NOTICE.txt │ │ │ ├── NOTICE_details.mustache │ │ │ ├── README_api_endpoints.mustache │ │ │ ├── README_calling_api.mustache │ │ │ ├── README_custom_badges.mustache │ │ │ ├── README_initializing.mustache │ │ │ ├── README_installation.mustache │ │ │ ├── README_license_disclaimer.mustache │ │ │ ├── README_models.mustache │ │ │ ├── README_retries.mustache │ │ │ ├── api.mustache │ │ │ ├── api_client.mustache │ │ │ ├── api_client_test.mustache │ │ │ ├── api_doc.mustache │ │ │ ├── api_test.mustache │ │ │ ├── client │ │ │ ├── client.mustache │ │ │ ├── client_test.mustache │ │ │ └── errors.mustache │ │ │ ├── configuration.mustache │ │ │ ├── credentials.mustache │ │ │ ├── docs │ │ │ └── opentelemetry.md.mustache │ │ │ ├── errors.mustache │ │ │ ├── example │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── example1 │ │ │ │ ├── example1.go │ │ │ │ └── go.mod.mustache │ │ │ └── opentelemetry │ │ │ │ ├── go.mod.mustache │ │ │ │ └── main.go │ │ │ ├── git_push.sh.mustache │ │ │ ├── gitignore_custom.mustache │ │ │ ├── go.mod.mustache │ │ │ ├── go.sum.mustache │ │ │ ├── internal │ │ │ └── utils │ │ │ │ ├── retryutils │ │ │ │ ├── retryparams.mustache │ │ │ │ ├── retryparams_test.mustache │ │ │ │ ├── retryutils.mustache │ │ │ │ └── retryutils_test.mustache │ │ │ │ ├── ulid.mustache │ │ │ │ └── ulid_test.mustache │ │ │ ├── model.mustache │ │ │ ├── model_anyof.mustache │ │ │ ├── model_doc.mustache │ │ │ ├── model_enum.mustache │ │ │ ├── model_oneof.mustache │ │ │ ├── model_simple.mustache │ │ │ ├── nullable_model.mustache │ │ │ ├── oauth2 │ │ │ ├── LICENSE │ │ │ ├── ORIGINAL_AUTHORS │ │ │ ├── ORIGINAL_CONTRIBUTORS │ │ │ ├── README.md │ │ │ ├── clientcredentials │ │ │ │ ├── clientcredentials.mustache │ │ │ │ └── clientcredentials_test.mustache │ │ │ ├── example_test.mustache │ │ │ ├── internal │ │ │ │ ├── doc.go │ │ │ │ ├── token.go │ │ │ │ ├── token_test.go │ │ │ │ └── transport.go │ │ │ ├── oauth2.mustache │ │ │ ├── oauth2_test.mustache │ │ │ ├── token.mustache │ │ │ ├── token_test.go │ │ │ ├── transport.go │ │ │ └── transport_test.go │ │ │ ├── openapi.mustache │ │ │ ├── response.mustache │ │ │ ├── signing.mustache │ │ │ ├── telemetry │ │ │ ├── attribute.mustache │ │ │ ├── attribute_test.mustache │ │ │ ├── attributes.mustache │ │ │ ├── attributes_test.mustache │ │ │ ├── configuration.mustache │ │ │ ├── configuration_test.mustache │ │ │ ├── counter.mustache │ │ │ ├── counter_test.mustache │ │ │ ├── counters.mustache │ │ │ ├── counters_test.mustache │ │ │ ├── histogram.mustache │ │ │ ├── histogram_test.mustache │ │ │ ├── histograms.mustache │ │ │ ├── histograms_test.mustache │ │ │ ├── interfaces.mustache │ │ │ ├── interfaces_test.mustache │ │ │ ├── metric.mustache │ │ │ ├── metric_test.mustache │ │ │ ├── metrics.mustache │ │ │ ├── metrics_test.mustache │ │ │ ├── telemetry.mustache │ │ │ └── telemetry_test.mustache │ │ │ └── utils.mustache │ ├── java │ │ ├── .openapi-generator-ignore │ │ ├── CHANGELOG.md.mustache │ │ ├── config.overrides.json │ │ ├── generator.txt │ │ ├── template-source.json │ │ └── template │ │ │ ├── .github │ │ │ └── dependabot.yaml │ │ │ ├── CustomInstantDeserializer.mustache │ │ │ ├── ExampleTest.java.mustache │ │ │ ├── JavaTimeFormatter.mustache │ │ │ ├── README_api_endpoints.mustache │ │ │ ├── README_calling_api.mustache │ │ │ ├── README_custom_badges.mustache │ │ │ ├── README_initializing.mustache │ │ │ ├── README_installation.mustache │ │ │ ├── README_license_disclaimer.mustache │ │ │ ├── README_models.mustache │ │ │ ├── README_retries.mustache │ │ │ ├── additionalEnumTypeAnnotations.mustache │ │ │ ├── additionalModelTypeAnnotations.mustache │ │ │ ├── additionalOneOfTypeAnnotations.mustache │ │ │ ├── apiOperation.mustache │ │ │ ├── build.gradle.mustache │ │ │ ├── docs │ │ │ └── OpenTelemetry.md.mustache │ │ │ ├── enum_outer_doc.mustache │ │ │ ├── example │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ └── example1 │ │ │ │ ├── README.md │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── gradle.properties │ │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ │ └── gradle-wrapper.properties │ │ │ │ ├── gradlew │ │ │ │ ├── links │ │ │ │ ├── Example1.java │ │ │ │ └── example1-auth-model.json │ │ │ │ ├── settings.gradle │ │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── dev │ │ │ │ │ └── openfga │ │ │ │ │ └── sdk │ │ │ │ │ └── example │ │ │ │ │ └── Example1.java │ │ │ │ ├── kotlin │ │ │ │ └── dev │ │ │ │ │ └── openfga │ │ │ │ │ └── sdk │ │ │ │ │ └── example │ │ │ │ │ └── KotlinExample1.kt │ │ │ │ └── resources │ │ │ │ └── example1-auth-model.json │ │ │ ├── gitignore.mustache │ │ │ ├── gitignore_custom.mustache │ │ │ ├── gradle-wrapper.jar │ │ │ ├── gradle-wrapper.properties.mustache │ │ │ ├── gradlew.bat.mustache │ │ │ ├── gradlew.mustache │ │ │ ├── jackson_annotations.mustache │ │ │ ├── libraries │ │ │ └── native │ │ │ │ ├── AbstractOpenApiSchema.mustache │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── ApiResponse.mustache │ │ │ │ ├── additional_properties.mustache │ │ │ │ ├── anyof_model.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_doc.mustache │ │ │ │ ├── gradle.properties.mustache │ │ │ │ ├── model.mustache │ │ │ │ ├── modelEnum.mustache │ │ │ │ ├── model_anyof_doc.mustache │ │ │ │ ├── model_doc.mustache │ │ │ │ ├── model_oneof_doc.mustache │ │ │ │ ├── oneof_model.mustache │ │ │ │ ├── pojo.mustache │ │ │ │ └── travis.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── modelInnerEnum.mustache │ │ │ ├── model_test.mustache │ │ │ ├── oneof_interface.mustache │ │ │ ├── openapi.mustache │ │ │ ├── pojo_doc.mustache │ │ │ ├── publish.gradle.mustache │ │ │ ├── settings.gradle.mustache │ │ │ ├── src │ │ │ ├── main │ │ │ │ ├── api │ │ │ │ │ ├── auth │ │ │ │ │ │ ├── AccessToken.java.mustache │ │ │ │ │ │ ├── CredentialsFlowRequest.java.mustache │ │ │ │ │ │ ├── CredentialsFlowResponse.java.mustache │ │ │ │ │ │ └── OAuth2Client.java.mustache │ │ │ │ │ ├── client │ │ │ │ │ │ ├── ClientAssertion.java.mustache │ │ │ │ │ │ ├── HttpRequestAttempt.java.mustache │ │ │ │ │ │ ├── OpenFgaClient.java.mustache │ │ │ │ │ │ └── model │ │ │ │ │ │ │ ├── ClientBatchCheckClientResponse.java.mustache │ │ │ │ │ │ │ ├── ClientBatchCheckItem.java.mustache │ │ │ │ │ │ │ ├── ClientBatchCheckRequest.java.mustache │ │ │ │ │ │ │ ├── ClientBatchCheckResponse.java.mustache │ │ │ │ │ │ │ ├── ClientBatchCheckSingleResponse.java.mustache │ │ │ │ │ │ │ ├── ClientCheckRequest.java.mustache │ │ │ │ │ │ │ ├── ClientCheckResponse.java.mustache │ │ │ │ │ │ │ ├── ClientCreateStoreResponse.java.mustache │ │ │ │ │ │ │ ├── ClientDeleteStoreResponse.java.mustache │ │ │ │ │ │ │ ├── ClientExpandRequest.java.mustache │ │ │ │ │ │ │ ├── ClientExpandResponse.java.mustache │ │ │ │ │ │ │ ├── ClientGetStoreResponse.java.mustache │ │ │ │ │ │ │ ├── ClientListObjectsRequest.java.mustache │ │ │ │ │ │ │ ├── ClientListObjectsResponse.java.mustache │ │ │ │ │ │ │ ├── ClientListRelationsRequest.java.mustache │ │ │ │ │ │ │ ├── ClientListRelationsResponse.java.mustache │ │ │ │ │ │ │ ├── ClientListStoresResponse.java.mustache │ │ │ │ │ │ │ ├── ClientListUsersRequest.java.mustache │ │ │ │ │ │ │ ├── ClientListUsersResponse.java.mustache │ │ │ │ │ │ │ ├── ClientReadAssertionsResponse.java.mustache │ │ │ │ │ │ │ ├── ClientReadAuthorizationModelResponse.java.mustache │ │ │ │ │ │ │ ├── ClientReadAuthorizationModelsResponse.java.mustache │ │ │ │ │ │ │ ├── ClientReadChangesRequest.java.mustache │ │ │ │ │ │ │ ├── ClientReadChangesResponse.java.mustache │ │ │ │ │ │ │ ├── ClientReadRequest.java.mustache │ │ │ │ │ │ │ ├── ClientReadResponse.java.mustache │ │ │ │ │ │ │ ├── ClientRelationshipCondition.java.mustache │ │ │ │ │ │ │ ├── ClientTupleKey.java.mustache │ │ │ │ │ │ │ ├── ClientTupleKeyWithoutCondition.java.mustache │ │ │ │ │ │ │ ├── ClientWriteAssertionsResponse.java.mustache │ │ │ │ │ │ │ ├── ClientWriteAuthorizationModelResponse.java.mustache │ │ │ │ │ │ │ ├── ClientWriteRequest.java.mustache │ │ │ │ │ │ │ └── ClientWriteResponse.java.mustache │ │ │ │ │ └── configuration │ │ │ │ │ │ ├── AdditionalHeadersSupplier.java.mustache │ │ │ │ │ │ ├── ApiToken.java.mustache │ │ │ │ │ │ ├── BaseConfiguration.java.mustache │ │ │ │ │ │ ├── ClientBatchCheckClientOptions.java.mustache │ │ │ │ │ │ ├── ClientBatchCheckOptions.java.mustache │ │ │ │ │ │ ├── ClientCheckOptions.java.mustache │ │ │ │ │ │ ├── ClientConfiguration.java.mustache │ │ │ │ │ │ ├── ClientCreateStoreOptions.java.mustache │ │ │ │ │ │ ├── ClientCredentials.java.mustache │ │ │ │ │ │ ├── ClientDeleteStoreOptions.java.mustache │ │ │ │ │ │ ├── ClientDeleteTuplesOptions.java.mustache │ │ │ │ │ │ ├── ClientExpandOptions.java.mustache │ │ │ │ │ │ ├── ClientGetStoreOptions.java.mustache │ │ │ │ │ │ ├── ClientListObjectsOptions.java.mustache │ │ │ │ │ │ ├── ClientListRelationsOptions.java.mustache │ │ │ │ │ │ ├── ClientListStoresOptions.java.mustache │ │ │ │ │ │ ├── ClientListUsersOptions.java.mustache │ │ │ │ │ │ ├── ClientReadAssertionsOptions.java.mustache │ │ │ │ │ │ ├── ClientReadAuthorizationModelOptions.java.mustache │ │ │ │ │ │ ├── ClientReadAuthorizationModelsOptions.java.mustache │ │ │ │ │ │ ├── ClientReadChangesOptions.java.mustache │ │ │ │ │ │ ├── ClientReadLatestAuthorizationModelOptions.java.mustache │ │ │ │ │ │ ├── ClientReadOptions.java.mustache │ │ │ │ │ │ ├── ClientWriteAssertionsOptions.java.mustache │ │ │ │ │ │ ├── ClientWriteAuthorizationModelOptions.java.mustache │ │ │ │ │ │ ├── ClientWriteOptions.java.mustache │ │ │ │ │ │ ├── ClientWriteTuplesOptions.java.mustache │ │ │ │ │ │ ├── Configuration.java.mustache │ │ │ │ │ │ ├── ConfigurationOverride.java.mustache │ │ │ │ │ │ ├── Credentials.java.mustache │ │ │ │ │ │ ├── CredentialsMethod.java.mustache │ │ │ │ │ │ └── TelemetryConfiguration.java.mustache │ │ │ │ ├── errors │ │ │ │ │ ├── ApiException.java.mustache │ │ │ │ │ ├── FgaApiAuthenticationError.java.mustache │ │ │ │ │ ├── FgaApiInternalError.java.mustache │ │ │ │ │ ├── FgaApiNotFoundError.java.mustache │ │ │ │ │ ├── FgaApiRateLimitExceededError.java.mustache │ │ │ │ │ ├── FgaApiValidationError.java.mustache │ │ │ │ │ ├── FgaError.java.mustache │ │ │ │ │ ├── FgaInvalidParameterException.java.mustache │ │ │ │ │ ├── FgaValidationError.java.mustache │ │ │ │ │ └── HttpStatusCode.java.mustache │ │ │ │ ├── telemetry │ │ │ │ │ ├── Attribute.java.mustache │ │ │ │ │ ├── Attributes.java.mustache │ │ │ │ │ ├── Counter.java.mustache │ │ │ │ │ ├── Counters.java.mustache │ │ │ │ │ ├── Histogram.java.mustache │ │ │ │ │ ├── Histograms.java.mustache │ │ │ │ │ ├── Metric.java.mustache │ │ │ │ │ ├── Metrics.java.mustache │ │ │ │ │ └── Telemetry.java.mustache │ │ │ │ └── util │ │ │ │ │ ├── Pair.mustache │ │ │ │ │ ├── StringUtil.java.mustache │ │ │ │ │ └── Validation.java.mustache │ │ │ ├── test-integration │ │ │ │ ├── api │ │ │ │ │ ├── OpenFgaApiIntegrationTest.java.mustache │ │ │ │ │ └── client │ │ │ │ │ │ └── OpenFgaClientIntegrationTest.java.mustache │ │ │ │ ├── package-info.java.mustache │ │ │ │ └── resources │ │ │ │ │ └── auth-model.json │ │ │ └── test │ │ │ │ ├── api │ │ │ │ ├── OpenFgaApiTest.java.mustache │ │ │ │ ├── auth │ │ │ │ │ ├── AccessTokenTest.java.mustache │ │ │ │ │ └── OAuth2ClientTest.java.mustache │ │ │ │ ├── client │ │ │ │ │ ├── ApiClientTest.java.mustache │ │ │ │ │ └── OpenFgaClientTest.java.mustache │ │ │ │ └── configuration │ │ │ │ │ ├── ClientCredentialsTest.java.mustache │ │ │ │ │ ├── ConfigurationTest.java.mustache │ │ │ │ │ └── TelemetryConfigurationTest.java.mustache │ │ │ │ ├── telemetry │ │ │ │ ├── AttributeTest.java.mustache │ │ │ │ ├── AttributesTest.java.mustache │ │ │ │ ├── CounterTest.java.mustache │ │ │ │ ├── CountersTest.java.mustache │ │ │ │ ├── HistogramTest.java.mustache │ │ │ │ ├── HistogramsTest.java.mustache │ │ │ │ ├── MetricTest.java.mustache │ │ │ │ ├── MetricsTest.java.mustache │ │ │ │ └── TelemetryTest.java.mustache │ │ │ │ └── util │ │ │ │ ├── PairTest.java.mustache │ │ │ │ ├── StringUtilTest.java.mustache │ │ │ │ └── ValidationTest.java.mustache │ │ │ └── typeInfoAnnotation.mustache │ ├── js │ │ ├── .openapi-generator-ignore │ │ ├── CHANGELOG.md.mustache │ │ ├── config.overrides.json │ │ ├── generator.txt │ │ └── template │ │ │ ├── .eslintignore │ │ │ ├── .eslintrc.js │ │ │ ├── .github │ │ │ └── dependabot.yaml │ │ │ ├── .madgerc │ │ │ ├── NOTICE.txt │ │ │ ├── NOTICE_details.mustache │ │ │ ├── README_api_endpoints.mustache │ │ │ ├── README_calling_api.mustache │ │ │ ├── README_custom_badges.mustache │ │ │ ├── README_initializing.mustache │ │ │ ├── README_installation.mustache │ │ │ ├── README_license_disclaimer.mustache │ │ │ ├── README_models.mustache │ │ │ ├── README_retries.mustache │ │ │ ├── api.mustache │ │ │ ├── apiInner.mustache │ │ │ ├── apiModel.mustache │ │ │ ├── baseApi.mustache │ │ │ ├── client.mustache │ │ │ ├── common.mustache │ │ │ ├── configuration.mustache │ │ │ ├── credentials │ │ │ ├── credentials.ts.mustache │ │ │ ├── index.ts.mustache │ │ │ └── types.ts.mustache │ │ │ ├── docs │ │ │ └── opentelemetry.md.mustache │ │ │ ├── errors.mustache │ │ │ ├── example │ │ │ ├── Makefile │ │ │ ├── README.md.mustache │ │ │ ├── example1 │ │ │ │ ├── example1.mjs │ │ │ │ └── package.json.mustache │ │ │ └── opentelemetry │ │ │ │ ├── .env.example │ │ │ │ ├── .npmrc │ │ │ │ ├── README.md │ │ │ │ ├── instrumentation.mjs │ │ │ │ ├── opentelemetry.mjs │ │ │ │ └── package.json.mustache │ │ │ ├── git_push.sh.mustache │ │ │ ├── gitignore_custom.mustache │ │ │ ├── index.mustache │ │ │ ├── model.mustache │ │ │ ├── modelAllOf.mustache │ │ │ ├── modelEnum.mustache │ │ │ ├── modelGeneric.mustache │ │ │ ├── modelIndex.mustache │ │ │ ├── modelOneOf.mustache │ │ │ ├── npmignore │ │ │ ├── npmrc.mustache │ │ │ ├── package.mustache │ │ │ ├── telemetry │ │ │ ├── attributes.ts.mustache │ │ │ ├── configuration.ts.mustache │ │ │ ├── counters.ts.mustache │ │ │ ├── histograms.ts.mustache │ │ │ └── metrics.ts.mustache │ │ │ ├── tests │ │ │ ├── client.test.ts.mustache │ │ │ ├── helpers │ │ │ │ ├── default-config.ts.mustache │ │ │ │ ├── index.ts.mustache │ │ │ │ └── nocks.ts.mustache │ │ │ ├── index.test.ts.mustache │ │ │ ├── jest.config.js │ │ │ ├── telemetry │ │ │ │ ├── attributes.test.ts.mustache │ │ │ │ ├── configuration.test.ts.mustache │ │ │ │ ├── counters.test.ts.mustache │ │ │ │ ├── histograms.test.ts.mustache │ │ │ │ └── metrics.test.ts.mustache │ │ │ ├── tsconfig.spec.json │ │ │ └── validation.test.ts.mustache │ │ │ ├── tsconfig.json │ │ │ ├── tsconfig.mustache │ │ │ ├── utils │ │ │ ├── assert-never.ts.mustache │ │ │ ├── chunk-array.ts.mustache │ │ │ ├── generate-random-id.ts.mustache │ │ │ ├── index.ts.mustache │ │ │ ├── set-header-if-not-set.ts.mustache │ │ │ └── set-not-enumerable-property.ts.mustache │ │ │ └── validation.mustache │ └── python │ │ ├── .openapi-generator-ignore │ │ ├── CHANGELOG.md.mustache │ │ ├── config.overrides.json │ │ ├── generator.txt │ │ ├── patches │ │ ├── OpenFgaApi.md.patch │ │ ├── open_fga_api.py.patch │ │ └── open_fga_api_sync.py.patch │ │ ├── template-source.json │ │ └── template │ │ ├── .github │ │ ├── ISSUE_TEMPLATE │ │ │ └── bug_report.md.mustache │ │ └── dependabot.yaml │ │ ├── .snyk │ │ ├── NOTICE_details.mustache │ │ ├── README_api_endpoints.mustache │ │ ├── README_calling_api.mustache │ │ ├── README_common.mustache │ │ ├── README_custom_badges.mustache │ │ ├── README_initializing.mustache │ │ ├── README_installation.mustache │ │ ├── README_license_disclaimer.mustache │ │ ├── README_models.mustache │ │ ├── README_retries.mustache │ │ ├── api.mustache │ │ ├── api_doc.mustache │ │ ├── api_doc_example.mustache │ │ ├── api_sync.mustache │ │ ├── api_test.mustache │ │ ├── docs │ │ └── opentelemetry.md.mustache │ │ ├── example │ │ ├── Makefile │ │ ├── README.md │ │ ├── example1 │ │ │ ├── example1.py.mustache │ │ │ ├── requirements.txt.mustache │ │ │ ├── setup.cfg │ │ │ └── setup.py.mustache │ │ ├── opentelemetry │ │ │ ├── .env.example │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── main.py.mustache │ │ │ ├── requirements.txt │ │ │ ├── setup.cfg │ │ │ └── setup.py.mustache │ │ └── streamed-list-objects │ │ │ ├── README.md │ │ │ ├── example.py.mustache │ │ │ └── model.json │ │ ├── gitignore_custom.mustache │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── partial_header.mustache │ │ ├── pyproject.toml │ │ ├── python_doc_auth_partial.mustache │ │ ├── requirements.mustache │ │ ├── setup.mustache │ │ ├── src │ │ ├── __init__.py.mustache │ │ ├── api.py.mustache │ │ ├── api │ │ │ └── __init__.py.mustache │ │ ├── api_client.py.mustache │ │ ├── client │ │ │ ├── __init__.py.mustache │ │ │ ├── client.py.mustache │ │ │ ├── configuration.py.mustache │ │ │ └── models │ │ │ │ ├── __init__.py.mustache │ │ │ │ ├── assertion.py.mustache │ │ │ │ ├── batch_check_item.py.mustache │ │ │ │ ├── batch_check_request.py.mustache │ │ │ │ ├── batch_check_response.py.mustache │ │ │ │ ├── batch_check_single_response.py.mustache │ │ │ │ ├── check_request.py.mustache │ │ │ │ ├── client_batch_check_response.py.mustache │ │ │ │ ├── expand_request.py.mustache │ │ │ │ ├── list_objects_request.py.mustache │ │ │ │ ├── list_relations_request.py.mustache │ │ │ │ ├── list_users_request.py.mustache │ │ │ │ ├── read_changes_request.py.mustache │ │ │ │ ├── tuple.py.mustache │ │ │ │ ├── write_request.py.mustache │ │ │ │ ├── write_response.py.mustache │ │ │ │ ├── write_single_response.py.mustache │ │ │ │ └── write_transaction_opts.py.mustache │ │ ├── configuration.py.mustache │ │ ├── credentials.py.mustache │ │ ├── exceptions.py.mustache │ │ ├── help.py.mustache │ │ ├── models │ │ │ └── __init__.py.mustache │ │ ├── oauth2.py.mustache │ │ ├── rest.py.mustache │ │ ├── sync │ │ │ ├── __init__.py.mustache │ │ │ ├── api.py.mustache │ │ │ ├── api_client.py.mustache │ │ │ ├── client │ │ │ │ ├── __init__.py.mustache │ │ │ │ └── client.py.mustache │ │ │ ├── oauth2.py.mustache │ │ │ └── rest.py.mustache │ │ ├── telemetry │ │ │ ├── __init__.py.mustache │ │ │ ├── attributes.py.mustache │ │ │ ├── configuration.py.mustache │ │ │ ├── counters.py.mustache │ │ │ ├── histograms.py.mustache │ │ │ ├── metrics.py.mustache │ │ │ └── telemetry.py.mustache │ │ └── validation.py.mustache │ │ ├── test-requirements.mustache │ │ └── test │ │ ├── __init__.py.mustache │ │ ├── api │ │ └── __init__.py.mustache │ │ ├── api_test.py.mustache │ │ ├── client │ │ ├── __init__.py.mustache │ │ └── client_test.py.mustache │ │ ├── configuration_test.py.mustache │ │ ├── credentials_test.py.mustache │ │ ├── oauth2_test.py.mustache │ │ ├── rest_test.py.mustache │ │ ├── sync │ │ ├── __init__.py.mustache │ │ ├── api_test.py.mustache │ │ ├── client │ │ │ ├── __init__.py.mustache │ │ │ └── client_test.py.mustache │ │ ├── oauth2_test.py.mustache │ │ └── rest_test.py.mustache │ │ ├── telemetry │ │ ├── attributes_test.py.mustache │ │ ├── configuration_test.py.mustache │ │ ├── counters_test.py.mustache │ │ ├── histograms_test.py.mustache │ │ ├── metrics_test.py.mustache │ │ └── telemetry_test.py.mustache │ │ └── validation_test.py.mustache └── common │ ├── config.base.json │ └── files │ ├── .codecov.yml.mustache │ ├── .fossa.yml.mustache │ ├── .github │ ├── CODEOWNERS.mustache │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.yaml.mustache │ │ ├── config.yaml │ │ └── feature_request.yaml.mustache │ └── dependabot.yaml │ ├── CONTRIBUTING.md.mustache │ ├── LICENSE.mustache │ ├── NOTICE.mustache │ ├── NOTICE_details.mustache │ ├── README.mustache │ ├── README_custom_badges.mustache │ ├── README_project_introduction.mustache │ ├── README_retries.mustache │ ├── VERSION.mustache │ ├── assets │ └── FGAIcon.png │ ├── gitignore.mustache │ └── partial_header.mustache ├── docker └── nuget.Dockerfile ├── docs └── GENERATING-A-NEW-SDK.md └── scripts ├── build_client.sh └── setup_new_sdk.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | # insert_final_newline = false 6 | charset = utf-8 7 | 8 | [Makefile] 9 | indent_style = tab 10 | 11 | [*.go] 12 | indent_style = space 13 | indent_size = 4 14 | 15 | [*.{js,ts,mjs}] 16 | indent_style = space 17 | indent_size = 2 18 | 19 | [*.cs] 20 | indent_style = space 21 | indent_size = 4 22 | -------------------------------------------------------------------------------- /.fossa.yml: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | server: https://app.fossa.com 4 | 5 | project: 6 | id: github.com/openfga/sdk-generator 7 | name: github.com/openfga/sdk-generator 8 | link: openfga.dev 9 | url: github.com/openfga/sdk-generator 10 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @openfga/dx 2 | README.md @openfga/product @openfga/community @openfga/dx 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yaml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 📖 OpenFGA's Documentation 4 | url: https://openfga.dev/docs 5 | about: Check OpenFGA's documentation for an in-depth overview 6 | - name: 👽 Discord 7 | url: https://discord.gg/8naAwJfWN6 8 | about: Join OpenFGA's active Discord community 9 | - name: 📝 RFCs 10 | url: https://github.com/openfga/rfcs 11 | about: Check existing RFCs to understand where the project is headed 12 | - name: 💬 Discussions 13 | url: https://github.com/orgs/openfga/discussions 14 | about: Start a discussion about your authorization needs or questions 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | -------------------------------------------------------------------------------- /.github/workflows/semgrep.yaml: -------------------------------------------------------------------------------- 1 | name: Semgrep 2 | on: 3 | push: 4 | branches: 5 | - main 6 | jobs: 7 | semgrep: 8 | name: Scan 9 | runs-on: ubuntu-latest 10 | container: 11 | image: returntocorp/semgrep 12 | if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') 13 | steps: 14 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 15 | with: 16 | fetch-depth: 0 17 | - run: semgrep ci --no-suppress-errors 18 | env: 19 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .idea 3 | .env 4 | docs/openapi/*.json 5 | docs/openapi/*.json-e 6 | 7 | .DS_Store 8 | .dccache 9 | 10 | clients/**/* 11 | 12 | # JetBrains IDEs 13 | .idea/ 14 | *.iml 15 | 16 | config/clients/dotnet/template/example/Example1/obj 17 | config/clients/dotnet/template/example/Example1/bin/ -------------------------------------------------------------------------------- /config/clients/dotnet/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | appveyor.yml 2 | git_push.sh 3 | src/OpenFga.Sdk.Test/Model/* 4 | src/OpenFga.Sdk/Client/ApiException.cs 5 | src/OpenFga.Sdk/Client/ApiResponse.cs 6 | src/OpenFga.Sdk/Client/ClientUtils.cs 7 | src/OpenFga.Sdk/Client/Configuration.cs 8 | src/OpenFga.Sdk/Client/ExceptionFactory.cs 9 | src/OpenFga.Sdk/Client/FileParameter.cs 10 | src/OpenFga.Sdk/Client/GlobalConfiguration.cs 11 | src/OpenFga.Sdk/Client/IApiAccessor.cs 12 | src/OpenFga.Sdk/Client/IAsynchronousClient.cs 13 | src/OpenFga.Sdk/Client/IReadableConfiguration.cs 14 | src/OpenFga.Sdk/Client/ISynchronousClient.cs 15 | src/OpenFga.Sdk/Client/Multimap.cs 16 | src/OpenFga.Sdk/Client/OpenAPIDateConverter.cs 17 | src/OpenFga.Sdk/Client/RequestOptions.cs 18 | src/OpenFga.Sdk/Client/RetryConfiguration.cs 19 | src/OpenFga.Sdk/Client/WebRequestPathBuilder.cs 20 | -------------------------------------------------------------------------------- /config/clients/dotnet/generator.txt: -------------------------------------------------------------------------------- 1 | csharp-netcore 2 | -------------------------------------------------------------------------------- /config/clients/dotnet/template-source.json: -------------------------------------------------------------------------------- 1 | {"repo":"https://github.com/OpenAPITools/openapi-generator","branch":"master","commit":"3e8dc31ec5a2590ab348e801f2d386c7f398fcb2","url":"https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/csharp-netcore","docs":"https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/csharp-netcore.md"} 2 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/.fossa.yml.mustache: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | server: https://app.fossa.com 4 | 5 | project: 6 | id: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 7 | name: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 8 | link: fga.dev 9 | url: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 10 | 11 | paths: 12 | only: 13 | - ./src/{{packageName}} 14 | exclude: 15 | - ./src/{{packageName}}.Test 16 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "nuget" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "monthly" 15 | groups: 16 | dependencies: 17 | patterns: 18 | - "*" 19 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/AbstractOpenAPISchema.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/AbstractOpenAPISchema.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/ApiClient.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ApiClient.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/ApiException.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ApiException.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/ApiResponse.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ApiResponse.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/AuthorizationModelIdOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | public interface AuthorizationModelIdOptions { 6 | /// 7 | /// Overrides the AuthorizationModelId in the ClientConfiguration 8 | /// 9 | string? AuthorizationModelId { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientBatchCheckOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientBatchCheckOptions: IClientCheckOptions { 8 | /// 9 | /// Max Requests to issue in parallel 10 | /// 11 | public int? MaxParallelRequests { get; set; } 12 | } 13 | 14 | public class ClientBatchCheckOptions : IClientBatchCheckOptions { 15 | /// 16 | public string? StoreId { get; set; } 17 | 18 | /// 19 | public string? AuthorizationModelId { get; set; } 20 | 21 | /// 22 | /// Max Requests to issue in parallel 23 | /// 24 | public int? MaxParallelRequests { get; set; } 25 | 26 | /// 27 | public ConsistencyPreference? Consistency { get; set; } 28 | } 29 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientCheckOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientCheckOptions : IClientRequestOptionsWithAuthZModelIdAndConsistency { 8 | } 9 | 10 | public class ClientCheckOptions : IClientCheckOptions { 11 | /// 12 | public string? StoreId { get; set; } 13 | 14 | /// 15 | public string? AuthorizationModelId { get; set; } 16 | 17 | /// 18 | public ConsistencyPreference? Consistency { get; set; } 19 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientConsistencyOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientConsistencyOptions { 8 | /// 9 | /// ConsistencyPreference - Can be used to indicate preference for lower latency or higher consistency 10 | /// 11 | public ConsistencyPreference? Consistency { get; set; } 12 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientCreateStoreOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | public interface IClientCreateStoreOptions : ClientRequestOptions {} 6 | 7 | public class ClientCreateStoreOptions: IClientCreateStoreOptions {} 8 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientCreateStoreRequest.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | /// 8 | public class ClientCreateStoreRequest : CreateStoreRequest { 9 | } 10 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientExpandOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientExpandOptions : IClientRequestOptionsWithAuthZModelIdAndConsistency { 8 | } 9 | 10 | public class ClientExpandOptions : IClientExpandOptions { 11 | /// 12 | public string? StoreId { get; set; } 13 | 14 | /// 15 | public string? AuthorizationModelId { get; set; } 16 | 17 | /// 18 | public ConsistencyPreference? Consistency { get; set; } 19 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientListObjectsOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientListObjectsOptions : IClientRequestOptionsWithAuthZModelIdAndConsistency { 8 | } 9 | 10 | public class ClientListObjectsOptions : IClientListObjectsOptions { 11 | /// 12 | public string? StoreId { get; set; } 13 | 14 | /// 15 | public string? AuthorizationModelId { get; set; } 16 | 17 | /// 18 | public ConsistencyPreference? Consistency { get; set; } 19 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientListRelationsOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public class ClientListRelationsOptions : IClientBatchCheckOptions { 8 | /// 9 | public string? StoreId { get; set; } 10 | 11 | /// 12 | public string? AuthorizationModelId { get; set; } 13 | 14 | /// 15 | /// Max Requests to issue in parallel 16 | /// 17 | public int? MaxParallelRequests { get; set; } 18 | 19 | /// 20 | public ConsistencyPreference? Consistency { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientListStoresOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientListStoresOptions - Client Options for ListStores 7 | /// 8 | public interface IClientListStoresOptions : ClientRequestOptions, AuthorizationModelIdOptions, ClientPaginationOptions { 9 | } 10 | 11 | /// 12 | public class ClientListStoresOptions : IClientListStoresOptions { 13 | 14 | /// 15 | public string? AuthorizationModelId { get; set; } 16 | 17 | /// 18 | public int? PageSize { get; set; } 19 | 20 | /// 21 | public string? ContinuationToken { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientListUsersOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public interface IClientListUsersOptions : IClientRequestOptionsWithAuthZModelIdAndConsistency { 8 | } 9 | 10 | public class ClientListUsersOptions : IClientListUsersOptions { 11 | /// 12 | public string? StoreId { get; set; } 13 | 14 | /// 15 | public string? AuthorizationModelId { get; set; } 16 | 17 | /// 18 | public ConsistencyPreference? Consistency { get; set; } 19 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientPaginationOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientPaginationOptions - Pagination specific options 7 | /// 8 | public interface ClientPaginationOptions { 9 | /// 10 | /// PageSize - The number of results to return in each page 11 | /// 12 | int? PageSize { get; set; } 13 | 14 | /// 15 | /// ContinuationToken - The continuation token from the last response 16 | /// 17 | string? ContinuationToken { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadAssertionsOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientReadAssertionsOptions - Client Options for ReadAssertions 7 | /// 8 | public interface IClientReadAssertionsOptions : IClientRequestOptionsWithStoreId, AuthorizationModelIdOptions { 9 | } 10 | 11 | /// 12 | public class ClientReadAssertionsOptions : IClientReadAssertionsOptions { 13 | /// 14 | public string? StoreId { get; set; } 15 | 16 | /// 17 | public string? AuthorizationModelId { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadAuthorizaionModelOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientReadAuthorizationModelOptions - Client Options for ReadAuthorizationModel 7 | /// 8 | public interface IClientReadAuthorizationModelOptions : IClientRequestOptionsWithStoreId, AuthorizationModelIdOptions { 9 | } 10 | 11 | /// 12 | public class ClientReadAuthorizationModelOptions : IClientReadAuthorizationModelOptions { 13 | /// 14 | public string? StoreId { get; set; } 15 | 16 | /// 17 | public string? AuthorizationModelId { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadAuthorizaionModelsOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientReadAuthorizationModelsOptions - Client Options for ReadAuthorizationModels 7 | /// 8 | public interface IClientReadAuthorizationModelsOptions : IClientRequestOptionsWithStoreId, ClientPaginationOptions { 9 | } 10 | 11 | /// 12 | public class ClientReadAuthorizationModelsOptions : IClientReadAuthorizationModelsOptions { 13 | /// 14 | public string? StoreId { get; set; } 15 | 16 | /// 17 | public int? PageSize { get; set; } 18 | 19 | /// 20 | public string? ContinuationToken { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadChangesOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientReadChangesOptions - Client Options for ReadChanges 7 | /// 8 | public interface IClientReadChangesOptions : IClientRequestOptionsWithStoreId, ClientPaginationOptions { 9 | } 10 | 11 | /// 12 | public class ClientReadChangesOptions : IClientReadChangesOptions { 13 | /// 14 | public string? StoreId { get; set; } 15 | 16 | /// 17 | public int? PageSize { get; set; } 18 | 19 | /// 20 | public string? ContinuationToken { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using OpenFga.Sdk.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | /// 8 | /// ClientReadOptions - Client Options for Read 9 | /// 10 | public interface IClientReadOptions : IClientRequestOptionsWithStoreId, ClientPaginationOptions, IClientConsistencyOptions { 11 | } 12 | 13 | /// 14 | public class ClientReadOptions : IClientReadOptions { 15 | /// 16 | public string? StoreId { get; set; } 17 | 18 | /// 19 | public int? PageSize { get; set; } 20 | 21 | /// 22 | public string? ContinuationToken { get; set; } 23 | 24 | /// 25 | public ConsistencyPreference? Consistency { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientReadRequest.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | public class ClientReadRequest : ReadRequestTupleKey { 8 | } 9 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientRequestOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// Base Client Request Options 7 | /// 8 | public interface ClientRequestOptions { 9 | } 10 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientRequestOptsWithAuthZModelId.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | public interface IClientRequestOptionsWithAuthZModelId : IClientRequestOptionsWithStoreId, AuthorizationModelIdOptions { 7 | } 8 | 9 | public interface IClientRequestOptionsWithAuthZModelIdAndConsistency : IClientRequestOptionsWithAuthZModelId, IClientConsistencyOptions { 10 | } -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientRequestOptsWithStoreId.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | public interface IClientRequestOptionsWithStoreId : ClientRequestOptions, StoreIdOptions { 7 | } 8 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientWriteAssertionsOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// ClientReadAssertionsOptions - Client Options for ReadAssertions 7 | /// 8 | public interface IClientWriteAssertionsOptions : IClientRequestOptionsWithStoreId, AuthorizationModelIdOptions { 9 | } 10 | 11 | /// 12 | public class ClientWriteAssertionsOptions : IClientWriteAssertionsOptions { 13 | 14 | /// 15 | public string? StoreId { get; set; } 16 | 17 | /// 18 | public string? AuthorizationModelId { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientWriteAuthorizationModelRequest.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Model; 4 | 5 | namespace {{packageName}}.Client.Model; 6 | 7 | /// 8 | public class ClientWriteAuthorizationModelRequest : WriteAuthorizationModelRequest { 9 | } 10 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/ClientWriteStatus.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System.Runtime.Serialization; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace {{packageName}}.Client.Model; 7 | 8 | /// 9 | /// ClientWriteStatus 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | public enum ClientWriteStatus { 13 | /// 14 | /// Enum SUCCESS for value: CLIENT_WRITE_STATUS_SUCCESS 15 | /// 16 | [EnumMember(Value = "CLIENT_WRITE_STATUS_SUCCESS")] 17 | SUCCESS = 1, 18 | 19 | /// 20 | /// Enum FAILURE for value: CLIENT_WRITE_STATUS_FAILURE 21 | /// 22 | [EnumMember(Value = "CLIENT_WRITE_STATUS_FAILURE")] 23 | FAILURE = 2 24 | } 25 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/RetryParams.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | /// 6 | /// Client Retry Params 7 | /// 8 | public interface IRetryParams { 9 | /// 10 | /// Max number of times to retry after a request is rate limited 11 | /// 12 | /// MaxRetry 13 | public int MaxRetry { get; set; } 14 | 15 | /// 16 | /// Minimum time in ms to wait before retrying 17 | /// 18 | /// MinWaitInMs 19 | public int MinWaitInMs { get; set; } 20 | } 21 | 22 | /// 23 | public class RetryParams : IRetryParams { 24 | /// 25 | public int MaxRetry { get; set; } 26 | 27 | /// 28 | public int MinWaitInMs { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Client/Model/StoreIdOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Client.Model; 4 | 5 | public interface StoreIdOptions { 6 | /// 7 | /// Overrides the StoreId in the ClientConfiguration 8 | /// 9 | string? StoreId { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/ClientUtils.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ClientUtils.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/Configuration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/Configuration.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/ExceptionFactory.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ExceptionFactory.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_ApiInternalError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Exceptions.Parsers; 4 | namespace {{packageName}}.Exceptions; 5 | 6 | public class FgaApiInternalError : FgaApiError { 7 | public FgaApiInternalError(HttpResponseMessage response, HttpRequestMessage request, string? apiName, 8 | ApiErrorParser? apiError = null) : base(response, request, apiName, apiError, true) { 9 | } 10 | 11 | internal new static async Task CreateAsync(HttpResponseMessage response, HttpRequestMessage request, string? apiName) { 12 | return new FgaApiInternalError(response, request, apiName, 13 | await ApiErrorParser.Parse(response).ConfigureAwait(false)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_ApiNotFoundError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Exceptions.Parsers; 4 | 5 | namespace {{packageName}}.Exceptions; 6 | 7 | /// 8 | /// FGA API Not Found Error - Corresponding to HTTP Error Codes 400 and 422 9 | /// 10 | public class FgaApiNotFoundError : FgaApiError { 11 | /// 12 | public FgaApiNotFoundError(HttpResponseMessage response, HttpRequestMessage request, string? apiName, 13 | ApiErrorParser? apiError = null) : base(response, request, apiName, apiError) { 14 | } 15 | 16 | internal new static async Task CreateAsync(HttpResponseMessage response, HttpRequestMessage request, string? apiName) { 17 | return new FgaApiNotFoundError(response, request, apiName, 18 | await ApiErrorParser.Parse(response).ConfigureAwait(false)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_ApiValidationError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using {{packageName}}.Exceptions.Parsers; 4 | 5 | namespace {{packageName}}.Exceptions; 6 | 7 | /// 8 | /// FGA API Validation Error - Corresponding to HTTP Error Codes 400 and 422 9 | /// 10 | public class FgaApiValidationError : FgaApiError { 11 | /// 12 | public FgaApiValidationError(HttpResponseMessage response, HttpRequestMessage request, string? apiName, 13 | ApiErrorParser? apiError = null) : base(response, request, apiName, apiError) { 14 | } 15 | 16 | internal new static async Task CreateAsync(HttpResponseMessage response, HttpRequestMessage request, string? apiName) { 17 | return new FgaApiValidationError(response, request, apiName, 18 | await ApiErrorParser.Parse(response).ConfigureAwait(false)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_GenericError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System; 4 | 5 | namespace {{packageName}}.Exceptions; 6 | 7 | /// 8 | /// Base FGA Exception 9 | /// 10 | public class FgaError : Exception { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public FgaError() : base() { 15 | } 16 | 17 | /// 18 | public FgaError(string message) : base(message) { 19 | } 20 | 21 | /// 22 | public FgaError(string message, Exception innerException) : base(message, innerException) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_RequiredParamError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | namespace {{packageName}}.Exceptions; 4 | 5 | /// 6 | /// An error indicating that a parameter was required but not provided 7 | /// 8 | public class FgaRequiredParamError : FgaValidationError { 9 | 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FgaRequiredParamError() 14 | : base() { 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class with a specified error message. 19 | /// 20 | /// The name of the function being called. 21 | /// The name of the problematic param. 22 | public FgaRequiredParamError(string functionName, string paramName) 23 | : base($"Required parameter {paramName} was not defined when calling {functionName}.") { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/Exceptions_ValidationError.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System; 4 | 5 | namespace {{packageName}}.Exceptions; 6 | 7 | /// 8 | /// A generic validation error 9 | /// 10 | public class FgaValidationError : FgaError { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public FgaValidationError() : base() { 15 | } 16 | 17 | /// 18 | public FgaValidationError(string message) : base(message) { 19 | } 20 | 21 | /// 22 | public FgaValidationError(string message, Exception innerException) : base(message, innerException) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/GlobalConfiguration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/GlobalConfiguration.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/HttpSigningConfiguration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/HttpSigningConfiguration.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/IApiAccessor.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/IApiAccessor.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/IAsynchronousClient.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/IAsynchronousClient.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/IReadableConfiguration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/IReadableConfiguration.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/ISynchronousClient.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ISynchronousClient.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/JsonSubTypesTests.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/JsonSubTypesTests.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/Multimap.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/Multimap.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/OpenAPIDateConverter.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/OpenAPIDateConverter.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/README_api_endpoints.mustache: -------------------------------------------------------------------------------- 1 | | Method | HTTP request | Description | 2 | | ------------- | ------------- | ------------- | 3 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} | 4 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} 5 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/README_custom_badges.mustache: -------------------------------------------------------------------------------- 1 | [![Nuget](https://img.shields.io/nuget/v/{{packageName}}?label={{packageName}}&style=flat-square)](https://www.nuget.org/packages/{{packageName}}) 2 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/README_installation.mustache: -------------------------------------------------------------------------------- 1 | The {{appName}} .NET SDK is available on [NuGet](https://www.nuget.org/). 2 | 3 | You can install it using: 4 | 5 | * The [dotnet CLI](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli) 6 | ```powershell 7 | dotnet add package {{packageName}} 8 | ``` 9 | 10 | * The [Package Manager Console](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell) inside Visual Studio: 11 | 12 | ```powershell 13 | Install-Package {{packageName}} 14 | ``` 15 | 16 | * [Visual Studio](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio), [Visual Studio for Mac](https://docs.microsoft.com/en-us/visualstudio/mac/nuget-walkthrough) and [IntelliJ Rider](https://www.jetbrains.com/help/rider/Using_NuGet.html) 17 | 18 | Search for and install `{{packageName}}` in each of their respective package manager UIs. 19 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/README_license_disclaimer.mustache: -------------------------------------------------------------------------------- 1 | The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [csharp-netcore template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/csharp-netcore), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). 2 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/README_models.mustache: -------------------------------------------------------------------------------- 1 | {{#modelPackage}} 2 | {{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) 3 | {{/model}}{{/models}} 4 | {{/modelPackage}} 5 | {{^modelPackage}} 6 | No model defined in this package 7 | {{/modelPackage}} 8 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/ReadOnlyDictionary.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/ReadOnlyDictionary.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/RequestOptions.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/RequestOptions.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/RetryConfiguration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/RetryConfiguration.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/WebRequestPathBuilder.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/dotnet/template/WebRequestPathBuilder.mustache -------------------------------------------------------------------------------- /config/clients/dotnet/template/example/Example1/Example1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | Linux 9 | 10 | 11 | 12 | 13 | all 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/example/Makefile: -------------------------------------------------------------------------------- 1 | all: build 2 | 3 | project_name=Example1 4 | openfga_version=latest 5 | 6 | restore: 7 | dotnet restore "${project_name}/${project_name}.csproj" 8 | 9 | build: restore 10 | dotnet build "${project_name}/${project_name}.csproj" -c Release -o "${project_name}/bin" 11 | 12 | run: 13 | sh -c "${project_name}/bin/${project_name}" 14 | 15 | run-openfga: 16 | docker pull docker.io/openfga/openfga:${openfga_version} && \ 17 | docker run -p 8080:8080 docker.io/openfga/openfga:${openfga_version} run 18 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/example/OpenTelemetryExample/.env.example: -------------------------------------------------------------------------------- 1 | # Configuration for OpenFGA 2 | FGA_CLIENT_ID= 3 | FGA_API_TOKEN_ISSUER= 4 | FGA_API_AUDIENCE= 5 | FGA_CLIENT_SECRET= 6 | FGA_STORE_ID= 7 | FGA_AUTHORIZATION_MODEL_ID= 8 | FGA_API_URL="http://localhost:8080" 9 | 10 | # Configuration for OpenTelemetry 11 | OTEL_SERVICE_NAME="openfga-otel-dotnet-example" 12 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/model.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System.Runtime.Serialization; 4 | using System.Text.Json; 5 | using System.Text.Json.Serialization; 6 | {{#models}} 7 | {{#model}} 8 | {{#discriminator}} 9 | using JsonSubTypes; 10 | {{/discriminator}} 11 | {{/model}} 12 | {{/models}} 13 | {{#validatable}} 14 | using System.ComponentModel.DataAnnotations; 15 | {{/validatable}} 16 | {{#models}} 17 | {{#model}} 18 | {{#oneOf}} 19 | {{#-first}} 20 | using System.Reflection; 21 | {{/-first}} 22 | {{/oneOf}} 23 | {{#aneOf}} 24 | {{#-first}} 25 | using System.Reflection; 26 | {{/-first}} 27 | {{/aneOf}} 28 | 29 | namespace {{packageName}}.{{modelPackage}} 30 | { 31 | {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#anyOf}}{{#-first}}{{>modelAnyOf}}{{/-first}}{{/anyOf}}{{^oneOf}}{{^anyOf}}{{>modelGeneric}}{{/anyOf}}{{/oneOf}}{{/isEnum}} 32 | {{/model}} 33 | {{/models}} 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/modelEnum.mustache: -------------------------------------------------------------------------------- 1 | /// 2 | /// {{description}}{{^description}}Defines {{{name}}}{{/description}} 3 | /// 4 | {{#description}} 5 | /// {{.}} 6 | {{/description}} 7 | {{#allowableValues}} 8 | {{#enumVars}} 9 | {{#-first}} 10 | {{#isString}} 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))] 12 | {{/isString}} 13 | {{/-first}} 14 | {{/enumVars}} 15 | {{/allowableValues}} 16 | {{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} 17 | { 18 | {{#allowableValues}} 19 | {{#enumVars}} 20 | /// 21 | /// Enum {{name}} for value: {{value}} 22 | /// 23 | {{#isString}} 24 | [EnumMember(Value = "{{{value}}}")] 25 | {{/isString}} 26 | {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}} 27 | 28 | {{/enumVars}} 29 | {{/allowableValues}} 30 | }{{! NOTE: This model's enumVars is modified to look like CodegenProperty}} 31 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/modelInnerEnum.mustache: -------------------------------------------------------------------------------- 1 | {{^isContainer}} 2 | /// 3 | /// {{description}}{{^description}}Defines {{{name}}}{{/description}} 4 | /// 5 | {{#description}} 6 | /// {{.}} 7 | {{/description}} 8 | {{#isString}} 9 | [JsonConverter(typeof(JsonStringEnumMemberConverter<{{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))] 10 | {{/isString}} 11 | {{>visibility}} enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} 12 | { 13 | {{#allowableValues}} 14 | {{#enumVars}} 15 | /// 16 | /// Enum {{name}} for value: {{value}} 17 | /// 18 | {{#isString}} 19 | [EnumMember(Value = "{{{value}}}")] 20 | {{/isString}} 21 | {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}} 22 | 23 | {{/enumVars}} 24 | {{/allowableValues}} 25 | } 26 | {{/isContainer}} 27 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}} 2 | {{#model}} 3 | # {{{packageName}}}.{{modelPackage}}.{{{classname}}} 4 | {{#description}}{{&description}} 5 | {{/description}} 6 | 7 | ## Properties 8 | 9 | Name | Type | Description | Notes 10 | ------------ | ------------- | ------------- | ------------- 11 | {{#parent}} 12 | {{#parentVars}} 13 | **{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 14 | {{/parentVars}} 15 | {{/parent}} 16 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 17 | {{/vars}} 18 | 19 | [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) 20 | 21 | {{/model}} 22 | {{/models}} 23 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/partial_header.mustache: -------------------------------------------------------------------------------- 1 | // 2 | {{#appName}} 3 | // {{{appName}}}{{#packageDescription}}/{{{packageDescription}}}{{/packageDescription}} 4 | // 5 | {{/appName}} 6 | {{#version}} 7 | // API version: {{{version}}} 8 | {{/version}} 9 | {{#websiteUrl}} 10 | // Website: {{{websiteUrl}}} 11 | {{/websiteUrl}} 12 | {{#docsUrl}} 13 | // Documentation: {{{docsUrl}}} 14 | {{/docsUrl}} 15 | {{#supportInfo}} 16 | // Support: {{{supportInfo}}} 17 | {{/supportInfo}} 18 | {{#licenseId}} 19 | // License: [{{{licenseId}}}](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/blob/main/LICENSE) 20 | {{/licenseId}} 21 | // 22 | // NOTE: This file was auto generated. DO NOT EDIT. 23 | // 24 | -------------------------------------------------------------------------------- /config/clients/dotnet/template/visibility.mustache: -------------------------------------------------------------------------------- 1 | {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} -------------------------------------------------------------------------------- /config/clients/go/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | .travis.yml 2 | api/openapi.yaml 3 | test/api_open_fga_test.go 4 | client.go 5 | -------------------------------------------------------------------------------- /config/clients/go/generator.txt: -------------------------------------------------------------------------------- 1 | go 2 | -------------------------------------------------------------------------------- /config/clients/go/template/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | groups: 16 | dependencies: 17 | patterns: 18 | - "*" 19 | -------------------------------------------------------------------------------- /config/clients/go/template/.golangci.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | run: 4 | skip-files: 5 | - ^.*model_.*\.go$ 6 | 7 | 8 | linters: 9 | enable-all: true 10 | disable: 11 | - unused 12 | 13 | exclude-rules: 14 | - path: ^.*model_.*\.go$ 15 | linters: 16 | - errcheck 17 | - govet 18 | - ineffassign 19 | - staticcheck 20 | - unused -------------------------------------------------------------------------------- /config/clients/go/template/README_api_endpoints.mustache: -------------------------------------------------------------------------------- 1 | Class | Method | HTTP request | Description 2 | ------------ | ------------- | ------------- | ------------- 3 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} 4 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} -------------------------------------------------------------------------------- /config/clients/go/template/README_custom_badges.mustache: -------------------------------------------------------------------------------- 1 | [![Go Reference](https://pkg.go.dev/badge/{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.svg)](https://pkg.go.dev/{{gitHost}}/{{gitUserId}}/{{gitRepoId}}) 2 | -------------------------------------------------------------------------------- /config/clients/go/template/README_installation.mustache: -------------------------------------------------------------------------------- 1 | To install: 2 | 3 | ``` 4 | go get -u {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 5 | ``` 6 | 7 | In your code, import the module and use it: 8 | 9 | ```go 10 | import "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}" 11 | 12 | func Main() { 13 | configuration, err := {{#lambda.lowercase}}{{appShortName}}{{/lambda.lowercase}}.NewConfiguration({{#lambda.lowercase}}{{appShortName}}{{/lambda.lowercase}}.Configuration{}) 14 | } 15 | ``` 16 | 17 | You can then run 18 | 19 | ```shell 20 | go mod tidy 21 | ``` 22 | 23 | to update `go.mod` and `go.sum` if you are using them. 24 | -------------------------------------------------------------------------------- /config/clients/go/template/README_license_disclaimer.mustache: -------------------------------------------------------------------------------- 1 | The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [go template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/go), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). 2 | 3 | This repo bundles some code from the [golang.org/x/oauth2](https://pkg.go.dev/golang.org/x/oauth2) package. You can find the code [here](./oauth2) and corresponding [BSD-3 License](./oauth2/LICENSE). -------------------------------------------------------------------------------- /config/clients/go/template/README_models.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) 2 | {{/model}}{{/models}} -------------------------------------------------------------------------------- /config/clients/go/template/api_client_test.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package {{packageName}} 3 | 4 | 5 | import ( 6 | "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/telemetry" 7 | "net/http" 8 | "testing" 9 | "time" 10 | ) 11 | 12 | func TestApiClientCreatedWithDefaultTelemetry(t *testing.T) { 13 | cfg := Configuration{ 14 | HTTPClient: &http.Client{Timeout: 10 * time.Second}, 15 | ApiUrl: "http://localhost:8080/", 16 | } 17 | _ = NewAPIClient(&cfg) 18 | 19 | telemetry1 := telemetry.Get(telemetry.TelemetryFactoryParameters{Configuration: cfg.Telemetry}) 20 | telemetry2 := telemetry.Get(telemetry.TelemetryFactoryParameters{Configuration: cfg.Telemetry}) 21 | 22 | if telemetry1 != telemetry2 { 23 | t.Fatalf("Telemetry instance should be the same") 24 | } 25 | } -------------------------------------------------------------------------------- /config/clients/go/template/client/errors.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package client 3 | 4 | // FgaRequiredParamError Provides access to the body, error and model on returned errors. 5 | type FgaRequiredParamError struct { 6 | error string 7 | param string 8 | } 9 | 10 | // Error returns non-empty string if there was an error. 11 | func (e FgaRequiredParamError) Error() string { 12 | if e.error == "" { 13 | return "Required parameter " + e.Param() + " was not provided" 14 | } 15 | return e.error 16 | } 17 | 18 | // Param returns the name of the missing parameter 19 | func (e FgaRequiredParamError) Param() string { 20 | return e.param 21 | } 22 | 23 | // FgaInvalidError Provides access to the body, error and model on returned errors. 24 | type FgaInvalidError struct { 25 | error string 26 | param string 27 | description string 28 | } 29 | 30 | // Error returns non-empty string if there was an error. 31 | func (e FgaInvalidError) Error() string { 32 | if e.error == "" { 33 | return "Parameter " + e.Param() + " is not a valid " + e.description 34 | } 35 | return e.error 36 | } 37 | 38 | // Param returns the name of the invalid parameter 39 | func (e FgaInvalidError) Param() string { 40 | return e.param 41 | } 42 | -------------------------------------------------------------------------------- /config/clients/go/template/example/Makefile: -------------------------------------------------------------------------------- 1 | all: run 2 | 3 | project_name=example1 4 | openfga_version=latest 5 | 6 | restore: 7 | go mod tidy 8 | 9 | run: restore 10 | go run ${project_name}/${project_name}.go 11 | 12 | run-openfga: 13 | docker pull docker.io/openfga/openfga:${openfga_version} && \ 14 | docker run -p 8080:8080 docker.io/openfga/openfga:${openfga_version} run 15 | -------------------------------------------------------------------------------- /config/clients/go/template/example/README.md: -------------------------------------------------------------------------------- 1 | ## Examples of using the OpenFGA Go SDK 2 | 3 | A set of examples on how to call the OpenFGA Go SDK 4 | 5 | ### Examples 6 | Example 1: 7 | A bare bones example. It creates a store, and runs a set of calls against it including creating a model, writing tuples and checking for access. 8 | 9 | 10 | ### Running the Examples 11 | 12 | Prerequisites: 13 | - `docker` 14 | - `make` 15 | - `go` 1.21+ 16 | 17 | #### Run using a published SDK 18 | 19 | Steps 20 | 1. Clone/Copy the example folder 21 | 2. If you have an OpenFGA server running, you can use it, otherwise run `make run-openfga` to spin up an instance (you'll need to switch to a different terminal after - don't forget to close it when done) 22 | 3. Run `make run` to run the example 23 | 24 | #### Run using a local unpublished SDK build 25 | 26 | Steps 27 | 1. Build the SDK 28 | 2. In the Example `go.mod`, uncomment out the part that replaces the remote SDK with the local one, e.g. 29 | ``` 30 | // To refrence local build, uncomment below and run `go mod tidy` 31 | replace github.com/openfga/go-sdk v0.3.2 => ../../ 32 | ``` 33 | 3. If you have an OpenFGA server running, you can use it, otherwise run `make run-openfga` to spin up an instance (you'll need to switch to a different terminal after - don't forget to close it when done) 34 | 4. Run `make run` to run the example -------------------------------------------------------------------------------- /config/clients/go/template/example/example1/go.mod.mustache: -------------------------------------------------------------------------------- 1 | module example1 2 | 3 | go 1.23.0 4 | 5 | toolchain go1.24.0 6 | 7 | require {{gitHost}}/{{gitUserId}}/{{gitRepoId}} v{{packageVersion}} 8 | 9 | require ( 10 | github.com/go-logr/logr v1.4.2 // indirect 11 | github.com/go-logr/stdr v1.2.2 // indirect 12 | go.opentelemetry.io/auto/sdk v1.1.0 // indirect 13 | go.opentelemetry.io/otel v1.35.0 // indirect 14 | go.opentelemetry.io/otel/metric v1.35.0 // indirect 15 | go.opentelemetry.io/otel/trace v1.35.0 // indirect 16 | golang.org/x/sync v0.12.0 // indirect 17 | ) 18 | 19 | // To reference local build, uncomment below and run `go mod tidy` 20 | replace {{gitHost}}/{{gitUserId}}/{{gitRepoId}} v{{packageVersion}} => ../../ -------------------------------------------------------------------------------- /config/clients/go/template/gitignore_custom.mustache: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | coverage.txt 27 | -------------------------------------------------------------------------------- /config/clients/go/template/go.mod.mustache: -------------------------------------------------------------------------------- 1 | module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} 2 | 3 | go 1.23.0 4 | 5 | toolchain go1.24.0 6 | 7 | require ( 8 | github.com/jarcoal/httpmock v1.3.1 9 | github.com/sourcegraph/conc v0.3.0 10 | go.opentelemetry.io/otel v1.35.0 11 | go.opentelemetry.io/otel/metric v1.35.0 12 | golang.org/x/sync v0.12.0 13 | ) 14 | 15 | require ( 16 | github.com/go-logr/logr v1.4.2 // indirect 17 | github.com/go-logr/stdr v1.2.2 // indirect 18 | go.opentelemetry.io/auto/sdk v1.1.0 // indirect 19 | go.opentelemetry.io/otel/trace v1.35.0 // indirect 20 | ) -------------------------------------------------------------------------------- /config/clients/go/template/go.sum.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/go/template/go.sum.mustache -------------------------------------------------------------------------------- /config/clients/go/template/internal/utils/retryutils/retryparams.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package retryutils 3 | 4 | import "fmt" 5 | 6 | // RetryParams configures configuration for retry in case of HTTP too many request 7 | type RetryParams struct { 8 | MaxRetry int `json:"maxRetry,omitempty"` 9 | MinWaitInMs int `json:"minWaitInMs,omitempty"` 10 | } 11 | 12 | var defaultRetryParams = RetryParams{ 13 | MaxRetry: defaultMaxRetry, 14 | MinWaitInMs: defaultMinWaitInMs, 15 | } 16 | 17 | func (r *RetryParams) Validate() error { 18 | if r.MaxRetry < 0 || r.MaxRetry > retryMaxAllowedNumber { 19 | return fmt.Errorf("maxRetry must be between 0 and %d", retryMaxAllowedNumber) 20 | 21 | } 22 | 23 | if r.MinWaitInMs <= 0 { 24 | return fmt.Errorf("maxRetry must be greater than 0") 25 | } 26 | 27 | return nil 28 | } 29 | 30 | func GetRetryParamsOrDefault(r *RetryParams) RetryParams { 31 | if r == nil { 32 | return defaultRetryParams 33 | } 34 | 35 | return *r 36 | } 37 | 38 | func NewRetryParams(retryParams *RetryParams) (*RetryParams, error) { 39 | if retryParams == nil { 40 | return &defaultRetryParams, nil 41 | } 42 | 43 | if err := retryParams.Validate(); err != nil { 44 | return &defaultRetryParams, err 45 | } 46 | 47 | return retryParams, nil 48 | } 49 | -------------------------------------------------------------------------------- /config/clients/go/template/internal/utils/ulid.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package internalutils 3 | 4 | import ( 5 | "regexp" 6 | ) 7 | 8 | // cUlidRegex contains the regex for valid ULID 9 | const cUlidRegex = "^[0-7][0-9A-HJKMNP-TV-Z]{25}$" 10 | 11 | // IsWellFormedUlidString returns whethr the ulidString is a properly formatted ulid string 12 | func IsWellFormedUlidString(ulidString string) bool { 13 | re := regexp.MustCompile(cUlidRegex) 14 | return re.MatchString(ulidString) 15 | } 16 | 17 | -------------------------------------------------------------------------------- /config/clients/go/template/internal/utils/ulid_test.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package internalutils 3 | 4 | import ( 5 | "testing" 6 | ) 7 | 8 | func TestIsWellFormedUlidString(t *testing.T) { 9 | tests := []struct { 10 | name string 11 | input string 12 | isValid bool 13 | }{ 14 | { 15 | name: "valid_ulid", 16 | input: "01GRC27AM72M4SGK4VBHF3DY0F", 17 | isValid: true, 18 | }, 19 | { 20 | name: "invalid_symbols", 21 | input: "01GRC27AM72M4S$^4VBHF3DY0F", 22 | isValid: false, 23 | }, 24 | { 25 | name: "not_start_in_0-7", 26 | input: "A1GRC27AM72M4SGK4VBHF3DY0F", 27 | isValid: false, 28 | }, 29 | { 30 | name: "too_long", 31 | input: "01GRC27AM72M4SGK4VBHF3DY0FA", 32 | isValid: false, 33 | }, 34 | { 35 | name: "too_short", 36 | input: "01GRC27AM72M4SGK4VBHF3DY0", 37 | isValid: false, 38 | }, 39 | } 40 | 41 | for _, test := range tests { 42 | t.Run(test.name, func(t *testing.T) { 43 | isValid := IsWellFormedUlidString(test.input) 44 | if isValid != test.isValid { 45 | t.Errorf("Expect %s to be valid %v actual %v", test.input, test.isValid, isValid) 46 | } 47 | }) 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /config/clients/go/template/model.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package {{packageName}} 3 | 4 | {{#models}} 5 | import ( 6 | {{#model}} 7 | {{^isEnum}} 8 | "bytes" 9 | {{/isEnum}} 10 | {{/model}} 11 | 12 | "encoding/json" 13 | {{#imports}} 14 | "{{import}}" 15 | {{/imports}} 16 | ) 17 | 18 | {{#model}} 19 | {{#isEnum}} 20 | {{>model_enum}} 21 | {{/isEnum}} 22 | {{^isEnum}} 23 | {{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_simple}}{{/anyOf}}{{/oneOf}} 24 | {{/isEnum}} 25 | {{/model}} 26 | {{/models}} 27 | -------------------------------------------------------------------------------- /config/clients/go/template/nullable_model.mustache: -------------------------------------------------------------------------------- 1 | type Nullable{{{classname}}} struct { 2 | value *{{{classname}}} 3 | isSet bool 4 | } 5 | 6 | func (v Nullable{{classname}}) Get() *{{classname}} { 7 | return v.value 8 | } 9 | 10 | func (v *Nullable{{classname}}) Set(val *{{classname}}) { 11 | v.value = val 12 | v.isSet = true 13 | } 14 | 15 | func (v Nullable{{classname}}) IsSet() bool { 16 | return v.isSet 17 | } 18 | 19 | func (v *Nullable{{classname}}) Unset() { 20 | v.value = nil 21 | v.isSet = false 22 | } 23 | 24 | func NewNullable{{classname}}(val *{{classname}}) *Nullable{{classname}} { 25 | return &Nullable{{classname}}{value: val, isSet: true} 26 | } 27 | 28 | func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) { 29 | return json.Marshal(v.value) 30 | } 31 | 32 | func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { 33 | v.isSet = true 34 | return json.Unmarshal(src, &v.value) 35 | } 36 | -------------------------------------------------------------------------------- /config/clients/go/template/oauth2/ORIGINAL_AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /config/clients/go/template/oauth2/ORIGINAL_CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /config/clients/go/template/oauth2/README.md: -------------------------------------------------------------------------------- 1 | This oauth2 folder contains a oauth2 package with a partial client OAuth2 implementation. 2 | 3 | It has been copied over from the original for our use. A lot of the original code and dependencies have been deleted, and the rest reshuffled. 4 | 5 | Original Project: Go OAuth2 - [pkg.go.dev/golang.org/x/oauth2](https://pkg.go.dev/golang.org/x/oauth2) 6 | * Commit hash at the time of cloning [d3ed0bb246c8d3c75b63937d9a5eecff9c74d7fe](https://github.com/golang/oauth2/blob/d3ed0bb246c8d3c75b63937d9a5eecff9c74d7fe/) 7 | * Original Project's Repo on GitHub: [golang/oauth2](https://github.com/golang/oauth2/) 8 | * Original Project's Repo on Google Open Source: https://cs.opensource.google/go/x/oauth2 9 | * License: [BSD 3-Clause](https://github.com/golang/oauth2/blob/d3ed0bb246c8d3c75b63937d9a5eecff9c74d7fe/LICENSE) - [Local copy](./LICENSE) 10 | 11 | Note: The original authors are not aware of this fork, and do not endorse it in any way. 12 | -------------------------------------------------------------------------------- /config/clients/go/template/oauth2/internal/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package internal contains support packages for oauth2 package. 6 | package internal 7 | -------------------------------------------------------------------------------- /config/clients/go/template/oauth2/internal/transport.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import ( 8 | "context" 9 | "net/http" 10 | ) 11 | 12 | // HTTPClient is the context key to use with golang.org/x/net/context's 13 | // WithValue function to associate an *http.Client value with a context. 14 | var HTTPClient ContextKey 15 | 16 | // ContextKey is just an empty struct. It exists so HTTPClient can be 17 | // an immutable public variable with a unique type. It's immutable 18 | // because nobody else can create a ContextKey, being unexported. 19 | type ContextKey struct{} 20 | 21 | var appengineClientHook func(context.Context) *http.Client 22 | 23 | func ContextClient(ctx context.Context) *http.Client { 24 | if ctx != nil { 25 | if hc, ok := ctx.Value(HTTPClient).(*http.Client); ok { 26 | return hc 27 | } 28 | } 29 | if appengineClientHook != nil { 30 | return appengineClientHook(ctx) 31 | } 32 | return http.DefaultClient 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/go/template/openapi.mustache: -------------------------------------------------------------------------------- 1 | {{{openapi-yaml}}} -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/attribute.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | type Attribute struct { 4 | Name string 5 | } 6 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/attribute_test.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestAttributeCreation(t *testing.T) { 8 | attrName := "test-attribute" 9 | attr := &Attribute{Name: attrName} 10 | 11 | if attr.Name != attrName { 12 | t.Errorf("Expected Attribute Name to be '%s', but got '%s'", attrName, attr.Name) 13 | } 14 | } 15 | 16 | func TestEmptyAttributeCreation(t *testing.T) { 17 | attr := &Attribute{} 18 | 19 | if attr.Name != "" { 20 | t.Errorf("Expected Attribute Name to be empty, but got '%s'", attr.Name) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/counter.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | type Counter struct { 4 | Name string 5 | Description string 6 | } 7 | 8 | func (m *Counter) GetName() string { 9 | return m.Name 10 | } 11 | 12 | func (m *Counter) GetDescription() string { 13 | return m.Description 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/counters.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | const ( 4 | METRIC_COUNTER_CREDENTIALS_REQUEST string = "fga-client.credentials.request" 5 | ) 6 | 7 | var CredentialsRequest = &Counter{ 8 | Name: METRIC_COUNTER_CREDENTIALS_REQUEST, 9 | Description: "The total number of times new access tokens have been requested using ClientCredentials.", 10 | } 11 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/counters_test.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestCredentialsRequestCounter(t *testing.T) { 8 | expectedName := METRIC_COUNTER_CREDENTIALS_REQUEST 9 | expectedDescription := "The total number of times new access tokens have been requested using ClientCredentials." 10 | 11 | if CredentialsRequest == nil { 12 | t.Fatalf("Expected CredentialsRequest to be initialized, but got nil") 13 | } 14 | 15 | if CredentialsRequest.GetName() != expectedName { 16 | t.Errorf("Expected Name to be '%s', but got '%s'", expectedName, CredentialsRequest.GetName()) 17 | } 18 | 19 | if CredentialsRequest.GetDescription() != expectedDescription { 20 | t.Errorf("Expected Description to be '%s', but got '%s'", expectedDescription, CredentialsRequest.GetDescription()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/histogram.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | type Histogram struct { 4 | Name string 5 | Unit string 6 | Description string 7 | } 8 | 9 | func (m *Histogram) GetName() string { 10 | return m.Name 11 | } 12 | 13 | func (m *Histogram) GetDescription() string { 14 | return m.Description 15 | } 16 | 17 | func (m *Histogram) GetUnit() string { 18 | return m.Unit 19 | } 20 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/histograms.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | const ( 4 | METRIC_HISTOGRAM_REQUEST_DURATION string = "fga-client.request.duration" 5 | METRIC_HISTOGRAM_QUERY_DURATION string = "fga-client.query.duration" 6 | ) 7 | 8 | var ( 9 | RequestDuration = &Histogram{ 10 | Name: METRIC_HISTOGRAM_REQUEST_DURATION, 11 | Unit: "milliseconds", 12 | Description: "The total time (in milliseconds) it took for the request to complete, including the time it took to send the request and receive the response.", 13 | } 14 | 15 | QueryDuration = &Histogram{ 16 | Name: METRIC_HISTOGRAM_QUERY_DURATION, 17 | Unit: "milliseconds", 18 | Description: "The total time it took (in milliseconds) for the FGA server to process and evaluate the request.", 19 | } 20 | ) 21 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/interfaces.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | /* 4 | CheckRequestTupleKeyInterface is a simplified interface that defines the methods the CheckRequestTupleKey struct implements, relevant to the context of the telemetry package. 5 | */ 6 | type CheckRequestTupleKeyInterface interface { 7 | GetUser() *string 8 | } 9 | 10 | /* 11 | CheckRequestInterface is a simplified interface that defines the methods the CheckRequest struct implements, relevant to the context of the telemetry package. 12 | */ 13 | type CheckRequestInterface interface { 14 | GetTupleKey() CheckRequestTupleKeyInterface 15 | RequestAuthorizationModelIdInterface 16 | } 17 | 18 | /* 19 | RequestAuthorizationModelIdInterface is a generic interface that defines the GetAuthorizationModelId() method a Request struct implements, relevant to the context of the telemetry package. 20 | */ 21 | type RequestAuthorizationModelIdInterface interface { 22 | GetAuthorizationModelId() *string 23 | } 24 | -------------------------------------------------------------------------------- /config/clients/go/template/telemetry/metric.mustache: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | type Metric struct { 4 | Name string 5 | Description string 6 | MetricInterface 7 | } 8 | 9 | type MetricInterface interface { 10 | GetName() string 11 | GetDescription() string 12 | } 13 | 14 | func (m *Metric) GetName() string { 15 | return m.Name 16 | } 17 | 18 | func (m *Metric) GetDescription() string { 19 | return m.Description 20 | } 21 | -------------------------------------------------------------------------------- /config/clients/java/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | # Used but at a different location 2 | **/client/Configuration.java 3 | **/client/Pair.java 4 | **/client/ApiException.java 5 | 6 | # Unused 7 | **/ServerConfiguration.java 8 | **/ServerVariable.java 9 | **/JSON.java 10 | **/RFC3339DateFormat.java 11 | src/main/AndroidManifest.xml 12 | build.sbt 13 | pom.xml 14 | .github/workflows/maven.yml 15 | git_push.sh 16 | .travis.yml 17 | 18 | # Model tests intentionally ignored 19 | **/test/**/model/* 20 | -------------------------------------------------------------------------------- /config/clients/java/generator.txt: -------------------------------------------------------------------------------- 1 | java 2 | -------------------------------------------------------------------------------- /config/clients/java/template-source.json: -------------------------------------------------------------------------------- 1 | { 2 | "repo": "https://github.com/OpenAPITools/openapi-generator", 3 | "branch": "master", 4 | "commit": "90eacb685c57308e67c65e436b19d160091f91e1", 5 | "url": "https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/Java", 6 | "docs": "https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/java.md" 7 | } 8 | -------------------------------------------------------------------------------- /config/clients/java/template/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | - package-ecosystem: "gradle" 12 | directory: "/example/example1" 13 | schedule: 14 | interval: "monthly" 15 | groups: 16 | dependencies: 17 | patterns: 18 | - "*" 19 | - package-ecosystem: "github-actions" 20 | directory: "/" 21 | schedule: 22 | interval: "monthly" 23 | groups: 24 | dependencies: 25 | patterns: 26 | - "*" 27 | -------------------------------------------------------------------------------- /config/clients/java/template/ExampleTest.java.mustache: -------------------------------------------------------------------------------- 1 | package dev.openfga.sdk.example; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.testcontainers.junit.jupiter.Container; 5 | import org.testcontainers.junit.jupiter.Testcontainers; 6 | import org.testcontainers.openfga.OpenFGAContainer; 7 | 8 | @Testcontainers 9 | public class ExampleTest { 10 | @Container 11 | private static final OpenFGAContainer openfga = new OpenFGAContainer("openfga/openfga:{{openFGADockerTag}}"); 12 | 13 | private final Example1 example1 = new Example1(); 14 | 15 | @Test 16 | public void example1() throws Exception { 17 | 18 | example1.module = "test-integration"; 19 | example1.run(openfga.getHttpEndpoint()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/java/template/README_api_endpoints.mustache: -------------------------------------------------------------------------------- 1 | | Method | HTTP request | Description | 2 | | ------------- | ------------- | ------------- | 3 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} | 4 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} 5 | -------------------------------------------------------------------------------- /config/clients/java/template/README_custom_badges.mustache: -------------------------------------------------------------------------------- 1 | [![Maven Central](https://img.shields.io/maven-central/v/dev.openfga/openfga-sdk.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22dev.openfga%22%20AND%20a:%22openfga-sdk%22) 2 | [![Javadoc](https://javadoc.io/badge2/dev.openfga/openfga-sdk/javadoc.svg)](https://javadoc.io/doc/dev.openfga/openfga-sdk) 3 | -------------------------------------------------------------------------------- /config/clients/java/template/README_installation.mustache: -------------------------------------------------------------------------------- 1 | The {{appName}} Java SDK is available on [Maven Central](https://central.sonatype.com/). 2 | 3 | The OpenFGA Java SDK currently supports **Java 11** as the minimum JDK version. 4 | 5 | It can be used with the following: 6 | 7 | * Gradle (Groovy) 8 | 9 | ```groovy 10 | implementation '{{groupId}}:{{artifactId}}:{{packageVersion}}' 11 | ``` 12 | 13 | * Gradle (Kotlin) 14 | 15 | ```kotlin 16 | implementation("{{groupId}}:{{artifactId}}:{{packageVersion}}") 17 | ``` 18 | 19 | * Apache Maven 20 | 21 | ```xml 22 | 23 | {{groupId}} 24 | {{artifactId}} 25 | {{packageVersion}} 26 | 27 | ``` 28 | 29 | * Ivy 30 | 31 | ```xml 32 | 33 | ``` 34 | 35 | * SBT 36 | 37 | ```scala 38 | libraryDependencies += "{{groupId}}" % "{{artifactId}}" % "{{packageVersion}}" 39 | ``` 40 | 41 | * Leiningen 42 | 43 | ```edn 44 | [{{groupId}}/{{artifactId}} "{{packageVersion}}"] 45 | ``` 46 | -------------------------------------------------------------------------------- /config/clients/java/template/README_license_disclaimer.mustache: -------------------------------------------------------------------------------- 1 | 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). 2 | -------------------------------------------------------------------------------- /config/clients/java/template/README_models.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}} 2 | - [{{{classname}}}](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/blob/main/docs/{{{classname}}}.md) 3 | {{/model}}{{/models}} 4 | -------------------------------------------------------------------------------- /config/clients/java/template/additionalEnumTypeAnnotations.mustache: -------------------------------------------------------------------------------- 1 | {{#additionalEnumTypeAnnotations}}{{{.}}} 2 | {{/additionalEnumTypeAnnotations}} -------------------------------------------------------------------------------- /config/clients/java/template/additionalModelTypeAnnotations.mustache: -------------------------------------------------------------------------------- 1 | {{#additionalModelTypeAnnotations}}{{{.}}} 2 | {{/additionalModelTypeAnnotations}} -------------------------------------------------------------------------------- /config/clients/java/template/additionalOneOfTypeAnnotations.mustache: -------------------------------------------------------------------------------- 1 | {{#additionalOneOfTypeAnnotations}}{{{.}}} 2 | {{/additionalOneOfTypeAnnotations}} -------------------------------------------------------------------------------- /config/clients/java/template/apiOperation.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{invokerPackage}}; 3 | 4 | import io.swagger.v3.oas.models.Operation; 5 | 6 | public class ApiOperation { 7 | private final String path; 8 | private final String method; 9 | private final Operation operation; 10 | 11 | public ApiOperation(String path, String method, Operation operation) { 12 | this.path = path; 13 | this.method = method; 14 | this.operation = operation; 15 | } 16 | 17 | public Operation getOperation() { 18 | return operation; 19 | } 20 | 21 | public String getPath() { 22 | return path; 23 | } 24 | 25 | public String getMethod() { 26 | return method; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /config/clients/java/template/enum_outer_doc.mustache: -------------------------------------------------------------------------------- 1 | # {{classname}} 2 | 3 | ## Enum 4 | 5 | {{#allowableValues}}{{#enumVars}} 6 | * `{{name}}` (value: `{{{value}}}`) 7 | {{/enumVars}}{{/allowableValues}} 8 | -------------------------------------------------------------------------------- /config/clients/java/template/example/Makefile: -------------------------------------------------------------------------------- 1 | all: build 2 | 3 | project_name=example1 4 | openfga_version=latest 5 | language=java 6 | 7 | build: 8 | cd "${project_name}" && \ 9 | ./gradlew -P language=$(language) build 10 | 11 | run: 12 | cd "${project_name}" && \ 13 | ./gradlew -P language=$(language) run 14 | 15 | run-openfga: 16 | docker pull docker.io/openfga/openfga:${openfga_version} && \ 17 | docker run -p 8080:8080 docker.io/openfga/openfga:${openfga_version} run 18 | -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/gradle.properties: -------------------------------------------------------------------------------- 1 | language=java -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/java/template/example/example1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/links/Example1.java: -------------------------------------------------------------------------------- 1 | ../src/main/java/dev/openfga/sdk/example/Example1.java -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/links/example1-auth-model.json: -------------------------------------------------------------------------------- 1 | ../src/main/resources/example1-auth-model.json -------------------------------------------------------------------------------- /config/clients/java/template/example/example1/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'example1' -------------------------------------------------------------------------------- /config/clients/java/template/gitignore.mustache: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # exclude jar for gradle wrapper 12 | !gradle/wrapper/*.jar 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* 16 | 17 | # build files 18 | **/target 19 | target 20 | .gradle 21 | build 22 | 23 | # openapi files 24 | /api/openapi.yaml 25 | VERSION.txt 26 | 27 | # JetBrains IDEs 28 | .idea/ 29 | *.iml 30 | 31 | # VSCode IDE 32 | /.vscode 33 | -------------------------------------------------------------------------------- /config/clients/java/template/gitignore_custom.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/java/template/gitignore_custom.mustache -------------------------------------------------------------------------------- /config/clients/java/template/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/java/template/gradle-wrapper.jar -------------------------------------------------------------------------------- /config/clients/java/template/gradle-wrapper.properties.mustache: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /config/clients/java/template/libraries/native/gradle.properties.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/clients/java/template/libraries/native/gradle.properties.mustache -------------------------------------------------------------------------------- /config/clients/java/template/libraries/native/model_anyof_doc.mustache: -------------------------------------------------------------------------------- 1 | # {{classname}} 2 | 3 | {{#description}} 4 | {{&description}} 5 | 6 | {{/description}} 7 | ## anyOf schemas 8 | {{#anyOf}} 9 | * [{{{.}}}]({{{.}}}.md) 10 | {{/anyOf}} 11 | 12 | {{#isNullable}} 13 | NOTE: this class is nullable. 14 | 15 | {{/isNullable}} 16 | ## Example 17 | ```java 18 | // Import classes: 19 | import {{{package}}}.{{{classname}}}; 20 | {{#anyOf}} 21 | import {{{package}}}.{{{.}}}; 22 | {{/anyOf}} 23 | 24 | public class Example { 25 | public static void main(String[] args) { 26 | {{classname}} example{{classname}} = new {{classname}}(); 27 | {{#anyOf}} 28 | 29 | // create a new {{{.}}} 30 | {{{.}}} example{{{.}}} = new {{{.}}}(); 31 | // set {{{classname}}} to {{{.}}} 32 | example{{classname}}.setActualInstance(example{{{.}}}); 33 | // to get back the {{{.}}} set earlier 34 | {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); 35 | {{/anyOf}} 36 | } 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /config/clients/java/template/libraries/native/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}} 2 | 3 | {{#isEnum}} 4 | {{>enum_outer_doc}} 5 | {{/isEnum}} 6 | {{^isEnum}} 7 | {{^oneOf.isEmpty}} 8 | {{>model_oneof_doc}} 9 | {{/oneOf.isEmpty}} 10 | {{^anyOf.isEmpty}} 11 | {{>model_anyof_doc}} 12 | {{/anyOf.isEmpty}} 13 | {{^anyOf}} 14 | {{^oneOf}} 15 | {{>pojo_doc}} 16 | {{/oneOf}} 17 | {{/anyOf}} 18 | {{/isEnum}} 19 | {{/model}}{{/models}} 20 | -------------------------------------------------------------------------------- /config/clients/java/template/libraries/native/model_oneof_doc.mustache: -------------------------------------------------------------------------------- 1 | # {{classname}} 2 | 3 | {{#description}} 4 | {{&description}} 5 | 6 | {{/description}} 7 | ## oneOf schemas 8 | {{#oneOf}} 9 | * [{{{.}}}]({{{.}}}.md) 10 | {{/oneOf}} 11 | 12 | {{#isNullable}} 13 | NOTE: this class is nullable. 14 | 15 | {{/isNullable}} 16 | ## Example 17 | ```java 18 | // Import classes: 19 | import {{{package}}}.{{{classname}}}; 20 | {{#oneOf}} 21 | import {{{package}}}.{{{.}}}; 22 | {{/oneOf}} 23 | 24 | public class Example { 25 | public static void main(String[] args) { 26 | {{classname}} example{{classname}} = new {{classname}}(); 27 | {{#oneOf}} 28 | 29 | // create a new {{{.}}} 30 | {{{.}}} example{{{.}}} = new {{{.}}}(); 31 | // set {{{classname}}} to {{{.}}} 32 | example{{classname}}.setActualInstance(example{{{.}}}); 33 | // to get back the {{{.}}} set earlier 34 | {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); 35 | {{/oneOf}} 36 | } 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /config/clients/java/template/libraries/native/travis.mustache: -------------------------------------------------------------------------------- 1 | # 2 | # Generated by: https://openapi-generator.tech 3 | # 4 | language: java 5 | jdk: 6 | - oraclejdk11 7 | before_install: 8 | # ensure gradlew has proper permission 9 | - chmod a+x ./gradlew 10 | script: 11 | # test using maven 12 | - mvn test 13 | # uncomment below to test using gradle 14 | # - gradle test 15 | # uncomment below to test using sbt 16 | # - sbt test 17 | -------------------------------------------------------------------------------- /config/clients/java/template/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * {{{appName}}} 3 | * {{{appDescription}}} 4 | * 5 | * {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}} 6 | * {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}} 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | -------------------------------------------------------------------------------- /config/clients/java/template/model_test.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{package}}; 4 | 5 | {{#imports}}import {{import}}; 6 | {{/imports}} 7 | import org.junit.jupiter.api.Assert; 8 | import org.junit.jupiter.api.Ignore; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Model tests for {{classname}} 13 | */ 14 | public class {{classname}}Test { 15 | {{#models}} 16 | {{#model}} 17 | {{^vendorExtensions.x-is-one-of-interface}} 18 | {{^isEnum}} 19 | private final {{classname}} model = new {{classname}}(); 20 | 21 | {{/isEnum}} 22 | /** 23 | * Model tests for {{classname}} 24 | */ 25 | @Test 26 | public void test{{classname}}() { 27 | // TODO: test {{classname}} 28 | } 29 | 30 | {{#allVars}} 31 | /** 32 | * Test the property '{{name}}' 33 | */ 34 | @Test 35 | public void {{name}}Test() { 36 | // TODO: test {{name}} 37 | } 38 | 39 | {{/allVars}} 40 | {{/vendorExtensions.x-is-one-of-interface}} 41 | {{/model}} 42 | {{/models}} 43 | } 44 | -------------------------------------------------------------------------------- /config/clients/java/template/oneof_interface.mustache: -------------------------------------------------------------------------------- 1 | {{>additionalOneOfTypeAnnotations}}{{>typeInfoAnnotation}}{{>xmlAnnotation}} 2 | public interface {{classname}} {{#vendorExtensions.x-implements}}{{#-first}}extends {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { 3 | {{#discriminator}} 4 | public {{propertyType}} {{propertyGetter}}(); 5 | {{/discriminator}} 6 | } 7 | -------------------------------------------------------------------------------- /config/clients/java/template/openapi.mustache: -------------------------------------------------------------------------------- 1 | {{{openapi-yaml}}} 2 | -------------------------------------------------------------------------------- /config/clients/java/template/settings.gradle.mustache: -------------------------------------------------------------------------------- 1 | rootProject.name = '{{artifactId}}' -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientBatchCheckRequest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{invokerPackage}}.model; 3 | 4 | import java.util.List; 5 | 6 | public class ClientBatchCheckRequest { 7 | private List checks; 8 | 9 | public static ClientBatchCheckRequest ofChecks(List checks) { 10 | return new ClientBatchCheckRequest().checks(checks); 11 | } 12 | 13 | public ClientBatchCheckRequest checks(List checks) { 14 | this.checks = checks; 15 | return this; 16 | } 17 | 18 | public List getChecks() { 19 | return checks; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientBatchCheckResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import java.util.List; 5 | 6 | public class ClientBatchCheckResponse { 7 | private final List result; 8 | 9 | public ClientBatchCheckResponse(List result) { 10 | this.result = result; 11 | } 12 | 13 | public List getResult() { 14 | return result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientBatchCheckSingleResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import dev.openfga.sdk.api.model.CheckError; 5 | 6 | public class ClientBatchCheckSingleResponse { 7 | private final boolean allowed; 8 | private final ClientBatchCheckItem request; 9 | private final String correlationId; 10 | private final CheckError error; 11 | 12 | public ClientBatchCheckSingleResponse(boolean allowed, ClientBatchCheckItem request, String correlationId, CheckError error) { 13 | this.allowed = allowed; 14 | this.request = request; 15 | this.correlationId = correlationId; 16 | this.error = error; 17 | } 18 | 19 | public boolean isAllowed() { 20 | return allowed; 21 | } 22 | 23 | public ClientBatchCheckItem getRequest() { 24 | return request; 25 | } 26 | 27 | public String getCorrelationId() { 28 | return correlationId; 29 | } 30 | 31 | public CheckError getError() { 32 | return error; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientCheckResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.CheckResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientCheckResponse extends CheckResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientCheckResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | CheckResponse response = apiResponse.getData(); 19 | this.setAllowed(response.getAllowed()); 20 | this.setResolution(response.getResolution()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientCreateStoreResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.CreateStoreResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientCreateStoreResponse extends CreateStoreResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientCreateStoreResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | CreateStoreResponse response = apiResponse.getData(); 19 | this.setName(response.getName()); 20 | this.setId(response.getId()); 21 | this.setCreatedAt(response.getCreatedAt()); 22 | this.setUpdatedAt(response.getUpdatedAt()); 23 | } 24 | 25 | public int getStatusCode() { 26 | return statusCode; 27 | } 28 | 29 | public Map> getHeaders() { 30 | return headers; 31 | } 32 | 33 | public String getRawResponse() { 34 | return rawResponse; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientDeleteStoreResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class ClientDeleteStoreResponse { 9 | private final int statusCode; 10 | private final Map> headers; 11 | private final String rawResponse; 12 | 13 | public ClientDeleteStoreResponse(ApiResponse apiResponse) { 14 | this.statusCode = apiResponse.getStatusCode(); 15 | this.headers = apiResponse.getHeaders(); 16 | this.rawResponse = apiResponse.getRawResponse(); 17 | } 18 | 19 | public int getStatusCode() { 20 | return statusCode; 21 | } 22 | 23 | public Map> getHeaders() { 24 | return headers; 25 | } 26 | 27 | public String getRawResponse() { 28 | return rawResponse; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientExpandRequest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | public class ClientExpandRequest { 5 | private String relation; 6 | private String _object; 7 | 8 | public ClientExpandRequest _object(String _object) { 9 | this._object = _object; 10 | return this; 11 | } 12 | 13 | /** 14 | * Get _object 15 | * @return _object 16 | **/ 17 | public String getObject() { 18 | return _object; 19 | } 20 | 21 | public ClientExpandRequest relation(String relation) { 22 | this.relation = relation; 23 | return this; 24 | } 25 | 26 | /** 27 | * Get relation 28 | * @return relation 29 | **/ 30 | public String getRelation() { 31 | return relation; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientExpandResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ExpandResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientExpandResponse extends ExpandResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientExpandResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ExpandResponse response = apiResponse.getData(); 19 | this.setTree(response.getTree()); 20 | } 21 | 22 | public int getStatusCode() { 23 | return statusCode; 24 | } 25 | 26 | public Map> getHeaders() { 27 | return headers; 28 | } 29 | 30 | public String getRawResponse() { 31 | return rawResponse; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientGetStoreResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.GetStoreResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientGetStoreResponse extends GetStoreResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientGetStoreResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | GetStoreResponse response = apiResponse.getData(); 19 | this.setName(response.getName()); 20 | this.setId(response.getId()); 21 | this.setCreatedAt(response.getCreatedAt()); 22 | this.setUpdatedAt(response.getUpdatedAt()); 23 | } 24 | 25 | public int getStatusCode() { 26 | return statusCode; 27 | } 28 | 29 | public Map> getHeaders() { 30 | return headers; 31 | } 32 | 33 | public String getRawResponse() { 34 | return rawResponse; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientListObjectsResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ListObjectsResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientListObjectsResponse extends ListObjectsResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientListObjectsResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ListObjectsResponse response = apiResponse.getData(); 19 | this.setObjects(response.getObjects()); 20 | } 21 | 22 | public int getStatusCode() { 23 | return statusCode; 24 | } 25 | 26 | public Map> getHeaders() { 27 | return headers; 28 | } 29 | 30 | public String getRawResponse() { 31 | return rawResponse; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientListStoresResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ListStoresResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientListStoresResponse extends ListStoresResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientListStoresResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ListStoresResponse response = apiResponse.getData(); 19 | this.setStores(response.getStores()); 20 | this.setContinuationToken(response.getContinuationToken()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientListUsersResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ListUsersResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientListUsersResponse extends ListUsersResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientListUsersResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ListUsersResponse response = apiResponse.getData(); 19 | this.setUsers(response.getUsers()); 20 | } 21 | 22 | public int getStatusCode() { 23 | return statusCode; 24 | } 25 | 26 | public Map> getHeaders() { 27 | return headers; 28 | } 29 | 30 | public String getRawResponse() { 31 | return rawResponse; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadAssertionsResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ReadAssertionsResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientReadAssertionsResponse extends ReadAssertionsResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientReadAssertionsResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ReadAssertionsResponse response = apiResponse.getData(); 19 | this.setAssertions(response.getAssertions()); 20 | this.setAuthorizationModelId(response.getAuthorizationModelId()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadAuthorizationModelsResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ReadAuthorizationModelsResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientReadAuthorizationModelsResponse extends ReadAuthorizationModelsResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientReadAuthorizationModelsResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ReadAuthorizationModelsResponse response = apiResponse.getData(); 19 | this.setAuthorizationModels(response.getAuthorizationModels()); 20 | this.setContinuationToken(response.getContinuationToken()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadChangesRequest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import java.time.OffsetDateTime; 5 | 6 | public class ClientReadChangesRequest { 7 | private String type; 8 | private OffsetDateTime startTime; 9 | 10 | public ClientReadChangesRequest type(String type) { 11 | this.type = type; 12 | return this; 13 | } 14 | 15 | public ClientReadChangesRequest startTime(OffsetDateTime startTime) { 16 | this.startTime = startTime; 17 | return this; 18 | } 19 | 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | public OffsetDateTime getStartTime(){ 25 | return startTime; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadChangesResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ReadChangesResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientReadChangesResponse extends ReadChangesResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientReadChangesResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ReadChangesResponse response = apiResponse.getData(); 19 | this.setChanges(response.getChanges()); 20 | this.setContinuationToken(response.getContinuationToken()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadRequest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | public class ClientReadRequest { 5 | private String user; 6 | private String relation; 7 | private String _object; 8 | 9 | public ClientReadRequest _object(String _object) { 10 | this._object = _object; 11 | return this; 12 | } 13 | 14 | /** 15 | * Get _object 16 | * @return _object 17 | **/ 18 | public String getObject() { 19 | return _object; 20 | } 21 | 22 | public ClientReadRequest relation(String relation) { 23 | this.relation = relation; 24 | return this; 25 | } 26 | 27 | /** 28 | * Get relation 29 | * @return relation 30 | **/ 31 | public String getRelation() { 32 | return relation; 33 | } 34 | 35 | public ClientReadRequest user(String user) { 36 | this.user = user; 37 | return this; 38 | } 39 | 40 | /** 41 | * Get user 42 | * @return user 43 | **/ 44 | public String getUser() { 45 | return user; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientReadResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.ReadResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientReadResponse extends ReadResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientReadResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | ReadResponse response = apiResponse.getData(); 19 | this.setTuples(response.getTuples()); 20 | this.setContinuationToken(response.getContinuationToken()); 21 | } 22 | 23 | public int getStatusCode() { 24 | return statusCode; 25 | } 26 | 27 | public Map> getHeaders() { 28 | return headers; 29 | } 30 | 31 | public String getRawResponse() { 32 | return rawResponse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientRelationshipCondition.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{modelPackage}}.RelationshipCondition; 5 | 6 | public class ClientRelationshipCondition { 7 | private String name; 8 | private Object context; 9 | 10 | public ClientRelationshipCondition name(String name) { 11 | this.name = name; 12 | return this; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public ClientRelationshipCondition context(Object context) { 20 | this.context = context; 21 | return this; 22 | } 23 | 24 | public Object getContext() { 25 | return context; 26 | } 27 | 28 | public RelationshipCondition asRelationshipCondition() { 29 | return new RelationshipCondition().name(name).context(context); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientWriteAssertionsResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class ClientWriteAssertionsResponse { 9 | private final int statusCode; 10 | private final Map> headers; 11 | private final String rawResponse; 12 | 13 | public ClientWriteAssertionsResponse(ApiResponse apiResponse) { 14 | this.statusCode = apiResponse.getStatusCode(); 15 | this.headers = apiResponse.getHeaders(); 16 | this.rawResponse = apiResponse.getRawResponse(); 17 | } 18 | 19 | public int getStatusCode() { 20 | return statusCode; 21 | } 22 | 23 | public Map> getHeaders() { 24 | return headers; 25 | } 26 | 27 | public String getRawResponse() { 28 | return rawResponse; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientWriteAuthorizationModelResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import {{modelPackage}}.WriteAuthorizationModelResponse; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ClientWriteAuthorizationModelResponse extends WriteAuthorizationModelResponse { 10 | private final int statusCode; 11 | private final Map> headers; 12 | private final String rawResponse; 13 | 14 | public ClientWriteAuthorizationModelResponse(ApiResponse apiResponse) { 15 | this.statusCode = apiResponse.getStatusCode(); 16 | this.headers = apiResponse.getHeaders(); 17 | this.rawResponse = apiResponse.getRawResponse(); 18 | WriteAuthorizationModelResponse response = apiResponse.getData(); 19 | this.setAuthorizationModelId(response.getAuthorizationModelId()); 20 | } 21 | 22 | public int getStatusCode() { 23 | return statusCode; 24 | } 25 | 26 | public Map> getHeaders() { 27 | return headers; 28 | } 29 | 30 | public String getRawResponse() { 31 | return rawResponse; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientWriteRequest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import java.util.List; 5 | 6 | public class ClientWriteRequest { 7 | private List writes; 8 | private List deletes; 9 | 10 | public static ClientWriteRequest ofWrites(List writes) { 11 | return new ClientWriteRequest().writes(writes); 12 | } 13 | 14 | public ClientWriteRequest writes(List writes) { 15 | this.writes = writes; 16 | return this; 17 | } 18 | 19 | public List getWrites() { 20 | return writes; 21 | } 22 | 23 | public static ClientWriteRequest ofDeletes(List deletes) { 24 | return new ClientWriteRequest().deletes(deletes); 25 | } 26 | 27 | public ClientWriteRequest deletes(List deletes) { 28 | this.deletes = deletes; 29 | return this; 30 | } 31 | 32 | public List getDeletes() { 33 | return deletes; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/client/model/ClientWriteResponse.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{clientPackage}}.model; 3 | 4 | import {{clientPackage}}.ApiResponse; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class ClientWriteResponse { 9 | private final int statusCode; 10 | private final Map> headers; 11 | private final String rawResponse; 12 | 13 | public ClientWriteResponse(ApiResponse apiResponse) { 14 | this.statusCode = apiResponse.getStatusCode(); 15 | this.headers = apiResponse.getHeaders(); 16 | this.rawResponse = apiResponse.getRawResponse(); 17 | } 18 | 19 | public int getStatusCode() { 20 | return statusCode; 21 | } 22 | 23 | public Map> getHeaders() { 24 | return headers; 25 | } 26 | 27 | public String getRawResponse() { 28 | return rawResponse; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/AdditionalHeadersSupplier.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public interface AdditionalHeadersSupplier { 7 | Map getAdditionalHeaders(); 8 | } 9 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ApiToken.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | /** 5 | * A static API token. In OAuth2 terms, this indicates an "access token" 6 | * that will be used to authenticate a request. 7 | */ 8 | public class ApiToken { 9 | private String token; 10 | 11 | public ApiToken(String token) { 12 | this.token = token; 13 | } 14 | 15 | public void setToken(String token) { 16 | this.token = token; 17 | } 18 | 19 | public String getToken() { 20 | return this.token; 21 | } 22 | } -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/BaseConfiguration.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import {{errorsPackage}}.FgaInvalidParameterException; 5 | import java.time.Duration; 6 | 7 | public interface BaseConfiguration { 8 | String getApiUrl(); 9 | 10 | String getUserAgent(); 11 | 12 | Duration getReadTimeout(); 13 | 14 | Duration getConnectTimeout(); 15 | 16 | Integer getMaxRetries(); 17 | 18 | Duration getMinimumRetryDelay(); 19 | } 20 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientCheckOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import dev.openfga.sdk.api.model.ConsistencyPreference; 5 | import java.util.Map; 6 | 7 | public class ClientCheckOptions implements AdditionalHeadersSupplier { 8 | private Map additionalHeaders; 9 | private String authorizationModelId; 10 | private ConsistencyPreference consistency; 11 | 12 | public ClientCheckOptions additionalHeaders(Map additionalHeaders) { 13 | this.additionalHeaders = additionalHeaders; 14 | return this; 15 | } 16 | 17 | @Override 18 | public Map getAdditionalHeaders() { 19 | return this.additionalHeaders; 20 | } 21 | 22 | public ClientCheckOptions authorizationModelId(String authorizationModelId) { 23 | this.authorizationModelId = authorizationModelId; 24 | return this; 25 | } 26 | 27 | public String getAuthorizationModelId() { 28 | return authorizationModelId; 29 | } 30 | 31 | public ClientCheckOptions consistency(ConsistencyPreference consistency) { 32 | this.consistency = consistency; 33 | return this; 34 | } 35 | 36 | public ConsistencyPreference getConsistency() { 37 | return consistency; 38 | } 39 | } -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientCreateStoreOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientCreateStoreOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientCreateStoreOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientDeleteStoreOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientDeleteStoreOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientDeleteStoreOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientDeleteTuplesOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientDeleteTuplesOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientDeleteTuplesOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientExpandOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import dev.openfga.sdk.api.model.ConsistencyPreference; 5 | import java.util.Map; 6 | 7 | public class ClientExpandOptions implements AdditionalHeadersSupplier { 8 | private Map additionalHeaders; 9 | private String authorizationModelId; 10 | private ConsistencyPreference consistency; 11 | 12 | public ClientExpandOptions additionalHeaders(Map additionalHeaders) { 13 | this.additionalHeaders = additionalHeaders; 14 | return this; 15 | } 16 | 17 | @Override 18 | public Map getAdditionalHeaders() { 19 | return this.additionalHeaders; 20 | } 21 | 22 | public ClientExpandOptions authorizationModelId(String authorizationModelId) { 23 | this.authorizationModelId = authorizationModelId; 24 | return this; 25 | } 26 | 27 | public String getAuthorizationModelId() { 28 | return authorizationModelId; 29 | } 30 | 31 | public ClientExpandOptions consistency(ConsistencyPreference consistency) { 32 | this.consistency = consistency; 33 | return this; 34 | } 35 | 36 | public ConsistencyPreference getConsistency() { 37 | return consistency; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientGetStoreOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientGetStoreOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientGetStoreOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientListObjectsOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import dev.openfga.sdk.api.model.ConsistencyPreference; 5 | import java.util.Map; 6 | 7 | public class ClientListObjectsOptions implements AdditionalHeadersSupplier { 8 | private Map additionalHeaders; 9 | private String authorizationModelId; 10 | private ConsistencyPreference consistency; 11 | 12 | public ClientListObjectsOptions additionalHeaders(Map additionalHeaders) { 13 | this.additionalHeaders = additionalHeaders; 14 | return this; 15 | } 16 | 17 | @Override 18 | public Map getAdditionalHeaders() { 19 | return this.additionalHeaders; 20 | } 21 | 22 | public ClientListObjectsOptions authorizationModelId(String authorizationModelId) { 23 | this.authorizationModelId = authorizationModelId; 24 | return this; 25 | } 26 | 27 | public String getAuthorizationModelId() { 28 | return authorizationModelId; 29 | } 30 | 31 | public ClientListObjectsOptions consistency(ConsistencyPreference consistency) { 32 | this.consistency = consistency; 33 | return this; 34 | } 35 | 36 | public ConsistencyPreference getConsistency() { 37 | return consistency; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientListStoresOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientListStoresOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | private Integer pageSize; 9 | private String continuationToken; 10 | 11 | public ClientListStoresOptions additionalHeaders(Map additionalHeaders) { 12 | this.additionalHeaders = additionalHeaders; 13 | return this; 14 | } 15 | 16 | @Override 17 | public Map getAdditionalHeaders() { 18 | return this.additionalHeaders; 19 | } 20 | 21 | public ClientListStoresOptions pageSize(Integer pageSize) { 22 | this.pageSize = pageSize; 23 | return this; 24 | } 25 | 26 | public Integer getPageSize() { 27 | return pageSize; 28 | } 29 | 30 | public ClientListStoresOptions continuationToken(String continuationToken) { 31 | this.continuationToken = continuationToken; 32 | return this; 33 | } 34 | 35 | public String getContinuationToken() { 36 | return continuationToken; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientListUsersOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import dev.openfga.sdk.api.model.ConsistencyPreference; 5 | import java.util.Map; 6 | 7 | public class ClientListUsersOptions implements AdditionalHeadersSupplier { 8 | private Map additionalHeaders; 9 | private String authorizationModelId; 10 | private ConsistencyPreference consistency; 11 | 12 | public ClientListUsersOptions additionalHeaders(Map additionalHeaders) { 13 | this.additionalHeaders = additionalHeaders; 14 | return this; 15 | } 16 | 17 | @Override 18 | public Map getAdditionalHeaders() { 19 | return this.additionalHeaders; 20 | } 21 | 22 | public ClientListUsersOptions authorizationModelId(String authorizationModelId) { 23 | this.authorizationModelId = authorizationModelId; 24 | return this; 25 | } 26 | 27 | public String getAuthorizationModelId() { 28 | return authorizationModelId; 29 | } 30 | 31 | public ClientListUsersOptions consistency(ConsistencyPreference consistency) { 32 | this.consistency = consistency; 33 | return this; 34 | } 35 | 36 | public ConsistencyPreference getConsistency() { 37 | return consistency; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientReadAuthorizationModelsOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientReadAuthorizationModelsOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | private Integer pageSize; 9 | private String continuationToken; 10 | 11 | public ClientReadAuthorizationModelsOptions additionalHeaders(Map additionalHeaders) { 12 | this.additionalHeaders = additionalHeaders; 13 | return this; 14 | } 15 | 16 | @Override 17 | public Map getAdditionalHeaders() { 18 | return this.additionalHeaders; 19 | } 20 | 21 | public ClientReadAuthorizationModelsOptions pageSize(Integer pageSize) { 22 | this.pageSize = pageSize; 23 | return this; 24 | } 25 | 26 | public Integer getPageSize() { 27 | return pageSize; 28 | } 29 | 30 | public ClientReadAuthorizationModelsOptions continuationToken(String continuationToken) { 31 | this.continuationToken = continuationToken; 32 | return this; 33 | } 34 | 35 | public String getContinuationToken() { 36 | return continuationToken; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientReadChangesOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientReadChangesOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | private Integer pageSize; 9 | private String continuationToken; 10 | 11 | public ClientReadChangesOptions additionalHeaders(Map additionalHeaders) { 12 | this.additionalHeaders = additionalHeaders; 13 | return this; 14 | } 15 | 16 | @Override 17 | public Map getAdditionalHeaders() { 18 | return this.additionalHeaders; 19 | } 20 | 21 | public ClientReadChangesOptions pageSize(Integer pageSize) { 22 | this.pageSize = pageSize; 23 | return this; 24 | } 25 | 26 | public Integer getPageSize() { 27 | return pageSize; 28 | } 29 | 30 | public ClientReadChangesOptions continuationToken(String continuationToken) { 31 | this.continuationToken = continuationToken; 32 | return this; 33 | } 34 | 35 | public String getContinuationToken() { 36 | return continuationToken; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientReadLatestAuthorizationModelOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientReadLatestAuthorizationModelOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientReadLatestAuthorizationModelOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientWriteAuthorizationModelOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientWriteAuthorizationModelOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientWriteAuthorizationModelOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/ClientWriteTuplesOptions.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | import java.util.Map; 5 | 6 | public class ClientWriteTuplesOptions implements AdditionalHeadersSupplier { 7 | private Map additionalHeaders; 8 | 9 | public ClientWriteTuplesOptions additionalHeaders(Map additionalHeaders) { 10 | this.additionalHeaders = additionalHeaders; 11 | return this; 12 | } 13 | 14 | @Override 15 | public Map getAdditionalHeaders() { 16 | return this.additionalHeaders; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/api/configuration/CredentialsMethod.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{configPackage}}; 3 | 4 | /** 5 | * Mutually exclusive methods for delivering credentials. 6 | */ 7 | public enum CredentialsMethod { 8 | /** 9 | * No credentials. 10 | */ 11 | NONE, 12 | 13 | /** 14 | * A static API token. In OAuth2 terms, this indicates an "access token" 15 | * that will be used to make a request. When used as part of {@link Configuration} 16 | * then an {@link ApiToken} should also be defined. 17 | */ 18 | API_TOKEN, 19 | 20 | /** 21 | * OAuth2 client credentials that can be used to acquire an OAuth2 access 22 | * token. When used as part of {@link Configuration} then a 23 | * {@link ClientCredentials} should also be defined. 24 | */ 25 | CLIENT_CREDENTIALS; 26 | } -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaApiAuthenticationError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | import java.net.http.HttpHeaders; 4 | 5 | public class FgaApiAuthenticationError extends FgaError { 6 | public FgaApiAuthenticationError( 7 | String message, Throwable cause, int code, HttpHeaders responseHeaders, String responseBody) { 8 | super(message, cause, code, responseHeaders, responseBody); 9 | } 10 | 11 | public FgaApiAuthenticationError(String message, int code, HttpHeaders responseHeaders, String responseBody) { 12 | super(message, code, responseHeaders, responseBody); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaApiInternalError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | import java.net.http.HttpHeaders; 4 | 5 | public class FgaApiInternalError extends FgaError { 6 | public FgaApiInternalError( 7 | String message, Throwable cause, int code, HttpHeaders responseHeaders, String responseBody) { 8 | super(message, cause, code, responseHeaders, responseBody); 9 | } 10 | 11 | public FgaApiInternalError(String message, int code, HttpHeaders responseHeaders, String responseBody) { 12 | super(message, code, responseHeaders, responseBody); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaApiNotFoundError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | import java.net.http.HttpHeaders; 4 | 5 | public class FgaApiNotFoundError extends FgaError { 6 | public FgaApiNotFoundError( 7 | String message, Throwable cause, int code, HttpHeaders responseHeaders, String responseBody) { 8 | super(message, cause, code, responseHeaders, responseBody); 9 | } 10 | 11 | public FgaApiNotFoundError(String message, int code, HttpHeaders responseHeaders, String responseBody) { 12 | super(message, code, responseHeaders, responseBody); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaApiRateLimitExceededError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | import java.net.http.HttpHeaders; 4 | 5 | public class FgaApiRateLimitExceededError extends FgaError { 6 | public FgaApiRateLimitExceededError( 7 | String message, Throwable cause, int code, HttpHeaders responseHeaders, String responseBody) { 8 | super(message, cause, code, responseHeaders, responseBody); 9 | } 10 | 11 | public FgaApiRateLimitExceededError(String message, int code, HttpHeaders responseHeaders, String responseBody) { 12 | super(message, code, responseHeaders, responseBody); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaApiValidationError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | import java.net.http.HttpHeaders; 4 | 5 | public class FgaApiValidationError extends FgaError { 6 | public FgaApiValidationError( 7 | String message, Throwable cause, int code, HttpHeaders responseHeaders, String responseBody) { 8 | super(message, cause, code, responseHeaders, responseBody); 9 | } 10 | 11 | public FgaApiValidationError(String message, int code, HttpHeaders responseHeaders, String responseBody) { 12 | super(message, code, responseHeaders, responseBody); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaInvalidParameterException.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | public class FgaInvalidParameterException extends Exception { 4 | public FgaInvalidParameterException(String message) { 5 | super(message); 6 | } 7 | 8 | public FgaInvalidParameterException(String paramName, String functionName) { 9 | super(message(paramName, functionName)); 10 | } 11 | 12 | public FgaInvalidParameterException(String paramName, String functionName, Throwable cause) { 13 | super(message(paramName, functionName), cause); 14 | } 15 | 16 | private static String message(String paramName, String functionName) { 17 | return String.format("Required parameter %s was invalid when calling %s.", paramName, functionName); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/errors/FgaValidationError.java.mustache: -------------------------------------------------------------------------------- 1 | package {{errorsPackage}}; 2 | 3 | public class FgaValidationError extends Exception { 4 | private final String field; 5 | 6 | public FgaValidationError(String field, String message) { 7 | super(message); 8 | this.field = field; 9 | } 10 | 11 | public String getField() { 12 | return field; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Attribute.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | /** 5 | * Represents an attribute in telemetry data. 6 | */ 7 | public class Attribute { 8 | private final String name; 9 | 10 | /** 11 | * Constructs a new Attribute object with the specified name. 12 | * 13 | * @param name the name of the attribute 14 | */ 15 | public Attribute(String name) { 16 | this.name = name; 17 | } 18 | 19 | /** 20 | * Returns the name of the attribute. 21 | * 22 | * @return the name of the attribute 23 | */ 24 | public String getName() { 25 | return name; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Counter.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | /** 5 | * Represents a counter used for telemetry purposes. 6 | */ 7 | public class Counter extends Metric { 8 | /** 9 | * Constructs a new Counter with the specified name, unit, and description. 10 | * 11 | * @param name the name of the counter 12 | * @param description the description of the counter 13 | */ 14 | public Counter(String name, String description) { 15 | super(name, description); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Counters.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | /** 5 | * The Counters class represents telemetry counters used in the OpenFGA SDK. 6 | */ 7 | public class Counters { 8 | /** 9 | * The CREDENTIALS_REQUEST counter represents the number of times an access token is requested. 10 | */ 11 | public static final Counter CREDENTIALS_REQUEST = new Counter( 12 | "fga-client.credentials.request", 13 | "The total number of times new access tokens have been requested using ClientCredentials."); 14 | 15 | private Counters() {} // Instantiation prevented. 16 | } 17 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Histogram.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | /** 5 | * Represents a histogram for telemetry data. 6 | */ 7 | public class Histogram extends Metric { 8 | private final String unit; 9 | 10 | /** 11 | * Constructs a Histogram object with the specified name, unit, and description. 12 | * 13 | * @param name the name of the histogram 14 | * @param unit the unit of measurement for the histogram 15 | * @param description the description of the histogram 16 | */ 17 | public Histogram(String name, String unit, String description) { 18 | super(name, description); 19 | this.unit = unit; 20 | } 21 | 22 | /** 23 | * Constructs a Histogram object with the specified name and description. The unit of measurement is set to "milliseconds" by default. 24 | * 25 | * @param name the name of the histogram 26 | * @param description the description of the histogram 27 | */ 28 | public Histogram(String name, String description) { 29 | super(name, description); 30 | this.unit = "milliseconds"; 31 | } 32 | 33 | /** 34 | * Returns the unit of measurement for the histogram. 35 | */ 36 | public String getUnit() { 37 | return unit; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Histograms.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | /** 5 | * The Histograms class represents a collection of predefined histograms for telemetry purposes. 6 | */ 7 | public class Histograms { 8 | /** 9 | * A histogram for measuring the total time (in milliseconds) it took for the request to complete, including the time it took to send the request and receive the response. 10 | */ 11 | public static final Histogram REQUEST_DURATION = new Histogram( 12 | "fga-client.request.duration", 13 | "The total time (in milliseconds) it took for the request to complete, including the time it took to send the request and receive the response."); 14 | 15 | /** 16 | * A histogram for measuring the total time it took (in milliseconds) for the FGA server to process and evaluate the request. 17 | */ 18 | public static final Histogram QUERY_DURATION = new Histogram( 19 | "fga-client.query.duration", 20 | "The total time it took (in milliseconds) for the FGA server to process and evaluate the request."); 21 | 22 | private Histograms() {} // Instantiation prevented. 23 | } 24 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Metric.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | public class Metric { 5 | private final String name; 6 | private final String description; 7 | 8 | /** 9 | * Constructs a new metric with the specified name and description. 10 | * 11 | * @param name the name of the counter 12 | * @param description the description of the counter 13 | */ 14 | public Metric(String name, String description) { 15 | this.name = name; 16 | this.description = description; 17 | } 18 | 19 | /** 20 | * Returns the name of the metric. 21 | */ 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | /** 27 | * Returns the description of the metric. 28 | */ 29 | public String getDescription() { 30 | return description; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/telemetry/Telemetry.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import {{configPackage}}.Configuration; 5 | 6 | /** 7 | * The Telemetry class provides access to telemetry-related functionality. 8 | */ 9 | public class Telemetry { 10 | private Configuration configuration = null; 11 | private Metrics metrics = null; 12 | 13 | public Telemetry(Configuration configuration) { 14 | this.configuration = configuration; 15 | } 16 | 17 | /** 18 | * Returns a Metrics singleton for collecting telemetry data. 19 | * If the Metrics singleton has not previously been initialized, it will be created. 20 | */ 21 | public Metrics metrics() { 22 | if (metrics == null) { 23 | metrics = new Metrics(configuration); 24 | } 25 | 26 | return metrics; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /config/clients/java/template/src/main/util/Validation.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{utilPackage}}; 3 | 4 | import static {{utilPackage}}.StringUtil.isNullOrWhitespace; 5 | import {{errorsPackage}}.FgaInvalidParameterException; 6 | 7 | public class Validation { 8 | private Validation() {} // Instantiation prevented for utility class. 9 | 10 | public static void assertParamExists(Object obj, String name, String context) throws FgaInvalidParameterException { 11 | if (obj == null || obj instanceof String && isNullOrWhitespace((String) obj)) { 12 | throw new FgaInvalidParameterException(name, context); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test-integration/package-info.java.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * This is an autogenerated Java SDK for OpenFGA. 3 | * It provides a wrapper around the OpenFGA API definition. 4 | *

5 | * Most interaction should be centered around the high-level {@link {{clientPackage}}.OpenFgaClient}. 6 | * 7 | * @see OpenFGA Docs 8 | * @see Source 9 | */ 10 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/AttributeTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class AttributeTest { 9 | @Test 10 | void shouldGetName() { 11 | // given 12 | String attributeName = "testAttribute"; 13 | Attribute attribute = new Attribute(attributeName); 14 | 15 | // when 16 | String result = attribute.getName(); 17 | 18 | // then 19 | assertThat(result).isEqualTo(attributeName); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/CounterTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class CounterTest { 9 | @Test 10 | void shouldCreateCounter() { 11 | // given 12 | String name = "testCounter"; 13 | String description = "A counter for testing"; 14 | 15 | // when 16 | Counter counter = new Counter(name, description); 17 | 18 | // then 19 | assertThat(counter.getName()).isEqualTo(name); 20 | assertThat(counter.getDescription()).isEqualTo(description); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/CountersTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class CountersTest { 9 | @Test 10 | void shouldCreateCredentialsRequestCounter() { 11 | // given 12 | String expectedName = "fga-client.credentials.request"; 13 | String expectedDescription = 14 | "The total number of times new access tokens have been requested using ClientCredentials."; 15 | 16 | // when 17 | Counter counter = Counters.CREDENTIALS_REQUEST; 18 | 19 | // then 20 | assertThat(counter.getName()).isEqualTo(expectedName); 21 | assertThat(counter.getDescription()).isEqualTo(expectedDescription); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/HistogramTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class HistogramTest { 9 | @Test 10 | void shouldCreateHistogramWithUnit() { 11 | // given 12 | String name = "testHistogram"; 13 | String unit = "seconds"; 14 | String description = "A histogram for testing"; 15 | 16 | // when 17 | Histogram histogram = new Histogram(name, unit, description); 18 | 19 | // then 20 | assertThat(histogram.getName()).isEqualTo(name); 21 | assertThat(histogram.getDescription()).isEqualTo(description); 22 | assertThat(histogram.getUnit()).isEqualTo(unit); 23 | } 24 | 25 | @Test 26 | void shouldCreateHistogramWithDefaultMillisecondsUnit() { 27 | // given 28 | String name = "testHistogram"; 29 | String description = "A histogram for testing"; 30 | 31 | // when 32 | Histogram histogram = new Histogram(name, description); 33 | 34 | // then 35 | assertThat(histogram.getName()).isEqualTo(name); 36 | assertThat(histogram.getDescription()).isEqualTo(description); 37 | assertThat(histogram.getUnit()).isEqualTo("milliseconds"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/MetricTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class MetricTest { 9 | @Test 10 | void shouldCreateMetric() { 11 | // given 12 | String name = "testMetric"; 13 | String description = "A metric for testing"; 14 | 15 | // when 16 | Metric metric = new Metric(name, description); 17 | 18 | // then 19 | assertThat(metric.getName()).isEqualTo(name); 20 | assertThat(metric.getDescription()).isEqualTo(description); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/java/template/src/test/telemetry/TelemetryTest.java.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{telemetryPackage}}; 3 | 4 | import static org.assertj.core.api.Assertions.assertThat; 5 | 6 | import {{configPackage}}.Configuration; 7 | import org.junit.jupiter.api.Test; 8 | 9 | class TelemetryTest { 10 | @Test 11 | void shouldBeASingletonMetricsInitialization() { 12 | // given 13 | Telemetry telemetry = new Telemetry(new Configuration()); 14 | 15 | // when 16 | Metrics firstCall = telemetry.metrics(); 17 | Metrics secondCall = telemetry.metrics(); 18 | 19 | // then 20 | assertThat(firstCall).isNotNull().isSameAs(secondCall); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/java/template/typeInfoAnnotation.mustache: -------------------------------------------------------------------------------- 1 | {{#jackson}} 2 | 3 | @JsonIgnoreProperties( 4 | value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization 5 | allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization 6 | ) 7 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) 8 | {{#discriminator.mappedModels}} 9 | {{#-first}} 10 | @JsonSubTypes({ 11 | {{/-first}} 12 | @JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), 13 | {{#-last}} 14 | }) 15 | {{/-last}} 16 | {{/discriminator.mappedModels}} 17 | {{/jackson}} 18 | -------------------------------------------------------------------------------- /config/clients/js/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | .npmignore 2 | -------------------------------------------------------------------------------- /config/clients/js/generator.txt: -------------------------------------------------------------------------------- 1 | typescript-axios 2 | -------------------------------------------------------------------------------- /config/clients/js/template/.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /config/clients/js/template/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "es2021": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended" 10 | ], 11 | "parser": "@typescript-eslint/parser", 12 | "parserOptions": { 13 | "ecmaVersion": 13, 14 | "sourceType": "module" 15 | }, 16 | "plugins": [ 17 | "@typescript-eslint" 18 | ], 19 | "rules": { 20 | "@typescript-eslint/no-unused-vars": ["warn"], 21 | "@typescript-eslint/no-explicit-any": ["warn"], 22 | "@typescript-eslint/no-require-imports":["error", { allowAsImport: true }], 23 | "indent": [ 24 | "error", 25 | 2 26 | ], 27 | "linebreak-style": [ 28 | "error", 29 | "unix" 30 | ], 31 | "quotes": [ 32 | "error", 33 | "double" 34 | ], 35 | "semi": [ 36 | "error", 37 | "always" 38 | ] 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /config/clients/js/template/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | exclude-patterns: 12 | - "eslint" 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | groups: 18 | dependencies: 19 | patterns: 20 | - "*" 21 | -------------------------------------------------------------------------------- /config/clients/js/template/.madgerc: -------------------------------------------------------------------------------- 1 | { 2 | "detectiveOptions": { 3 | "ts": { 4 | "skipTypeImports": true 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /config/clients/js/template/README_custom_badges.mustache: -------------------------------------------------------------------------------- 1 | [![npm](https://img.shields.io/npm/v/{{packageName}}.svg?style=flat)](https://www.npmjs.com/package/{{packageName}}) 2 | -------------------------------------------------------------------------------- /config/clients/js/template/README_installation.mustache: -------------------------------------------------------------------------------- 1 | Using [npm](https://npmjs.org): 2 | 3 | ```shell 4 | npm install {{packageName}} 5 | ``` 6 | 7 | Using [yarn](https://yarnpkg.com): 8 | 9 | ```shell 10 | yarn add {{packageName}} 11 | ``` -------------------------------------------------------------------------------- /config/clients/js/template/README_license_disclaimer.mustache: -------------------------------------------------------------------------------- 1 | The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [typescript-axios template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/typescript-axios) and [go template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/go), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). -------------------------------------------------------------------------------- /config/clients/js/template/README_models.mustache: -------------------------------------------------------------------------------- 1 | [Models](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/blob/main/apiModel.ts) 2 | -------------------------------------------------------------------------------- /config/clients/js/template/README_retries.mustache: -------------------------------------------------------------------------------- 1 | If a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to {{defaultMaxRetry}} times with a minimum wait time of {{defaultMinWaitInMs}} milliseconds between each attempt. 2 | 3 | To customize this behavior, create an object with `maxRetry` and `minWaitInMs` properties. `maxRetry` determines the maximum number of retries (up to {{retryMaxAllowedNumber}}), while `minWaitInMs` sets the minimum wait time between retries in milliseconds. 4 | 5 | Apply your custom retry values by setting to `retryParams` on the configuration object passed to the `OpenFgaClient` call. 6 | 7 | ```javascript 8 | const { OpenFgaClient } = require('@openfga/sdk'); // OR import { OpenFgaClient } from '@openfga/sdk'; 9 | 10 | const fgaClient = new OpenFgaClient({ 11 | apiUrl: process.env.FGA_API_URL, // required 12 | storeId: process.env.FGA_STORE_ID, // not needed when calling `CreateStore` or `ListStores` 13 | authorizationModelId: process.env.FGA_MODEL_ID, // Optional, can be overridden per request 14 | retryParams: { 15 | maxRetry: 3, // retry up to 3 times on API requests 16 | minWaitInMs: 250 // wait a minimum of 250 milliseconds between requests 17 | } 18 | }); 19 | ``` -------------------------------------------------------------------------------- /config/clients/js/template/api.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | {{^withSeparateModelsAndApi}} 4 | import globalAxios, { AxiosInstance } from 'axios'; 5 | 6 | import { BaseAPI } from './base'; 7 | import { 8 | DUMMY_BASE_URL, 9 | setSearchParams, 10 | serializeDataIfNeeded, 11 | toPathString, 12 | createRequestFunction, 13 | RequestArgs, 14 | CallResult, 15 | PromiseResult 16 | } from './common'; 17 | import { Configuration } from './configuration'; 18 | import { Credentials } from "./credentials"; 19 | import { assertParamExists } from './validation'; 20 | 21 | import { 22 | {{#models}} 23 | {{#model}}{{classname}},{{/model}} 24 | {{/models}} 25 | } from './apiModel'; 26 | import { TelemetryAttribute, TelemetryAttributes } from "./telemetry/attributes"; 27 | 28 | {{#apiInfo}}{{#apis}} 29 | {{>apiInner}} 30 | {{/apis}}{{/apiInfo}} 31 | {{/withSeparateModelsAndApi}}{{#withSeparateModelsAndApi}} 32 | {{#apiInfo}}{{#apis}}{{#operations}}export * from './{{tsApiPackage}}/{{classFilename}}'; 33 | {{/operations}}{{/apis}}{{/apiInfo}} 34 | {{/withSeparateModelsAndApi}} 35 | -------------------------------------------------------------------------------- /config/clients/js/template/apiModel.mustache: -------------------------------------------------------------------------------- 1 | {{^withSeparateModelsAndApi}} 2 | /* tslint:disable */ 3 | /* eslint-disable */ 4 | {{>partial_header}} 5 | 6 | {{#models}} 7 | {{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{^isEnum}}{{^oneOf}}{{>modelGeneric}}{{/oneOf}}{{/isEnum}}{{/model}} 8 | {{/models}} 9 | 10 | {{/withSeparateModelsAndApi}} -------------------------------------------------------------------------------- /config/clients/js/template/credentials/index.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export * from "./credentials"; 4 | export * from "./types"; 5 | -------------------------------------------------------------------------------- /config/clients/js/template/example/Makefile: -------------------------------------------------------------------------------- 1 | all: run 2 | 3 | project_name=example1 4 | openfga_version=latest 5 | 6 | setup: 7 | npm --prefix "${project_name}" install 8 | 9 | run: 10 | npm --prefix "${project_name}" run start 11 | 12 | run-openfga: 13 | docker pull docker.io/openfga/openfga:${openfga_version} && \ 14 | docker run -p 8080:8080 docker.io/openfga/openfga:${openfga_version} run -------------------------------------------------------------------------------- /config/clients/js/template/example/example1/package.json.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example1", 3 | "private": "true", 4 | "version": "1.0.0", 5 | "description": "A bare bones example of using the OpenFGA SDK", 6 | "author": "OpenFGA", 7 | "license": "Apache-2.0", 8 | "scripts": { 9 | "start": "node example1.mjs" 10 | }, 11 | "dependencies": { 12 | "@openfga/sdk": "^{{packageVersion}}" 13 | }, 14 | "engines": { 15 | "node": ">=16.13.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /config/clients/js/template/example/opentelemetry/.env.example: -------------------------------------------------------------------------------- 1 | # Configuration for OpenFGA 2 | FGA_CLIENT_ID= 3 | FGA_API_TOKEN_ISSUER= 4 | FGA_API_AUDIENCE= 5 | FGA_CLIENT_SECRET= 6 | FGA_STORE_ID= 7 | FGA_AUTHORIZATION_MODEL_ID= 8 | FGA_API_URL="http://localhost:8080" 9 | 10 | # Configuration for OpenTelemetry 11 | OTEL_SERVICE_NAME="openfga-opentelemetry-example" -------------------------------------------------------------------------------- /config/clients/js/template/example/opentelemetry/.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false -------------------------------------------------------------------------------- /config/clients/js/template/example/opentelemetry/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry usage with OpenFGA's JS SDK 2 | 3 | This example demonstrates how you can use OpenTelemetry with OpenFGA's JS SDK. 4 | 5 | ## Prerequisites 6 | 7 | If you do not already have an OpenFGA instance running, you can start one using the following command: 8 | 9 | ```bash 10 | docker run -d -p 8080:8080 openfga/openfga 11 | ``` 12 | 13 | You need to have an OpenTelemetry collector running to receive data. A pre-configured collector is available using Docker: 14 | 15 | ```bash 16 | git clone https://github.com/ewanharris/opentelemetry-collector-dev-setup.git 17 | cd opentelemetry-collector-dev-setup 18 | docker-compose up -d 19 | ``` 20 | 21 | ## Configure the example 22 | 23 | You need to configure the example for your environment: 24 | 25 | ```bash 26 | cp .env.example .env 27 | ``` 28 | 29 | Now edit the `.env` file and set the values as appropriate. 30 | 31 | ## Running the example 32 | 33 | Begin by installing the required dependencies: 34 | 35 | ```bash 36 | npm i 37 | ``` 38 | 39 | Next, run the example: 40 | 41 | ```bash 42 | npm start 43 | ``` -------------------------------------------------------------------------------- /config/clients/js/template/example/opentelemetry/instrumentation.mjs: -------------------------------------------------------------------------------- 1 | import "dotenv/config"; 2 | import { NodeSDK } from "@opentelemetry/sdk-node"; 3 | import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics"; 4 | import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto"; 5 | import process from "process"; 6 | 7 | const sdk = new NodeSDK({ 8 | metricReader: new PeriodicExportingMetricReader({ 9 | exportIntervalMillis: 5000, 10 | exporter: new OTLPMetricExporter({ 11 | concurrencyLimit: 1, 12 | }), 13 | }), 14 | }); 15 | sdk.start(); 16 | 17 | process.on("exit", () => { 18 | sdk 19 | .shutdown() 20 | .then( 21 | () => console.log("SDK shut down successfully"), 22 | (err) => console.log("Error shutting down SDK", err) 23 | ) 24 | .finally(() => process.exit(0)); 25 | }); -------------------------------------------------------------------------------- /config/clients/js/template/example/opentelemetry/package.json.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openfga-opentelemetry-example", 3 | "private": "true", 4 | "version": "1.0.0", 5 | "description": "A bare bones example of using the OpenFGA SDK with OpenTelemetry metrics reporting", 6 | "author": "OpenFGA", 7 | "license": "Apache-2.0", 8 | "scripts": { 9 | "start": "node --import ./instrumentation.mjs opentelemetry.mjs" 10 | }, 11 | "dependencies": { 12 | "@openfga/sdk": "file:../../", 13 | "@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1", 14 | "@opentelemetry/exporter-prometheus": "^0.52.1", 15 | "@opentelemetry/sdk-metrics": "^1.25.1", 16 | "@opentelemetry/sdk-node": "^0.52.1", 17 | "dotenv": "^16.4.5" 18 | }, 19 | "engines": { 20 | "node": ">=16.13.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/clients/js/template/gitignore_custom.mustache: -------------------------------------------------------------------------------- 1 | wwwroot/*.js 2 | node_modules 3 | typings 4 | dist 5 | coverage 6 | -------------------------------------------------------------------------------- /config/clients/js/template/index.mustache: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | {{>partial_header}} 4 | 5 | export * from "./api"; 6 | export * from "./client"; 7 | export * from "./apiModel"; 8 | export { Configuration, UserConfigurationParams, GetDefaultRetryParams } from "./configuration"; 9 | export { Credentials, CredentialsMethod } from "./credentials"; 10 | export * from "./telemetry/attributes"; 11 | export * from "./telemetry/configuration"; 12 | export * from "./telemetry/counters"; 13 | export * from "./telemetry/histograms"; 14 | export * from "./telemetry/metrics"; 15 | export * from "./errors"; 16 | 17 | {{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}} 18 | -------------------------------------------------------------------------------- /config/clients/js/template/model.mustache: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | {{>partial_header}} 4 | {{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}} 5 | import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}} 6 | import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}} 7 | import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}} 8 | {{#models}}{{#model}} 9 | {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}} 10 | {{/model}}{{/models}} 11 | -------------------------------------------------------------------------------- /config/clients/js/template/modelAllOf.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {{classname}}{{#description}} 3 | * {{{description}}}{{/description}} 4 | * @export 5 | */ 6 | export type {{classname}} = {{#allOf}}{{{.}}}{{^-last}} & {{/-last}}{{/allOf}}; 7 | -------------------------------------------------------------------------------- /config/clients/js/template/modelEnum.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * {{{description}}} 3 | * @export 4 | * @enum {string} 5 | */ 6 | {{#isBoolean}} 7 | export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}} 8 | {{/isBoolean}} 9 | 10 | {{^isBoolean}} 11 | export enum {{classname}} { 12 | {{#allowableValues}} 13 | {{#enumVars}} 14 | {{#enumDescription}} 15 | /** 16 | * {{enumDescription}} 17 | */ 18 | {{/enumDescription}} 19 | {{{name}}} = {{{value}}}{{^-last}},{{/-last}} 20 | {{/enumVars}} 21 | {{/allowableValues}} 22 | } 23 | {{/isBoolean}} 24 | -------------------------------------------------------------------------------- /config/clients/js/template/modelGeneric.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * {{{description}}} 3 | * @export 4 | * @interface {{classname}} 5 | */ 6 | export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ 7 | {{#additionalPropertiesType}} 8 | [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; 9 | 10 | {{/additionalPropertiesType}} 11 | {{#vars}} 12 | /** 13 | * {{{description}}} 14 | * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> 15 | * @memberof {{classname}} 16 | {{#deprecated}} 17 | * @deprecated 18 | {{/deprecated}} 19 | */ 20 | {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; 21 | {{/vars}} 22 | }{{#hasEnums}} 23 | 24 | {{#vars}} 25 | {{#isEnum}} 26 | /** 27 | * @export 28 | * @enum {string} 29 | */ 30 | export enum {{enumName}} { 31 | {{#allowableValues}} 32 | {{#enumVars}} 33 | {{#enumDescription}} 34 | /** 35 | * {{enumDescription}} 36 | */ 37 | {{/enumDescription}} 38 | {{{name}}} = {{{value}}}{{^-last}},{{/-last}} 39 | {{/enumVars}} 40 | {{/allowableValues}} 41 | } 42 | {{/isEnum}} 43 | {{/vars}} 44 | {{/hasEnums}} 45 | -------------------------------------------------------------------------------- /config/clients/js/template/modelIndex.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}export * from './{{classFilename}}';{{/model}} 2 | {{/models}} -------------------------------------------------------------------------------- /config/clients/js/template/modelOneOf.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {{classname}}{{#description}} 3 | * {{{description}}}{{/description}} 4 | * @export 5 | */ 6 | export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}}; 7 | -------------------------------------------------------------------------------- /config/clients/js/template/npmignore: -------------------------------------------------------------------------------- 1 | # empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm -------------------------------------------------------------------------------- /config/clients/js/template/npmrc.mustache: -------------------------------------------------------------------------------- 1 | registry={{npmRegistry}} 2 | sign-git-tag=true 3 | -------------------------------------------------------------------------------- /config/clients/js/template/telemetry/counters.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export interface TelemetryCounter { 4 | name: string; 5 | unit: string; 6 | description: string; 7 | } 8 | 9 | export class TelemetryCounters { 10 | static credentialsRequest: TelemetryCounter = { 11 | name: "fga-client.credentials.request", 12 | unit: "milliseconds", 13 | description: "The number of times an access token is requested.", 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /config/clients/js/template/telemetry/histograms.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export interface TelemetryHistogram { 4 | name: string; 5 | unit: string; 6 | description: string; 7 | } 8 | 9 | export class TelemetryHistograms { 10 | static requestDuration: TelemetryHistogram = { 11 | name: "fga-client.request.duration", 12 | unit: "milliseconds", 13 | description: "How long it took for a request to be fulfilled.", 14 | }; 15 | 16 | static queryDuration: TelemetryHistogram = { 17 | name: "fga-client.query.duration", 18 | unit: "milliseconds", 19 | description: "How long it took to perform a query request.", 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/helpers/index.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export { getNocks } from "./nocks"; 4 | export { baseConfig, defaultConfiguration } from "./default-config"; 5 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | rootDir: "../", 4 | testEnvironment: "node", 5 | moduleFileExtensions: ["js", "d.ts", "ts", "json"], 6 | collectCoverage: true, 7 | coverageReporters: ["text", "cobertura", "lcov"], 8 | collectCoverageFrom: [ 9 | "**/**.{ts,tsx,js,jsx}", 10 | "!**/**.d.ts", 11 | "!**/**.eslintrc.js", 12 | "!**/coverage/**", 13 | "!**/dist/**", 14 | "!**/example/**", 15 | "!**/node_modules/**", 16 | "!**/tests/**", 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/telemetry/counters.test.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import { TelemetryCounters } from "../../telemetry/counters"; 4 | 5 | describe("TelemetryCounters", () => { 6 | test("should have correct counter details", () => { 7 | expect(TelemetryCounters.credentialsRequest.name).toBe("fga-client.credentials.request"); 8 | expect(TelemetryCounters.credentialsRequest.unit).toBe("milliseconds"); 9 | expect(TelemetryCounters.credentialsRequest.description).toBe("The number of times an access token is requested."); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/telemetry/histograms.test.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import { TelemetryHistograms } from "../../telemetry/histograms"; 4 | 5 | describe("TelemetryHistograms", () => { 6 | test("should have correct histogram details for request duration", () => { 7 | expect(TelemetryHistograms.requestDuration.name).toBe("fga-client.request.duration"); 8 | expect(TelemetryHistograms.requestDuration.unit).toBe("milliseconds"); 9 | expect(TelemetryHistograms.requestDuration.description).toBe("How long it took for a request to be fulfilled."); 10 | }); 11 | 12 | test("should have correct histogram details for query duration", () => { 13 | expect(TelemetryHistograms.queryDuration.name).toBe("fga-client.query.duration"); 14 | expect(TelemetryHistograms.queryDuration.unit).toBe("milliseconds"); 15 | expect(TelemetryHistograms.queryDuration.description).toBe("How long it took to perform a query request."); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["jest", "node"], 5 | "noEmit": true, 6 | "rootDir": "../" 7 | }, 8 | "include": [ 9 | "../**/*.ts", 10 | "./*.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /config/clients/js/template/tests/validation.test.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import { isWellFormedUlidString } from "../validation"; 4 | 5 | describe("validation.ts", () => { 6 | describe("isWellFormedUlidString", () => { 7 | it("should return true on valid ulids", async () => { 8 | const ulids: string[] = [ 9 | "01H0GVCS1HCQM6SJRJ4A026FZ9", 10 | "01H0GVD9ACPFKGMWJV0Y93ZM7H", 11 | "01H0GVDH0FRZ4WAFED6T9KZYZR", 12 | "01H0GVDSW72AZ8QV3R0HJ91QBX", 13 | ]; 14 | ulids.forEach(ulid => { 15 | const result = isWellFormedUlidString(ulid); 16 | expect(result).toBe(true); 17 | }); 18 | }); 19 | 20 | it("should return false on invalid ulids", async () => { 21 | const ulids: string[] = [ 22 | "abc", 23 | 123 as any, 24 | null, 25 | "01H0GVDSW72AZ8QV3R0HJ91QBXa", 26 | "b523ad13-8adb-4803-a6db-013ac50197ca", 27 | "9240BFC0-DA00-457B-A328-FC370A598D60", 28 | ]; 29 | ulids.forEach(ulid => { 30 | const result = isWellFormedUlidString(ulid); 31 | expect(result).toBe(false); 32 | }); 33 | }); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /config/clients/js/template/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "es2020", 5 | "module": "commonjs", 6 | "noImplicitAny": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "rootDir": ".", 10 | "typeRoots": [ 11 | "node_modules/@types" 12 | ] 13 | }, 14 | "exclude": [ 15 | "dist", 16 | "node_modules", 17 | "**/*.test.ts", 18 | "tests" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /config/clients/js/template/tsconfig.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", 5 | "module": "commonjs", 6 | "noImplicitAny": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "rootDir": ".", 10 | {{^supportsES6}} 11 | "lib": [ 12 | "es6", 13 | "dom" 14 | ], 15 | {{/supportsES6}} 16 | "typeRoots": [ 17 | "node_modules/@types" 18 | ] 19 | }, 20 | "exclude": [ 21 | "dist", 22 | "node_modules", 23 | "**/*.test.ts", 24 | "tests" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/assert-never.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export function assertNever(value: never): never { 4 | throw new Error(`Assertion failed. Unacceptable value: '${value}'`); 5 | } 6 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/chunk-array.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export function chunkArray(inputArray: T[], maxChunkSize: number): T[][] { 4 | const arrayOfArrays = []; 5 | 6 | const inputArrayClone = [...inputArray]; 7 | while (inputArrayClone.length > 0) { 8 | arrayOfArrays.push(inputArrayClone.splice(0, maxChunkSize)); 9 | } 10 | 11 | return arrayOfArrays; 12 | } 13 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/generate-random-id.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import { randomUUID, randomBytes } from "crypto"; 4 | 5 | /** 6 | * Generates a random ID 7 | * 8 | * Note: May not return a valid value on older browsers - we're fine with this for now 9 | */ 10 | export function generateRandomId(): string | undefined { 11 | if (typeof randomUUID === "function") { 12 | return randomUUID(); 13 | } 14 | 15 | if (typeof randomBytes === "function") { 16 | // Fallback for older node versions 17 | return randomBytes(20).toString("hex"); 18 | } 19 | 20 | // For older browsers 21 | return; 22 | } 23 | 24 | export function generateRandomIdWithNonUniqueFallback(): string { 25 | return generateRandomId() || "00000000-0000-0000-0000-000000000000"; 26 | } 27 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/index.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export * from "./assert-never"; 4 | export * from "./chunk-array"; 5 | export * from "./generate-random-id"; 6 | export * from "./set-header-if-not-set"; 7 | export * from "./set-not-enumerable-property"; 8 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/set-header-if-not-set.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export function setHeaderIfNotSet(headers: Record, key: string, value: string): void { 4 | if (!headers[key] && value) { 5 | headers[key] = value; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /config/clients/js/template/utils/set-not-enumerable-property.ts.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | export function setNotEnumerableProperty(entity: object, property: string, value: T) { 4 | Object.defineProperty(entity, property, { 5 | enumerable: false, 6 | writable: false, 7 | value: value 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /config/clients/js/template/validation.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import { FgaRequiredParamError } from "./errors"; 4 | 5 | /** 6 | * 7 | * @throws { FgaRequiredParamError } 8 | * @export 9 | */ 10 | export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { 11 | if (paramValue === null || paramValue === undefined) { 12 | throw new FgaRequiredParamError(functionName, paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); 13 | } 14 | }; 15 | 16 | /** 17 | * 18 | * @export 19 | */ 20 | export const isWellFormedUriString = (uri: string): boolean => { 21 | try { 22 | const uriResult = new URL(uri); 23 | return ((uriResult.toString() === uri || uriResult.toString() === `${uri}/`) && 24 | (uriResult.protocol === "https:" || uriResult.protocol === "http:")); 25 | } catch (err) { 26 | return false; 27 | } 28 | }; 29 | 30 | export const isWellFormedUlidString = (ulid: string): boolean => { 31 | const regex = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/; 32 | return !!(typeof ulid === "string" && ulid.match(regex)?.length); 33 | }; 34 | -------------------------------------------------------------------------------- /config/clients/python/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | git_push.sh 2 | test/* 3 | !test/__init__.py 4 | !test/test_open_fga_api.py 5 | !test/test_configuration.py 6 | !test/test_credentials.py 7 | !test/test_client.py 8 | !test/test_client_sync.py 9 | !test/test_open_fga_api_sync.py 10 | !test/test_validation.py 11 | !test/test_oauth2.py 12 | !test/test_oauth2_sync.py 13 | .github/workflows/python.yml 14 | .gitlab-ci.yml 15 | .travis.yml 16 | tox.ini 17 | setup.cfg 18 | -------------------------------------------------------------------------------- /config/clients/python/generator.txt: -------------------------------------------------------------------------------- 1 | python-legacy 2 | -------------------------------------------------------------------------------- /config/clients/python/template-source.json: -------------------------------------------------------------------------------- 1 | { 2 | "repo": "https://github.com/OpenAPITools/openapi-generator", 3 | "branch": "master", 4 | "commit": "fea42b547ed61dcfdfc479cab6f68a601ec5adde", 5 | "url": "https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python-legacy", 6 | "docs": "https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/python-legacy.md" 7 | } 8 | -------------------------------------------------------------------------------- /config/clients/python/template/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | groups: 8 | dependencies: 9 | patterns: 10 | - "*" 11 | ignore: 12 | - dependency-name: "urllib3" 13 | - package-ecosystem: "pip" 14 | directory: "/example/example1" 15 | schedule: 16 | interval: "monthly" 17 | groups: 18 | dependencies: 19 | patterns: 20 | - "*" 21 | - package-ecosystem: "github-actions" 22 | directory: "/" 23 | schedule: 24 | interval: "monthly" 25 | groups: 26 | dependencies: 27 | patterns: 28 | - "*" 29 | -------------------------------------------------------------------------------- /config/clients/python/template/.snyk: -------------------------------------------------------------------------------- 1 | language-settings: 2 | python: '3.10.6' -------------------------------------------------------------------------------- /config/clients/python/template/README_api_endpoints.mustache: -------------------------------------------------------------------------------- 1 | Class | Method | HTTP request | Description 2 | ------------ | ------------- | ------------- | ------------- 3 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{docPrefix}}{{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} 4 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} 5 | -------------------------------------------------------------------------------- /config/clients/python/template/README_common.mustache: -------------------------------------------------------------------------------- 1 | {{>README_calling_api}} 2 | 3 | {{>README_api_endpoints}} 4 | 5 | {{>README_models}} 6 | ## Author 7 | 8 | {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} 9 | {{/-last}}{{/apis}}{{/apiInfo}} 10 | -------------------------------------------------------------------------------- /config/clients/python/template/README_custom_badges.mustache: -------------------------------------------------------------------------------- 1 | [![pypi](https://img.shields.io/pypi/v/{{packageName}}.svg?style=flat)](https://pypi.org/project/{{packageName}}) 2 | -------------------------------------------------------------------------------- /config/clients/python/template/README_installation.mustache: -------------------------------------------------------------------------------- 1 | ### pip install 2 | 3 | #### PyPI 4 | 5 | The {{packageName}} is available to be downloaded via PyPI, you can install directly using: 6 | 7 | ```sh 8 | pip3 install {{packageName}} 9 | ``` 10 | (you may need to run `pip` with root permission: `sudo pip3 install {{packageName}}`) 11 | 12 | Then import the package: 13 | ```python 14 | import {{{packageName}}} 15 | ``` 16 | 17 | #### GitHub 18 | 19 | The {{packageName}} is also hosted in GitHub, you can install directly using: 20 | 21 | ```sh 22 | pip3 install https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git 23 | ``` 24 | (you may need to run `pip` with root permission: `sudo pip3 install https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`) 25 | 26 | Then import the package: 27 | ```python 28 | import {{{packageName}}} 29 | ``` 30 | 31 | ### Setuptools 32 | 33 | Install via [Setuptools](https://pypi.python.org/pypi/setuptools). 34 | 35 | ```sh 36 | python setup.py install --user 37 | ``` 38 | (or `sudo python setup.py install` to install the package for all users) 39 | 40 | Then import the package: 41 | ```python 42 | import {{{packageName}}} 43 | ``` 44 | -------------------------------------------------------------------------------- /config/clients/python/template/README_license_disclaimer.mustache: -------------------------------------------------------------------------------- 1 | The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [python legacy template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python-legacy), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE). 2 | -------------------------------------------------------------------------------- /config/clients/python/template/README_models.mustache: -------------------------------------------------------------------------------- 1 | ## Documentation For Models 2 | 3 | {{#models}}{{#model}} - [{{{classname}}}]({{docPrefix}}{{modelDocPath}}{{{classname}}}.md) 4 | {{/model}}{{/models}} 5 | -------------------------------------------------------------------------------- /config/clients/python/template/README_retries.mustache: -------------------------------------------------------------------------------- 1 | If a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to {{defaultMaxRetry}} times with a minimum wait time of {{defaultMinWaitInMs}} milliseconds between each attempt. 2 | 3 | To customize this behavior, create a `RetryParams` object and assign values to the `max_retry` and `min_wait_in_ms` constructor parameters. `max_retry` determines the maximum number of retries (up to {{retryMaxAllowedNumber}}), while `min_wait_in_ms` sets the minimum wait time between retries in milliseconds. 4 | 5 | Apply your custom retry values by passing the object to the `ClientConfiguration` constructor's `retry_params` parameter. 6 | 7 | ```python 8 | from {{packageName}} import ClientConfiguration, {{appShortName}}Client 9 | from {{packageName}}.configuration import RetryParams 10 | from os import environ 11 | 12 | async def main(): 13 | # Configure the client with custom retry settings 14 | config = ClientConfiguration( 15 | api_url=environ.get("FGA_API_URL"), 16 | retry_params=RetryParams(max_retry=3, min_wait_in_ms=250) 17 | ) 18 | 19 | # Create a client instance and read authorization models 20 | async with {{appShortName}}Client(config) as client: 21 | return await client.read_authorization_models() 22 | ``` 23 | -------------------------------------------------------------------------------- /config/clients/python/template/api.mustache: -------------------------------------------------------------------------------- 1 | {{>src/api.py}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/api_sync.mustache: -------------------------------------------------------------------------------- 1 | {{>src/sync/api.py}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/api_test.mustache: -------------------------------------------------------------------------------- 1 | {{>test/api_test.py}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/example/Makefile: -------------------------------------------------------------------------------- 1 | all: run 2 | 3 | project_name=example1 4 | openfga_version=latest 5 | 6 | setup: 7 | cd "${project_name}/" && pip3 install -r requirements.txt && cd - 8 | 9 | run: setup 10 | python3 "${project_name}/${project_name}.py" 11 | 12 | run-openfga: 13 | docker pull docker.io/openfga/openfga:${openfga_version} && \ 14 | docker run -p 8080:8080 docker.io/openfga/openfga:${openfga_version} run 15 | -------------------------------------------------------------------------------- /config/clients/python/template/example/example1/requirements.txt.mustache: -------------------------------------------------------------------------------- 1 | aiohttp >= 3.9.2 2 | aiosignal >= 1.3.1 3 | attrs >= 23.1.0 4 | frozenlist >= 1.4.1 5 | idna >= 3.6 6 | multidict >= 6.0.4 7 | openfga-sdk >= {{packageVersion}} 8 | python-dateutil >= 2.8.2 9 | urllib3 >= 2.1.0 10 | yarl >= 1.9.4 11 | python-dotenv >= 1, <2 12 | -------------------------------------------------------------------------------- /config/clients/python/template/example/example1/setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length=99 3 | -------------------------------------------------------------------------------- /config/clients/python/template/example/example1/setup.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from setuptools import find_packages, setup 4 | 5 | NAME = "example1" 6 | VERSION = "0.0.1" 7 | REQUIRES = ["openfga-sdk >= {{packageVersion}}"] 8 | 9 | setup( 10 | name=NAME, 11 | version=VERSION, 12 | description="An example of using the OpenFGA Python SDK", 13 | author="OpenFGA (https://openfga.dev)", 14 | author_email="community@openfga.dev", 15 | url="https://github.com/openfga/python-sdk", 16 | install_requires=REQUIRES, 17 | python_requires=">={{pythonMinimumRuntime}}", 18 | packages=find_packages(exclude=["test", "tests"]), 19 | include_package_data=True, 20 | license="Apache-2.0", 21 | ) 22 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/.env.example: -------------------------------------------------------------------------------- 1 | FGA_CLIENT_ID= 2 | FGA_API_TOKEN_ISSUER= 3 | FGA_API_AUDIENCE= 4 | FGA_CLIENT_SECRET= 5 | FGA_STORE_ID= 6 | FGA_AUTHORIZATION_MODEL_ID= 7 | FGA_API_URL="http://localhost:8080" 8 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry usage with OpenFGA's Python SDK 2 | 3 | This example demonstrates how you can use OpenTelemetry with OpenFGA's Python SDK. 4 | 5 | ## Prerequisites 6 | 7 | If you do not already have an OpenFGA instance running, you can start one using the following command: 8 | 9 | ```bash 10 | docker run -d -p 8080:8080 openfga/openfga 11 | ``` 12 | 13 | You need to have an OpenTelemetry collector running to receive data. A pre-configured collector is available using Docker: 14 | 15 | ```bash 16 | git clone https://github.com/ewanharris/opentelemetry-collector-dev-setup.git 17 | cd opentelemetry-collector-dev-setup 18 | docker-compose up -d 19 | ``` 20 | 21 | ## Configure the example 22 | 23 | You need to configure the example for your environment: 24 | 25 | ```bash 26 | cp .env.example .env 27 | ``` 28 | 29 | Now edit the `.env` file and set the values as appropriate. 30 | 31 | ## Running the example 32 | 33 | Begin by installing the required dependencies: 34 | 35 | ```bash 36 | pip install -r requirements.txt 37 | ``` 38 | 39 | Next, run the example: 40 | 41 | ```bash 42 | python main.py 43 | ``` 44 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/requirements.txt: -------------------------------------------------------------------------------- 1 | python-dotenv >= 1, <2 2 | opentelemetry-sdk >= 1, <2 3 | opentelemetry-exporter-otlp-proto-grpc >= 1.25, <2 4 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length=99 3 | -------------------------------------------------------------------------------- /config/clients/python/template/example/opentelemetry/setup.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from setuptools import find_packages, setup 4 | 5 | NAME = "openfga-opentelemetry-example" 6 | VERSION = "0.0.1" 7 | REQUIRES = [""] 8 | 9 | setup( 10 | name=NAME, 11 | version=VERSION, 12 | description="An example of using the OpenFGA Python SDK with OpenTelemetry", 13 | author="OpenFGA (https://openfga.dev)", 14 | author_email="community@openfga.dev", 15 | url="https://github.com/openfga/python-sdk", 16 | python_requires=">={{pythonMinimumRuntime}}", 17 | packages=find_packages(exclude=["test", "tests"]), 18 | include_package_data=True, 19 | license="Apache-2.0", 20 | ) 21 | -------------------------------------------------------------------------------- /config/clients/python/template/example/streamed-list-objects/README.md: -------------------------------------------------------------------------------- 1 | # Streamed List Objects Example 2 | 3 | This example demonstrates working with [OpenFGA's `/streamed-list-objects` endpoint](https://openfga.dev/api/service#/Relationship%20Queries/StreamedListObjects) using the Python SDK's `streamed_list_objects()` method. 4 | 5 | ## Prerequisites 6 | 7 | - Python 3.10+ 8 | - OpenFGA running on `localhost:8080` 9 | 10 | You can start OpenFGA with Docker by running the following command: 11 | 12 | ```bash 13 | docker pull openfga/openfga && docker run -it --rm -p 8080:8080 openfga/openfga run 14 | ``` 15 | 16 | ## Running the example 17 | 18 | No additional setup is required to run this example. Simply run the following command: 19 | 20 | ```bash 21 | python example.py 22 | ``` 23 | -------------------------------------------------------------------------------- /config/clients/python/template/gitignore_custom.mustache: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.pyc 6 | openfga_sdk/__pycache__/ 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *,cover 48 | .hypothesis/ 49 | venv/ 50 | .venv/ 51 | .python-version 52 | .pytest_cache 53 | .ruff_cache 54 | test/__pycache__/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # Django stuff: 61 | *.log 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | #Ipython Notebook 70 | .ipynb_checkpoints 71 | 72 | # Python tooling 73 | setup.local.cfg 74 | -------------------------------------------------------------------------------- /config/clients/python/template/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{classname}} 2 | 3 | {{#description}}{{&description}} 4 | {{/description}} 5 | 6 | ## Properties 7 | Name | Type | Description | Notes 8 | ------------ | ------------- | ------------- | ------------- 9 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 10 | {{/vars}} 11 | 12 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 13 | 14 | {{/model}}{{/models}} 15 | -------------------------------------------------------------------------------- /config/clients/python/template/partial_header.mustache: -------------------------------------------------------------------------------- 1 | """ 2 | {{#packageDescription}} 3 | {{{packageDescription}}} 4 | 5 | {{/packageDescription}} 6 | {{#version}} 7 | API version: {{{version}}} 8 | {{/version}} 9 | {{#websiteUrl}} 10 | Website: {{{websiteUrl}}} 11 | {{/websiteUrl}} 12 | {{#docsUrl}} 13 | Documentation: {{{docsUrl}}} 14 | {{/docsUrl}} 15 | {{#supportInfo}} 16 | Support: {{{supportInfo}}} 17 | {{/supportInfo}} 18 | {{#licenseId}} 19 | License: [{{{licenseId}}}](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/blob/main/LICENSE) 20 | {{/licenseId}} 21 | 22 | NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. 23 | """ 24 | -------------------------------------------------------------------------------- /config/clients/python/template/python_doc_auth_partial.mustache: -------------------------------------------------------------------------------- 1 | # To configure the configuration 2 | # host is mandatory 3 | # api_scheme is optional and default to https 4 | {{#requiredParams}} 5 | {{#-first}} 6 | # store_id is mandatory 7 | {{/-first}} 8 | {{/requiredParams}} 9 | # See configuration.py for a list of all supported configuration parameters. 10 | configuration = {{{packageName}}}.Configuration( 11 | scheme = "https", 12 | api_host = "api.{{{sampleApiDomain}}}", 13 | {{#requiredParams}} 14 | {{#-first}} 15 | store_id = 'YOUR_STORE_ID', 16 | {{/-first}} 17 | {{/requiredParams}} 18 | ) 19 | 20 | 21 | # When authenticating via the API TOKEN method 22 | credentials = Credentials(method='api_token', configuration=CredentialConfiguration(api_token='TOKEN1')) 23 | configuration = {{{packageName}}}.Configuration( 24 | scheme = "https", 25 | api_host = "api.{{{sampleApiDomain}}}", 26 | {{#requiredParams}} 27 | {{#-first}} 28 | store_id = 'YOUR_STORE_ID', 29 | {{/-first}} 30 | {{/requiredParams}} 31 | credentials = credentials 32 | ) 33 | -------------------------------------------------------------------------------- /config/clients/python/template/requirements.mustache: -------------------------------------------------------------------------------- 1 | aiohttp >= 3.9.3, < 4 2 | python-dateutil >= 2.9.0, < 3 3 | setuptools >= 69.1.1 4 | build >= 1.2.1, < 2 5 | urllib3 >= 1.26.19, < 3 6 | opentelemetry-api >= 1.25.0, < 2 7 | -------------------------------------------------------------------------------- /config/clients/python/template/src/api/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} 4 | {{/apis}}{{/apiInfo}} 5 | 6 | __all__ = [ 7 | {{#apiInfo}}{{#apis}}"{{classname}}", 8 | {{/apis}}{{/apiInfo}} 9 | ] 10 | -------------------------------------------------------------------------------- /config/clients/python/template/src/client/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.client.client import OpenFgaClient 4 | from {{packageName}}.client.configuration import ClientConfiguration 5 | from {{packageName}}.client.models.check_request import ClientCheckRequest 6 | 7 | __all__ = [ 8 | "OpenFgaClient", 9 | "ClientConfiguration", 10 | "ClientCheckRequest", 11 | ] 12 | -------------------------------------------------------------------------------- /config/clients/python/template/src/client/models/batch_check_request.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.client.models.batch_check_item import ClientBatchCheckItem 4 | 5 | 6 | class ClientBatchCheckRequest: 7 | """ 8 | ClientBatchCheckRequest encapsulates the parameters for a BatchCheck request 9 | """ 10 | 11 | def __init__( 12 | self, 13 | checks: list[ClientBatchCheckItem], 14 | ) -> None: 15 | self._checks = checks 16 | 17 | @property 18 | def checks(self) -> list[ClientBatchCheckItem]: 19 | """ 20 | Return checks 21 | """ 22 | return self._checks 23 | 24 | @checks.setter 25 | def checks(self, checks: list[ClientBatchCheckItem]) -> None: 26 | """ 27 | Set checks 28 | """ 29 | self._checks = checks 30 | -------------------------------------------------------------------------------- /config/clients/python/template/src/client/models/batch_check_response.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.client.models.batch_check_single_response import ClientBatchCheckSingleResponse 4 | 5 | 6 | class ClientBatchCheckResponse: 7 | def __init__( 8 | self, 9 | result: list[ClientBatchCheckSingleResponse], 10 | ) -> None: 11 | self._result = result 12 | 13 | @property 14 | def result(self) -> list[ClientBatchCheckSingleResponse]: 15 | """ 16 | Return result 17 | """ 18 | return self._result 19 | 20 | @result.setter 21 | def result(self, result: list[ClientBatchCheckSingleResponse]) -> None: 22 | """ 23 | Set result 24 | """ 25 | self._result = result 26 | -------------------------------------------------------------------------------- /config/clients/python/template/src/client/models/read_changes_request.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | class ClientReadChangesRequest: 4 | """ 5 | ClientReadChangesRequest encapsulates the parameters required to read changes 6 | """ 7 | 8 | def __init__( 9 | self, 10 | type: str, 11 | start_time: str | None = None, 12 | ): 13 | self._type = type 14 | self._startTime = start_time 15 | 16 | @property 17 | def type(self) -> str: 18 | """ 19 | Return type 20 | """ 21 | return self._type 22 | 23 | @type.setter 24 | def type( 25 | self, 26 | value: str, 27 | ) -> None: 28 | """ 29 | Set type 30 | """ 31 | self._type = value 32 | 33 | @property 34 | def start_time(self) -> str | None: 35 | """ 36 | Return startTime 37 | """ 38 | return self._startTime 39 | 40 | @start_time.setter 41 | def start_time( 42 | self, 43 | value: str | None, 44 | ) -> None: 45 | """ 46 | Set startTime 47 | """ 48 | self._startTime = value 49 | -------------------------------------------------------------------------------- /config/clients/python/template/src/models/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | {{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}{{/model}} 3 | {{/models}} 4 | 5 | __all__ = [ 6 | {{#models}}{{#model}}"{{classname}}", 7 | {{/model}}{{/models}} 8 | ] 9 | -------------------------------------------------------------------------------- /config/clients/python/template/src/sync/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.sync.client.client import OpenFgaClient 4 | from {{packageName}}.sync.api_client import ApiClient 5 | 6 | 7 | __all__ = [ 8 | "ApiClient", 9 | "OpenFgaClient", 10 | ] 11 | -------------------------------------------------------------------------------- /config/clients/python/template/src/sync/client/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/src/telemetry/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.telemetry.attributes import TelemetryAttribute, TelemetryAttributes 4 | from {{packageName}}.telemetry.configuration import ( 5 | TelemetryConfiguration, 6 | TelemetryConfigurations, 7 | TelemetryConfigurationType, 8 | TelemetryMetricConfiguration, 9 | TelemetryMetricsConfiguration, 10 | ) 11 | from {{packageName}}.telemetry.histograms import TelemetryHistogram, TelemetryHistograms 12 | from {{packageName}}.telemetry.metrics import TelemetryMetrics 13 | from {{packageName}}.telemetry.telemetry import Telemetry 14 | 15 | 16 | __all__ = [ 17 | "Telemetry", 18 | "TelemetryAttribute", 19 | "TelemetryAttributes", 20 | "TelemetryConfiguration", 21 | "TelemetryConfigurations", 22 | "TelemetryConfigurationType", 23 | "TelemetryMetricConfiguration", 24 | "TelemetryMetricsConfiguration", 25 | "TelemetryHistogram", 26 | "TelemetryHistograms", 27 | "TelemetryMetrics", 28 | ] 29 | -------------------------------------------------------------------------------- /config/clients/python/template/src/telemetry/counters.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from typing import NamedTuple 4 | 5 | 6 | class TelemetryCounter(NamedTuple): 7 | name: str 8 | description: str 9 | unit: str = "" 10 | 11 | 12 | class TelemetryCounters: 13 | fga_client_credentials_request: TelemetryCounter = TelemetryCounter( 14 | name="fga-client.credentials.request", 15 | description="Total number of new token requests initiated using the Client Credentials flow.", 16 | ) 17 | 18 | fga_client_request: TelemetryCounter = TelemetryCounter( 19 | name="fga-client.request", 20 | description="Total number of requests made to the FGA server.", 21 | ) 22 | 23 | _counters: list[TelemetryCounter] = [ 24 | fga_client_credentials_request, 25 | fga_client_request, 26 | ] 27 | 28 | @staticmethod 29 | def getAll() -> list[TelemetryCounter]: 30 | return TelemetryCounters._counters 31 | 32 | @staticmethod 33 | def get( 34 | name: str | None = None, 35 | ) -> TelemetryCounter | None: 36 | for counter in TelemetryCounters._counters: 37 | if counter.name == name: 38 | return counter 39 | 40 | return None 41 | -------------------------------------------------------------------------------- /config/clients/python/template/src/telemetry/histograms.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from typing import NamedTuple 4 | 5 | 6 | class TelemetryHistogram(NamedTuple): 7 | name: str 8 | description: str 9 | unit: str = "milliseconds" 10 | 11 | 12 | class TelemetryHistograms: 13 | fga_client_request_duration: TelemetryHistogram = TelemetryHistogram( 14 | name="fga-client.request.duration", 15 | description="Total request time for FGA requests, in milliseconds.", 16 | ) 17 | fga_client_query_duration: TelemetryHistogram = TelemetryHistogram( 18 | name="fga-client.query.duration", 19 | description="Time taken by the FGA server to process and evaluate the request, in milliseconds.", 20 | ) 21 | 22 | _histograms: list[TelemetryHistogram] = [ 23 | fga_client_request_duration, 24 | fga_client_query_duration, 25 | ] 26 | 27 | @staticmethod 28 | def getAll() -> list[TelemetryHistogram]: 29 | return TelemetryHistograms._histograms 30 | 31 | @staticmethod 32 | def get( 33 | name: str | None = None, 34 | ) -> TelemetryHistogram | None: 35 | for histogram in TelemetryHistograms._histograms: 36 | if histogram.name == name: 37 | return histogram 38 | 39 | return None 40 | -------------------------------------------------------------------------------- /config/clients/python/template/src/telemetry/telemetry.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | from {{packageName}}.telemetry.metrics import TelemetryMetrics 4 | 5 | 6 | class Telemetry: 7 | _metrics: TelemetryMetrics | None = None 8 | 9 | @property 10 | def metrics(self) -> TelemetryMetrics: 11 | if self._metrics is None: 12 | self._metrics = TelemetryMetrics() 13 | 14 | return self._metrics 15 | -------------------------------------------------------------------------------- /config/clients/python/template/src/validation.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | import re 4 | 5 | def is_well_formed_ulid_string(ulid): 6 | regex = re.compile("^[0-7][0-9A-HJKMNP-TV-Z]{25}$") 7 | if not isinstance(ulid, str): 8 | return False 9 | match = regex.match(ulid) 10 | if match is None: 11 | return False 12 | return True 13 | -------------------------------------------------------------------------------- /config/clients/python/template/test-requirements.mustache: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | 3 | griffe >= 0.41.2, < 2 4 | mock >= 5.1.0, < 6 5 | pytest-asyncio >= 0.25, < 1 6 | pytest-cov >= 5, < 7 7 | ruff >= 0.9, < 1 8 | mypy >= 1.14.1, < 2 9 | -------------------------------------------------------------------------------- /config/clients/python/template/test/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/test/api/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/test/client/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/test/sync/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/clients/python/template/test/sync/client/__init__.py.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | -------------------------------------------------------------------------------- /config/common/files/.codecov.yml.mustache: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | range: "60...80" 4 | round: down 5 | -------------------------------------------------------------------------------- /config/common/files/.fossa.yml.mustache: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | server: https://app.fossa.com 4 | 5 | project: 6 | id: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 7 | name: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 8 | link: openfga.dev 9 | url: {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 10 | -------------------------------------------------------------------------------- /config/common/files/.github/CODEOWNERS.mustache: -------------------------------------------------------------------------------- 1 | * @{{gitUserId}}/dx 2 | README.md @{{gitUserId}}/product @{{gitUserId}}/community @{{gitUserId}}/dx 3 | -------------------------------------------------------------------------------- /config/common/files/.github/ISSUE_TEMPLATE/config.yaml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 📖 OpenFGA's Documentation 4 | url: https://openfga.dev/docs 5 | about: Check OpenFGA's documentation for an in-depth overview 6 | - name: 👽 Community 7 | url: https://openfga.dev/community 8 | about: Join OpenFGA's community on Slack and GitHub Discussions 9 | - name: 📝 RFCs 10 | url: https://github.com/openfga/rfcs 11 | about: Check existing RFCs to understand where the project is headed 12 | - name: 💬 Discussions 13 | url: https://github.com/orgs/openfga/discussions 14 | about: Start a discussion about your authorization needs or questions 15 | -------------------------------------------------------------------------------- /config/common/files/.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: [] -------------------------------------------------------------------------------- /config/common/files/NOTICE.mustache: -------------------------------------------------------------------------------- 1 | {{packageDescription}} 2 | {{gitHost}}/{{gitUserId}}/{{gitRepoId}} 3 | 4 | {{{copyrightNotice}}} 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | 11 | -------------------------------------------------------------------------------- 12 | 13 | 14 | {{>NOTICE_details}} 15 | -------------------------------------------------------------------------------- /config/common/files/README_custom_badges.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/common/files/README_custom_badges.mustache -------------------------------------------------------------------------------- /config/common/files/README_project_introduction.mustache: -------------------------------------------------------------------------------- 1 | [{{appName}}]({{websiteUrl}}) is an open source Fine-Grained Authorization solution inspired by [Google's Zanzibar paper](https://research.google/pubs/pub48190/). It was created by the FGA team at [Auth0](https://auth0.com) based on [Auth0 Fine-Grained Authorization (FGA)](https://fga.dev), available under [a permissive license (Apache-2)](https://{{gitHost}}/{{gitUserId}}/rfcs/blob/main/LICENSE) and welcomes community contributions. 2 | 3 | {{appName}} is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. {{appName}}’s design is optimized for reliability and low latency at a high scale. 4 | -------------------------------------------------------------------------------- /config/common/files/README_retries.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/common/files/README_retries.mustache -------------------------------------------------------------------------------- /config/common/files/VERSION.mustache: -------------------------------------------------------------------------------- 1 | {{packageVersion}} 2 | -------------------------------------------------------------------------------- /config/common/files/assets/FGAIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfga/sdk-generator/d545d99d5ca559d36bf7b0ac79b8172ad17bb7e4/config/common/files/assets/FGAIcon.png -------------------------------------------------------------------------------- /config/common/files/gitignore.mustache: -------------------------------------------------------------------------------- 1 | {{>gitignore_custom}} 2 | 3 | # IDEs 4 | .idea 5 | .vscode 6 | .sublime-workspace 7 | .sublime-project 8 | .idea/ 9 | .vscode/ 10 | 11 | # Possible credential files 12 | .env 13 | credentials.json 14 | 15 | # git conflict leftover files 16 | *.orig 17 | 18 | # Mac 19 | .DS_Store 20 | 21 | VERSION.txt 22 | git_push.sh 23 | -------------------------------------------------------------------------------- /config/common/files/partial_header.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | {{#packageDescription}} 3 | * {{{packageDescription}}} 4 | * 5 | {{/packageDescription}} 6 | {{#version}} 7 | * API version: {{{version}}} 8 | {{/version}} 9 | {{#websiteUrl}} 10 | * Website: {{{websiteUrl}}} 11 | {{/websiteUrl}} 12 | {{#docsUrl}} 13 | * Documentation: {{{docsUrl}}} 14 | {{/docsUrl}} 15 | {{#supportInfo}} 16 | * Support: {{{supportInfo}}} 17 | {{/supportInfo}} 18 | {{#licenseId}} 19 | * License: [{{{licenseId}}}](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/blob/main/LICENSE) 20 | {{/licenseId}} 21 | * 22 | * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. 23 | */ 24 | -------------------------------------------------------------------------------- /docker/nuget.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mono 2 | 3 | RUN mozroots --import --sync 4 | RUN nuget update -self 5 | 6 | WORKDIR /data 7 | 8 | ENTRYPOINT ["nuget"] 9 | CMD ["help"] 10 | --------------------------------------------------------------------------------