From ee3ae2952132b7ac687c6a964351ed659e080888 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 05:57:54 +0000 Subject: [PATCH 1/3] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.11.1 --- reference.md | 2309 ++++++++++++++--- .../client/mgmt/AsyncOrganizationsClient.java | 8 - .../client/mgmt/AsyncRawUsersClient.java | 64 +- .../auth0/client/mgmt/AsyncUsersClient.java | 64 +- .../client/mgmt/OrganizationsClient.java | 8 - .../com/auth0/client/mgmt/RawUsersClient.java | 64 +- .../com/auth0/client/mgmt/UsersClient.java | 64 +- .../AsyncExperimentationClient.java | 14 + .../AsyncExperimentsClient.java | 143 + .../AsyncFeatureFlagsClient.java | 164 ++ .../AsyncRawExperimentsClient.java | 845 ++++++ .../AsyncRawFeatureFlagsClient.java | 750 ++++++ .../AsyncRawSegmentsClient.java | 637 +++++ .../experimentation/AsyncSegmentsClient.java | 135 + .../ExperimentationClient.java | 14 + .../experimentation/ExperimentsClient.java | 141 + .../experimentation/FeatureFlagsClient.java | 162 ++ .../experimentation/RawExperimentsClient.java | 656 +++++ .../RawFeatureFlagsClient.java | 590 +++++ .../experimentation/RawSegmentsClient.java | 499 ++++ .../mgmt/experimentation/SegmentsClient.java | 132 + .../AsyncRawVariationsClient.java | 609 +++++ .../featureflags/AsyncVariationsClient.java | 120 + .../featureflags/RawVariationsClient.java | 477 ++++ .../featureflags/VariationsClient.java | 117 + .../types/CreateVariationRequestContent.java | 234 ++ .../types/UpdateVariationRequestContent.java | 198 ++ .../types/CreateExperimentRequestContent.java | 427 +++ .../CreateFeatureFlagRequestContent.java | 218 ++ .../types/CreateSegmentRequestContent.java | 236 ++ .../ListExperimentsRequestParameters.java | 388 +++ .../ListFeatureFlagsRequestParameters.java | 328 +++ .../types/ListSegmentsRequestParameters.java | 265 ++ .../UpdateExperimentRequestParameters.java | 307 +++ .../UpdateExperimentStatusRequestContent.java | 121 + .../UpdateFeatureFlagRequestContent.java | 199 ++ ...UpdateFeatureFlagStatusRequestContent.java | 131 + .../types/UpdateSegmentRequestContent.java | 206 ++ .../AsyncOrganizationTemplateClient.java | 75 - .../AsyncRawOrganizationTemplateClient.java | 335 --- .../OrganizationTemplateClient.java | 72 - .../RawOrganizationTemplateClient.java | 262 -- .../client/mgmt/types/AllocationItem.java | 407 +++ .../mgmt/types/AllocationRequestItem.java | 340 +++ ...rEnum.java => AllocationStrategyEnum.java} | 41 +- ...syncApprovalNotificationsChannelsEnum.java | 11 + .../mgmt/types/AuthenticationFlowEnum.java | 129 + ...ntOidcBackchannelLogoutInitiatorsEnum.java | 11 + .../ClientOidcSupportAllowedScopesEnum.java | 108 + .../mgmt/types/ClientOidcSupportPost.java | 182 ++ .../mgmt/types/ConnectionOptionsAd.java | 26 + .../mgmt/types/ConnectionOptionsAdfs.java | 26 + .../mgmt/types/ConnectionOptionsAzureAd.java | 32 + .../types/ConnectionOptionsCommonSaml.java | 27 + .../types/ConnectionOptionsPingFederate.java | 33 + .../mgmt/types/ConnectionOptionsSaml.java | 27 + .../types/ConnectionPropertiesOptions.java | 56 +- .../types/CreateClientRequestContent.java | 36 +- .../CreateExperimentResponseContent.java | 819 ++++++ .../CreateFeatureFlagResponseContent.java | 313 +++ .../CreateResourceServerRequestContent.java | 45 + .../CreateResourceServerResponseContent.java | 32 + .../types/CreateSegmentResponseContent.java | 297 +++ .../types/CreateVariationResponseContent.java | 302 +++ ...haviorEnum.java => DefaultConfigEnum.java} | 41 +- .../client/mgmt/types/ExperimentListItem.java | 819 ++++++ .../mgmt/types/ExperimentStatusEnum.java | 113 + .../types/ExperimentTransitionStatusEnum.java | 108 + ...de.java => ExperimentValidationError.java} | 94 +- .../auth0/client/mgmt/types/FeatureFlag.java | 313 +++ .../mgmt/types/FeatureFlagConfigParam.java | 187 ++ .../types/FeatureFlagConfigParamTypeEnum.java | 118 + .../mgmt/types/FeatureFlagStatusEnum.java | 94 + .../mgmt/types/FeatureFlagTypeEnum.java | 83 + .../types/GetExperimentResponseContent.java | 819 ++++++ .../types/GetFeatureFlagResponseContent.java | 313 +++ .../GetResourceServerResponseContent.java | 32 + .../mgmt/types/GetSegmentResponseContent.java | 297 +++ .../types/GetVariationResponseContent.java | 302 +++ .../types/IConnectionOptionsCommonSaml.java | 2 + .../types/ListExperimentsResponseContent.java | 146 ++ .../ListFeatureFlagsResponseContent.java | 146 ++ .../types/ListSegmentsResponseContent.java | 146 ++ ...erBlocksByIdentifierRequestParameters.java | 24 +- .../ListUserBlocksRequestParameters.java | 8 +- .../types/ListVariationsResponseContent.java | 116 + .../auth0/client/mgmt/types/OauthScope.java | 44 +- .../mgmt/types/OrganizationTemplate.java | 648 ----- ...ganizationTemplateAllowedStrategyEnum.java | 141 - ...rganizationTemplateRoleVisibilityEnum.java | 97 - ...anizationTemplateRoleVisibilityPolicy.java | 166 -- ...onTemplateUseForOrganizationDiscovery.java | 174 -- .../client/mgmt/types/ResourceServer.java | 32 + .../types/ResourceServerSearchResponse.java | 32 + .../com/auth0/client/mgmt/types/Segment.java | 296 +++ .../mgmt/types/SegmentContainsExpression.java | 116 + .../mgmt/types/SegmentEndsWithExpression.java | 116 + .../mgmt/types/SegmentExistsExpression.java | 117 + .../mgmt/types/SegmentMatchConditions.java | 370 +++ .../mgmt/types/SegmentMatchExpression.java | 142 + .../mgmt/types/SegmentNotMatchConditions.java | 370 +++ .../auth0/client/mgmt/types/SegmentRule.java | 130 + .../types/SegmentStartsWithExpression.java | 116 + .../client/mgmt/types/SegmentTypeEnum.java | 83 + .../mgmt/types/SegmentTypeFilterEnum.java | 84 + .../mgmt/types/UpdateConnectionOptions.java | 56 +- .../UpdateExperimentResponseContent.java | 819 ++++++ ...UpdateExperimentStatusResponseContent.java | 820 ++++++ .../UpdateFeatureFlagResponseContent.java | 313 +++ ...pdateFeatureFlagStatusResponseContent.java | 314 +++ .../UpdateResourceServerRequestContent.java | 32 + .../UpdateResourceServerResponseContent.java | 32 + .../types/UpdateSegmentResponseContent.java | 297 +++ .../types/UpdateVariationResponseContent.java | 302 +++ .../ValidateExperimentResponseContent.java | 189 ++ .../auth0/client/mgmt/types/Variation.java | 302 +++ .../ExperimentationExperimentsWireTest.java | 575 ++++ ...ntationFeatureFlagsVariationsWireTest.java | 398 +++ .../ExperimentationFeatureFlagsWireTest.java | 474 ++++ .../mgmt/ExperimentationSegmentsWireTest.java | 349 +++ ...nizationsOrganizationTemplateWireTest.java | 167 -- .../client/mgmt/ResourceServersWireTest.java | 4 +- .../client/mgmt/UndiscriminatedUnionTest.java | 41 + ...ceServersWireTest_testCreate_response.json | 1 + ...ourceServersWireTest_testGet_response.json | 1 + ...ceServersWireTest_testUpdate_response.json | 1 + 126 files changed, 26409 insertions(+), 2761 deletions(-) create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/AsyncFeatureFlagsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawFeatureFlagsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawSegmentsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/AsyncSegmentsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/FeatureFlagsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/RawFeatureFlagsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/RawSegmentsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/SegmentsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncRawVariationsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncVariationsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/RawVariationsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/VariationsClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/CreateVariationRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/UpdateVariationRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/CreateExperimentRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/CreateFeatureFlagRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/CreateSegmentRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/ListExperimentsRequestParameters.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/ListFeatureFlagsRequestParameters.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/ListSegmentsRequestParameters.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentRequestParameters.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentStatusRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagStatusRequestContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateSegmentRequestContent.java delete mode 100644 src/main/java/com/auth0/client/mgmt/organizations/AsyncOrganizationTemplateClient.java delete mode 100644 src/main/java/com/auth0/client/mgmt/organizations/AsyncRawOrganizationTemplateClient.java delete mode 100644 src/main/java/com/auth0/client/mgmt/organizations/OrganizationTemplateClient.java delete mode 100644 src/main/java/com/auth0/client/mgmt/organizations/RawOrganizationTemplateClient.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/AllocationItem.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/AllocationRequestItem.java rename src/main/java/com/auth0/client/mgmt/types/{ConnectionDeletionBehaviorEnum.java => AllocationStrategyEnum.java} (51%) create mode 100644 src/main/java/com/auth0/client/mgmt/types/AuthenticationFlowEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportAllowedScopesEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportPost.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/CreateExperimentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/CreateFeatureFlagResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/CreateSegmentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/CreateVariationResponseContent.java rename src/main/java/com/auth0/client/mgmt/types/{OrganizationDeletionBehaviorEnum.java => DefaultConfigEnum.java} (50%) create mode 100644 src/main/java/com/auth0/client/mgmt/types/ExperimentListItem.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ExperimentStatusEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ExperimentTransitionStatusEnum.java rename src/main/java/com/auth0/client/mgmt/types/{OrganizationTemplateRoleVisibilityOverride.java => ExperimentValidationError.java} (50%) create mode 100644 src/main/java/com/auth0/client/mgmt/types/FeatureFlag.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParam.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParamTypeEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/FeatureFlagStatusEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/FeatureFlagTypeEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/GetExperimentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/GetFeatureFlagResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/GetSegmentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/GetVariationResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ListExperimentsResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ListFeatureFlagsResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ListSegmentsResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ListVariationsResponseContent.java delete mode 100644 src/main/java/com/auth0/client/mgmt/types/OrganizationTemplate.java delete mode 100644 src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateAllowedStrategyEnum.java delete mode 100644 src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityEnum.java delete mode 100644 src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityPolicy.java delete mode 100644 src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateUseForOrganizationDiscovery.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/Segment.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentContainsExpression.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentEndsWithExpression.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentExistsExpression.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentMatchConditions.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentMatchExpression.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentNotMatchConditions.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentRule.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentStartsWithExpression.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentTypeEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/SegmentTypeFilterEnum.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateExperimentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateExperimentStatusResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagStatusResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateSegmentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/UpdateVariationResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/ValidateExperimentResponseContent.java create mode 100644 src/main/java/com/auth0/client/mgmt/types/Variation.java create mode 100644 src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsVariationsWireTest.java create mode 100644 src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsWireTest.java create mode 100644 src/test/java/com/auth0/client/mgmt/ExperimentationSegmentsWireTest.java delete mode 100644 src/test/java/com/auth0/client/mgmt/OrganizationsOrganizationTemplateWireTest.java diff --git a/reference.md b/reference.md index 6c5d89bd0..bcdc3a8d0 100644 --- a/reference.md +++ b/reference.md @@ -2188,6 +2188,14 @@ See https://auth0.com/docs/secure/security-guidance/measures-against-app-imperso **asyncApprovalNotificationChannels:** `Optional>` + + + +
+
+ +**oidcSupport:** `Optional` +
@@ -10872,6 +10880,14 @@ client.resourceServers().create(
+**requireConsentNonRepudiation:** `Optional` — When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + +
+
+ +
+
+ **authorizationDetails:** `Optional>`
@@ -11321,6 +11337,14 @@ client.resourceServers().update(
+**requireConsentNonRepudiation:** `Optional` — When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + +
+
+ +
+
+ **authorizationDetails:** `Optional>`
@@ -14232,8 +14256,8 @@ client.userBlocks().listByIdentifier( **considerBruteForceEnablement:** `Optional` - If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - If true and Brute Force Protection is disabled, will return an empty list. + If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + If false or omitted, returns all blocks regardless of enforcement state. @@ -14366,8 +14390,8 @@ client.userBlocks().list( **considerBruteForceEnablement:** `Optional` - If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - If true and Brute Force Protection is disabled, will return an empty list. + If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + If false or omitted, returns all blocks regardless of enforcement state. @@ -14449,24 +14473,22 @@ client.userBlocks().delete("id");
-Retrieve details of users. It is possible to: +This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: -- Specify a search criteria for users +- Specify search criteria for users - Sort the users to be returned - Select the fields to be returned - Specify the number of users to retrieve per page and the page index +This endpoint is **not suited for use in critical paths**. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503. +- Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, [look users up directly by ID or email](https://auth0.com/docs/manage-users/user-search/get-users-by-id-or-email#management-api) to get their current state. +- Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to [Event Streams](https://auth0.com/docs/customize/events/sync-data-across-systems) to receive every change as it happens. +- Do not use this endpoint to enumerate or export your entire user base. Instead, run a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports) to retrieve the full set. -The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax) - -[Learn more about searching for users.](https://auth0.com/docs/users/search/v3) - -Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users. - +Use the `q` query parameter to match users with [query string syntax](https://auth0.com/docs/manage-users/user-search/user-search-query-syntax). For full instructions and guidance, see [How to List and Search Users](https://auth0.com/docs/manage-users/user-search/list-and-search-users). - -Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension. +For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in `app_metadata` or `user_metadata`) or using leading wildcards.
@@ -21901,7 +21923,7 @@ client.eventStreams().redeliveries().createById("id", "event_id"); ## Experimentation Experiments -
client.experimentation.experiments.advanceRamp(id, request) -> AdvanceRampResponseContent +
client.experimentation.experiments.list() -> SyncPagingIterable&lt;ExperimentListItem&gt;
@@ -21913,7 +21935,7 @@ client.eventStreams().redeliveries().createById("id", "event_id");
-Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. +Retrieve a paginated list of experiments for the tenant, with optional filters.
@@ -21928,11 +21950,14 @@ Increments the current ramp index to the requested target level. Up-only: the ta
```java -client.experimentation().experiments().advanceRamp( - "id", - AdvanceRampRequestContent +client.experimentation().experiments().list( + ListExperimentsRequestParameters .builder() - .targetLevel(1) + .from("from") + .take(1) + .status(ExperimentStatusEnum.DRAFT) + .authenticationFlow("authentication_flow") + .featureFlagId("feature_flag_id") .build() ); ``` @@ -21949,7 +21974,7 @@ client.experimentation().experiments().advanceRamp(
-**id:** `String` — The ID of the experiment to advance. +**from:** `Optional` — Optional Id from which to start selection.
@@ -21957,94 +21982,59 @@ client.experimentation().experiments().advanceRamp(
-**targetLevel:** `Integer` — The target percentage level from the experiment schedule. Must be the immediate next level. +**take:** `Optional` — Number of experiments to return per page. Defaults to 25, maximum 50.
-
-
+
+
+**status:** `Optional` — Filter by status. Exact match. +
-
-## Flows Executions -
client.flows.executions.list(flowId) -> SyncPagingIterable&lt;FlowExecutionSummary&gt;
-#### 🔌 Usage - -
-
+**authenticationFlow:** `Optional` — Filter by authentication flow. Exact match. + +
+
-```java -client.flows().executions().list( - "flow_id", - ListFlowExecutionsRequestParameters - .builder() - .includeTotals(true) - .from("from") - .take(1) - .build() -); -``` +**featureFlagId:** `Optional` — Filter by feature flag ID. Exact match. +
-#### ⚙️ Parameters - -
-
- -
-
-**flowId:** `String` — Flow id -
+
+
client.experimentation.experiments.create(request) -> CreateExperimentResponseContent
-**includeTotals:** `Optional` — Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). - -
-
+#### 📝 Description
-**from:** `Optional` — Optional Id from which to start selection. - -
-
-
-**take:** `Optional` — Number of results per page. Defaults to 50. - -
-
+Create a new experiment for A/B testing.
- -
- - -
client.flows.executions.get(flowId, executionId) -> GetFlowExecutionResponseContent -
-
#### 🔌 Usage @@ -22055,14 +22045,12 @@ client.flows().executions().list(
```java -client.flows().executions().get( - "flow_id", - "execution_id", - GetFlowExecutionRequestParameters +client.experimentation().experiments().create( + CreateExperimentRequestContent .builder() - .hydrate( - Arrays.asList(GetFlowExecutionRequestParametersHydrateEnum.DEBUG) - ) + .name("name") + .featureFlagId("feature_flag_id") + .authenticationFlow(AuthenticationFlowEnum.AUTHENTICATION) .build() ); ``` @@ -22079,7 +22067,7 @@ client.flows().executions().get(
-**flowId:** `String` — Flow id +**name:** `String` — A human-readable name for the experiment
@@ -22087,7 +22075,7 @@ client.flows().executions().get(
-**executionId:** `String` — Flow execution id +**description:** `Optional` — A description of the experiment
@@ -22095,47 +22083,39 @@ client.flows().executions().get(
-**hydrate:** `Optional` — Hydration param +**featureFlagId:** `String` — The ID of the feature flag this experiment is based on
-
-
+
+
+**authenticationFlow:** `AuthenticationFlowEnum` +
-
-
client.flows.executions.delete(flowId, executionId)
-#### 🔌 Usage - -
-
+**defaultConfig:** `Optional` — Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config so the experiment overlays only its changes, 'flag' uses the flag's frozen defaults for a complete config. Optional; defaults to 'tenant' when omitted. Rejected for customer-defined flags. + +
+
-```java -client.flows().executions().delete("flow_id", "execution_id"); -``` -
-
+**allocationStrategy:** `Optional` — The traffic allocation strategy for this experiment +
-#### ⚙️ Parameters - -
-
-
-**flowId:** `String` — Flows id +**allocations:** `Optional>` — Traffic allocations mapping variations to weights or segments
@@ -22143,7 +22123,7 @@ client.flows().executions().delete("flow_id", "execution_id");
-**executionId:** `String` — Flow execution identifier +**levels:** `Optional>` — Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100].
@@ -22155,12 +22135,11 @@ client.flows().executions().delete("flow_id", "execution_id");
-## Flows Vault Connections -
client.flows.vault.connections.list() -> SyncPagingIterable&lt;FlowsVaultConnectionSummary&gt; +
client.experimentation.experiments.get(id) -> GetExperimentResponseContent
-#### 🔌 Usage +#### 📝 Description
@@ -22168,22 +22147,13 @@ client.flows().executions().delete("flow_id", "execution_id");
-```java -client.flows().vault().connections().list( - ListFlowsVaultConnectionsRequestParameters - .builder() - .page(1) - .perPage(1) - .includeTotals(true) - .build() -); -``` +Retrieve a single experiment with its allocations by ID.
-#### ⚙️ Parameters +#### 🔌 Usage
@@ -22191,23 +22161,23 @@ client.flows().vault().connections().list(
-**page:** `Optional` — Page index of the results to return. First page is 0. - +```java +client.experimentation().experiments().get("id"); +```
+
+
+ +#### ⚙️ Parameters
-**perPage:** `Optional` — Number of results per page. Defaults to 50. - -
-
-
-**includeTotals:** `Optional` — Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). +**id:** `String` — The ID of the experiment to retrieve.
@@ -22219,45 +22189,11 @@ client.flows().vault().connections().list(
-
client.flows.vault.connections.create(request) -> CreateFlowsVaultConnectionResponseContent -
-
- -#### 🔌 Usage - +
client.experimentation.experiments.delete(id)
-
-
- -```java -client.flows().vault().connections().create( - CreateFlowsVaultConnectionRequestContent.of( - CreateFlowsVaultConnectionActivecampaign.of( - CreateFlowsVaultConnectionActivecampaignApiKey - .builder() - .name("name") - .appId(FlowsVaultConnectionAppIdActivecampaignEnum.ACTIVECAMPAIGN) - .setup( - FlowsVaultConnectioSetupApiKeyWithBaseUrl - .builder() - .type(FlowsVaultConnectioSetupTypeApiKeyEnum.API_KEY) - .apiKey("api_key") - .baseUrl("base_url") - .build() - ) - .build() - ) - ) -); -``` -
-
-
-
- -#### ⚙️ Parameters +#### 📝 Description
@@ -22265,21 +22201,11 @@ client.flows().vault().connections().create(
-**request:** `CreateFlowsVaultConnectionRequestContent` - -
-
+Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist.
- -
-
- -
client.flows.vault.connections.get(id) -> GetFlowsVaultConnectionResponseContent -
-
#### 🔌 Usage @@ -22290,7 +22216,7 @@ client.flows().vault().connections().create(
```java -client.flows().vault().connections().get("id"); +client.experimentation().experiments().delete("id"); ```
@@ -22305,7 +22231,7 @@ client.flows().vault().connections().get("id");
-**id:** `String` — Flows Vault connection ID +**id:** `String` — The ID of the experiment to delete.
@@ -22317,27 +22243,11 @@ client.flows().vault().connections().get("id");
-
client.flows.vault.connections.delete(id) -
-
- -#### 🔌 Usage - -
-
- +
client.experimentation.experiments.update(id, request) -> UpdateExperimentResponseContent
-```java -client.flows().vault().connections().delete("id"); -``` -
-
-
-
- -#### ⚙️ Parameters +#### 📝 Description
@@ -22345,21 +22255,11 @@ client.flows().vault().connections().delete("id");
-**id:** `String` — Vault connection id - -
-
+Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set.
- -
-
- -
client.flows.vault.connections.update(id, request) -> UpdateFlowsVaultConnectionResponseContent -
-
#### 🔌 Usage @@ -22370,9 +22270,9 @@ client.flows().vault().connections().delete("id");
```java -client.flows().vault().connections().update( +client.experimentation().experiments().update( "id", - UpdateFlowsVaultConnectionRequestContent + UpdateExperimentRequestParameters .builder() .build() ); @@ -22390,7 +22290,7 @@ client.flows().vault().connections().update(
-**id:** `String` — Flows Vault connection ID +**id:** `String` — The ID of the experiment to update.
@@ -22398,7 +22298,7 @@ client.flows().vault().connections().update(
-**name:** `Optional` — Flows Vault Connection name. +**name:** `Optional` — A human-readable name for the experiment
@@ -22406,24 +22306,1830 @@ client.flows().vault().connections().update(
-**setup:** `Optional` +**description:** `Optional` — A description of the experiment
-
-
+
+
+**authenticationFlow:** `Optional` — Specifies the target authentication flow for this experiment. This field can only be modified on draft experiments. Must be one of: authentication, mfa_enrollment, mfa_challenge, password_reset, passkey_enrollment, or all. Note that the all value targets every flow at once, but requires that this is the only active experiment. +
-
-## Groups Members -
client.groups.members.get(id) -> SyncPagingIterable&lt;GroupMember&gt;
-#### 📝 Description +**allocations:** `Optional>` — Replaces all traffic allocations. Cannot be modified while the experiment is active. + +
+
+ +
+
+ +**defaultConfig:** `Optional` — Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config, 'flag' uses the flag's frozen defaults. Can only be modified on draft experiments. Rejected for customer-defined flags. + +
+
+ +
+
+ +**levels:** `Optional>` — Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100]. Can only be modified on draft experiments. + +
+
+ + + + + + +
+ +
client.experimentation.experiments.advanceRamp(id, request) -> AdvanceRampResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().experiments().advanceRamp( + "id", + AdvanceRampRequestContent + .builder() + .targetLevel(1) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the experiment to advance. + +
+
+ +
+
+ +**targetLevel:** `Integer` — The target percentage level from the experiment schedule. Must be the immediate next level. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.experiments.updateStatus(id, request) -> UpdateExperimentStatusResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().experiments().updateStatus( + "id", + UpdateExperimentStatusRequestContent + .builder() + .status(ExperimentTransitionStatusEnum.ACTIVE) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the experiment to transition. + +
+
+ +
+
+ +**status:** `ExperimentTransitionStatusEnum` + +
+
+
+
+ + +
+
+
+ +
client.experimentation.experiments.validate(id) -> ValidateExperimentResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().experiments().validate("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the experiment to validate. + +
+
+
+
+ + +
+
+
+ +## Experimentation FeatureFlags +
client.experimentation.featureFlags.list() -> SyncPagingIterable&lt;FeatureFlag&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a paginated list of feature flags for the tenant. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().list( + ListFeatureFlagsRequestParameters + .builder() + .from("from") + .take(1) + .type(FeatureFlagTypeEnum.AUTH0) + .status(FeatureFlagStatusEnum.DRAFT) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**from:** `Optional` — Optional Id from which to start selection. + +
+
+ +
+
+ +**take:** `Optional` — Number of feature flags to return per page. Defaults to 25, maximum 50. + +
+
+ +
+
+ +**type:** `Optional` — Filter by type. Exact match. + +
+
+ +
+
+ +**status:** `Optional` — Filter by status. Exact match. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.create(request) -> CreateFeatureFlagResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new feature flag with parameters for use in experiments. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().create( + CreateFeatureFlagRequestContent + .builder() + .name("name") + .parameters( + new HashMap() + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `String` — A human-readable name for the feature flag + +
+
+ +
+
+ +**description:** `Optional` — A description of what this feature flag controls + +
+
+ +
+
+ +**parameters:** `Map` + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.get(id) -> GetFeatureFlagResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single feature flag by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().get("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the feature flag to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.delete(id) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().delete("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the feature flag to delete. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.update(id, request) -> UpdateFeatureFlagResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Partially update a feature flag by ID. Only provided fields are updated. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().update( + "id", + UpdateFeatureFlagRequestContent + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the feature flag to update. + +
+
+ +
+
+ +**name:** `Optional` — A human-readable name for the feature flag + +
+
+ +
+
+ +**description:** `Optional` — A description of what this feature flag controls + +
+
+ +
+
+ +**parameters:** `Optional>` + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.updateStatus(id, request) -> UpdateFeatureFlagStatusResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().updateStatus( + "id", + UpdateFeatureFlagStatusRequestContent + .builder() + .status(FeatureFlagStatusEnum.DRAFT) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the feature flag to transition. + +
+
+ +
+
+ +**status:** `FeatureFlagStatusEnum` — The target status to transition the feature flag to. + +
+
+
+
+ + +
+
+
+ +## Experimentation Segments +
client.experimentation.segments.list() -> SyncPagingIterable&lt;Segment&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a paginated list of segments for the tenant. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().segments().list( + ListSegmentsRequestParameters + .builder() + .from("from") + .take(1) + .type(SegmentTypeFilterEnum.AUTH0) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**from:** `Optional` — Optional Id from which to start selection. + +
+
+ +
+
+ +**take:** `Optional` — Number of segments to return per page. Defaults to 25, maximum 50. + +
+
+ +
+
+ +**type:** `Optional` — Filter by type. Exact match. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.segments.create(request) -> CreateSegmentResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new segment with rule-based membership criteria for use in experiments. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().segments().create( + CreateSegmentRequestContent + .builder() + .name("name") + .rules( + Arrays.asList( + SegmentRule + .builder() + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `String` — A human-readable name for the segment + +
+
+ +
+
+ +**description:** `Optional` — A description of the segment + +
+
+ +
+
+ +**rules:** `List` — An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized). + +
+
+
+
+ + +
+
+
+ +
client.experimentation.segments.get(id) -> GetSegmentResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single segment by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().segments().get("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the segment to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.segments.delete(id) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().segments().delete("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the segment to delete. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.segments.update(id, request) -> UpdateSegmentResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().segments().update( + "id", + UpdateSegmentRequestContent + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the segment to update. + +
+
+ +
+
+ +**name:** `Optional` — A human-readable name for the segment + +
+
+ +
+
+ +**description:** `Optional` — A description of the segment + +
+
+ +
+
+ +**rules:** `Optional>` — Replaces the entire rules array. Each rule is limited to 4KB and the whole segment to 10KB (serialized). + +
+
+
+
+ + +
+
+
+ +## Experimentation FeatureFlags Variations +
client.experimentation.featureFlags.variations.list(id) -> ListVariationsResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all variations defined for a specific feature flag. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().variations().list("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the parent feature flag. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.variations.create(id, request) -> CreateVariationResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new variation with parameter overrides for a specific feature flag. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().variations().create( + "id", + CreateVariationRequestContent + .builder() + .name("name") + .overrides( + new HashMap() {{ + put("key", "value"); + }} + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the parent feature flag. + +
+
+ +
+
+ +**name:** `String` — A human-readable name for the variation + +
+
+ +
+
+ +**description:** `Optional` — A description of what this variation controls + +
+
+ +
+
+ +**overrides:** `Map` — Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.variations.get(id, vid) -> GetVariationResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single variation by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().variations().get("id", "vid"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the parent feature flag. + +
+
+ +
+
+ +**vid:** `String` — The ID of the variation to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.variations.delete(id, vid) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().variations().delete("id", "vid"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the parent feature flag. + +
+
+ +
+
+ +**vid:** `String` — The ID of the variation to delete. + +
+
+
+
+ + +
+
+
+ +
client.experimentation.featureFlags.variations.update(id, vid, request) -> UpdateVariationResponseContent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Partially update a variation by ID. Only provided fields are updated. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experimentation().featureFlags().variations().update( + "id", + "vid", + UpdateVariationRequestContent + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the parent feature flag. + +
+
+ +
+
+ +**vid:** `String` — The ID of the variation to update. + +
+
+ +
+
+ +**name:** `Optional` — A human-readable name for the variation + +
+
+ +
+
+ +**description:** `Optional` — A description of what this variation controls + +
+
+ +
+
+ +**overrides:** `Optional>` + +
+
+
+
+ + +
+
+
+ +## Flows Executions +
client.flows.executions.list(flowId) -> SyncPagingIterable&lt;FlowExecutionSummary&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().executions().list( + "flow_id", + ListFlowExecutionsRequestParameters + .builder() + .includeTotals(true) + .from("from") + .take(1) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**flowId:** `String` — Flow id + +
+
+ +
+
+ +**includeTotals:** `Optional` — Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + +
+
+ +
+
+ +**from:** `Optional` — Optional Id from which to start selection. + +
+
+ +
+
+ +**take:** `Optional` — Number of results per page. Defaults to 50. + +
+
+
+
+ + +
+
+
+ +
client.flows.executions.get(flowId, executionId) -> GetFlowExecutionResponseContent +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().executions().get( + "flow_id", + "execution_id", + GetFlowExecutionRequestParameters + .builder() + .hydrate( + Arrays.asList(GetFlowExecutionRequestParametersHydrateEnum.DEBUG) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**flowId:** `String` — Flow id + +
+
+ +
+
+ +**executionId:** `String` — Flow execution id + +
+
+ +
+
+ +**hydrate:** `Optional` — Hydration param + +
+
+
+
+ + +
+
+
+ +
client.flows.executions.delete(flowId, executionId) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().executions().delete("flow_id", "execution_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**flowId:** `String` — Flows id + +
+
+ +
+
+ +**executionId:** `String` — Flow execution identifier + +
+
+
+
+ + +
+
+
+ +## Flows Vault Connections +
client.flows.vault.connections.list() -> SyncPagingIterable&lt;FlowsVaultConnectionSummary&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().vault().connections().list( + ListFlowsVaultConnectionsRequestParameters + .builder() + .page(1) + .perPage(1) + .includeTotals(true) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `Optional` — Page index of the results to return. First page is 0. + +
+
+ +
+
+ +**perPage:** `Optional` — Number of results per page. Defaults to 50. + +
+
+ +
+
+ +**includeTotals:** `Optional` — Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + +
+
+
+
+ + +
+
+
+ +
client.flows.vault.connections.create(request) -> CreateFlowsVaultConnectionResponseContent +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().vault().connections().create( + CreateFlowsVaultConnectionRequestContent.of( + CreateFlowsVaultConnectionActivecampaign.of( + CreateFlowsVaultConnectionActivecampaignApiKey + .builder() + .name("name") + .appId(FlowsVaultConnectionAppIdActivecampaignEnum.ACTIVECAMPAIGN) + .setup( + FlowsVaultConnectioSetupApiKeyWithBaseUrl + .builder() + .type(FlowsVaultConnectioSetupTypeApiKeyEnum.API_KEY) + .apiKey("api_key") + .baseUrl("base_url") + .build() + ) + .build() + ) + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateFlowsVaultConnectionRequestContent` + +
+
+
+
+ + +
+
+
+ +
client.flows.vault.connections.get(id) -> GetFlowsVaultConnectionResponseContent +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().vault().connections().get("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Flows Vault connection ID + +
+
+
+
+ + +
+
+
+ +
client.flows.vault.connections.delete(id) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().vault().connections().delete("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Vault connection id + +
+
+
+
+ + +
+
+
+ +
client.flows.vault.connections.update(id, request) -> UpdateFlowsVaultConnectionResponseContent +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.flows().vault().connections().update( + "id", + UpdateFlowsVaultConnectionRequestContent + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Flows Vault connection ID + +
+
+ +
+
+ +**name:** `Optional` — Flows Vault Connection name. + +
+
+ +
+
+ +**setup:** `Optional` + +
+
+
+
+ + +
+
+
+ +## Groups Members +
client.groups.members.get(id) -> SyncPagingIterable&lt;GroupMember&gt; +
+
+ +#### 📝 Description
@@ -28948,185 +30654,6 @@ client.organizations().members().delete(
-
-
-
- -## Organizations OrganizationTemplate -
client.organizations.organizationTemplate.get(id) -> OrganizationTemplate -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.organizations().organizationTemplate().get("id"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**id:** `String` — ID of the organization. - -
-
-
-
- - -
-
-
- -
client.organizations.organizationTemplate.assignOrganizationTemplate(id, templateId) -
-
- -#### 📝 Description - -
-
- -
-
- -Assign an Organization Template to an organization. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.organizations().organizationTemplate().assignOrganizationTemplate("id", "template_id"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**id:** `String` — The ID of the organization. - -
-
- -
-
- -**templateId:** `String` — The ID of the organization template to assign. - -
-
-
-
- - -
-
-
- -
client.organizations.organizationTemplate.unassignOrganizationTemplate(id, templateId) -
-
- -#### 📝 Description - -
-
- -
-
- -Remove an Organization Template assignment from an organization. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.organizations().organizationTemplate().unassignOrganizationTemplate("id", "template_id"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**id:** `String` — The ID of the organization. - -
-
- -
-
- -**templateId:** `String` — The ID of the organization template to unassign. - -
-
-
-
- -
diff --git a/src/main/java/com/auth0/client/mgmt/AsyncOrganizationsClient.java b/src/main/java/com/auth0/client/mgmt/AsyncOrganizationsClient.java index e0f7da549..45951f50f 100644 --- a/src/main/java/com/auth0/client/mgmt/AsyncOrganizationsClient.java +++ b/src/main/java/com/auth0/client/mgmt/AsyncOrganizationsClient.java @@ -15,7 +15,6 @@ import com.auth0.client.mgmt.organizations.AsyncGroupsClient; import com.auth0.client.mgmt.organizations.AsyncInvitationsClient; import com.auth0.client.mgmt.organizations.AsyncMembersClient; -import com.auth0.client.mgmt.organizations.AsyncOrganizationTemplateClient; import com.auth0.client.mgmt.organizations.roles.AsyncRolesClient; import com.auth0.client.mgmt.types.CreateOrganizationRequestContent; import com.auth0.client.mgmt.types.CreateOrganizationResponseContent; @@ -49,8 +48,6 @@ public class AsyncOrganizationsClient { protected final Supplier membersClient; - protected final Supplier organizationTemplateClient; - protected final Supplier groupsClient; protected final Supplier rolesClient; @@ -65,7 +62,6 @@ public AsyncOrganizationsClient(ClientOptions clientOptions) { this.enabledConnectionsClient = Suppliers.memoize(() -> new AsyncEnabledConnectionsClient(clientOptions)); this.invitationsClient = Suppliers.memoize(() -> new AsyncInvitationsClient(clientOptions)); this.membersClient = Suppliers.memoize(() -> new AsyncMembersClient(clientOptions)); - this.organizationTemplateClient = Suppliers.memoize(() -> new AsyncOrganizationTemplateClient(clientOptions)); this.groupsClient = Suppliers.memoize(() -> new AsyncGroupsClient(clientOptions)); this.rolesClient = Suppliers.memoize(() -> new AsyncRolesClient(clientOptions)); } @@ -350,10 +346,6 @@ public AsyncMembersClient members() { return this.membersClient.get(); } - public AsyncOrganizationTemplateClient organizationTemplate() { - return this.organizationTemplateClient.get(); - } - public AsyncGroupsClient groups() { return this.groupsClient.get(); } diff --git a/src/main/java/com/auth0/client/mgmt/AsyncRawUsersClient.java b/src/main/java/com/auth0/client/mgmt/AsyncRawUsersClient.java index 8443f782a..ab57cf6f9 100644 --- a/src/main/java/com/auth0/client/mgmt/AsyncRawUsersClient.java +++ b/src/main/java/com/auth0/client/mgmt/AsyncRawUsersClient.java @@ -58,34 +58,42 @@ public AsyncRawUsersClient(ClientOptions clientOptions) { } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
    - *
  • Specify a search criteria for users
  • + *
  • Specify search criteria for users
  • *
  • Sort the users to be returned
  • *
  • Select the fields to be returned
  • *
  • Specify the number of users to retrieve per page and the page index
  • *
- *

The q query parameter can be used to get users that match the specified criteria using query string syntax.

- *

Learn more about searching for users.

- *

Read about best practices when working with the API endpoints for retrieving users.

- *

Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

+ *

This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

+ *
    + *
  • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
  • + *
  • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
  • + *
  • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
  • + *
+ *

Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

+ *

For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

*/ public CompletableFuture>> list() { return list(ListUsersRequestParameters.builder().build()); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
    - *
  • Specify a search criteria for users
  • + *
  • Specify search criteria for users
  • *
  • Sort the users to be returned
  • *
  • Select the fields to be returned
  • *
  • Specify the number of users to retrieve per page and the page index
  • *
- *

The q query parameter can be used to get users that match the specified criteria using query string syntax.

- *

Learn more about searching for users.

- *

Read about best practices when working with the API endpoints for retrieving users.

- *

Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

+ *

This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

+ *
    + *
  • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
  • + *
  • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
  • + *
  • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
  • + *
+ *

Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

+ *

For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

*/ public CompletableFuture>> list( RequestOptions requestOptions) { @@ -93,17 +101,21 @@ public CompletableFuture - *
  • Specify a search criteria for users
  • + *
  • Specify search criteria for users
  • *
  • Sort the users to be returned
  • *
  • Select the fields to be returned
  • *
  • Specify the number of users to retrieve per page and the page index
  • * - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture>> list( ListUsersRequestParameters request) { @@ -111,17 +123,21 @@ public CompletableFuture - *
  • Specify a search criteria for users
  • + *
  • Specify search criteria for users
  • *
  • Sort the users to be returned
  • *
  • Select the fields to be returned
  • *
  • Specify the number of users to retrieve per page and the page index
  • * - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture>> list( ListUsersRequestParameters request, RequestOptions requestOptions) { diff --git a/src/main/java/com/auth0/client/mgmt/AsyncUsersClient.java b/src/main/java/com/auth0/client/mgmt/AsyncUsersClient.java index 9e924073c..e95b12bd9 100644 --- a/src/main/java/com/auth0/client/mgmt/AsyncUsersClient.java +++ b/src/main/java/com/auth0/client/mgmt/AsyncUsersClient.java @@ -104,68 +104,84 @@ public AsyncRawUsersClient withRawResponse() { } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture> list(RequestOptions requestOptions) { return this.rawClient.list(requestOptions).thenApply(response -> response.body()); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture> list(ListUsersRequestParameters request) { return this.rawClient.list(request).thenApply(response -> response.body()); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public CompletableFuture> list( ListUsersRequestParameters request, RequestOptions requestOptions) { diff --git a/src/main/java/com/auth0/client/mgmt/OrganizationsClient.java b/src/main/java/com/auth0/client/mgmt/OrganizationsClient.java index 0ed3fd48e..b758cd9c5 100644 --- a/src/main/java/com/auth0/client/mgmt/OrganizationsClient.java +++ b/src/main/java/com/auth0/client/mgmt/OrganizationsClient.java @@ -15,7 +15,6 @@ import com.auth0.client.mgmt.organizations.GroupsClient; import com.auth0.client.mgmt.organizations.InvitationsClient; import com.auth0.client.mgmt.organizations.MembersClient; -import com.auth0.client.mgmt.organizations.OrganizationTemplateClient; import com.auth0.client.mgmt.organizations.roles.RolesClient; import com.auth0.client.mgmt.types.CreateOrganizationRequestContent; import com.auth0.client.mgmt.types.CreateOrganizationResponseContent; @@ -48,8 +47,6 @@ public class OrganizationsClient { protected final Supplier membersClient; - protected final Supplier organizationTemplateClient; - protected final Supplier groupsClient; protected final Supplier rolesClient; @@ -64,7 +61,6 @@ public OrganizationsClient(ClientOptions clientOptions) { this.enabledConnectionsClient = Suppliers.memoize(() -> new EnabledConnectionsClient(clientOptions)); this.invitationsClient = Suppliers.memoize(() -> new InvitationsClient(clientOptions)); this.membersClient = Suppliers.memoize(() -> new MembersClient(clientOptions)); - this.organizationTemplateClient = Suppliers.memoize(() -> new OrganizationTemplateClient(clientOptions)); this.groupsClient = Suppliers.memoize(() -> new GroupsClient(clientOptions)); this.rolesClient = Suppliers.memoize(() -> new RolesClient(clientOptions)); } @@ -346,10 +342,6 @@ public MembersClient members() { return this.membersClient.get(); } - public OrganizationTemplateClient organizationTemplate() { - return this.organizationTemplateClient.get(); - } - public GroupsClient groups() { return this.groupsClient.get(); } diff --git a/src/main/java/com/auth0/client/mgmt/RawUsersClient.java b/src/main/java/com/auth0/client/mgmt/RawUsersClient.java index 1ab2f0adb..39f25b5ef 100644 --- a/src/main/java/com/auth0/client/mgmt/RawUsersClient.java +++ b/src/main/java/com/auth0/client/mgmt/RawUsersClient.java @@ -53,68 +53,84 @@ public RawUsersClient(ClientOptions clientOptions) { } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public ManagementApiHttpResponse> list() { return list(ListUsersRequestParameters.builder().build()); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public ManagementApiHttpResponse> list(RequestOptions requestOptions) { return list(ListUsersRequestParameters.builder().build(), requestOptions); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public ManagementApiHttpResponse> list(ListUsersRequestParameters request) { return list(request, null); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public ManagementApiHttpResponse> list( ListUsersRequestParameters request, RequestOptions requestOptions) { diff --git a/src/main/java/com/auth0/client/mgmt/UsersClient.java b/src/main/java/com/auth0/client/mgmt/UsersClient.java index 0d9cf59d2..509be2e14 100644 --- a/src/main/java/com/auth0/client/mgmt/UsersClient.java +++ b/src/main/java/com/auth0/client/mgmt/UsersClient.java @@ -103,68 +103,84 @@ public RawUsersClient withRawResponse() { } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public SyncPagingIterable list() { return this.rawClient.list().body(); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public SyncPagingIterable list(RequestOptions requestOptions) { return this.rawClient.list(requestOptions).body(); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public SyncPagingIterable list(ListUsersRequestParameters request) { return this.rawClient.list(request).body(); } /** - * Retrieve details of users. It is possible to: + * This endpoint retrieves details of users. It's best suited to interactive, best-effort search and lookups where slightly stale results are acceptable. With it, you can: *
      - *
    • Specify a search criteria for users
    • + *
    • Specify search criteria for users
    • *
    • Sort the users to be returned
    • *
    • Select the fields to be returned
    • *
    • Specify the number of users to retrieve per page and the page index
    • *
    - *

    The q query parameter can be used to get users that match the specified criteria using query string syntax.

    - *

    Learn more about searching for users.

    - *

    Read about best practices when working with the API endpoints for retrieving users.

    - *

    Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.

    + *

    This endpoint is not suited for use in critical paths. It is eventually consistent and runs under a short (~2 second) query time limit, so results can be stale and heavy queries can return a 503.

    + *
      + *
    • Do not use this endpoint for authentication, account linking, or logic inside login-flow Actions. Instead, look users up directly by ID or email to get their current state.
    • + *
    • Do not use this endpoint to keep an external system in sync with user data. Instead, subscribe to Event Streams to receive every change as it happens.
    • + *
    • Do not use this endpoint to enumerate or export your entire user base. Instead, run a bulk user export to retrieve the full set.
    • + *
    + *

    Use the q query parameter to match users with query string syntax. For full instructions and guidance, see How to List and Search Users.

    + *

    For efficient queries, prefer indexed top-level fields and exact matches. Certain kinds of queries can be slow and may time out, such as filtering on freeform or multi-value fields (like user-defined attributes in app_metadata or user_metadata) or using leading wildcards.

    */ public SyncPagingIterable list( ListUsersRequestParameters request, RequestOptions requestOptions) { diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentationClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentationClient.java index 8d032e2bc..82bad5c1b 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentationClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentationClient.java @@ -12,12 +12,26 @@ public class AsyncExperimentationClient { protected final Supplier experimentsClient; + protected final Supplier featureFlagsClient; + + protected final Supplier segmentsClient; + public AsyncExperimentationClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.experimentsClient = Suppliers.memoize(() -> new AsyncExperimentsClient(clientOptions)); + this.featureFlagsClient = Suppliers.memoize(() -> new AsyncFeatureFlagsClient(clientOptions)); + this.segmentsClient = Suppliers.memoize(() -> new AsyncSegmentsClient(clientOptions)); } public AsyncExperimentsClient experiments() { return this.experimentsClient.get(); } + + public AsyncFeatureFlagsClient featureFlags() { + return this.featureFlagsClient.get(); + } + + public AsyncSegmentsClient segments() { + return this.segmentsClient.get(); + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentsClient.java index 5148c7636..7ede182e8 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentsClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncExperimentsClient.java @@ -5,8 +5,19 @@ import com.auth0.client.mgmt.core.ClientOptions; import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.SyncPagingIterable; import com.auth0.client.mgmt.experimentation.types.AdvanceRampRequestContent; +import com.auth0.client.mgmt.experimentation.types.CreateExperimentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListExperimentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentStatusRequestContent; import com.auth0.client.mgmt.types.AdvanceRampResponseContent; +import com.auth0.client.mgmt.types.CreateExperimentResponseContent; +import com.auth0.client.mgmt.types.ExperimentListItem; +import com.auth0.client.mgmt.types.GetExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentStatusResponseContent; +import com.auth0.client.mgmt.types.ValidateExperimentResponseContent; import java.util.concurrent.CompletableFuture; public class AsyncExperimentsClient { @@ -26,6 +37,108 @@ public AsyncRawExperimentsClient withRawResponse() { return this.rawClient; } + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture> list(ListExperimentsRequestParameters request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture> list( + ListExperimentsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new experiment for A/B testing. + */ + public CompletableFuture create(CreateExperimentRequestContent request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new experiment for A/B testing. + */ + public CompletableFuture create( + CreateExperimentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public CompletableFuture get(String id) { + return this.rawClient.get(id).thenApply(response -> response.body()); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public CompletableFuture get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture update( + String id, UpdateExperimentRequestParameters request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture update( + String id, UpdateExperimentRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + /** * Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. */ @@ -40,4 +153,34 @@ public CompletableFuture advanceRamp( String id, AdvanceRampRequestContent request, RequestOptions requestOptions) { return this.rawClient.advanceRamp(id, request, requestOptions).thenApply(response -> response.body()); } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public CompletableFuture updateStatus( + String id, UpdateExperimentStatusRequestContent request) { + return this.rawClient.updateStatus(id, request).thenApply(response -> response.body()); + } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public CompletableFuture updateStatus( + String id, UpdateExperimentStatusRequestContent request, RequestOptions requestOptions) { + return this.rawClient.updateStatus(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public CompletableFuture validate(String id) { + return this.rawClient.validate(id).thenApply(response -> response.body()); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public CompletableFuture validate(String id, RequestOptions requestOptions) { + return this.rawClient.validate(id, requestOptions).thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncFeatureFlagsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncFeatureFlagsClient.java new file mode 100644 index 000000000..06a18b037 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncFeatureFlagsClient.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.Suppliers; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.featureflags.AsyncVariationsClient; +import com.auth0.client.mgmt.experimentation.types.CreateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListFeatureFlagsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagStatusRequestContent; +import com.auth0.client.mgmt.types.CreateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.FeatureFlag; +import com.auth0.client.mgmt.types.GetFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagStatusResponseContent; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncFeatureFlagsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFeatureFlagsClient rawClient; + + protected final Supplier variationsClient; + + public AsyncFeatureFlagsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFeatureFlagsClient(clientOptions); + this.variationsClient = Suppliers.memoize(() -> new AsyncVariationsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFeatureFlagsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture> list(ListFeatureFlagsRequestParameters request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture> list( + ListFeatureFlagsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CompletableFuture create(CreateFeatureFlagRequestContent request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CompletableFuture create( + CreateFeatureFlagRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public CompletableFuture get(String id) { + return this.rawClient.get(id).thenApply(response -> response.body()); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public CompletableFuture get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture update( + String id, UpdateFeatureFlagRequestContent request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture update( + String id, UpdateFeatureFlagRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public CompletableFuture updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request) { + return this.rawClient.updateStatus(id, request).thenApply(response -> response.body()); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public CompletableFuture updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request, RequestOptions requestOptions) { + return this.rawClient.updateStatus(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncVariationsClient variations() { + return this.variationsClient.get(); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawExperimentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawExperimentsClient.java index 0e1bbf2f2..8b88e3b91 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawExperimentsClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawExperimentsClient.java @@ -9,19 +9,36 @@ import com.auth0.client.mgmt.core.ManagementException; import com.auth0.client.mgmt.core.MediaTypes; import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; import com.auth0.client.mgmt.core.RequestOptions; import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; import com.auth0.client.mgmt.errors.BadRequestError; import com.auth0.client.mgmt.errors.ConflictError; import com.auth0.client.mgmt.errors.ForbiddenError; import com.auth0.client.mgmt.errors.NotFoundError; import com.auth0.client.mgmt.errors.TooManyRequestsError; import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.errors.UnprocessableEntityError; import com.auth0.client.mgmt.experimentation.types.AdvanceRampRequestContent; +import com.auth0.client.mgmt.experimentation.types.CreateExperimentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListExperimentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentStatusRequestContent; import com.auth0.client.mgmt.types.AdvanceRampResponseContent; +import com.auth0.client.mgmt.types.CreateExperimentResponseContent; +import com.auth0.client.mgmt.types.ExperimentListItem; +import com.auth0.client.mgmt.types.GetExperimentResponseContent; +import com.auth0.client.mgmt.types.ListExperimentsResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentStatusResponseContent; +import com.auth0.client.mgmt.types.ValidateExperimentResponseContent; import com.fasterxml.jackson.core.JsonProcessingException; import java.io.IOException; +import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Headers; @@ -40,6 +57,608 @@ public AsyncRawExperimentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture>> list() { + return list(ListExperimentsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListExperimentsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture>> list( + ListExperimentsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public CompletableFuture>> list( + ListExperimentsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getStatus().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().orElse(null), false); + } + if (!request.getAuthenticationFlow().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "authentication_flow", + request.getAuthenticationFlow().orElse(null), + false); + } + if (!request.getFeatureFlagId().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_flag_id", request.getFeatureFlagId().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperimentsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListExperimentsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListExperimentsRequestParameters nextRequest = ListExperimentsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getExperiments(); + future.complete(new ManagementApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new experiment for A/B testing. + */ + public CompletableFuture> create( + CreateExperimentRequestContent request) { + return create(request, null); + } + + /** + * Create a new experiment for A/B testing. + */ + public CompletableFuture> create( + CreateExperimentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateExperimentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public CompletableFuture> get(String id) { + return get(id, null); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public CompletableFuture> get( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetExperimentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public CompletableFuture> delete(String id) { + return delete(id, null); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateExperimentRequestParameters.builder().build()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture> update( + String id, RequestOptions requestOptions) { + return update(id, UpdateExperimentRequestParameters.builder().build(), requestOptions); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture> update( + String id, UpdateExperimentRequestParameters request) { + return update(id, request, null); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public CompletableFuture> update( + String id, UpdateExperimentRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateExperimentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + /** * Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. */ @@ -158,4 +777,230 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public CompletableFuture> updateStatus( + String id, UpdateExperimentStatusRequestContent request) { + return updateStatus(id, request, null); + } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public CompletableFuture> updateStatus( + String id, UpdateExperimentStatusRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateExperimentStatusResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public CompletableFuture> validate(String id) { + return validate(id, null); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public CompletableFuture> validate( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id) + .addPathSegments("validate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ValidateExperimentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawFeatureFlagsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawFeatureFlagsClient.java new file mode 100644 index 000000000..c373d401e --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawFeatureFlagsClient.java @@ -0,0 +1,750 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.experimentation.types.CreateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListFeatureFlagsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagStatusRequestContent; +import com.auth0.client.mgmt.types.CreateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.FeatureFlag; +import com.auth0.client.mgmt.types.GetFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.ListFeatureFlagsResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagStatusResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFeatureFlagsClient { + protected final ClientOptions clientOptions; + + public AsyncRawFeatureFlagsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture>> list() { + return list(ListFeatureFlagsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListFeatureFlagsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture>> list( + ListFeatureFlagsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public CompletableFuture>> list( + ListFeatureFlagsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getType().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().orElse(null), false); + } + if (!request.getStatus().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeatureFlagsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListFeatureFlagsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListFeatureFlagsRequestParameters nextRequest = ListFeatureFlagsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getFeatureFlags(); + future.complete(new ManagementApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CompletableFuture> create( + CreateFeatureFlagRequestContent request) { + return create(request, null); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CompletableFuture> create( + CreateFeatureFlagRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateFeatureFlagResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieve a single feature flag by its ID. + */ + public CompletableFuture> get(String id) { + return get(id, null); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public CompletableFuture> get( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetFeatureFlagResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public CompletableFuture> delete(String id) { + return delete(id, null); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateFeatureFlagRequestContent.builder().build()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, RequestOptions requestOptions) { + return update(id, UpdateFeatureFlagRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, UpdateFeatureFlagRequestContent request) { + return update(id, request, null); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, UpdateFeatureFlagRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateFeatureFlagResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public CompletableFuture> updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request) { + return updateStatus(id, request, null); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public CompletableFuture> updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateFeatureFlagStatusResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawSegmentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawSegmentsClient.java new file mode 100644 index 000000000..40964f139 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncRawSegmentsClient.java @@ -0,0 +1,637 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.errors.UnprocessableEntityError; +import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListSegmentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateSegmentRequestContent; +import com.auth0.client.mgmt.types.CreateSegmentResponseContent; +import com.auth0.client.mgmt.types.GetSegmentResponseContent; +import com.auth0.client.mgmt.types.ListSegmentsResponseContent; +import com.auth0.client.mgmt.types.Segment; +import com.auth0.client.mgmt.types.UpdateSegmentResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSegmentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSegmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture>> list() { + return list(ListSegmentsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSegmentsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture>> list( + ListSegmentsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture>> list( + ListSegmentsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getType().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSegmentsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListSegmentsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListSegmentsRequestParameters nextRequest = ListSegmentsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getSegments(); + future.complete(new ManagementApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CompletableFuture> create( + CreateSegmentRequestContent request) { + return create(request, null); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CompletableFuture> create( + CreateSegmentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateSegmentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieve a single segment by its ID. + */ + public CompletableFuture> get(String id) { + return get(id, null); + } + + /** + * Retrieve a single segment by its ID. + */ + public CompletableFuture> get( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetSegmentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public CompletableFuture> delete(String id) { + return delete(id, null); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateSegmentRequestContent.builder().build()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture> update( + String id, RequestOptions requestOptions) { + return update(id, UpdateSegmentRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture> update( + String id, UpdateSegmentRequestContent request) { + return update(id, request, null); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture> update( + String id, UpdateSegmentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateSegmentResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/AsyncSegmentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncSegmentsClient.java new file mode 100644 index 000000000..498ca308c --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/AsyncSegmentsClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListSegmentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateSegmentRequestContent; +import com.auth0.client.mgmt.types.CreateSegmentResponseContent; +import com.auth0.client.mgmt.types.GetSegmentResponseContent; +import com.auth0.client.mgmt.types.Segment; +import com.auth0.client.mgmt.types.UpdateSegmentResponseContent; +import java.util.concurrent.CompletableFuture; + +public class AsyncSegmentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSegmentsClient rawClient; + + public AsyncSegmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSegmentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSegmentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture> list(ListSegmentsRequestParameters request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public CompletableFuture> list( + ListSegmentsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CompletableFuture create(CreateSegmentRequestContent request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CompletableFuture create( + CreateSegmentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single segment by its ID. + */ + public CompletableFuture get(String id) { + return this.rawClient.get(id).thenApply(response -> response.body()); + } + + /** + * Retrieve a single segment by its ID. + */ + public CompletableFuture get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture update(String id, UpdateSegmentRequestContent request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public CompletableFuture update( + String id, UpdateSegmentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentationClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentationClient.java index 6c123d76a..c4f690628 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentationClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentationClient.java @@ -12,12 +12,26 @@ public class ExperimentationClient { protected final Supplier experimentsClient; + protected final Supplier featureFlagsClient; + + protected final Supplier segmentsClient; + public ExperimentationClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.experimentsClient = Suppliers.memoize(() -> new ExperimentsClient(clientOptions)); + this.featureFlagsClient = Suppliers.memoize(() -> new FeatureFlagsClient(clientOptions)); + this.segmentsClient = Suppliers.memoize(() -> new SegmentsClient(clientOptions)); } public ExperimentsClient experiments() { return this.experimentsClient.get(); } + + public FeatureFlagsClient featureFlags() { + return this.featureFlagsClient.get(); + } + + public SegmentsClient segments() { + return this.segmentsClient.get(); + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentsClient.java index 3cfb5729d..d974bf92b 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentsClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/ExperimentsClient.java @@ -5,8 +5,19 @@ import com.auth0.client.mgmt.core.ClientOptions; import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.SyncPagingIterable; import com.auth0.client.mgmt.experimentation.types.AdvanceRampRequestContent; +import com.auth0.client.mgmt.experimentation.types.CreateExperimentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListExperimentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentStatusRequestContent; import com.auth0.client.mgmt.types.AdvanceRampResponseContent; +import com.auth0.client.mgmt.types.CreateExperimentResponseContent; +import com.auth0.client.mgmt.types.ExperimentListItem; +import com.auth0.client.mgmt.types.GetExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentStatusResponseContent; +import com.auth0.client.mgmt.types.ValidateExperimentResponseContent; public class ExperimentsClient { protected final ClientOptions clientOptions; @@ -25,6 +36,107 @@ public RawExperimentsClient withRawResponse() { return this.rawClient; } + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public SyncPagingIterable list(ListExperimentsRequestParameters request) { + return this.rawClient.list(request).body(); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public SyncPagingIterable list( + ListExperimentsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new experiment for A/B testing. + */ + public CreateExperimentResponseContent create(CreateExperimentRequestContent request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new experiment for A/B testing. + */ + public CreateExperimentResponseContent create( + CreateExperimentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public GetExperimentResponseContent get(String id) { + return this.rawClient.get(id).body(); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public GetExperimentResponseContent get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).body(); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public void delete(String id) { + this.rawClient.delete(id).body(); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public void delete(String id, RequestOptions requestOptions) { + this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public UpdateExperimentResponseContent update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public UpdateExperimentResponseContent update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public UpdateExperimentResponseContent update(String id, UpdateExperimentRequestParameters request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public UpdateExperimentResponseContent update( + String id, UpdateExperimentRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + /** * Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. */ @@ -39,4 +151,33 @@ public AdvanceRampResponseContent advanceRamp( String id, AdvanceRampRequestContent request, RequestOptions requestOptions) { return this.rawClient.advanceRamp(id, request, requestOptions).body(); } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public UpdateExperimentStatusResponseContent updateStatus(String id, UpdateExperimentStatusRequestContent request) { + return this.rawClient.updateStatus(id, request).body(); + } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public UpdateExperimentStatusResponseContent updateStatus( + String id, UpdateExperimentStatusRequestContent request, RequestOptions requestOptions) { + return this.rawClient.updateStatus(id, request, requestOptions).body(); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public ValidateExperimentResponseContent validate(String id) { + return this.rawClient.validate(id).body(); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public ValidateExperimentResponseContent validate(String id, RequestOptions requestOptions) { + return this.rawClient.validate(id, requestOptions).body(); + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/FeatureFlagsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/FeatureFlagsClient.java new file mode 100644 index 000000000..166b6110c --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/FeatureFlagsClient.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.Suppliers; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.featureflags.VariationsClient; +import com.auth0.client.mgmt.experimentation.types.CreateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListFeatureFlagsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagStatusRequestContent; +import com.auth0.client.mgmt.types.CreateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.FeatureFlag; +import com.auth0.client.mgmt.types.GetFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagStatusResponseContent; +import java.util.function.Supplier; + +public class FeatureFlagsClient { + protected final ClientOptions clientOptions; + + private final RawFeatureFlagsClient rawClient; + + protected final Supplier variationsClient; + + public FeatureFlagsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFeatureFlagsClient(clientOptions); + this.variationsClient = Suppliers.memoize(() -> new VariationsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFeatureFlagsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public SyncPagingIterable list(ListFeatureFlagsRequestParameters request) { + return this.rawClient.list(request).body(); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public SyncPagingIterable list( + ListFeatureFlagsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CreateFeatureFlagResponseContent create(CreateFeatureFlagRequestContent request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public CreateFeatureFlagResponseContent create( + CreateFeatureFlagRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public GetFeatureFlagResponseContent get(String id) { + return this.rawClient.get(id).body(); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public GetFeatureFlagResponseContent get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).body(); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public void delete(String id) { + this.rawClient.delete(id).body(); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public void delete(String id, RequestOptions requestOptions) { + this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public UpdateFeatureFlagResponseContent update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public UpdateFeatureFlagResponseContent update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public UpdateFeatureFlagResponseContent update(String id, UpdateFeatureFlagRequestContent request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public UpdateFeatureFlagResponseContent update( + String id, UpdateFeatureFlagRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public UpdateFeatureFlagStatusResponseContent updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request) { + return this.rawClient.updateStatus(id, request).body(); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public UpdateFeatureFlagStatusResponseContent updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request, RequestOptions requestOptions) { + return this.rawClient.updateStatus(id, request, requestOptions).body(); + } + + public VariationsClient variations() { + return this.variationsClient.get(); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/RawExperimentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/RawExperimentsClient.java index 828ffb322..2fcd0b3a7 100644 --- a/src/main/java/com/auth0/client/mgmt/experimentation/RawExperimentsClient.java +++ b/src/main/java/com/auth0/client/mgmt/experimentation/RawExperimentsClient.java @@ -9,18 +9,34 @@ import com.auth0.client.mgmt.core.ManagementException; import com.auth0.client.mgmt.core.MediaTypes; import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; import com.auth0.client.mgmt.core.RequestOptions; import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; import com.auth0.client.mgmt.errors.BadRequestError; import com.auth0.client.mgmt.errors.ConflictError; import com.auth0.client.mgmt.errors.ForbiddenError; import com.auth0.client.mgmt.errors.NotFoundError; import com.auth0.client.mgmt.errors.TooManyRequestsError; import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.errors.UnprocessableEntityError; import com.auth0.client.mgmt.experimentation.types.AdvanceRampRequestContent; +import com.auth0.client.mgmt.experimentation.types.CreateExperimentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListExperimentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentStatusRequestContent; import com.auth0.client.mgmt.types.AdvanceRampResponseContent; +import com.auth0.client.mgmt.types.CreateExperimentResponseContent; +import com.auth0.client.mgmt.types.ExperimentListItem; +import com.auth0.client.mgmt.types.GetExperimentResponseContent; +import com.auth0.client.mgmt.types.ListExperimentsResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentStatusResponseContent; +import com.auth0.client.mgmt.types.ValidateExperimentResponseContent; import com.fasterxml.jackson.core.JsonProcessingException; import java.io.IOException; +import java.util.List; +import java.util.Optional; import okhttp3.Headers; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @@ -36,6 +52,472 @@ public RawExperimentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public ManagementApiHttpResponse> list() { + return list(ListExperimentsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public ManagementApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListExperimentsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public ManagementApiHttpResponse> list( + ListExperimentsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of experiments for the tenant, with optional filters. + */ + public ManagementApiHttpResponse> list( + ListExperimentsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getStatus().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().orElse(null), false); + } + if (!request.getAuthenticationFlow().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "authentication_flow", + request.getAuthenticationFlow().orElse(null), + false); + } + if (!request.getFeatureFlagId().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_flag_id", request.getFeatureFlagId().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperimentsResponseContent parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExperimentsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListExperimentsRequestParameters nextRequest = ListExperimentsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getExperiments(); + return new ManagementApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Create a new experiment for A/B testing. + */ + public ManagementApiHttpResponse create(CreateExperimentRequestContent request) { + return create(request, null); + } + + /** + * Create a new experiment for A/B testing. + */ + public ManagementApiHttpResponse create( + CreateExperimentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateExperimentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public ManagementApiHttpResponse get(String id) { + return get(id, null); + } + + /** + * Retrieve a single experiment with its allocations by ID. + */ + public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetExperimentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public ManagementApiHttpResponse delete(String id) { + return delete(id, null); + } + + /** + * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist. + */ + public ManagementApiHttpResponse delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public ManagementApiHttpResponse update(String id) { + return update(id, UpdateExperimentRequestParameters.builder().build()); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public ManagementApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateExperimentRequestParameters.builder().build(), requestOptions); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public ManagementApiHttpResponse update( + String id, UpdateExperimentRequestParameters request) { + return update(id, request, null); + } + + /** + * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set. + */ + public ManagementApiHttpResponse update( + String id, UpdateExperimentRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateExperimentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + /** * Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything. */ @@ -127,4 +609,178 @@ public ManagementApiHttpResponse advanceRamp( throw new ManagementException("Network error executing HTTP request", e); } } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public ManagementApiHttpResponse updateStatus( + String id, UpdateExperimentStatusRequestContent request) { + return updateStatus(id, request, null); + } + + /** + * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation. + */ + public ManagementApiHttpResponse updateStatus( + String id, UpdateExperimentStatusRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateExperimentStatusResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public ManagementApiHttpResponse validate(String id) { + return validate(id, null); + } + + /** + * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified. + */ + public ManagementApiHttpResponse validate( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/experiments") + .addPathSegment(id) + .addPathSegments("validate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ValidateExperimentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/RawFeatureFlagsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/RawFeatureFlagsClient.java new file mode 100644 index 000000000..eefcd7ba6 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/RawFeatureFlagsClient.java @@ -0,0 +1,590 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.experimentation.types.CreateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListFeatureFlagsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagStatusRequestContent; +import com.auth0.client.mgmt.types.CreateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.FeatureFlag; +import com.auth0.client.mgmt.types.GetFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.ListFeatureFlagsResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagStatusResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFeatureFlagsClient { + protected final ClientOptions clientOptions; + + public RawFeatureFlagsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public ManagementApiHttpResponse> list() { + return list(ListFeatureFlagsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public ManagementApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListFeatureFlagsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public ManagementApiHttpResponse> list(ListFeatureFlagsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of feature flags for the tenant. + */ + public ManagementApiHttpResponse> list( + ListFeatureFlagsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getType().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().orElse(null), false); + } + if (!request.getStatus().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeatureFlagsResponseContent parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureFlagsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListFeatureFlagsRequestParameters nextRequest = ListFeatureFlagsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getFeatureFlags(); + return new ManagementApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public ManagementApiHttpResponse create(CreateFeatureFlagRequestContent request) { + return create(request, null); + } + + /** + * Create a new feature flag with parameters for use in experiments. + */ + public ManagementApiHttpResponse create( + CreateFeatureFlagRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFeatureFlagResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Retrieve a single feature flag by its ID. + */ + public ManagementApiHttpResponse get(String id) { + return get(id, null); + } + + /** + * Retrieve a single feature flag by its ID. + */ + public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFeatureFlagResponseContent.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public ManagementApiHttpResponse delete(String id) { + return delete(id, null); + } + + /** + * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist. + */ + public ManagementApiHttpResponse delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update(String id) { + return update(id, UpdateFeatureFlagRequestContent.builder().build()); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, RequestOptions requestOptions) { + return update(id, UpdateFeatureFlagRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, UpdateFeatureFlagRequestContent request) { + return update(id, request, null); + } + + /** + * Partially update a feature flag by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, UpdateFeatureFlagRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFeatureFlagResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public ManagementApiHttpResponse updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request) { + return updateStatus(id, request, null); + } + + /** + * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived. + */ + public ManagementApiHttpResponse updateStatus( + String id, UpdateFeatureFlagStatusRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateFeatureFlagStatusResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/RawSegmentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/RawSegmentsClient.java new file mode 100644 index 000000000..b32925aae --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/RawSegmentsClient.java @@ -0,0 +1,499 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.QueryStringMapper; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.errors.UnprocessableEntityError; +import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListSegmentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateSegmentRequestContent; +import com.auth0.client.mgmt.types.CreateSegmentResponseContent; +import com.auth0.client.mgmt.types.GetSegmentResponseContent; +import com.auth0.client.mgmt.types.ListSegmentsResponseContent; +import com.auth0.client.mgmt.types.Segment; +import com.auth0.client.mgmt.types.UpdateSegmentResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSegmentsClient { + protected final ClientOptions clientOptions; + + public RawSegmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public ManagementApiHttpResponse> list() { + return list(ListSegmentsRequestParameters.builder().build()); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public ManagementApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListSegmentsRequestParameters.builder().build(), requestOptions); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public ManagementApiHttpResponse> list(ListSegmentsRequestParameters request) { + return list(request, null); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public ManagementApiHttpResponse> list( + ListSegmentsRequestParameters request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments"); + if (!request.getFrom().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().orElse(null), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false); + if (!request.getType().isAbsent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().orElse(null), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSegmentsResponseContent parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSegmentsResponseContent.class); + Optional startingAfter = parsedResponse.getNext(); + ListSegmentsRequestParameters nextRequest = ListSegmentsRequestParameters.builder() + .from(request) + .from(startingAfter) + .build(); + List result = parsedResponse.getSegments(); + return new ManagementApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public ManagementApiHttpResponse create(CreateSegmentRequestContent request) { + return create(request, null); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public ManagementApiHttpResponse create( + CreateSegmentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateSegmentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Retrieve a single segment by its ID. + */ + public ManagementApiHttpResponse get(String id) { + return get(id, null); + } + + /** + * Retrieve a single segment by its ID. + */ + public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetSegmentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public ManagementApiHttpResponse delete(String id) { + return delete(id, null); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public ManagementApiHttpResponse delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public ManagementApiHttpResponse update(String id) { + return update(id, UpdateSegmentRequestContent.builder().build()); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public ManagementApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateSegmentRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public ManagementApiHttpResponse update( + String id, UpdateSegmentRequestContent request) { + return update(id, request, null); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public ManagementApiHttpResponse update( + String id, UpdateSegmentRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/segments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateSegmentResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/SegmentsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/SegmentsClient.java new file mode 100644 index 000000000..70f6c8b30 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/SegmentsClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListSegmentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateSegmentRequestContent; +import com.auth0.client.mgmt.types.CreateSegmentResponseContent; +import com.auth0.client.mgmt.types.GetSegmentResponseContent; +import com.auth0.client.mgmt.types.Segment; +import com.auth0.client.mgmt.types.UpdateSegmentResponseContent; + +public class SegmentsClient { + protected final ClientOptions clientOptions; + + private final RawSegmentsClient rawClient; + + public SegmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSegmentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSegmentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public SyncPagingIterable list(ListSegmentsRequestParameters request) { + return this.rawClient.list(request).body(); + } + + /** + * Retrieve a paginated list of segments for the tenant. + */ + public SyncPagingIterable list(ListSegmentsRequestParameters request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CreateSegmentResponseContent create(CreateSegmentRequestContent request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new segment with rule-based membership criteria for use in experiments. + */ + public CreateSegmentResponseContent create(CreateSegmentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieve a single segment by its ID. + */ + public GetSegmentResponseContent get(String id) { + return this.rawClient.get(id).body(); + } + + /** + * Retrieve a single segment by its ID. + */ + public GetSegmentResponseContent get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).body(); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public void delete(String id) { + this.rawClient.delete(id).body(); + } + + /** + * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist. + */ + public void delete(String id, RequestOptions requestOptions) { + this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public UpdateSegmentResponseContent update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public UpdateSegmentResponseContent update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public UpdateSegmentResponseContent update(String id, UpdateSegmentRequestContent request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array. + */ + public UpdateSegmentResponseContent update( + String id, UpdateSegmentRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncRawVariationsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncRawVariationsClient.java new file mode 100644 index 000000000..88e21b43d --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncRawVariationsClient.java @@ -0,0 +1,609 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.experimentation.featureflags.types.CreateVariationRequestContent; +import com.auth0.client.mgmt.experimentation.featureflags.types.UpdateVariationRequestContent; +import com.auth0.client.mgmt.types.CreateVariationResponseContent; +import com.auth0.client.mgmt.types.GetVariationResponseContent; +import com.auth0.client.mgmt.types.ListVariationsResponseContent; +import com.auth0.client.mgmt.types.UpdateVariationResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawVariationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawVariationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public CompletableFuture> list(String id) { + return list(id, null); + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public CompletableFuture> list( + String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListVariationsResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CompletableFuture> create( + String id, CreateVariationRequestContent request) { + return create(id, request, null); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CompletableFuture> create( + String id, CreateVariationRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateVariationResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieve a single variation by its ID. + */ + public CompletableFuture> get(String id, String vid) { + return get(id, vid, null); + } + + /** + * Retrieve a single variation by its ID. + */ + public CompletableFuture> get( + String id, String vid, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetVariationResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public CompletableFuture> delete(String id, String vid) { + return delete(id, vid, null); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public CompletableFuture> delete( + String id, String vid, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture> update(String id, String vid) { + return update(id, vid, UpdateVariationRequestContent.builder().build()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, String vid, RequestOptions requestOptions) { + return update(id, vid, UpdateVariationRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, String vid, UpdateVariationRequestContent request) { + return update(id, vid, request, null); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture> update( + String id, String vid, UpdateVariationRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateVariationResponseContent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncVariationsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncVariationsClient.java new file mode 100644 index 000000000..ea6f57ec9 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/AsyncVariationsClient.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.experimentation.featureflags.types.CreateVariationRequestContent; +import com.auth0.client.mgmt.experimentation.featureflags.types.UpdateVariationRequestContent; +import com.auth0.client.mgmt.types.CreateVariationResponseContent; +import com.auth0.client.mgmt.types.GetVariationResponseContent; +import com.auth0.client.mgmt.types.ListVariationsResponseContent; +import com.auth0.client.mgmt.types.UpdateVariationResponseContent; +import java.util.concurrent.CompletableFuture; + +public class AsyncVariationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawVariationsClient rawClient; + + public AsyncVariationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawVariationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawVariationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public CompletableFuture list(String id) { + return this.rawClient.list(id).thenApply(response -> response.body()); + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public CompletableFuture list(String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CompletableFuture create(String id, CreateVariationRequestContent request) { + return this.rawClient.create(id, request).thenApply(response -> response.body()); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CompletableFuture create( + String id, CreateVariationRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single variation by its ID. + */ + public CompletableFuture get(String id, String vid) { + return this.rawClient.get(id, vid).thenApply(response -> response.body()); + } + + /** + * Retrieve a single variation by its ID. + */ + public CompletableFuture get(String id, String vid, RequestOptions requestOptions) { + return this.rawClient.get(id, vid, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public CompletableFuture delete(String id, String vid) { + return this.rawClient.delete(id, vid).thenApply(response -> response.body()); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public CompletableFuture delete(String id, String vid, RequestOptions requestOptions) { + return this.rawClient.delete(id, vid, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture update(String id, String vid) { + return this.rawClient.update(id, vid).thenApply(response -> response.body()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture update( + String id, String vid, RequestOptions requestOptions) { + return this.rawClient.update(id, vid, requestOptions).thenApply(response -> response.body()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture update( + String id, String vid, UpdateVariationRequestContent request) { + return this.rawClient.update(id, vid, request).thenApply(response -> response.body()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public CompletableFuture update( + String id, String vid, UpdateVariationRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, vid, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/RawVariationsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/RawVariationsClient.java new file mode 100644 index 000000000..1500d7572 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/RawVariationsClient.java @@ -0,0 +1,477 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.ManagementApiException; +import com.auth0.client.mgmt.core.ManagementApiHttpResponse; +import com.auth0.client.mgmt.core.ManagementException; +import com.auth0.client.mgmt.core.MediaTypes; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.core.RetryInterceptor; +import com.auth0.client.mgmt.errors.BadRequestError; +import com.auth0.client.mgmt.errors.ConflictError; +import com.auth0.client.mgmt.errors.ForbiddenError; +import com.auth0.client.mgmt.errors.NotFoundError; +import com.auth0.client.mgmt.errors.TooManyRequestsError; +import com.auth0.client.mgmt.errors.UnauthorizedError; +import com.auth0.client.mgmt.experimentation.featureflags.types.CreateVariationRequestContent; +import com.auth0.client.mgmt.experimentation.featureflags.types.UpdateVariationRequestContent; +import com.auth0.client.mgmt.types.CreateVariationResponseContent; +import com.auth0.client.mgmt.types.GetVariationResponseContent; +import com.auth0.client.mgmt.types.ListVariationsResponseContent; +import com.auth0.client.mgmt.types.UpdateVariationResponseContent; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawVariationsClient { + protected final ClientOptions clientOptions; + + public RawVariationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public ManagementApiHttpResponse list(String id) { + return list(id, null); + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public ManagementApiHttpResponse list(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListVariationsResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public ManagementApiHttpResponse create( + String id, CreateVariationRequestContent request) { + return create(id, request, null); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public ManagementApiHttpResponse create( + String id, CreateVariationRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateVariationResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Retrieve a single variation by its ID. + */ + public ManagementApiHttpResponse get(String id, String vid) { + return get(id, vid, null); + } + + /** + * Retrieve a single variation by its ID. + */ + public ManagementApiHttpResponse get( + String id, String vid, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetVariationResponseContent.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public ManagementApiHttpResponse delete(String id, String vid) { + return delete(id, vid, null); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public ManagementApiHttpResponse delete(String id, String vid, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update(String id, String vid) { + return update(id, vid, UpdateVariationRequestContent.builder().build()); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, String vid, RequestOptions requestOptions) { + return update(id, vid, UpdateVariationRequestContent.builder().build(), requestOptions); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, String vid, UpdateVariationRequestContent request) { + return update(id, vid, request, null); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public ManagementApiHttpResponse update( + String id, String vid, UpdateVariationRequestContent request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experimentation/feature-flags") + .addPathSegment(id) + .addPathSegments("variations") + .addPathSegment(vid); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new ManagementApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateVariationResponseContent.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new ManagementApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new ManagementException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/VariationsClient.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/VariationsClient.java new file mode 100644 index 000000000..807539cb9 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/VariationsClient.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags; + +import com.auth0.client.mgmt.core.ClientOptions; +import com.auth0.client.mgmt.core.RequestOptions; +import com.auth0.client.mgmt.experimentation.featureflags.types.CreateVariationRequestContent; +import com.auth0.client.mgmt.experimentation.featureflags.types.UpdateVariationRequestContent; +import com.auth0.client.mgmt.types.CreateVariationResponseContent; +import com.auth0.client.mgmt.types.GetVariationResponseContent; +import com.auth0.client.mgmt.types.ListVariationsResponseContent; +import com.auth0.client.mgmt.types.UpdateVariationResponseContent; + +public class VariationsClient { + protected final ClientOptions clientOptions; + + private final RawVariationsClient rawClient; + + public VariationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawVariationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawVariationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public ListVariationsResponseContent list(String id) { + return this.rawClient.list(id).body(); + } + + /** + * Retrieve all variations defined for a specific feature flag. + */ + public ListVariationsResponseContent list(String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).body(); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CreateVariationResponseContent create(String id, CreateVariationRequestContent request) { + return this.rawClient.create(id, request).body(); + } + + /** + * Create a new variation with parameter overrides for a specific feature flag. + */ + public CreateVariationResponseContent create( + String id, CreateVariationRequestContent request, RequestOptions requestOptions) { + return this.rawClient.create(id, request, requestOptions).body(); + } + + /** + * Retrieve a single variation by its ID. + */ + public GetVariationResponseContent get(String id, String vid) { + return this.rawClient.get(id, vid).body(); + } + + /** + * Retrieve a single variation by its ID. + */ + public GetVariationResponseContent get(String id, String vid, RequestOptions requestOptions) { + return this.rawClient.get(id, vid, requestOptions).body(); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public void delete(String id, String vid) { + this.rawClient.delete(id, vid).body(); + } + + /** + * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist. + */ + public void delete(String id, String vid, RequestOptions requestOptions) { + this.rawClient.delete(id, vid, requestOptions).body(); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public UpdateVariationResponseContent update(String id, String vid) { + return this.rawClient.update(id, vid).body(); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public UpdateVariationResponseContent update(String id, String vid, RequestOptions requestOptions) { + return this.rawClient.update(id, vid, requestOptions).body(); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public UpdateVariationResponseContent update(String id, String vid, UpdateVariationRequestContent request) { + return this.rawClient.update(id, vid, request).body(); + } + + /** + * Partially update a variation by ID. Only provided fields are updated. + */ + public UpdateVariationResponseContent update( + String id, String vid, UpdateVariationRequestContent request, RequestOptions requestOptions) { + return this.rawClient.update(id, vid, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/CreateVariationRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/CreateVariationRequestContent.java new file mode 100644 index 000000000..ad5adaaf9 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/CreateVariationRequestContent.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVariationRequestContent.Builder.class) +public final class CreateVariationRequestContent { + private final String name; + + private final Optional description; + + private final Map overrides; + + private final Map additionalProperties; + + private CreateVariationRequestContent( + String name, + Optional description, + Map overrides, + Map additionalProperties) { + this.name = name; + this.description = description; + this.overrides = overrides; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the variation + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return A description of what this variation controls + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing. + */ + @JsonProperty("overrides") + public Map getOverrides() { + return overrides; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVariationRequestContent && equalTo((CreateVariationRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVariationRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && overrides.equals(other.overrides); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.overrides); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

    A human-readable name for the variation

    + */ + _FinalStage name(@NotNull String name); + + Builder from(CreateVariationRequestContent other); + } + + public interface _FinalStage { + CreateVariationRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    A description of what this variation controls

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing.

    + */ + _FinalStage overrides(Map overrides); + + _FinalStage putAllOverrides(Map overrides); + + _FinalStage overrides(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Map overrides = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVariationRequestContent other) { + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + return this; + } + + /** + *

    A human-readable name for the variation

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage overrides(String key, Object value) { + this.overrides.put(key, value); + return this; + } + + /** + *

    Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllOverrides(Map overrides) { + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + /** + *

    Configuration overrides for this variation; keys must exist in the parent flag parameters. Empty {} is the baseline (control) variation that overrides nothing.

    + */ + @java.lang.Override + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public _FinalStage overrides(Map overrides) { + this.overrides.clear(); + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + /** + *

    A description of what this variation controls

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of what this variation controls

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateVariationRequestContent build() { + return new CreateVariationRequestContent(name, description, overrides, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/UpdateVariationRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/UpdateVariationRequestContent.java new file mode 100644 index 000000000..f4cbb3333 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/featureflags/types/UpdateVariationRequestContent.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.featureflags.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVariationRequestContent.Builder.class) +public final class UpdateVariationRequestContent { + private final Optional name; + + private final OptionalNullable description; + + private final Optional> overrides; + + private final Map additionalProperties; + + private UpdateVariationRequestContent( + Optional name, + OptionalNullable description, + Optional> overrides, + Map additionalProperties) { + this.name = name; + this.description = description; + this.overrides = overrides; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the variation + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A description of what this variation controls + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + public OptionalNullable getDescription() { + if (description == null) { + return OptionalNullable.absent(); + } + return description; + } + + @JsonProperty("overrides") + public Optional> getOverrides() { + return overrides; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private OptionalNullable _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVariationRequestContent && equalTo((UpdateVariationRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVariationRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && overrides.equals(other.overrides); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.overrides); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private OptionalNullable description = OptionalNullable.absent(); + + private Optional> overrides = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVariationRequestContent other) { + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + return this; + } + + /** + *

    A human-readable name for the variation

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A description of what this variation controls

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(@Nullable OptionalNullable description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = OptionalNullable.of(description); + return this; + } + + public Builder description(Optional description) { + if (description.isPresent()) { + this.description = OptionalNullable.of(description.get()); + } else { + this.description = OptionalNullable.absent(); + } + return this; + } + + public Builder description(com.auth0.client.mgmt.core.Nullable description) { + if (description.isNull()) { + this.description = OptionalNullable.ofNull(); + } else if (description.isEmpty()) { + this.description = OptionalNullable.absent(); + } else { + this.description = OptionalNullable.of(description.get()); + } + return this; + } + + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public Builder overrides(Optional> overrides) { + this.overrides = overrides; + return this; + } + + public Builder overrides(Map overrides) { + this.overrides = Optional.ofNullable(overrides); + return this; + } + + public UpdateVariationRequestContent build() { + return new UpdateVariationRequestContent(name, description, overrides, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateExperimentRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateExperimentRequestContent.java new file mode 100644 index 000000000..1267dec51 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateExperimentRequestContent.java @@ -0,0 +1,427 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.types.AllocationRequestItem; +import com.auth0.client.mgmt.types.AllocationStrategyEnum; +import com.auth0.client.mgmt.types.AuthenticationFlowEnum; +import com.auth0.client.mgmt.types.DefaultConfigEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateExperimentRequestContent.Builder.class) +public final class CreateExperimentRequestContent { + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final AuthenticationFlowEnum authenticationFlow; + + private final Optional defaultConfig; + + private final Optional allocationStrategy; + + private final Optional> allocations; + + private final Optional> levels; + + private final Map additionalProperties; + + private CreateExperimentRequestContent( + String name, + Optional description, + String featureFlagId, + AuthenticationFlowEnum authenticationFlow, + Optional defaultConfig, + Optional allocationStrategy, + Optional> allocations, + Optional> levels, + Map additionalProperties) { + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.authenticationFlow = authenticationFlow; + this.defaultConfig = defaultConfig; + this.allocationStrategy = allocationStrategy; + this.allocations = allocations; + this.levels = levels; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the experiment + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return A description of the experiment + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The ID of the feature flag this experiment is based on + */ + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("authentication_flow") + public AuthenticationFlowEnum getAuthenticationFlow() { + return authenticationFlow; + } + + /** + * @return Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config so the experiment overlays only its changes, 'flag' uses the flag's frozen defaults for a complete config. Optional; defaults to 'tenant' when omitted. Rejected for customer-defined flags. + */ + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + /** + * @return The traffic allocation strategy for this experiment + */ + @JsonProperty("allocation_strategy") + public Optional getAllocationStrategy() { + return allocationStrategy; + } + + /** + * @return Traffic allocations mapping variations to weights or segments + */ + @JsonProperty("allocations") + public Optional> getAllocations() { + return allocations; + } + + /** + * @return Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100]. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateExperimentRequestContent && equalTo((CreateExperimentRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateExperimentRequestContent other) { + return name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && authenticationFlow.equals(other.authenticationFlow) + && defaultConfig.equals(other.defaultConfig) + && allocationStrategy.equals(other.allocationStrategy) + && allocations.equals(other.allocations) + && levels.equals(other.levels); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.description, + this.featureFlagId, + this.authenticationFlow, + this.defaultConfig, + this.allocationStrategy, + this.allocations, + this.levels); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

    A human-readable name for the experiment

    + */ + FeatureFlagIdStage name(@NotNull String name); + + Builder from(CreateExperimentRequestContent other); + } + + public interface FeatureFlagIdStage { + /** + *

    The ID of the feature flag this experiment is based on

    + */ + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + _FinalStage authenticationFlow(@NotNull AuthenticationFlowEnum authenticationFlow); + } + + public interface _FinalStage { + CreateExperimentRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    A description of the experiment

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config so the experiment overlays only its changes, 'flag' uses the flag's frozen defaults for a complete config. Optional; defaults to 'tenant' when omitted. Rejected for customer-defined flags.

    + */ + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + /** + *

    The traffic allocation strategy for this experiment

    + */ + _FinalStage allocationStrategy(Optional allocationStrategy); + + _FinalStage allocationStrategy(AllocationStrategyEnum allocationStrategy); + + /** + *

    Traffic allocations mapping variations to weights or segments

    + */ + _FinalStage allocations(Optional> allocations); + + _FinalStage allocations(List allocations); + + /** + *

    Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100].

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, FeatureFlagIdStage, AuthenticationFlowStage, _FinalStage { + private String name; + + private String featureFlagId; + + private AuthenticationFlowEnum authenticationFlow; + + private Optional> levels = Optional.empty(); + + private Optional> allocations = Optional.empty(); + + private Optional allocationStrategy = Optional.empty(); + + private Optional defaultConfig = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateExperimentRequestContent other) { + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + authenticationFlow(other.getAuthenticationFlow()); + defaultConfig(other.getDefaultConfig()); + allocationStrategy(other.getAllocationStrategy()); + allocations(other.getAllocations()); + levels(other.getLevels()); + return this; + } + + /** + *

    A human-readable name for the experiment

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The ID of the feature flag this experiment is based on

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public _FinalStage authenticationFlow(@NotNull AuthenticationFlowEnum authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + /** + *

    Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100].

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100].

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Traffic allocations mapping variations to weights or segments

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allocations(List allocations) { + this.allocations = Optional.ofNullable(allocations); + return this; + } + + /** + *

    Traffic allocations mapping variations to weights or segments

    + */ + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(Optional> allocations) { + this.allocations = allocations; + return this; + } + + /** + *

    The traffic allocation strategy for this experiment

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allocationStrategy(AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Optional.ofNullable(allocationStrategy); + return this; + } + + /** + *

    The traffic allocation strategy for this experiment

    + */ + @java.lang.Override + @JsonSetter(value = "allocation_strategy", nulls = Nulls.SKIP) + public _FinalStage allocationStrategy(Optional allocationStrategy) { + this.allocationStrategy = allocationStrategy; + return this; + } + + /** + *

    Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config so the experiment overlays only its changes, 'flag' uses the flag's frozen defaults for a complete config. Optional; defaults to 'tenant' when omitted. Rejected for customer-defined flags.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + /** + *

    Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config so the experiment overlays only its changes, 'flag' uses the flag's frozen defaults for a complete config. Optional; defaults to 'tenant' when omitted. Rejected for customer-defined flags.

    + */ + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + /** + *

    A description of the experiment

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of the experiment

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateExperimentRequestContent build() { + return new CreateExperimentRequestContent( + name, + description, + featureFlagId, + authenticationFlow, + defaultConfig, + allocationStrategy, + allocations, + levels, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateFeatureFlagRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateFeatureFlagRequestContent.java new file mode 100644 index 000000000..1910a5e4a --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateFeatureFlagRequestContent.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.types.FeatureFlagConfigParam; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFeatureFlagRequestContent.Builder.class) +public final class CreateFeatureFlagRequestContent { + private final String name; + + private final Optional description; + + private final Map parameters; + + private final Map additionalProperties; + + private CreateFeatureFlagRequestContent( + String name, + Optional description, + Map parameters, + Map additionalProperties) { + this.name = name; + this.description = description; + this.parameters = parameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the feature flag + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return A description of what this feature flag controls + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("parameters") + public Map getParameters() { + return parameters; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFeatureFlagRequestContent && equalTo((CreateFeatureFlagRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFeatureFlagRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && parameters.equals(other.parameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.parameters); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

    A human-readable name for the feature flag

    + */ + _FinalStage name(@NotNull String name); + + Builder from(CreateFeatureFlagRequestContent other); + } + + public interface _FinalStage { + CreateFeatureFlagRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    A description of what this feature flag controls

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Map parameters); + + _FinalStage putAllParameters(Map parameters); + + _FinalStage parameters(String key, FeatureFlagConfigParam value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Map parameters = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateFeatureFlagRequestContent other) { + name(other.getName()); + description(other.getDescription()); + parameters(other.getParameters()); + return this; + } + + /** + *

    A human-readable name for the feature flag

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(String key, FeatureFlagConfigParam value) { + this.parameters.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllParameters(Map parameters) { + if (parameters != null) { + this.parameters.putAll(parameters); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Map parameters) { + this.parameters.clear(); + if (parameters != null) { + this.parameters.putAll(parameters); + } + return this; + } + + /** + *

    A description of what this feature flag controls

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of what this feature flag controls

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateFeatureFlagRequestContent build() { + return new CreateFeatureFlagRequestContent(name, description, parameters, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateSegmentRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateSegmentRequestContent.java new file mode 100644 index 000000000..a9900d4b2 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/CreateSegmentRequestContent.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.types.SegmentRule; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSegmentRequestContent.Builder.class) +public final class CreateSegmentRequestContent { + private final String name; + + private final Optional description; + + private final List rules; + + private final Map additionalProperties; + + private CreateSegmentRequestContent( + String name, + Optional description, + List rules, + Map additionalProperties) { + this.name = name; + this.description = description; + this.rules = rules; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the segment + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return A description of the segment + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized). + */ + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSegmentRequestContent && equalTo((CreateSegmentRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSegmentRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && rules.equals(other.rules); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.rules); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

    A human-readable name for the segment

    + */ + _FinalStage name(@NotNull String name); + + Builder from(CreateSegmentRequestContent other); + } + + public interface _FinalStage { + CreateSegmentRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    A description of the segment

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized).

    + */ + _FinalStage rules(List rules); + + _FinalStage addRules(SegmentRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private List rules = new ArrayList<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSegmentRequestContent other) { + name(other.getName()); + description(other.getDescription()); + rules(other.getRules()); + return this; + } + + /** + *

    A human-readable name for the segment

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized).

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + /** + *

    An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized).

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRules(SegmentRule rules) { + this.rules.add(rules); + return this; + } + + /** + *

    An ordered list of rules. A segment matches if any rule matches. Each rule is limited to 4KB and the whole segment to 10KB (serialized).

    + */ + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + /** + *

    A description of the segment

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of the segment

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateSegmentRequestContent build() { + return new CreateSegmentRequestContent(name, description, rules, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/ListExperimentsRequestParameters.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListExperimentsRequestParameters.java new file mode 100644 index 000000000..d6a6197ff --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListExperimentsRequestParameters.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.ExperimentStatusEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperimentsRequestParameters.Builder.class) +public final class ListExperimentsRequestParameters { + private final OptionalNullable from; + + private final OptionalNullable take; + + private final OptionalNullable status; + + private final OptionalNullable authenticationFlow; + + private final OptionalNullable featureFlagId; + + private final Map additionalProperties; + + private ListExperimentsRequestParameters( + OptionalNullable from, + OptionalNullable take, + OptionalNullable status, + OptionalNullable authenticationFlow, + OptionalNullable featureFlagId, + Map additionalProperties) { + this.from = from; + this.take = take; + this.status = status; + this.authenticationFlow = authenticationFlow; + this.featureFlagId = featureFlagId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional Id from which to start selection. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + public OptionalNullable getFrom() { + if (from == null) { + return OptionalNullable.absent(); + } + return from; + } + + /** + * @return Number of experiments to return per page. Defaults to 25, maximum 50. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + public OptionalNullable getTake() { + if (take == null) { + return OptionalNullable.absent(); + } + return take; + } + + /** + * @return Filter by status. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + public OptionalNullable getStatus() { + if (status == null) { + return OptionalNullable.absent(); + } + return status; + } + + /** + * @return Filter by authentication flow. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authentication_flow") + public OptionalNullable getAuthenticationFlow() { + if (authenticationFlow == null) { + return OptionalNullable.absent(); + } + return authenticationFlow; + } + + /** + * @return Filter by feature flag ID. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_id") + public OptionalNullable getFeatureFlagId() { + if (featureFlagId == null) { + return OptionalNullable.absent(); + } + return featureFlagId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + private OptionalNullable _getFrom() { + return from; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + private OptionalNullable _getTake() { + return take; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private OptionalNullable _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authentication_flow") + private OptionalNullable _getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_id") + private OptionalNullable _getFeatureFlagId() { + return featureFlagId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperimentsRequestParameters && equalTo((ListExperimentsRequestParameters) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperimentsRequestParameters other) { + return from.equals(other.from) + && take.equals(other.take) + && status.equals(other.status) + && authenticationFlow.equals(other.authenticationFlow) + && featureFlagId.equals(other.featureFlagId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.from, this.take, this.status, this.authenticationFlow, this.featureFlagId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private OptionalNullable from = OptionalNullable.absent(); + + private OptionalNullable take = OptionalNullable.absent(); + + private OptionalNullable status = OptionalNullable.absent(); + + private OptionalNullable authenticationFlow = OptionalNullable.absent(); + + private OptionalNullable featureFlagId = OptionalNullable.absent(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListExperimentsRequestParameters other) { + from(other.getFrom()); + take(other.getTake()); + status(other.getStatus()); + authenticationFlow(other.getAuthenticationFlow()); + featureFlagId(other.getFeatureFlagId()); + return this; + } + + /** + *

    Optional Id from which to start selection.

    + */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(@Nullable OptionalNullable from) { + this.from = from; + return this; + } + + public Builder from(String from) { + this.from = OptionalNullable.of(from); + return this; + } + + public Builder from(Optional from) { + if (from.isPresent()) { + this.from = OptionalNullable.of(from.get()); + } else { + this.from = OptionalNullable.absent(); + } + return this; + } + + public Builder from(com.auth0.client.mgmt.core.Nullable from) { + if (from.isNull()) { + this.from = OptionalNullable.ofNull(); + } else if (from.isEmpty()) { + this.from = OptionalNullable.absent(); + } else { + this.from = OptionalNullable.of(from.get()); + } + return this; + } + + /** + *

    Number of experiments to return per page. Defaults to 25, maximum 50.

    + */ + @JsonSetter(value = "take", nulls = Nulls.SKIP) + public Builder take(@Nullable OptionalNullable take) { + this.take = take; + return this; + } + + public Builder take(Integer take) { + this.take = OptionalNullable.of(take); + return this; + } + + public Builder take(Optional take) { + if (take.isPresent()) { + this.take = OptionalNullable.of(take.get()); + } else { + this.take = OptionalNullable.absent(); + } + return this; + } + + public Builder take(com.auth0.client.mgmt.core.Nullable take) { + if (take.isNull()) { + this.take = OptionalNullable.ofNull(); + } else if (take.isEmpty()) { + this.take = OptionalNullable.absent(); + } else { + this.take = OptionalNullable.of(take.get()); + } + return this; + } + + /** + *

    Filter by status. Exact match.

    + */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(@Nullable OptionalNullable status) { + this.status = status; + return this; + } + + public Builder status(ExperimentStatusEnum status) { + this.status = OptionalNullable.of(status); + return this; + } + + public Builder status(Optional status) { + if (status.isPresent()) { + this.status = OptionalNullable.of(status.get()); + } else { + this.status = OptionalNullable.absent(); + } + return this; + } + + public Builder status(com.auth0.client.mgmt.core.Nullable status) { + if (status.isNull()) { + this.status = OptionalNullable.ofNull(); + } else if (status.isEmpty()) { + this.status = OptionalNullable.absent(); + } else { + this.status = OptionalNullable.of(status.get()); + } + return this; + } + + /** + *

    Filter by authentication flow. Exact match.

    + */ + @JsonSetter(value = "authentication_flow", nulls = Nulls.SKIP) + public Builder authenticationFlow(@Nullable OptionalNullable authenticationFlow) { + this.authenticationFlow = authenticationFlow; + return this; + } + + public Builder authenticationFlow(String authenticationFlow) { + this.authenticationFlow = OptionalNullable.of(authenticationFlow); + return this; + } + + public Builder authenticationFlow(Optional authenticationFlow) { + if (authenticationFlow.isPresent()) { + this.authenticationFlow = OptionalNullable.of(authenticationFlow.get()); + } else { + this.authenticationFlow = OptionalNullable.absent(); + } + return this; + } + + public Builder authenticationFlow(com.auth0.client.mgmt.core.Nullable authenticationFlow) { + if (authenticationFlow.isNull()) { + this.authenticationFlow = OptionalNullable.ofNull(); + } else if (authenticationFlow.isEmpty()) { + this.authenticationFlow = OptionalNullable.absent(); + } else { + this.authenticationFlow = OptionalNullable.of(authenticationFlow.get()); + } + return this; + } + + /** + *

    Filter by feature flag ID. Exact match.

    + */ + @JsonSetter(value = "feature_flag_id", nulls = Nulls.SKIP) + public Builder featureFlagId(@Nullable OptionalNullable featureFlagId) { + this.featureFlagId = featureFlagId; + return this; + } + + public Builder featureFlagId(String featureFlagId) { + this.featureFlagId = OptionalNullable.of(featureFlagId); + return this; + } + + public Builder featureFlagId(Optional featureFlagId) { + if (featureFlagId.isPresent()) { + this.featureFlagId = OptionalNullable.of(featureFlagId.get()); + } else { + this.featureFlagId = OptionalNullable.absent(); + } + return this; + } + + public Builder featureFlagId(com.auth0.client.mgmt.core.Nullable featureFlagId) { + if (featureFlagId.isNull()) { + this.featureFlagId = OptionalNullable.ofNull(); + } else if (featureFlagId.isEmpty()) { + this.featureFlagId = OptionalNullable.absent(); + } else { + this.featureFlagId = OptionalNullable.of(featureFlagId.get()); + } + return this; + } + + public ListExperimentsRequestParameters build() { + return new ListExperimentsRequestParameters( + from, take, status, authenticationFlow, featureFlagId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/ListFeatureFlagsRequestParameters.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListFeatureFlagsRequestParameters.java new file mode 100644 index 000000000..b0625235b --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListFeatureFlagsRequestParameters.java @@ -0,0 +1,328 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.FeatureFlagStatusEnum; +import com.auth0.client.mgmt.types.FeatureFlagTypeEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeatureFlagsRequestParameters.Builder.class) +public final class ListFeatureFlagsRequestParameters { + private final OptionalNullable from; + + private final OptionalNullable take; + + private final OptionalNullable type; + + private final OptionalNullable status; + + private final Map additionalProperties; + + private ListFeatureFlagsRequestParameters( + OptionalNullable from, + OptionalNullable take, + OptionalNullable type, + OptionalNullable status, + Map additionalProperties) { + this.from = from; + this.take = take; + this.type = type; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional Id from which to start selection. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + public OptionalNullable getFrom() { + if (from == null) { + return OptionalNullable.absent(); + } + return from; + } + + /** + * @return Number of feature flags to return per page. Defaults to 25, maximum 50. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + public OptionalNullable getTake() { + if (take == null) { + return OptionalNullable.absent(); + } + return take; + } + + /** + * @return Filter by type. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + public OptionalNullable getType() { + if (type == null) { + return OptionalNullable.absent(); + } + return type; + } + + /** + * @return Filter by status. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + public OptionalNullable getStatus() { + if (status == null) { + return OptionalNullable.absent(); + } + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + private OptionalNullable _getFrom() { + return from; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + private OptionalNullable _getTake() { + return take; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private OptionalNullable _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private OptionalNullable _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeatureFlagsRequestParameters && equalTo((ListFeatureFlagsRequestParameters) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeatureFlagsRequestParameters other) { + return from.equals(other.from) + && take.equals(other.take) + && type.equals(other.type) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.from, this.take, this.type, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private OptionalNullable from = OptionalNullable.absent(); + + private OptionalNullable take = OptionalNullable.absent(); + + private OptionalNullable type = OptionalNullable.absent(); + + private OptionalNullable status = OptionalNullable.absent(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListFeatureFlagsRequestParameters other) { + from(other.getFrom()); + take(other.getTake()); + type(other.getType()); + status(other.getStatus()); + return this; + } + + /** + *

    Optional Id from which to start selection.

    + */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(@Nullable OptionalNullable from) { + this.from = from; + return this; + } + + public Builder from(String from) { + this.from = OptionalNullable.of(from); + return this; + } + + public Builder from(Optional from) { + if (from.isPresent()) { + this.from = OptionalNullable.of(from.get()); + } else { + this.from = OptionalNullable.absent(); + } + return this; + } + + public Builder from(com.auth0.client.mgmt.core.Nullable from) { + if (from.isNull()) { + this.from = OptionalNullable.ofNull(); + } else if (from.isEmpty()) { + this.from = OptionalNullable.absent(); + } else { + this.from = OptionalNullable.of(from.get()); + } + return this; + } + + /** + *

    Number of feature flags to return per page. Defaults to 25, maximum 50.

    + */ + @JsonSetter(value = "take", nulls = Nulls.SKIP) + public Builder take(@Nullable OptionalNullable take) { + this.take = take; + return this; + } + + public Builder take(Integer take) { + this.take = OptionalNullable.of(take); + return this; + } + + public Builder take(Optional take) { + if (take.isPresent()) { + this.take = OptionalNullable.of(take.get()); + } else { + this.take = OptionalNullable.absent(); + } + return this; + } + + public Builder take(com.auth0.client.mgmt.core.Nullable take) { + if (take.isNull()) { + this.take = OptionalNullable.ofNull(); + } else if (take.isEmpty()) { + this.take = OptionalNullable.absent(); + } else { + this.take = OptionalNullable.of(take.get()); + } + return this; + } + + /** + *

    Filter by type. Exact match.

    + */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(@Nullable OptionalNullable type) { + this.type = type; + return this; + } + + public Builder type(FeatureFlagTypeEnum type) { + this.type = OptionalNullable.of(type); + return this; + } + + public Builder type(Optional type) { + if (type.isPresent()) { + this.type = OptionalNullable.of(type.get()); + } else { + this.type = OptionalNullable.absent(); + } + return this; + } + + public Builder type(com.auth0.client.mgmt.core.Nullable type) { + if (type.isNull()) { + this.type = OptionalNullable.ofNull(); + } else if (type.isEmpty()) { + this.type = OptionalNullable.absent(); + } else { + this.type = OptionalNullable.of(type.get()); + } + return this; + } + + /** + *

    Filter by status. Exact match.

    + */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(@Nullable OptionalNullable status) { + this.status = status; + return this; + } + + public Builder status(FeatureFlagStatusEnum status) { + this.status = OptionalNullable.of(status); + return this; + } + + public Builder status(Optional status) { + if (status.isPresent()) { + this.status = OptionalNullable.of(status.get()); + } else { + this.status = OptionalNullable.absent(); + } + return this; + } + + public Builder status(com.auth0.client.mgmt.core.Nullable status) { + if (status.isNull()) { + this.status = OptionalNullable.ofNull(); + } else if (status.isEmpty()) { + this.status = OptionalNullable.absent(); + } else { + this.status = OptionalNullable.of(status.get()); + } + return this; + } + + public ListFeatureFlagsRequestParameters build() { + return new ListFeatureFlagsRequestParameters(from, take, type, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/ListSegmentsRequestParameters.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListSegmentsRequestParameters.java new file mode 100644 index 000000000..04a2359db --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/ListSegmentsRequestParameters.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.SegmentTypeFilterEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSegmentsRequestParameters.Builder.class) +public final class ListSegmentsRequestParameters { + private final OptionalNullable from; + + private final OptionalNullable take; + + private final OptionalNullable type; + + private final Map additionalProperties; + + private ListSegmentsRequestParameters( + OptionalNullable from, + OptionalNullable take, + OptionalNullable type, + Map additionalProperties) { + this.from = from; + this.take = take; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional Id from which to start selection. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + public OptionalNullable getFrom() { + if (from == null) { + return OptionalNullable.absent(); + } + return from; + } + + /** + * @return Number of segments to return per page. Defaults to 25, maximum 50. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + public OptionalNullable getTake() { + if (take == null) { + return OptionalNullable.absent(); + } + return take; + } + + /** + * @return Filter by type. Exact match. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + public OptionalNullable getType() { + if (type == null) { + return OptionalNullable.absent(); + } + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from") + private OptionalNullable _getFrom() { + return from; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("take") + private OptionalNullable _getTake() { + return take; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private OptionalNullable _getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSegmentsRequestParameters && equalTo((ListSegmentsRequestParameters) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSegmentsRequestParameters other) { + return from.equals(other.from) && take.equals(other.take) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.from, this.take, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private OptionalNullable from = OptionalNullable.absent(); + + private OptionalNullable take = OptionalNullable.absent(); + + private OptionalNullable type = OptionalNullable.absent(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSegmentsRequestParameters other) { + from(other.getFrom()); + take(other.getTake()); + type(other.getType()); + return this; + } + + /** + *

    Optional Id from which to start selection.

    + */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(@Nullable OptionalNullable from) { + this.from = from; + return this; + } + + public Builder from(String from) { + this.from = OptionalNullable.of(from); + return this; + } + + public Builder from(Optional from) { + if (from.isPresent()) { + this.from = OptionalNullable.of(from.get()); + } else { + this.from = OptionalNullable.absent(); + } + return this; + } + + public Builder from(com.auth0.client.mgmt.core.Nullable from) { + if (from.isNull()) { + this.from = OptionalNullable.ofNull(); + } else if (from.isEmpty()) { + this.from = OptionalNullable.absent(); + } else { + this.from = OptionalNullable.of(from.get()); + } + return this; + } + + /** + *

    Number of segments to return per page. Defaults to 25, maximum 50.

    + */ + @JsonSetter(value = "take", nulls = Nulls.SKIP) + public Builder take(@Nullable OptionalNullable take) { + this.take = take; + return this; + } + + public Builder take(Integer take) { + this.take = OptionalNullable.of(take); + return this; + } + + public Builder take(Optional take) { + if (take.isPresent()) { + this.take = OptionalNullable.of(take.get()); + } else { + this.take = OptionalNullable.absent(); + } + return this; + } + + public Builder take(com.auth0.client.mgmt.core.Nullable take) { + if (take.isNull()) { + this.take = OptionalNullable.ofNull(); + } else if (take.isEmpty()) { + this.take = OptionalNullable.absent(); + } else { + this.take = OptionalNullable.of(take.get()); + } + return this; + } + + /** + *

    Filter by type. Exact match.

    + */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(@Nullable OptionalNullable type) { + this.type = type; + return this; + } + + public Builder type(SegmentTypeFilterEnum type) { + this.type = OptionalNullable.of(type); + return this; + } + + public Builder type(Optional type) { + if (type.isPresent()) { + this.type = OptionalNullable.of(type.get()); + } else { + this.type = OptionalNullable.absent(); + } + return this; + } + + public Builder type(com.auth0.client.mgmt.core.Nullable type) { + if (type.isNull()) { + this.type = OptionalNullable.ofNull(); + } else if (type.isEmpty()) { + this.type = OptionalNullable.absent(); + } else { + this.type = OptionalNullable.of(type.get()); + } + return this; + } + + public ListSegmentsRequestParameters build() { + return new ListSegmentsRequestParameters(from, take, type, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentRequestParameters.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentRequestParameters.java new file mode 100644 index 000000000..d3186dc04 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentRequestParameters.java @@ -0,0 +1,307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.AllocationRequestItem; +import com.auth0.client.mgmt.types.AuthenticationFlowEnum; +import com.auth0.client.mgmt.types.DefaultConfigEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperimentRequestParameters.Builder.class) +public final class UpdateExperimentRequestParameters { + private final Optional name; + + private final OptionalNullable description; + + private final Optional authenticationFlow; + + private final Optional> allocations; + + private final Optional defaultConfig; + + private final Optional> levels; + + private final Map additionalProperties; + + private UpdateExperimentRequestParameters( + Optional name, + OptionalNullable description, + Optional authenticationFlow, + Optional> allocations, + Optional defaultConfig, + Optional> levels, + Map additionalProperties) { + this.name = name; + this.description = description; + this.authenticationFlow = authenticationFlow; + this.allocations = allocations; + this.defaultConfig = defaultConfig; + this.levels = levels; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the experiment + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A description of the experiment + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + public OptionalNullable getDescription() { + if (description == null) { + return OptionalNullable.absent(); + } + return description; + } + + /** + * @return Specifies the target authentication flow for this experiment. This field can only be modified on draft experiments. Must be one of: authentication, mfa_enrollment, mfa_challenge, password_reset, passkey_enrollment, or all. Note that the all value targets every flow at once, but requires that this is the only active experiment. + */ + @JsonProperty("authentication_flow") + public Optional getAuthenticationFlow() { + return authenticationFlow; + } + + /** + * @return Replaces all traffic allocations. Cannot be modified while the experiment is active. + */ + @JsonProperty("allocations") + public Optional> getAllocations() { + return allocations; + } + + /** + * @return Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config, 'flag' uses the flag's frozen defaults. Can only be modified on draft experiments. Rejected for customer-defined flags. + */ + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + /** + * @return Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100]. Can only be modified on draft experiments. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private OptionalNullable _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperimentRequestParameters && equalTo((UpdateExperimentRequestParameters) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperimentRequestParameters other) { + return name.equals(other.name) + && description.equals(other.description) + && authenticationFlow.equals(other.authenticationFlow) + && allocations.equals(other.allocations) + && defaultConfig.equals(other.defaultConfig) + && levels.equals(other.levels); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.description, + this.authenticationFlow, + this.allocations, + this.defaultConfig, + this.levels); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private OptionalNullable description = OptionalNullable.absent(); + + private Optional authenticationFlow = Optional.empty(); + + private Optional> allocations = Optional.empty(); + + private Optional defaultConfig = Optional.empty(); + + private Optional> levels = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateExperimentRequestParameters other) { + name(other.getName()); + description(other.getDescription()); + authenticationFlow(other.getAuthenticationFlow()); + allocations(other.getAllocations()); + defaultConfig(other.getDefaultConfig()); + levels(other.getLevels()); + return this; + } + + /** + *

    A human-readable name for the experiment

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A description of the experiment

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(@Nullable OptionalNullable description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = OptionalNullable.of(description); + return this; + } + + public Builder description(Optional description) { + if (description.isPresent()) { + this.description = OptionalNullable.of(description.get()); + } else { + this.description = OptionalNullable.absent(); + } + return this; + } + + public Builder description(com.auth0.client.mgmt.core.Nullable description) { + if (description.isNull()) { + this.description = OptionalNullable.ofNull(); + } else if (description.isEmpty()) { + this.description = OptionalNullable.absent(); + } else { + this.description = OptionalNullable.of(description.get()); + } + return this; + } + + /** + *

    Specifies the target authentication flow for this experiment. This field can only be modified on draft experiments. Must be one of: authentication, mfa_enrollment, mfa_challenge, password_reset, passkey_enrollment, or all. Note that the all value targets every flow at once, but requires that this is the only active experiment.

    + */ + @JsonSetter(value = "authentication_flow", nulls = Nulls.SKIP) + public Builder authenticationFlow(Optional authenticationFlow) { + this.authenticationFlow = authenticationFlow; + return this; + } + + public Builder authenticationFlow(AuthenticationFlowEnum authenticationFlow) { + this.authenticationFlow = Optional.ofNullable(authenticationFlow); + return this; + } + + /** + *

    Replaces all traffic allocations. Cannot be modified while the experiment is active.

    + */ + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public Builder allocations(Optional> allocations) { + this.allocations = allocations; + return this; + } + + public Builder allocations(List allocations) { + this.allocations = Optional.ofNullable(allocations); + return this; + } + + /** + *

    Applies only to Auth0-managed flags. Controls where non-overridden config keys resolve from: 'tenant' inherits the tenant's live config, 'flag' uses the flag's frozen defaults. Can only be modified on draft experiments. Rejected for customer-defined flags.

    + */ + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public Builder defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + public Builder defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + /** + *

    Ramp experiment levels configuration. A strictly-increasing sequence of exposure percentages, each an integer in [0, 100]. Can only be modified on draft experiments.

    + */ + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public Builder levels(Optional> levels) { + this.levels = levels; + return this; + } + + public Builder levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + public UpdateExperimentRequestParameters build() { + return new UpdateExperimentRequestParameters( + name, description, authenticationFlow, allocations, defaultConfig, levels, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentStatusRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentStatusRequestContent.java new file mode 100644 index 000000000..d571a4e6a --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateExperimentStatusRequestContent.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.types.ExperimentTransitionStatusEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperimentStatusRequestContent.Builder.class) +public final class UpdateExperimentStatusRequestContent { + private final ExperimentTransitionStatusEnum status; + + private final Map additionalProperties; + + private UpdateExperimentStatusRequestContent( + ExperimentTransitionStatusEnum status, Map additionalProperties) { + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("status") + public ExperimentTransitionStatusEnum getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperimentStatusRequestContent + && equalTo((UpdateExperimentStatusRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperimentStatusRequestContent other) { + return status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + _FinalStage status(@NotNull ExperimentTransitionStatusEnum status); + + Builder from(UpdateExperimentStatusRequestContent other); + } + + public interface _FinalStage { + UpdateExperimentStatusRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private ExperimentTransitionStatusEnum status; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateExperimentStatusRequestContent other) { + status(other.getStatus()); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ExperimentTransitionStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public UpdateExperimentStatusRequestContent build() { + return new UpdateExperimentStatusRequestContent(status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagRequestContent.java new file mode 100644 index 000000000..f7447c359 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagRequestContent.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.FeatureFlagConfigParam; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateFeatureFlagRequestContent.Builder.class) +public final class UpdateFeatureFlagRequestContent { + private final Optional name; + + private final OptionalNullable description; + + private final Optional> parameters; + + private final Map additionalProperties; + + private UpdateFeatureFlagRequestContent( + Optional name, + OptionalNullable description, + Optional> parameters, + Map additionalProperties) { + this.name = name; + this.description = description; + this.parameters = parameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the feature flag + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A description of what this feature flag controls + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + public OptionalNullable getDescription() { + if (description == null) { + return OptionalNullable.absent(); + } + return description; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private OptionalNullable _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateFeatureFlagRequestContent && equalTo((UpdateFeatureFlagRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateFeatureFlagRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && parameters.equals(other.parameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.parameters); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private OptionalNullable description = OptionalNullable.absent(); + + private Optional> parameters = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateFeatureFlagRequestContent other) { + name(other.getName()); + description(other.getDescription()); + parameters(other.getParameters()); + return this; + } + + /** + *

    A human-readable name for the feature flag

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A description of what this feature flag controls

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(@Nullable OptionalNullable description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = OptionalNullable.of(description); + return this; + } + + public Builder description(Optional description) { + if (description.isPresent()) { + this.description = OptionalNullable.of(description.get()); + } else { + this.description = OptionalNullable.absent(); + } + return this; + } + + public Builder description(com.auth0.client.mgmt.core.Nullable description) { + if (description.isNull()) { + this.description = OptionalNullable.ofNull(); + } else if (description.isEmpty()) { + this.description = OptionalNullable.absent(); + } else { + this.description = OptionalNullable.of(description.get()); + } + return this; + } + + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public Builder parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + public Builder parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + public UpdateFeatureFlagRequestContent build() { + return new UpdateFeatureFlagRequestContent(name, description, parameters, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagStatusRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagStatusRequestContent.java new file mode 100644 index 000000000..8ca350fed --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateFeatureFlagStatusRequestContent.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.types.FeatureFlagStatusEnum; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateFeatureFlagStatusRequestContent.Builder.class) +public final class UpdateFeatureFlagStatusRequestContent { + private final FeatureFlagStatusEnum status; + + private final Map additionalProperties; + + private UpdateFeatureFlagStatusRequestContent( + FeatureFlagStatusEnum status, Map additionalProperties) { + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The target status to transition the feature flag to. + */ + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateFeatureFlagStatusRequestContent + && equalTo((UpdateFeatureFlagStatusRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateFeatureFlagStatusRequestContent other) { + return status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

    The target status to transition the feature flag to.

    + */ + _FinalStage status(@NotNull FeatureFlagStatusEnum status); + + Builder from(UpdateFeatureFlagStatusRequestContent other); + } + + public interface _FinalStage { + UpdateFeatureFlagStatusRequestContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private FeatureFlagStatusEnum status; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateFeatureFlagStatusRequestContent other) { + status(other.getStatus()); + return this; + } + + /** + *

    The target status to transition the feature flag to.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public UpdateFeatureFlagStatusRequestContent build() { + return new UpdateFeatureFlagStatusRequestContent(status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateSegmentRequestContent.java b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateSegmentRequestContent.java new file mode 100644 index 000000000..f8fc764f8 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/experimentation/types/UpdateSegmentRequestContent.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.experimentation.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.auth0.client.mgmt.types.SegmentRule; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateSegmentRequestContent.Builder.class) +public final class UpdateSegmentRequestContent { + private final Optional name; + + private final OptionalNullable description; + + private final Optional> rules; + + private final Map additionalProperties; + + private UpdateSegmentRequestContent( + Optional name, + OptionalNullable description, + Optional> rules, + Map additionalProperties) { + this.name = name; + this.description = description; + this.rules = rules; + this.additionalProperties = additionalProperties; + } + + /** + * @return A human-readable name for the segment + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A description of the segment + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + public OptionalNullable getDescription() { + if (description == null) { + return OptionalNullable.absent(); + } + return description; + } + + /** + * @return Replaces the entire rules array. Each rule is limited to 4KB and the whole segment to 10KB (serialized). + */ + @JsonProperty("rules") + public Optional> getRules() { + return rules; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private OptionalNullable _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateSegmentRequestContent && equalTo((UpdateSegmentRequestContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateSegmentRequestContent other) { + return name.equals(other.name) && description.equals(other.description) && rules.equals(other.rules); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.rules); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private OptionalNullable description = OptionalNullable.absent(); + + private Optional> rules = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateSegmentRequestContent other) { + name(other.getName()); + description(other.getDescription()); + rules(other.getRules()); + return this; + } + + /** + *

    A human-readable name for the segment

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A description of the segment

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(@Nullable OptionalNullable description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = OptionalNullable.of(description); + return this; + } + + public Builder description(Optional description) { + if (description.isPresent()) { + this.description = OptionalNullable.of(description.get()); + } else { + this.description = OptionalNullable.absent(); + } + return this; + } + + public Builder description(com.auth0.client.mgmt.core.Nullable description) { + if (description.isNull()) { + this.description = OptionalNullable.ofNull(); + } else if (description.isEmpty()) { + this.description = OptionalNullable.absent(); + } else { + this.description = OptionalNullable.of(description.get()); + } + return this; + } + + /** + *

    Replaces the entire rules array. Each rule is limited to 4KB and the whole segment to 10KB (serialized).

    + */ + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public Builder rules(Optional> rules) { + this.rules = rules; + return this; + } + + public Builder rules(List rules) { + this.rules = Optional.ofNullable(rules); + return this; + } + + public UpdateSegmentRequestContent build() { + return new UpdateSegmentRequestContent(name, description, rules, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/organizations/AsyncOrganizationTemplateClient.java b/src/main/java/com/auth0/client/mgmt/organizations/AsyncOrganizationTemplateClient.java deleted file mode 100644 index fd81a1840..000000000 --- a/src/main/java/com/auth0/client/mgmt/organizations/AsyncOrganizationTemplateClient.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.organizations; - -import com.auth0.client.mgmt.core.ClientOptions; -import com.auth0.client.mgmt.core.RequestOptions; -import com.auth0.client.mgmt.types.OrganizationTemplate; -import java.util.concurrent.CompletableFuture; - -public class AsyncOrganizationTemplateClient { - protected final ClientOptions clientOptions; - - private final AsyncRawOrganizationTemplateClient rawClient; - - public AsyncOrganizationTemplateClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawOrganizationTemplateClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawOrganizationTemplateClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public CompletableFuture get(String id) { - return this.rawClient.get(id).thenApply(response -> response.body()); - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public CompletableFuture get(String id, RequestOptions requestOptions) { - return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); - } - - /** - * Assign an Organization Template to an organization. - */ - public CompletableFuture assignOrganizationTemplate(String id, String templateId) { - return this.rawClient.assignOrganizationTemplate(id, templateId).thenApply(response -> response.body()); - } - - /** - * Assign an Organization Template to an organization. - */ - public CompletableFuture assignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - return this.rawClient - .assignOrganizationTemplate(id, templateId, requestOptions) - .thenApply(response -> response.body()); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public CompletableFuture unassignOrganizationTemplate(String id, String templateId) { - return this.rawClient.unassignOrganizationTemplate(id, templateId).thenApply(response -> response.body()); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public CompletableFuture unassignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - return this.rawClient - .unassignOrganizationTemplate(id, templateId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/auth0/client/mgmt/organizations/AsyncRawOrganizationTemplateClient.java b/src/main/java/com/auth0/client/mgmt/organizations/AsyncRawOrganizationTemplateClient.java deleted file mode 100644 index 2dc59e020..000000000 --- a/src/main/java/com/auth0/client/mgmt/organizations/AsyncRawOrganizationTemplateClient.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.organizations; - -import com.auth0.client.mgmt.core.ClientOptions; -import com.auth0.client.mgmt.core.ManagementApiException; -import com.auth0.client.mgmt.core.ManagementApiHttpResponse; -import com.auth0.client.mgmt.core.ManagementException; -import com.auth0.client.mgmt.core.ObjectMappers; -import com.auth0.client.mgmt.core.RequestOptions; -import com.auth0.client.mgmt.core.RetryInterceptor; -import com.auth0.client.mgmt.errors.BadRequestError; -import com.auth0.client.mgmt.errors.ForbiddenError; -import com.auth0.client.mgmt.errors.NotFoundError; -import com.auth0.client.mgmt.errors.TooManyRequestsError; -import com.auth0.client.mgmt.errors.UnauthorizedError; -import com.auth0.client.mgmt.types.OrganizationTemplate; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -public class AsyncRawOrganizationTemplateClient { - protected final ClientOptions clientOptions; - - public AsyncRawOrganizationTemplateClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public CompletableFuture> get(String id) { - return get(id, null); - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public CompletableFuture> get( - String id, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates"); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new ManagementApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OrganizationTemplate.class), - response)); - return; - } - try { - switch (response.code()) { - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 429: - future.completeExceptionally(new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Assign an Organization Template to an organization. - */ - public CompletableFuture> assignOrganizationTemplate(String id, String templateId) { - return assignOrganizationTemplate(id, templateId, null); - } - - /** - * Assign an Organization Template to an organization. - */ - public CompletableFuture> assignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates") - .addPathSegment(templateId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", RequestBody.create("", null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new ManagementApiHttpResponse<>(null, response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 429: - future.completeExceptionally(new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public CompletableFuture> unassignOrganizationTemplate( - String id, String templateId) { - return unassignOrganizationTemplate(id, templateId, null); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public CompletableFuture> unassignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates") - .addPathSegment(templateId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new ManagementApiHttpResponse<>(null, response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - case 429: - future.completeExceptionally(new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new ManagementException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new ManagementException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/com/auth0/client/mgmt/organizations/OrganizationTemplateClient.java b/src/main/java/com/auth0/client/mgmt/organizations/OrganizationTemplateClient.java deleted file mode 100644 index 191be5f22..000000000 --- a/src/main/java/com/auth0/client/mgmt/organizations/OrganizationTemplateClient.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.organizations; - -import com.auth0.client.mgmt.core.ClientOptions; -import com.auth0.client.mgmt.core.RequestOptions; -import com.auth0.client.mgmt.types.OrganizationTemplate; - -public class OrganizationTemplateClient { - protected final ClientOptions clientOptions; - - private final RawOrganizationTemplateClient rawClient; - - public OrganizationTemplateClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawOrganizationTemplateClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawOrganizationTemplateClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public OrganizationTemplate get(String id) { - return this.rawClient.get(id).body(); - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public OrganizationTemplate get(String id, RequestOptions requestOptions) { - return this.rawClient.get(id, requestOptions).body(); - } - - /** - * Assign an Organization Template to an organization. - */ - public void assignOrganizationTemplate(String id, String templateId) { - this.rawClient.assignOrganizationTemplate(id, templateId).body(); - } - - /** - * Assign an Organization Template to an organization. - */ - public void assignOrganizationTemplate(String id, String templateId, RequestOptions requestOptions) { - this.rawClient - .assignOrganizationTemplate(id, templateId, requestOptions) - .body(); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public void unassignOrganizationTemplate(String id, String templateId) { - this.rawClient.unassignOrganizationTemplate(id, templateId).body(); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public void unassignOrganizationTemplate(String id, String templateId, RequestOptions requestOptions) { - this.rawClient - .unassignOrganizationTemplate(id, templateId, requestOptions) - .body(); - } -} diff --git a/src/main/java/com/auth0/client/mgmt/organizations/RawOrganizationTemplateClient.java b/src/main/java/com/auth0/client/mgmt/organizations/RawOrganizationTemplateClient.java deleted file mode 100644 index 3aacd2d87..000000000 --- a/src/main/java/com/auth0/client/mgmt/organizations/RawOrganizationTemplateClient.java +++ /dev/null @@ -1,262 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.organizations; - -import com.auth0.client.mgmt.core.ClientOptions; -import com.auth0.client.mgmt.core.ManagementApiException; -import com.auth0.client.mgmt.core.ManagementApiHttpResponse; -import com.auth0.client.mgmt.core.ManagementException; -import com.auth0.client.mgmt.core.ObjectMappers; -import com.auth0.client.mgmt.core.RequestOptions; -import com.auth0.client.mgmt.core.RetryInterceptor; -import com.auth0.client.mgmt.errors.BadRequestError; -import com.auth0.client.mgmt.errors.ForbiddenError; -import com.auth0.client.mgmt.errors.NotFoundError; -import com.auth0.client.mgmt.errors.TooManyRequestsError; -import com.auth0.client.mgmt.errors.UnauthorizedError; -import com.auth0.client.mgmt.types.OrganizationTemplate; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class RawOrganizationTemplateClient { - protected final ClientOptions clientOptions; - - public RawOrganizationTemplateClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public ManagementApiHttpResponse get(String id) { - return get(id, null); - } - - /** - * Retrieve the organization template assigned to a specific organization. Returns the template object if one is explicitly assigned, or a 404 if no template is assigned. - */ - public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates"); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new ManagementApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OrganizationTemplate.class), response); - } - try { - switch (response.code()) { - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 429: - throw new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new ManagementException("Network error executing HTTP request", e); - } - } - - /** - * Assign an Organization Template to an organization. - */ - public ManagementApiHttpResponse assignOrganizationTemplate(String id, String templateId) { - return assignOrganizationTemplate(id, templateId, null); - } - - /** - * Assign an Organization Template to an organization. - */ - public ManagementApiHttpResponse assignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates") - .addPathSegment(templateId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", RequestBody.create("", null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new ManagementApiHttpResponse<>(null, response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 429: - throw new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new ManagementException("Network error executing HTTP request", e); - } - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public ManagementApiHttpResponse unassignOrganizationTemplate(String id, String templateId) { - return unassignOrganizationTemplate(id, templateId, null); - } - - /** - * Remove an Organization Template assignment from an organization. - */ - public ManagementApiHttpResponse unassignOrganizationTemplate( - String id, String templateId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("organizations") - .addPathSegment(id) - .addPathSegments("organization-templates") - .addPathSegment(templateId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new ManagementApiHttpResponse<>(null, response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 429: - throw new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new ManagementApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new ManagementException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new ManagementException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/AllocationItem.java b/src/main/java/com/auth0/client/mgmt/types/AllocationItem.java new file mode 100644 index 000000000..eb24e6771 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/AllocationItem.java @@ -0,0 +1,407 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AllocationItem.Builder.class) +public final class AllocationItem { + private final Optional variationId; + + private final Optional variationName; + + private final Optional segmentId; + + private final Optional segmentName; + + private final Optional weight; + + private final Optional priority; + + private final Optional isControl; + + private final Optional isFallback; + + private final OptionalNullable> variationSnapshot; + + private final OptionalNullable> segmentSnapshot; + + private final Map additionalProperties; + + private AllocationItem( + Optional variationId, + Optional variationName, + Optional segmentId, + Optional segmentName, + Optional weight, + Optional priority, + Optional isControl, + Optional isFallback, + OptionalNullable> variationSnapshot, + OptionalNullable> segmentSnapshot, + Map additionalProperties) { + this.variationId = variationId; + this.variationName = variationName; + this.segmentId = segmentId; + this.segmentName = segmentName; + this.weight = weight; + this.priority = priority; + this.isControl = isControl; + this.isFallback = isFallback; + this.variationSnapshot = variationSnapshot; + this.segmentSnapshot = segmentSnapshot; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("variation_id") + public Optional getVariationId() { + return variationId; + } + + @JsonProperty("variation_name") + public Optional getVariationName() { + return variationName; + } + + @JsonProperty("segment_id") + public Optional getSegmentId() { + return segmentId; + } + + @JsonProperty("segment_name") + public Optional getSegmentName() { + return segmentName; + } + + @JsonProperty("weight") + public Optional getWeight() { + return weight; + } + + @JsonProperty("priority") + public Optional getPriority() { + return priority; + } + + @JsonProperty("is_control") + public Optional getIsControl() { + return isControl; + } + + @JsonProperty("is_fallback") + public Optional getIsFallback() { + return isFallback; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("variation_snapshot") + public OptionalNullable> getVariationSnapshot() { + if (variationSnapshot == null) { + return OptionalNullable.absent(); + } + return variationSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("segment_snapshot") + public OptionalNullable> getSegmentSnapshot() { + if (segmentSnapshot == null) { + return OptionalNullable.absent(); + } + return segmentSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("variation_snapshot") + private OptionalNullable> _getVariationSnapshot() { + return variationSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("segment_snapshot") + private OptionalNullable> _getSegmentSnapshot() { + return segmentSnapshot; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AllocationItem && equalTo((AllocationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AllocationItem other) { + return variationId.equals(other.variationId) + && variationName.equals(other.variationName) + && segmentId.equals(other.segmentId) + && segmentName.equals(other.segmentName) + && weight.equals(other.weight) + && priority.equals(other.priority) + && isControl.equals(other.isControl) + && isFallback.equals(other.isFallback) + && variationSnapshot.equals(other.variationSnapshot) + && segmentSnapshot.equals(other.segmentSnapshot); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.variationId, + this.variationName, + this.segmentId, + this.segmentName, + this.weight, + this.priority, + this.isControl, + this.isFallback, + this.variationSnapshot, + this.segmentSnapshot); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional variationId = Optional.empty(); + + private Optional variationName = Optional.empty(); + + private Optional segmentId = Optional.empty(); + + private Optional segmentName = Optional.empty(); + + private Optional weight = Optional.empty(); + + private Optional priority = Optional.empty(); + + private Optional isControl = Optional.empty(); + + private Optional isFallback = Optional.empty(); + + private OptionalNullable> variationSnapshot = OptionalNullable.absent(); + + private OptionalNullable> segmentSnapshot = OptionalNullable.absent(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AllocationItem other) { + variationId(other.getVariationId()); + variationName(other.getVariationName()); + segmentId(other.getSegmentId()); + segmentName(other.getSegmentName()); + weight(other.getWeight()); + priority(other.getPriority()); + isControl(other.getIsControl()); + isFallback(other.getIsFallback()); + variationSnapshot(other.getVariationSnapshot()); + segmentSnapshot(other.getSegmentSnapshot()); + return this; + } + + @JsonSetter(value = "variation_id", nulls = Nulls.SKIP) + public Builder variationId(Optional variationId) { + this.variationId = variationId; + return this; + } + + public Builder variationId(String variationId) { + this.variationId = Optional.ofNullable(variationId); + return this; + } + + @JsonSetter(value = "variation_name", nulls = Nulls.SKIP) + public Builder variationName(Optional variationName) { + this.variationName = variationName; + return this; + } + + public Builder variationName(String variationName) { + this.variationName = Optional.ofNullable(variationName); + return this; + } + + @JsonSetter(value = "segment_id", nulls = Nulls.SKIP) + public Builder segmentId(Optional segmentId) { + this.segmentId = segmentId; + return this; + } + + public Builder segmentId(String segmentId) { + this.segmentId = Optional.ofNullable(segmentId); + return this; + } + + @JsonSetter(value = "segment_name", nulls = Nulls.SKIP) + public Builder segmentName(Optional segmentName) { + this.segmentName = segmentName; + return this; + } + + public Builder segmentName(String segmentName) { + this.segmentName = Optional.ofNullable(segmentName); + return this; + } + + @JsonSetter(value = "weight", nulls = Nulls.SKIP) + public Builder weight(Optional weight) { + this.weight = weight; + return this; + } + + public Builder weight(Integer weight) { + this.weight = Optional.ofNullable(weight); + return this; + } + + @JsonSetter(value = "priority", nulls = Nulls.SKIP) + public Builder priority(Optional priority) { + this.priority = priority; + return this; + } + + public Builder priority(Integer priority) { + this.priority = Optional.ofNullable(priority); + return this; + } + + @JsonSetter(value = "is_control", nulls = Nulls.SKIP) + public Builder isControl(Optional isControl) { + this.isControl = isControl; + return this; + } + + public Builder isControl(Boolean isControl) { + this.isControl = Optional.ofNullable(isControl); + return this; + } + + @JsonSetter(value = "is_fallback", nulls = Nulls.SKIP) + public Builder isFallback(Optional isFallback) { + this.isFallback = isFallback; + return this; + } + + public Builder isFallback(Boolean isFallback) { + this.isFallback = Optional.ofNullable(isFallback); + return this; + } + + @JsonSetter(value = "variation_snapshot", nulls = Nulls.SKIP) + public Builder variationSnapshot(@Nullable OptionalNullable> variationSnapshot) { + this.variationSnapshot = variationSnapshot; + return this; + } + + public Builder variationSnapshot(Map variationSnapshot) { + this.variationSnapshot = OptionalNullable.of(variationSnapshot); + return this; + } + + public Builder variationSnapshot(Optional> variationSnapshot) { + if (variationSnapshot.isPresent()) { + this.variationSnapshot = OptionalNullable.of(variationSnapshot.get()); + } else { + this.variationSnapshot = OptionalNullable.absent(); + } + return this; + } + + public Builder variationSnapshot(com.auth0.client.mgmt.core.Nullable> variationSnapshot) { + if (variationSnapshot.isNull()) { + this.variationSnapshot = OptionalNullable.ofNull(); + } else if (variationSnapshot.isEmpty()) { + this.variationSnapshot = OptionalNullable.absent(); + } else { + this.variationSnapshot = OptionalNullable.of(variationSnapshot.get()); + } + return this; + } + + @JsonSetter(value = "segment_snapshot", nulls = Nulls.SKIP) + public Builder segmentSnapshot(@Nullable OptionalNullable> segmentSnapshot) { + this.segmentSnapshot = segmentSnapshot; + return this; + } + + public Builder segmentSnapshot(Map segmentSnapshot) { + this.segmentSnapshot = OptionalNullable.of(segmentSnapshot); + return this; + } + + public Builder segmentSnapshot(Optional> segmentSnapshot) { + if (segmentSnapshot.isPresent()) { + this.segmentSnapshot = OptionalNullable.of(segmentSnapshot.get()); + } else { + this.segmentSnapshot = OptionalNullable.absent(); + } + return this; + } + + public Builder segmentSnapshot(com.auth0.client.mgmt.core.Nullable> segmentSnapshot) { + if (segmentSnapshot.isNull()) { + this.segmentSnapshot = OptionalNullable.ofNull(); + } else if (segmentSnapshot.isEmpty()) { + this.segmentSnapshot = OptionalNullable.absent(); + } else { + this.segmentSnapshot = OptionalNullable.of(segmentSnapshot.get()); + } + return this; + } + + public AllocationItem build() { + return new AllocationItem( + variationId, + variationName, + segmentId, + segmentName, + weight, + priority, + isControl, + isFallback, + variationSnapshot, + segmentSnapshot, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/AllocationRequestItem.java b/src/main/java/com/auth0/client/mgmt/types/AllocationRequestItem.java new file mode 100644 index 000000000..519172e8a --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/AllocationRequestItem.java @@ -0,0 +1,340 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AllocationRequestItem.Builder.class) +public final class AllocationRequestItem { + private final String variationId; + + private final Optional weight; + + private final Optional segmentId; + + private final Optional priority; + + private final boolean isControl; + + private final Optional isFallback; + + private final Map additionalProperties; + + private AllocationRequestItem( + String variationId, + Optional weight, + Optional segmentId, + Optional priority, + boolean isControl, + Optional isFallback, + Map additionalProperties) { + this.variationId = variationId; + this.weight = weight; + this.segmentId = segmentId; + this.priority = priority; + this.isControl = isControl; + this.isFallback = isFallback; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the variation to allocate + */ + @JsonProperty("variation_id") + public String getVariationId() { + return variationId; + } + + /** + * @return Percentage weight for this allocation (percentage strategy only) + */ + @JsonProperty("weight") + public Optional getWeight() { + return weight; + } + + /** + * @return The segment this allocation targets (segment strategy only) + */ + @JsonProperty("segment_id") + public Optional getSegmentId() { + return segmentId; + } + + /** + * @return Evaluation order; 1 = highest priority (segment strategy only) + */ + @JsonProperty("priority") + public Optional getPriority() { + return priority; + } + + /** + * @return Whether this allocation is the control group + */ + @JsonProperty("is_control") + public boolean getIsControl() { + return isControl; + } + + /** + * @return Whether this allocation is the default fallback (segment strategy only) + */ + @JsonProperty("is_fallback") + public Optional getIsFallback() { + return isFallback; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AllocationRequestItem && equalTo((AllocationRequestItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AllocationRequestItem other) { + return variationId.equals(other.variationId) + && weight.equals(other.weight) + && segmentId.equals(other.segmentId) + && priority.equals(other.priority) + && isControl == other.isControl + && isFallback.equals(other.isFallback); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.variationId, this.weight, this.segmentId, this.priority, this.isControl, this.isFallback); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VariationIdStage builder() { + return new Builder(); + } + + public interface VariationIdStage { + /** + *

    The ID of the variation to allocate

    + */ + IsControlStage variationId(@NotNull String variationId); + + Builder from(AllocationRequestItem other); + } + + public interface IsControlStage { + /** + *

    Whether this allocation is the control group

    + */ + _FinalStage isControl(boolean isControl); + } + + public interface _FinalStage { + AllocationRequestItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    Percentage weight for this allocation (percentage strategy only)

    + */ + _FinalStage weight(Optional weight); + + _FinalStage weight(Integer weight); + + /** + *

    The segment this allocation targets (segment strategy only)

    + */ + _FinalStage segmentId(Optional segmentId); + + _FinalStage segmentId(String segmentId); + + /** + *

    Evaluation order; 1 = highest priority (segment strategy only)

    + */ + _FinalStage priority(Optional priority); + + _FinalStage priority(Integer priority); + + /** + *

    Whether this allocation is the default fallback (segment strategy only)

    + */ + _FinalStage isFallback(Optional isFallback); + + _FinalStage isFallback(Boolean isFallback); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VariationIdStage, IsControlStage, _FinalStage { + private String variationId; + + private boolean isControl; + + private Optional isFallback = Optional.empty(); + + private Optional priority = Optional.empty(); + + private Optional segmentId = Optional.empty(); + + private Optional weight = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AllocationRequestItem other) { + variationId(other.getVariationId()); + weight(other.getWeight()); + segmentId(other.getSegmentId()); + priority(other.getPriority()); + isControl(other.getIsControl()); + isFallback(other.getIsFallback()); + return this; + } + + /** + *

    The ID of the variation to allocate

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("variation_id") + public IsControlStage variationId(@NotNull String variationId) { + this.variationId = Objects.requireNonNull(variationId, "variationId must not be null"); + return this; + } + + /** + *

    Whether this allocation is the control group

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_control") + public _FinalStage isControl(boolean isControl) { + this.isControl = isControl; + return this; + } + + /** + *

    Whether this allocation is the default fallback (segment strategy only)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isFallback(Boolean isFallback) { + this.isFallback = Optional.ofNullable(isFallback); + return this; + } + + /** + *

    Whether this allocation is the default fallback (segment strategy only)

    + */ + @java.lang.Override + @JsonSetter(value = "is_fallback", nulls = Nulls.SKIP) + public _FinalStage isFallback(Optional isFallback) { + this.isFallback = isFallback; + return this; + } + + /** + *

    Evaluation order; 1 = highest priority (segment strategy only)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priority(Integer priority) { + this.priority = Optional.ofNullable(priority); + return this; + } + + /** + *

    Evaluation order; 1 = highest priority (segment strategy only)

    + */ + @java.lang.Override + @JsonSetter(value = "priority", nulls = Nulls.SKIP) + public _FinalStage priority(Optional priority) { + this.priority = priority; + return this; + } + + /** + *

    The segment this allocation targets (segment strategy only)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage segmentId(String segmentId) { + this.segmentId = Optional.ofNullable(segmentId); + return this; + } + + /** + *

    The segment this allocation targets (segment strategy only)

    + */ + @java.lang.Override + @JsonSetter(value = "segment_id", nulls = Nulls.SKIP) + public _FinalStage segmentId(Optional segmentId) { + this.segmentId = segmentId; + return this; + } + + /** + *

    Percentage weight for this allocation (percentage strategy only)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage weight(Integer weight) { + this.weight = Optional.ofNullable(weight); + return this; + } + + /** + *

    Percentage weight for this allocation (percentage strategy only)

    + */ + @java.lang.Override + @JsonSetter(value = "weight", nulls = Nulls.SKIP) + public _FinalStage weight(Optional weight) { + this.weight = weight; + return this; + } + + @java.lang.Override + public AllocationRequestItem build() { + return new AllocationRequestItem( + variationId, weight, segmentId, priority, isControl, isFallback, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionDeletionBehaviorEnum.java b/src/main/java/com/auth0/client/mgmt/types/AllocationStrategyEnum.java similarity index 51% rename from src/main/java/com/auth0/client/mgmt/types/ConnectionDeletionBehaviorEnum.java rename to src/main/java/com/auth0/client/mgmt/types/AllocationStrategyEnum.java index 4dbe7c858..b984d63da 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionDeletionBehaviorEnum.java +++ b/src/main/java/com/auth0/client/mgmt/types/AllocationStrategyEnum.java @@ -6,17 +6,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ConnectionDeletionBehaviorEnum { - public static final ConnectionDeletionBehaviorEnum ALLOW = new ConnectionDeletionBehaviorEnum(Value.ALLOW, "allow"); +public final class AllocationStrategyEnum { + public static final AllocationStrategyEnum SEGMENT = new AllocationStrategyEnum(Value.SEGMENT, "segment"); - public static final ConnectionDeletionBehaviorEnum ALLOW_IF_EMPTY = - new ConnectionDeletionBehaviorEnum(Value.ALLOW_IF_EMPTY, "allow_if_empty"); + public static final AllocationStrategyEnum PERCENTAGE = new AllocationStrategyEnum(Value.PERCENTAGE, "percentage"); private final Value value; private final String string; - ConnectionDeletionBehaviorEnum(Value value, String string) { + AllocationStrategyEnum(Value value, String string) { this.value = value; this.string = string; } @@ -34,8 +33,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ConnectionDeletionBehaviorEnum - && this.string.equals(((ConnectionDeletionBehaviorEnum) other).string)); + || (other instanceof AllocationStrategyEnum + && this.string.equals(((AllocationStrategyEnum) other).string)); } @java.lang.Override @@ -45,10 +44,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case ALLOW: - return visitor.visitAllow(); - case ALLOW_IF_EMPTY: - return visitor.visitAllowIfEmpty(); + case SEGMENT: + return visitor.visitSegment(); + case PERCENTAGE: + return visitor.visitPercentage(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -56,29 +55,29 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ConnectionDeletionBehaviorEnum valueOf(String value) { + public static AllocationStrategyEnum valueOf(String value) { switch (value) { - case "allow": - return ALLOW; - case "allow_if_empty": - return ALLOW_IF_EMPTY; + case "segment": + return SEGMENT; + case "percentage": + return PERCENTAGE; default: - return new ConnectionDeletionBehaviorEnum(Value.UNKNOWN, value); + return new AllocationStrategyEnum(Value.UNKNOWN, value); } } public enum Value { - ALLOW, + PERCENTAGE, - ALLOW_IF_EMPTY, + SEGMENT, UNKNOWN } public interface Visitor { - T visitAllow(); + T visitPercentage(); - T visitAllowIfEmpty(); + T visitSegment(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/auth0/client/mgmt/types/AsyncApprovalNotificationsChannelsEnum.java b/src/main/java/com/auth0/client/mgmt/types/AsyncApprovalNotificationsChannelsEnum.java index 84d74919d..005126122 100644 --- a/src/main/java/com/auth0/client/mgmt/types/AsyncApprovalNotificationsChannelsEnum.java +++ b/src/main/java/com/auth0/client/mgmt/types/AsyncApprovalNotificationsChannelsEnum.java @@ -10,6 +10,9 @@ public final class AsyncApprovalNotificationsChannelsEnum { public static final AsyncApprovalNotificationsChannelsEnum EMAIL = new AsyncApprovalNotificationsChannelsEnum(Value.EMAIL, "email"); + public static final AsyncApprovalNotificationsChannelsEnum MY_ACCOUNT = + new AsyncApprovalNotificationsChannelsEnum(Value.MY_ACCOUNT, "my-account"); + public static final AsyncApprovalNotificationsChannelsEnum GUARDIAN_PUSH = new AsyncApprovalNotificationsChannelsEnum(Value.GUARDIAN_PUSH, "guardian-push"); @@ -48,6 +51,8 @@ public T visit(Visitor visitor) { switch (value) { case EMAIL: return visitor.visitEmail(); + case MY_ACCOUNT: + return visitor.visitMyAccount(); case GUARDIAN_PUSH: return visitor.visitGuardianPush(); case UNKNOWN: @@ -61,6 +66,8 @@ public static AsyncApprovalNotificationsChannelsEnum valueOf(String value) { switch (value) { case "email": return EMAIL; + case "my-account": + return MY_ACCOUNT; case "guardian-push": return GUARDIAN_PUSH; default: @@ -73,6 +80,8 @@ public enum Value { EMAIL, + MY_ACCOUNT, + UNKNOWN } @@ -81,6 +90,8 @@ public interface Visitor { T visitEmail(); + T visitMyAccount(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/auth0/client/mgmt/types/AuthenticationFlowEnum.java b/src/main/java/com/auth0/client/mgmt/types/AuthenticationFlowEnum.java new file mode 100644 index 000000000..cb876e2e1 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/AuthenticationFlowEnum.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AuthenticationFlowEnum { + public static final AuthenticationFlowEnum AUTHENTICATION = + new AuthenticationFlowEnum(Value.AUTHENTICATION, "authentication"); + + public static final AuthenticationFlowEnum PASSKEY_ENROLLMENT = + new AuthenticationFlowEnum(Value.PASSKEY_ENROLLMENT, "passkey_enrollment"); + + public static final AuthenticationFlowEnum ALL = new AuthenticationFlowEnum(Value.ALL, "all"); + + public static final AuthenticationFlowEnum MFA_CHALLENGE = + new AuthenticationFlowEnum(Value.MFA_CHALLENGE, "mfa_challenge"); + + public static final AuthenticationFlowEnum MFA_ENROLLMENT = + new AuthenticationFlowEnum(Value.MFA_ENROLLMENT, "mfa_enrollment"); + + public static final AuthenticationFlowEnum PASSWORD_RESET = + new AuthenticationFlowEnum(Value.PASSWORD_RESET, "password_reset"); + + private final Value value; + + private final String string; + + AuthenticationFlowEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AuthenticationFlowEnum + && this.string.equals(((AuthenticationFlowEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AUTHENTICATION: + return visitor.visitAuthentication(); + case PASSKEY_ENROLLMENT: + return visitor.visitPasskeyEnrollment(); + case ALL: + return visitor.visitAll(); + case MFA_CHALLENGE: + return visitor.visitMfaChallenge(); + case MFA_ENROLLMENT: + return visitor.visitMfaEnrollment(); + case PASSWORD_RESET: + return visitor.visitPasswordReset(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AuthenticationFlowEnum valueOf(String value) { + switch (value) { + case "authentication": + return AUTHENTICATION; + case "passkey_enrollment": + return PASSKEY_ENROLLMENT; + case "all": + return ALL; + case "mfa_challenge": + return MFA_CHALLENGE; + case "mfa_enrollment": + return MFA_ENROLLMENT; + case "password_reset": + return PASSWORD_RESET; + default: + return new AuthenticationFlowEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTHENTICATION, + + MFA_ENROLLMENT, + + MFA_CHALLENGE, + + PASSWORD_RESET, + + PASSKEY_ENROLLMENT, + + ALL, + + UNKNOWN + } + + public interface Visitor { + T visitAuthentication(); + + T visitMfaEnrollment(); + + T visitMfaChallenge(); + + T visitPasswordReset(); + + T visitPasskeyEnrollment(); + + T visitAll(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ClientOidcBackchannelLogoutInitiatorsEnum.java b/src/main/java/com/auth0/client/mgmt/types/ClientOidcBackchannelLogoutInitiatorsEnum.java index e48d62b26..6f45107b8 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ClientOidcBackchannelLogoutInitiatorsEnum.java +++ b/src/main/java/com/auth0/client/mgmt/types/ClientOidcBackchannelLogoutInitiatorsEnum.java @@ -22,6 +22,9 @@ public final class ClientOidcBackchannelLogoutInitiatorsEnum { public static final ClientOidcBackchannelLogoutInitiatorsEnum IDP_LOGOUT = new ClientOidcBackchannelLogoutInitiatorsEnum(Value.IDP_LOGOUT, "idp-logout"); + public static final ClientOidcBackchannelLogoutInitiatorsEnum PROFILE_CHANGED = + new ClientOidcBackchannelLogoutInitiatorsEnum(Value.PROFILE_CHANGED, "profile-changed"); + public static final ClientOidcBackchannelLogoutInitiatorsEnum RP_LOGOUT = new ClientOidcBackchannelLogoutInitiatorsEnum(Value.RP_LOGOUT, "rp-logout"); @@ -77,6 +80,8 @@ public T visit(Visitor visitor) { return visitor.visitAccountDeactivated(); case IDP_LOGOUT: return visitor.visitIdpLogout(); + case PROFILE_CHANGED: + return visitor.visitProfileChanged(); case RP_LOGOUT: return visitor.visitRpLogout(); case PASSWORD_CHANGED: @@ -104,6 +109,8 @@ public static ClientOidcBackchannelLogoutInitiatorsEnum valueOf(String value) { return ACCOUNT_DEACTIVATED; case "idp-logout": return IDP_LOGOUT; + case "profile-changed": + return PROFILE_CHANGED; case "rp-logout": return RP_LOGOUT; case "password-changed": @@ -136,6 +143,8 @@ public enum Value { ACCOUNT_DEACTIVATED, + PROFILE_CHANGED, + UNKNOWN } @@ -158,6 +167,8 @@ public interface Visitor { T visitAccountDeactivated(); + T visitProfileChanged(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportAllowedScopesEnum.java b/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportAllowedScopesEnum.java new file mode 100644 index 000000000..a75deb96d --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportAllowedScopesEnum.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ClientOidcSupportAllowedScopesEnum { + public static final ClientOidcSupportAllowedScopesEnum EMAIL = + new ClientOidcSupportAllowedScopesEnum(Value.EMAIL, "email"); + + public static final ClientOidcSupportAllowedScopesEnum PHONE = + new ClientOidcSupportAllowedScopesEnum(Value.PHONE, "phone"); + + public static final ClientOidcSupportAllowedScopesEnum PROFILE = + new ClientOidcSupportAllowedScopesEnum(Value.PROFILE, "profile"); + + public static final ClientOidcSupportAllowedScopesEnum ADDRESS = + new ClientOidcSupportAllowedScopesEnum(Value.ADDRESS, "address"); + + private final Value value; + + private final String string; + + ClientOidcSupportAllowedScopesEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ClientOidcSupportAllowedScopesEnum + && this.string.equals(((ClientOidcSupportAllowedScopesEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EMAIL: + return visitor.visitEmail(); + case PHONE: + return visitor.visitPhone(); + case PROFILE: + return visitor.visitProfile(); + case ADDRESS: + return visitor.visitAddress(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ClientOidcSupportAllowedScopesEnum valueOf(String value) { + switch (value) { + case "email": + return EMAIL; + case "phone": + return PHONE; + case "profile": + return PROFILE; + case "address": + return ADDRESS; + default: + return new ClientOidcSupportAllowedScopesEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + PROFILE, + + EMAIL, + + ADDRESS, + + PHONE, + + UNKNOWN + } + + public interface Visitor { + T visitProfile(); + + T visitEmail(); + + T visitAddress(); + + T visitPhone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportPost.java b/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportPost.java new file mode 100644 index 000000000..b98c974e5 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ClientOidcSupportPost.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientOidcSupportPost.Builder.class) +public final class ClientOidcSupportPost { + private final boolean isAllowed; + + private final Optional allowAllScopes; + + private final Optional> allowedScopes; + + private final Map additionalProperties; + + private ClientOidcSupportPost( + boolean isAllowed, + Optional allowAllScopes, + Optional> allowedScopes, + Map additionalProperties) { + this.isAllowed = isAllowed; + this.allowAllScopes = allowAllScopes; + this.allowedScopes = allowedScopes; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("is_allowed") + public boolean getIsAllowed() { + return isAllowed; + } + + @JsonProperty("allow_all_scopes") + public Optional getAllowAllScopes() { + return allowAllScopes; + } + + @JsonProperty("allowed_scopes") + public Optional> getAllowedScopes() { + return allowedScopes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientOidcSupportPost && equalTo((ClientOidcSupportPost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientOidcSupportPost other) { + return isAllowed == other.isAllowed + && allowAllScopes.equals(other.allowAllScopes) + && allowedScopes.equals(other.allowedScopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.isAllowed, this.allowAllScopes, this.allowedScopes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IsAllowedStage builder() { + return new Builder(); + } + + public interface IsAllowedStage { + _FinalStage isAllowed(boolean isAllowed); + + Builder from(ClientOidcSupportPost other); + } + + public interface _FinalStage { + ClientOidcSupportPost build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage allowAllScopes(Optional allowAllScopes); + + _FinalStage allowAllScopes(Boolean allowAllScopes); + + _FinalStage allowedScopes(Optional> allowedScopes); + + _FinalStage allowedScopes(List allowedScopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IsAllowedStage, _FinalStage { + private boolean isAllowed; + + private Optional> allowedScopes = Optional.empty(); + + private Optional allowAllScopes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientOidcSupportPost other) { + isAllowed(other.getIsAllowed()); + allowAllScopes(other.getAllowAllScopes()); + allowedScopes(other.getAllowedScopes()); + return this; + } + + @java.lang.Override + @JsonSetter("is_allowed") + public _FinalStage isAllowed(boolean isAllowed) { + this.isAllowed = isAllowed; + return this; + } + + @java.lang.Override + public _FinalStage allowedScopes(List allowedScopes) { + this.allowedScopes = Optional.ofNullable(allowedScopes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allowed_scopes", nulls = Nulls.SKIP) + public _FinalStage allowedScopes(Optional> allowedScopes) { + this.allowedScopes = allowedScopes; + return this; + } + + @java.lang.Override + public _FinalStage allowAllScopes(Boolean allowAllScopes) { + this.allowAllScopes = Optional.ofNullable(allowAllScopes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allow_all_scopes", nulls = Nulls.SKIP) + public _FinalStage allowAllScopes(Optional allowAllScopes) { + this.allowAllScopes = allowAllScopes; + return this; + } + + @java.lang.Override + public ClientOidcSupportPost build() { + return new ClientOidcSupportPost(isAllowed, allowAllScopes, allowedScopes, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAd.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAd.java index 90f01822a..cc643841f 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAd.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAd.java @@ -58,6 +58,8 @@ public final class ConnectionOptionsAd implements IConnectionOptionsCommon { private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -81,6 +83,7 @@ private ConnectionOptionsAd( Optional signInEndpoint, Optional tenantDomain, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Map additionalProperties) { this.nonPersistentAttrs = nonPersistentAttrs; @@ -100,6 +103,7 @@ private ConnectionOptionsAd( this.signInEndpoint = signInEndpoint; this.tenantDomain = tenantDomain; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.additionalProperties = additionalProperties; } @@ -202,6 +206,11 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") public OptionalNullable>> getUpstreamParams() { @@ -247,6 +256,7 @@ private boolean equalTo(ConnectionOptionsAd other) { && signInEndpoint.equals(other.signInEndpoint) && tenantDomain.equals(other.tenantDomain) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams); } @@ -270,6 +280,7 @@ public int hashCode() { this.signInEndpoint, this.tenantDomain, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams); } @@ -318,6 +329,8 @@ public static final class Builder { private Optional> thumbprints = Optional.empty(); + private Optional> thumbprintsSha384 = Optional.empty(); + private OptionalNullable>> upstreamParams = OptionalNullable.absent(); @@ -344,6 +357,7 @@ public Builder from(ConnectionOptionsAd other) { signInEndpoint(other.getSignInEndpoint()); tenantDomain(other.getTenantDomain()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); return this; } @@ -547,6 +561,17 @@ public Builder thumbprints(List thumbprints) { return this; } + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + @JsonSetter(value = "upstream_params", nulls = Nulls.SKIP) public Builder upstreamParams( @Nullable @@ -605,6 +630,7 @@ public ConnectionOptionsAd build() { signInEndpoint, tenantDomain, thumbprints, + thumbprintsSha384, upstreamParams, additionalProperties); } diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAdfs.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAdfs.java index f9688f05b..2c2f13d82 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAdfs.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAdfs.java @@ -48,6 +48,8 @@ public final class ConnectionOptionsAdfs implements IConnectionOptionsCommon { private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -68,6 +70,7 @@ private ConnectionOptionsAdfs( Optional signInEndpoint, Optional tenantDomain, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Optional userIdAttribute, Map additionalProperties) { @@ -83,6 +86,7 @@ private ConnectionOptionsAdfs( this.signInEndpoint = signInEndpoint; this.tenantDomain = tenantDomain; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.userIdAttribute = userIdAttribute; this.additionalProperties = additionalProperties; @@ -155,6 +159,11 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") public OptionalNullable>> getUpstreamParams() { @@ -203,6 +212,7 @@ private boolean equalTo(ConnectionOptionsAdfs other) { && signInEndpoint.equals(other.signInEndpoint) && tenantDomain.equals(other.tenantDomain) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams) && userIdAttribute.equals(other.userIdAttribute); } @@ -222,6 +232,7 @@ public int hashCode() { this.signInEndpoint, this.tenantDomain, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams, this.userIdAttribute); } @@ -262,6 +273,8 @@ public static final class Builder { private Optional> thumbprints = Optional.empty(); + private Optional> thumbprintsSha384 = Optional.empty(); + private OptionalNullable>> upstreamParams = OptionalNullable.absent(); @@ -285,6 +298,7 @@ public Builder from(ConnectionOptionsAdfs other) { signInEndpoint(other.getSignInEndpoint()); tenantDomain(other.getTenantDomain()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); userIdAttribute(other.getUserIdAttribute()); return this; @@ -430,6 +444,17 @@ public Builder thumbprints(List thumbprints) { return this; } + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + @JsonSetter(value = "upstream_params", nulls = Nulls.SKIP) public Builder upstreamParams( @Nullable @@ -497,6 +522,7 @@ public ConnectionOptionsAdfs build() { signInEndpoint, tenantDomain, thumbprints, + thumbprintsSha384, upstreamParams, userIdAttribute, additionalProperties); diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAzureAd.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAzureAd.java index 774a189ae..68a93c536 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAzureAd.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsAzureAd.java @@ -149,6 +149,8 @@ public final class ConnectionOptionsAzureAd implements IConnectionOptionsCommon private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -225,6 +227,7 @@ private ConnectionOptionsAzureAd( Optional tenantDomain, Optional tenantId, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Optional useWsfed, Optional useCommonEndpoint, @@ -293,6 +296,7 @@ private ConnectionOptionsAzureAd( this.tenantDomain = tenantDomain; this.tenantId = tenantId; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.useWsfed = useWsfed; this.useCommonEndpoint = useCommonEndpoint; @@ -738,6 +742,11 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") public OptionalNullable>> getUpstreamParams() { @@ -851,6 +860,7 @@ private boolean equalTo(ConnectionOptionsAzureAd other) { && tenantDomain.equals(other.tenantDomain) && tenantId.equals(other.tenantId) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams) && useWsfed.equals(other.useWsfed) && useCommonEndpoint.equals(other.useCommonEndpoint) @@ -923,6 +933,7 @@ public int hashCode() { this.tenantDomain, this.tenantId, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams, this.useWsfed, this.useCommonEndpoint, @@ -1324,6 +1335,10 @@ _FinalStage shouldTrustEmailVerifiedConnection( _FinalStage thumbprints(List thumbprints); + _FinalStage thumbprintsSha384(Optional> thumbprintsSha384); + + _FinalStage thumbprintsSha384(List thumbprintsSha384); + _FinalStage upstreamParams( @Nullable OptionalNullable>> @@ -1375,6 +1390,8 @@ public static final class Builder implements ClientIdStage, _FinalStage { private OptionalNullable>> upstreamParams = OptionalNullable.absent(); + private Optional> thumbprintsSha384 = Optional.empty(); + private Optional> thumbprints = Optional.empty(); private Optional tenantId = Optional.empty(); @@ -1567,6 +1584,7 @@ public Builder from(ConnectionOptionsAzureAd other) { tenantDomain(other.getTenantDomain()); tenantId(other.getTenantId()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); useWsfed(other.getUseWsfed()); useCommonEndpoint(other.getUseCommonEndpoint()); @@ -1684,6 +1702,19 @@ public _FinalStage upstreamParams( return this; } + @java.lang.Override + public _FinalStage thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public _FinalStage thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + @java.lang.Override public _FinalStage thumbprints(List thumbprints) { this.thumbprints = Optional.ofNullable(thumbprints); @@ -2838,6 +2869,7 @@ public ConnectionOptionsAzureAd build() { tenantDomain, tenantId, thumbprints, + thumbprintsSha384, upstreamParams, useWsfed, useCommonEndpoint, diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsCommonSaml.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsCommonSaml.java index 1efb4b8c9..1fee6f99b 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsCommonSaml.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsCommonSaml.java @@ -54,6 +54,8 @@ public final class ConnectionOptionsCommonSaml implements IConnectionOptionsComm private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -75,6 +77,7 @@ private ConnectionOptionsCommonSaml( Optional signatureAlgorithm, Optional tenantDomain, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Map additionalProperties) { this.assertionDecryptionSettings = assertionDecryptionSettings; @@ -92,6 +95,7 @@ private ConnectionOptionsCommonSaml( this.signatureAlgorithm = signatureAlgorithm; this.tenantDomain = tenantDomain; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.additionalProperties = additionalProperties; } @@ -186,6 +190,12 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + @java.lang.Override + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") @java.lang.Override @@ -230,6 +240,7 @@ private boolean equalTo(ConnectionOptionsCommonSaml other) { && signatureAlgorithm.equals(other.signatureAlgorithm) && tenantDomain.equals(other.tenantDomain) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams); } @@ -251,6 +262,7 @@ public int hashCode() { this.signatureAlgorithm, this.tenantDomain, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams); } @@ -295,6 +307,8 @@ public static final class Builder { private Optional> thumbprints = Optional.empty(); + private Optional> thumbprintsSha384 = Optional.empty(); + private OptionalNullable>> upstreamParams = OptionalNullable.absent(); @@ -319,6 +333,7 @@ public Builder from(ConnectionOptionsCommonSaml other) { signatureAlgorithm(other.getSignatureAlgorithm()); tenantDomain(other.getTenantDomain()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); return this; } @@ -489,6 +504,17 @@ public Builder thumbprints(List thumbprints) { return this; } + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + @JsonSetter(value = "upstream_params", nulls = Nulls.SKIP) public Builder upstreamParams( @Nullable @@ -545,6 +571,7 @@ public ConnectionOptionsCommonSaml build() { signatureAlgorithm, tenantDomain, thumbprints, + thumbprintsSha384, upstreamParams, additionalProperties); } diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsPingFederate.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsPingFederate.java index 8f9d002d7..f28b2d192 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsPingFederate.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsPingFederate.java @@ -55,6 +55,8 @@ public final class ConnectionOptionsPingFederate implements IConnectionOptionsCo private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -82,6 +84,7 @@ private ConnectionOptionsPingFederate( Optional signatureAlgorithm, Optional tenantDomain, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Optional> nonPersistentAttrs, String pingFederateBaseUrl, @@ -102,6 +105,7 @@ private ConnectionOptionsPingFederate( this.signatureAlgorithm = signatureAlgorithm; this.tenantDomain = tenantDomain; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.nonPersistentAttrs = nonPersistentAttrs; this.pingFederateBaseUrl = pingFederateBaseUrl; @@ -199,6 +203,12 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + @java.lang.Override + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") @java.lang.Override @@ -259,6 +269,7 @@ private boolean equalTo(ConnectionOptionsPingFederate other) { && signatureAlgorithm.equals(other.signatureAlgorithm) && tenantDomain.equals(other.tenantDomain) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams) && nonPersistentAttrs.equals(other.nonPersistentAttrs) && pingFederateBaseUrl.equals(other.pingFederateBaseUrl) @@ -283,6 +294,7 @@ public int hashCode() { this.signatureAlgorithm, this.tenantDomain, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams, this.nonPersistentAttrs, this.pingFederateBaseUrl, @@ -372,6 +384,10 @@ _FinalStage assertionDecryptionSettings( _FinalStage thumbprints(List thumbprints); + _FinalStage thumbprintsSha384(Optional> thumbprintsSha384); + + _FinalStage thumbprintsSha384(List thumbprintsSha384); + _FinalStage upstreamParams( @Nullable OptionalNullable>> @@ -408,6 +424,8 @@ public static final class Builder implements PingFederateBaseUrlStage, _FinalSta private OptionalNullable>> upstreamParams = OptionalNullable.absent(); + private Optional> thumbprintsSha384 = Optional.empty(); + private Optional> thumbprints = Optional.empty(); private Optional tenantDomain = Optional.empty(); @@ -460,6 +478,7 @@ public Builder from(ConnectionOptionsPingFederate other) { signatureAlgorithm(other.getSignatureAlgorithm()); tenantDomain(other.getTenantDomain()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); nonPersistentAttrs(other.getNonPersistentAttrs()); pingFederateBaseUrl(other.getPingFederateBaseUrl()); @@ -544,6 +563,19 @@ public _FinalStage upstreamParams( return this; } + @java.lang.Override + public _FinalStage thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public _FinalStage thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + @java.lang.Override public _FinalStage thumbprints(List thumbprints) { this.thumbprints = Optional.ofNullable(thumbprints); @@ -759,6 +791,7 @@ public ConnectionOptionsPingFederate build() { signatureAlgorithm, tenantDomain, thumbprints, + thumbprintsSha384, upstreamParams, nonPersistentAttrs, pingFederateBaseUrl, diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsSaml.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsSaml.java index 975e677a4..32eae8f27 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsSaml.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionOptionsSaml.java @@ -54,6 +54,8 @@ public final class ConnectionOptionsSaml implements IConnectionOptionsCommonSaml private final Optional> thumbprints; + private final Optional> thumbprintsSha384; + private final OptionalNullable>> upstreamParams; @@ -111,6 +113,7 @@ private ConnectionOptionsSaml( Optional signatureAlgorithm, Optional tenantDomain, Optional> thumbprints, + Optional> thumbprintsSha384, OptionalNullable>> upstreamParams, Optional> nonPersistentAttrs, Optional debug, @@ -146,6 +149,7 @@ private ConnectionOptionsSaml( this.signatureAlgorithm = signatureAlgorithm; this.tenantDomain = tenantDomain; this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.upstreamParams = upstreamParams; this.nonPersistentAttrs = nonPersistentAttrs; this.debug = debug; @@ -258,6 +262,12 @@ public Optional> getThumbprints() { return thumbprints; } + @JsonProperty("thumbprints_sha384") + @java.lang.Override + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("upstream_params") @java.lang.Override @@ -396,6 +406,7 @@ private boolean equalTo(ConnectionOptionsSaml other) { && signatureAlgorithm.equals(other.signatureAlgorithm) && tenantDomain.equals(other.tenantDomain) && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384) && upstreamParams.equals(other.upstreamParams) && nonPersistentAttrs.equals(other.nonPersistentAttrs) && debug.equals(other.debug) @@ -435,6 +446,7 @@ public int hashCode() { this.signatureAlgorithm, this.tenantDomain, this.thumbprints, + this.thumbprintsSha384, this.upstreamParams, this.nonPersistentAttrs, this.debug, @@ -497,6 +509,8 @@ public static final class Builder { private Optional> thumbprints = Optional.empty(); + private Optional> thumbprintsSha384 = Optional.empty(); + private OptionalNullable>> upstreamParams = OptionalNullable.absent(); @@ -557,6 +571,7 @@ public Builder from(ConnectionOptionsSaml other) { signatureAlgorithm(other.getSignatureAlgorithm()); tenantDomain(other.getTenantDomain()); thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); upstreamParams(other.getUpstreamParams()); nonPersistentAttrs(other.getNonPersistentAttrs()); debug(other.getDebug()); @@ -745,6 +760,17 @@ public Builder thumbprints(List thumbprints) { return this; } + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + @JsonSetter(value = "upstream_params", nulls = Nulls.SKIP) public Builder upstreamParams( @Nullable @@ -1002,6 +1028,7 @@ public ConnectionOptionsSaml build() { signatureAlgorithm, tenantDomain, thumbprints, + thumbprintsSha384, upstreamParams, nonPersistentAttrs, debug, diff --git a/src/main/java/com/auth0/client/mgmt/types/ConnectionPropertiesOptions.java b/src/main/java/com/auth0/client/mgmt/types/ConnectionPropertiesOptions.java index 2ba2199a6..d3ae1ded1 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ConnectionPropertiesOptions.java +++ b/src/main/java/com/auth0/client/mgmt/types/ConnectionPropertiesOptions.java @@ -109,6 +109,10 @@ public final class ConnectionPropertiesOptions { private final OptionalNullable oidcMetadata; + private final Optional> thumbprints; + + private final Optional> thumbprintsSha384; + private final Map additionalProperties; private ConnectionPropertiesOptions( @@ -154,6 +158,8 @@ private ConnectionPropertiesOptions( Optional useOauthSpecScope, OptionalNullable discoveryUrl, OptionalNullable oidcMetadata, + Optional> thumbprints, + Optional> thumbprintsSha384, Map additionalProperties) { this.validation = validation; this.nonPersistentAttrs = nonPersistentAttrs; @@ -197,6 +203,8 @@ private ConnectionPropertiesOptions( this.useOauthSpecScope = useOauthSpecScope; this.discoveryUrl = discoveryUrl; this.oidcMetadata = oidcMetadata; + this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.additionalProperties = additionalProperties; } @@ -496,6 +504,16 @@ public OptionalNullable getOidcMetadata() { return oidcMetadata; } + @JsonProperty("thumbprints") + public Optional> getThumbprints() { + return thumbprints; + } + + @JsonProperty("thumbprints_sha384") + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("validation") private OptionalNullable _getValidation() { @@ -652,7 +670,9 @@ private boolean equalTo(ConnectionPropertiesOptions other) { && idTokenSessionExpirySupported.equals(other.idTokenSessionExpirySupported) && useOauthSpecScope.equals(other.useOauthSpecScope) && discoveryUrl.equals(other.discoveryUrl) - && oidcMetadata.equals(other.oidcMetadata); + && oidcMetadata.equals(other.oidcMetadata) + && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384); } @java.lang.Override @@ -699,7 +719,9 @@ public int hashCode() { this.idTokenSessionExpirySupported, this.useOauthSpecScope, this.discoveryUrl, - this.oidcMetadata); + this.oidcMetadata, + this.thumbprints, + this.thumbprintsSha384); } @java.lang.Override @@ -803,6 +825,10 @@ public static final class Builder { private OptionalNullable oidcMetadata = OptionalNullable.absent(); + private Optional> thumbprints = Optional.empty(); + + private Optional> thumbprintsSha384 = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -851,6 +877,8 @@ public Builder from(ConnectionPropertiesOptions other) { useOauthSpecScope(other.getUseOauthSpecScope()); discoveryUrl(other.getDiscoveryUrl()); oidcMetadata(other.getOidcMetadata()); + thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); return this; } @@ -1713,6 +1741,28 @@ public Builder oidcMetadata(com.auth0.client.mgmt.core.Nullable> thumbprints) { + this.thumbprints = thumbprints; + return this; + } + + public Builder thumbprints(List thumbprints) { + this.thumbprints = Optional.ofNullable(thumbprints); + return this; + } + + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + public ConnectionPropertiesOptions build() { return new ConnectionPropertiesOptions( validation, @@ -1757,6 +1807,8 @@ public ConnectionPropertiesOptions build() { useOauthSpecScope, discoveryUrl, oidcMetadata, + thumbprints, + thumbprintsSha384, additionalProperties); } diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateClientRequestContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateClientRequestContent.java index 7b0dc5329..991347f1c 100644 --- a/src/main/java/com/auth0/client/mgmt/types/CreateClientRequestContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/CreateClientRequestContent.java @@ -141,6 +141,8 @@ public final class CreateClientRequestContent { private final Optional> asyncApprovalNotificationChannels; + private final Optional oidcSupport; + private final Map additionalProperties; private CreateClientRequestContent( @@ -202,6 +204,7 @@ private CreateClientRequestContent( Optional b2BIntegrationConfiguration, Optional myOrganizationConfiguration, Optional> asyncApprovalNotificationChannels, + Optional oidcSupport, Map additionalProperties) { this.name = name; this.description = description; @@ -261,6 +264,7 @@ private CreateClientRequestContent( this.b2BIntegrationConfiguration = b2BIntegrationConfiguration; this.myOrganizationConfiguration = myOrganizationConfiguration; this.asyncApprovalNotificationChannels = asyncApprovalNotificationChannels; + this.oidcSupport = oidcSupport; this.additionalProperties = additionalProperties; } @@ -667,6 +671,11 @@ public Optional> getAsyncApprovalNo return asyncApprovalNotificationChannels; } + @JsonProperty("oidc_support") + public Optional getOidcSupport() { + return oidcSupport; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("session_transfer") private OptionalNullable _getSessionTransfer() { @@ -773,7 +782,8 @@ private boolean equalTo(CreateClientRequestContent other) { && expressConfiguration.equals(other.expressConfiguration) && b2BIntegrationConfiguration.equals(other.b2BIntegrationConfiguration) && myOrganizationConfiguration.equals(other.myOrganizationConfiguration) - && asyncApprovalNotificationChannels.equals(other.asyncApprovalNotificationChannels); + && asyncApprovalNotificationChannels.equals(other.asyncApprovalNotificationChannels) + && oidcSupport.equals(other.oidcSupport); } @java.lang.Override @@ -836,7 +846,8 @@ public int hashCode() { this.expressConfiguration, this.b2BIntegrationConfiguration, this.myOrganizationConfiguration, - this.asyncApprovalNotificationChannels); + this.asyncApprovalNotificationChannels, + this.oidcSupport); } @java.lang.Override @@ -1214,12 +1225,18 @@ _FinalStage asyncApprovalNotificationChannels( _FinalStage asyncApprovalNotificationChannels( List asyncApprovalNotificationChannels); + + _FinalStage oidcSupport(Optional oidcSupport); + + _FinalStage oidcSupport(ClientOidcSupportPost oidcSupport); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional oidcSupport = Optional.empty(); + private Optional> asyncApprovalNotificationChannels = Optional.empty(); @@ -1401,6 +1418,7 @@ public Builder from(CreateClientRequestContent other) { b2BIntegrationConfiguration(other.getB2BIntegrationConfiguration()); myOrganizationConfiguration(other.getMyOrganizationConfiguration()); asyncApprovalNotificationChannels(other.getAsyncApprovalNotificationChannels()); + oidcSupport(other.getOidcSupport()); return this; } @@ -1415,6 +1433,19 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage oidcSupport(ClientOidcSupportPost oidcSupport) { + this.oidcSupport = Optional.ofNullable(oidcSupport); + return this; + } + + @java.lang.Override + @JsonSetter(value = "oidc_support", nulls = Nulls.SKIP) + public _FinalStage oidcSupport(Optional oidcSupport) { + this.oidcSupport = oidcSupport; + return this; + } + @java.lang.Override public _FinalStage asyncApprovalNotificationChannels( List asyncApprovalNotificationChannels) { @@ -2581,6 +2612,7 @@ public CreateClientRequestContent build() { b2BIntegrationConfiguration, myOrganizationConfiguration, asyncApprovalNotificationChannels, + oidcSupport, additionalProperties); } diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateExperimentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateExperimentResponseContent.java new file mode 100644 index 000000000..16c388ae8 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/CreateExperimentResponseContent.java @@ -0,0 +1,819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateExperimentResponseContent.Builder.class) +public final class CreateExperimentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final Optional featureFlagName; + + private final String authenticationFlow; + + private final AllocationStrategyEnum allocationStrategy; + + private final ExperimentStatusEnum status; + + private final boolean isValid; + + private final Optional defaultConfig; + + private final OptionalNullable> featureFlagSnapshot; + + private final List allocations; + + private final List editableFields; + + private final Optional> levels; + + private final OptionalNullable currentLevel; + + private final Optional startedAt; + + private final Optional endedAt; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CreateExperimentResponseContent( + String id, + String name, + Optional description, + String featureFlagId, + Optional featureFlagName, + String authenticationFlow, + AllocationStrategyEnum allocationStrategy, + ExperimentStatusEnum status, + boolean isValid, + Optional defaultConfig, + OptionalNullable> featureFlagSnapshot, + List allocations, + List editableFields, + Optional> levels, + OptionalNullable currentLevel, + Optional startedAt, + Optional endedAt, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.featureFlagName = featureFlagName; + this.authenticationFlow = authenticationFlow; + this.allocationStrategy = allocationStrategy; + this.status = status; + this.isValid = isValid; + this.defaultConfig = defaultConfig; + this.featureFlagSnapshot = featureFlagSnapshot; + this.allocations = allocations; + this.editableFields = editableFields; + this.levels = levels; + this.currentLevel = currentLevel; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("feature_flag_name") + public Optional getFeatureFlagName() { + return featureFlagName; + } + + @JsonProperty("authentication_flow") + public String getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonProperty("allocation_strategy") + public AllocationStrategyEnum getAllocationStrategy() { + return allocationStrategy; + } + + @JsonProperty("status") + public ExperimentStatusEnum getStatus() { + return status; + } + + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + public OptionalNullable> getFeatureFlagSnapshot() { + if (featureFlagSnapshot == null) { + return OptionalNullable.absent(); + } + return featureFlagSnapshot; + } + + @JsonProperty("allocations") + public List getAllocations() { + return allocations; + } + + /** + * @return Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic. + */ + @JsonProperty("editable_fields") + public List getEditableFields() { + return editableFields; + } + + /** + * @return Ramp experiment levels configuration. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + /** + * @return Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + public OptionalNullable getCurrentLevel() { + if (currentLevel == null) { + return OptionalNullable.absent(); + } + return currentLevel; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + private OptionalNullable> _getFeatureFlagSnapshot() { + return featureFlagSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + private OptionalNullable _getCurrentLevel() { + return currentLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateExperimentResponseContent && equalTo((CreateExperimentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateExperimentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && featureFlagName.equals(other.featureFlagName) + && authenticationFlow.equals(other.authenticationFlow) + && allocationStrategy.equals(other.allocationStrategy) + && status.equals(other.status) + && isValid == other.isValid + && defaultConfig.equals(other.defaultConfig) + && featureFlagSnapshot.equals(other.featureFlagSnapshot) + && allocations.equals(other.allocations) + && editableFields.equals(other.editableFields) + && levels.equals(other.levels) + && currentLevel.equals(other.currentLevel) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.featureFlagId, + this.featureFlagName, + this.authenticationFlow, + this.allocationStrategy, + this.status, + this.isValid, + this.defaultConfig, + this.featureFlagSnapshot, + this.allocations, + this.editableFields, + this.levels, + this.currentLevel, + this.startedAt, + this.endedAt, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreateExperimentResponseContent other); + } + + public interface NameStage { + FeatureFlagIdStage name(@NotNull String name); + } + + public interface FeatureFlagIdStage { + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow); + } + + public interface AllocationStrategyStage { + StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy); + } + + public interface StatusStage { + IsValidStage status(@NotNull ExperimentStatusEnum status); + } + + public interface IsValidStage { + CreatedAtStage isValid(boolean isValid); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CreateExperimentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage featureFlagName(Optional featureFlagName); + + _FinalStage featureFlagName(String featureFlagName); + + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Map featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot); + + _FinalStage allocations(List allocations); + + _FinalStage addAllocations(AllocationItem allocations); + + _FinalStage addAllAllocations(List allocations); + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + _FinalStage editableFields(List editableFields); + + _FinalStage addEditableFields(String editableFields); + + _FinalStage addAllEditableFields(List editableFields); + + /** + *

    Ramp experiment levels configuration.

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + _FinalStage currentLevel(@Nullable OptionalNullable currentLevel); + + _FinalStage currentLevel(Integer currentLevel); + + _FinalStage currentLevel(Optional currentLevel); + + _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + NameStage, + FeatureFlagIdStage, + AuthenticationFlowStage, + AllocationStrategyStage, + StatusStage, + IsValidStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String id; + + private String name; + + private String featureFlagId; + + private String authenticationFlow; + + private AllocationStrategyEnum allocationStrategy; + + private ExperimentStatusEnum status; + + private boolean isValid; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private OptionalNullable currentLevel = OptionalNullable.absent(); + + private Optional> levels = Optional.empty(); + + private List editableFields = new ArrayList<>(); + + private List allocations = new ArrayList<>(); + + private OptionalNullable> featureFlagSnapshot = OptionalNullable.absent(); + + private Optional defaultConfig = Optional.empty(); + + private Optional featureFlagName = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateExperimentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + featureFlagName(other.getFeatureFlagName()); + authenticationFlow(other.getAuthenticationFlow()); + allocationStrategy(other.getAllocationStrategy()); + status(other.getStatus()); + isValid(other.getIsValid()); + defaultConfig(other.getDefaultConfig()); + featureFlagSnapshot(other.getFeatureFlagSnapshot()); + allocations(other.getAllocations()); + editableFields(other.getEditableFields()); + levels(other.getLevels()); + currentLevel(other.getCurrentLevel()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("allocation_strategy") + public StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Objects.requireNonNull(allocationStrategy, "allocationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public IsValidStage status(@NotNull ExperimentStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_valid") + public CreatedAtStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel) { + if (currentLevel.isNull()) { + this.currentLevel = OptionalNullable.ofNull(); + } else if (currentLevel.isEmpty()) { + this.currentLevel = OptionalNullable.absent(); + } else { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Optional currentLevel) { + if (currentLevel.isPresent()) { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } else { + this.currentLevel = OptionalNullable.absent(); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Integer currentLevel) { + this.currentLevel = OptionalNullable.of(currentLevel); + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + @java.lang.Override + @JsonSetter(value = "current_level", nulls = Nulls.SKIP) + public _FinalStage currentLevel(@Nullable OptionalNullable currentLevel) { + this.currentLevel = currentLevel; + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEditableFields(List editableFields) { + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEditableFields(String editableFields) { + this.editableFields.add(editableFields); + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + @java.lang.Override + @JsonSetter(value = "editable_fields", nulls = Nulls.SKIP) + public _FinalStage editableFields(List editableFields) { + this.editableFields.clear(); + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAllocations(List allocations) { + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllocations(AllocationItem allocations) { + this.allocations.add(allocations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(List allocations) { + this.allocations.clear(); + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot( + com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot) { + if (featureFlagSnapshot.isNull()) { + this.featureFlagSnapshot = OptionalNullable.ofNull(); + } else if (featureFlagSnapshot.isEmpty()) { + this.featureFlagSnapshot = OptionalNullable.absent(); + } else { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot) { + if (featureFlagSnapshot.isPresent()) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } else { + this.featureFlagSnapshot = OptionalNullable.absent(); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Map featureFlagSnapshot) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_snapshot", nulls = Nulls.SKIP) + public _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot) { + this.featureFlagSnapshot = featureFlagSnapshot; + return this; + } + + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + @java.lang.Override + public _FinalStage featureFlagName(String featureFlagName) { + this.featureFlagName = Optional.ofNullable(featureFlagName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_name", nulls = Nulls.SKIP) + public _FinalStage featureFlagName(Optional featureFlagName) { + this.featureFlagName = featureFlagName; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateExperimentResponseContent build() { + return new CreateExperimentResponseContent( + id, + name, + description, + featureFlagId, + featureFlagName, + authenticationFlow, + allocationStrategy, + status, + isValid, + defaultConfig, + featureFlagSnapshot, + allocations, + editableFields, + levels, + currentLevel, + startedAt, + endedAt, + createdAt, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateFeatureFlagResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateFeatureFlagResponseContent.java new file mode 100644 index 000000000..c9a645091 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/CreateFeatureFlagResponseContent.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFeatureFlagResponseContent.Builder.class) +public final class CreateFeatureFlagResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final FeatureFlagTypeEnum type; + + private final FeatureFlagStatusEnum status; + + private final Optional> parameters; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CreateFeatureFlagResponseContent( + String id, + String name, + Optional description, + FeatureFlagTypeEnum type, + FeatureFlagStatusEnum status, + Optional> parameters, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.status = status; + this.parameters = parameters; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public FeatureFlagTypeEnum getType() { + return type; + } + + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFeatureFlagResponseContent && equalTo((CreateFeatureFlagResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFeatureFlagResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && status.equals(other.status) + && parameters.equals(other.parameters) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.type, + this.status, + this.parameters, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreateFeatureFlagResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + StatusStage type(@NotNull FeatureFlagTypeEnum type); + } + + public interface StatusStage { + CreatedAtStage status(@NotNull FeatureFlagStatusEnum status); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CreateFeatureFlagResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional> parameters); + + _FinalStage parameters(Map parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, StatusStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private FeatureFlagTypeEnum type; + + private FeatureFlagStatusEnum status; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateFeatureFlagResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + status(other.getStatus()); + parameters(other.getParameters()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public StatusStage type(@NotNull FeatureFlagTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public CreatedAtStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateFeatureFlagResponseContent build() { + return new CreateFeatureFlagResponseContent( + id, name, description, type, status, parameters, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerRequestContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerRequestContent.java index 196438fb6..669b0f8bd 100644 --- a/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerRequestContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerRequestContent.java @@ -57,6 +57,8 @@ public final class CreateResourceServerRequestContent { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -84,6 +86,7 @@ private CreateResourceServerRequestContent( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -105,6 +108,7 @@ private CreateResourceServerRequestContent( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -241,6 +245,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -344,6 +356,7 @@ private boolean equalTo(CreateResourceServerRequestContent other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -369,6 +382,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -509,6 +523,13 @@ _FinalStage skipConsentForVerifiableFirstPartyClients( _FinalStage consentPolicy(com.auth0.client.mgmt.core.Nullable consentPolicy); + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + _FinalStage requireConsentNonRepudiation(Optional requireConsentNonRepudiation); + + _FinalStage requireConsentNonRepudiation(Boolean requireConsentNonRepudiation); + _FinalStage authorizationDetails(@Nullable OptionalNullable> authorizationDetails); _FinalStage authorizationDetails(List authorizationDetails); @@ -553,6 +574,8 @@ public static final class Builder implements IdentifierStage, _FinalStage { private OptionalNullable> authorizationDetails = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable consentPolicy = OptionalNullable.absent(); private OptionalNullable tokenEncryption = OptionalNullable.absent(); @@ -606,6 +629,7 @@ public Builder from(CreateResourceServerRequestContent other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -748,6 +772,26 @@ public _FinalStage authorizationDetails(@Nullable OptionalNullable> return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @java.lang.Override + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public _FinalStage requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + @java.lang.Override public _FinalStage consentPolicy( com.auth0.client.mgmt.core.Nullable consentPolicy) { @@ -1139,6 +1183,7 @@ public CreateResourceServerRequestContent build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerResponseContent.java index 364c4f4fb..0bd7643d5 100644 --- a/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerResponseContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/CreateResourceServerResponseContent.java @@ -62,6 +62,8 @@ public final class CreateResourceServerResponseContent { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -94,6 +96,7 @@ private CreateResourceServerResponseContent( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -119,6 +122,7 @@ private CreateResourceServerResponseContent( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -276,6 +280,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -384,6 +396,7 @@ private boolean equalTo(CreateResourceServerResponseContent other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -413,6 +426,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -469,6 +483,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -504,6 +520,7 @@ public Builder from(CreateResourceServerResponseContent other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -828,6 +845,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -972,6 +1003,7 @@ public CreateResourceServerResponseContent build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateSegmentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateSegmentResponseContent.java new file mode 100644 index 000000000..756f816fb --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/CreateSegmentResponseContent.java @@ -0,0 +1,297 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSegmentResponseContent.Builder.class) +public final class CreateSegmentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final SegmentTypeEnum type; + + private final List rules; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CreateSegmentResponseContent( + String id, + String name, + Optional description, + SegmentTypeEnum type, + List rules, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.rules = rules; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public SegmentTypeEnum getType() { + return type; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSegmentResponseContent && equalTo((CreateSegmentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSegmentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && rules.equals(other.rules) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, this.name, this.description, this.type, this.rules, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreateSegmentResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + CreatedAtStage type(@NotNull SegmentTypeEnum type); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CreateSegmentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage rules(List rules); + + _FinalStage addRules(SegmentRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private SegmentTypeEnum type; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private List rules = new ArrayList<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSegmentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + rules(other.getRules()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public CreatedAtStage type(@NotNull SegmentTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(SegmentRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateSegmentResponseContent build() { + return new CreateSegmentResponseContent( + id, name, description, type, rules, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/CreateVariationResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/CreateVariationResponseContent.java new file mode 100644 index 000000000..a6cd176e1 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/CreateVariationResponseContent.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVariationResponseContent.Builder.class) +public final class CreateVariationResponseContent { + private final String id; + + private final String featureFlagId; + + private final String name; + + private final Optional description; + + private final Map overrides; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CreateVariationResponseContent( + String id, + String featureFlagId, + String name, + Optional description, + Map overrides, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.featureFlagId = featureFlagId; + this.name = name; + this.description = description; + this.overrides = overrides; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("overrides") + public Map getOverrides() { + return overrides; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVariationResponseContent && equalTo((CreateVariationResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVariationResponseContent other) { + return id.equals(other.id) + && featureFlagId.equals(other.featureFlagId) + && name.equals(other.name) + && description.equals(other.description) + && overrides.equals(other.overrides) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.featureFlagId, + this.name, + this.description, + this.overrides, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + FeatureFlagIdStage id(@NotNull String id); + + Builder from(CreateVariationResponseContent other); + } + + public interface FeatureFlagIdStage { + NameStage featureFlagId(@NotNull String featureFlagId); + } + + public interface NameStage { + CreatedAtStage name(@NotNull String name); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CreateVariationResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage overrides(Map overrides); + + _FinalStage putAllOverrides(Map overrides); + + _FinalStage overrides(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, FeatureFlagIdStage, NameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String featureFlagId; + + private String name; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Map overrides = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVariationResponseContent other) { + id(other.getId()); + featureFlagId(other.getFeatureFlagId()); + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public FeatureFlagIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public NameStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage overrides(String key, Object value) { + this.overrides.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllOverrides(Map overrides) { + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public _FinalStage overrides(Map overrides) { + this.overrides.clear(); + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateVariationResponseContent build() { + return new CreateVariationResponseContent( + id, featureFlagId, name, description, overrides, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationDeletionBehaviorEnum.java b/src/main/java/com/auth0/client/mgmt/types/DefaultConfigEnum.java similarity index 50% rename from src/main/java/com/auth0/client/mgmt/types/OrganizationDeletionBehaviorEnum.java rename to src/main/java/com/auth0/client/mgmt/types/DefaultConfigEnum.java index f433d6789..22ac80292 100644 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationDeletionBehaviorEnum.java +++ b/src/main/java/com/auth0/client/mgmt/types/DefaultConfigEnum.java @@ -6,18 +6,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class OrganizationDeletionBehaviorEnum { - public static final OrganizationDeletionBehaviorEnum ALLOW = - new OrganizationDeletionBehaviorEnum(Value.ALLOW, "allow"); +public final class DefaultConfigEnum { + public static final DefaultConfigEnum FLAG = new DefaultConfigEnum(Value.FLAG, "flag"); - public static final OrganizationDeletionBehaviorEnum ALLOW_IF_EMPTY = - new OrganizationDeletionBehaviorEnum(Value.ALLOW_IF_EMPTY, "allow_if_empty"); + public static final DefaultConfigEnum TENANT = new DefaultConfigEnum(Value.TENANT, "tenant"); private final Value value; private final String string; - OrganizationDeletionBehaviorEnum(Value value, String string) { + DefaultConfigEnum(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof OrganizationDeletionBehaviorEnum - && this.string.equals(((OrganizationDeletionBehaviorEnum) other).string)); + || (other instanceof DefaultConfigEnum && this.string.equals(((DefaultConfigEnum) other).string)); } @java.lang.Override @@ -46,10 +43,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case ALLOW: - return visitor.visitAllow(); - case ALLOW_IF_EMPTY: - return visitor.visitAllowIfEmpty(); + case FLAG: + return visitor.visitFlag(); + case TENANT: + return visitor.visitTenant(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -57,29 +54,29 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OrganizationDeletionBehaviorEnum valueOf(String value) { + public static DefaultConfigEnum valueOf(String value) { switch (value) { - case "allow": - return ALLOW; - case "allow_if_empty": - return ALLOW_IF_EMPTY; + case "flag": + return FLAG; + case "tenant": + return TENANT; default: - return new OrganizationDeletionBehaviorEnum(Value.UNKNOWN, value); + return new DefaultConfigEnum(Value.UNKNOWN, value); } } public enum Value { - ALLOW, + TENANT, - ALLOW_IF_EMPTY, + FLAG, UNKNOWN } public interface Visitor { - T visitAllow(); + T visitTenant(); - T visitAllowIfEmpty(); + T visitFlag(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/auth0/client/mgmt/types/ExperimentListItem.java b/src/main/java/com/auth0/client/mgmt/types/ExperimentListItem.java new file mode 100644 index 000000000..e17d85e35 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ExperimentListItem.java @@ -0,0 +1,819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperimentListItem.Builder.class) +public final class ExperimentListItem { + private final String id; + + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final Optional featureFlagName; + + private final String authenticationFlow; + + private final AllocationStrategyEnum allocationStrategy; + + private final ExperimentStatusEnum status; + + private final boolean isValid; + + private final Optional defaultConfig; + + private final OptionalNullable> featureFlagSnapshot; + + private final List allocations; + + private final List editableFields; + + private final Optional> levels; + + private final OptionalNullable currentLevel; + + private final Optional startedAt; + + private final Optional endedAt; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private ExperimentListItem( + String id, + String name, + Optional description, + String featureFlagId, + Optional featureFlagName, + String authenticationFlow, + AllocationStrategyEnum allocationStrategy, + ExperimentStatusEnum status, + boolean isValid, + Optional defaultConfig, + OptionalNullable> featureFlagSnapshot, + List allocations, + List editableFields, + Optional> levels, + OptionalNullable currentLevel, + Optional startedAt, + Optional endedAt, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.featureFlagName = featureFlagName; + this.authenticationFlow = authenticationFlow; + this.allocationStrategy = allocationStrategy; + this.status = status; + this.isValid = isValid; + this.defaultConfig = defaultConfig; + this.featureFlagSnapshot = featureFlagSnapshot; + this.allocations = allocations; + this.editableFields = editableFields; + this.levels = levels; + this.currentLevel = currentLevel; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("feature_flag_name") + public Optional getFeatureFlagName() { + return featureFlagName; + } + + @JsonProperty("authentication_flow") + public String getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonProperty("allocation_strategy") + public AllocationStrategyEnum getAllocationStrategy() { + return allocationStrategy; + } + + @JsonProperty("status") + public ExperimentStatusEnum getStatus() { + return status; + } + + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + public OptionalNullable> getFeatureFlagSnapshot() { + if (featureFlagSnapshot == null) { + return OptionalNullable.absent(); + } + return featureFlagSnapshot; + } + + @JsonProperty("allocations") + public List getAllocations() { + return allocations; + } + + /** + * @return Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic. + */ + @JsonProperty("editable_fields") + public List getEditableFields() { + return editableFields; + } + + /** + * @return Ramp experiment levels configuration. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + /** + * @return Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + public OptionalNullable getCurrentLevel() { + if (currentLevel == null) { + return OptionalNullable.absent(); + } + return currentLevel; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + private OptionalNullable> _getFeatureFlagSnapshot() { + return featureFlagSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + private OptionalNullable _getCurrentLevel() { + return currentLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperimentListItem && equalTo((ExperimentListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperimentListItem other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && featureFlagName.equals(other.featureFlagName) + && authenticationFlow.equals(other.authenticationFlow) + && allocationStrategy.equals(other.allocationStrategy) + && status.equals(other.status) + && isValid == other.isValid + && defaultConfig.equals(other.defaultConfig) + && featureFlagSnapshot.equals(other.featureFlagSnapshot) + && allocations.equals(other.allocations) + && editableFields.equals(other.editableFields) + && levels.equals(other.levels) + && currentLevel.equals(other.currentLevel) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.featureFlagId, + this.featureFlagName, + this.authenticationFlow, + this.allocationStrategy, + this.status, + this.isValid, + this.defaultConfig, + this.featureFlagSnapshot, + this.allocations, + this.editableFields, + this.levels, + this.currentLevel, + this.startedAt, + this.endedAt, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(ExperimentListItem other); + } + + public interface NameStage { + FeatureFlagIdStage name(@NotNull String name); + } + + public interface FeatureFlagIdStage { + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow); + } + + public interface AllocationStrategyStage { + StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy); + } + + public interface StatusStage { + IsValidStage status(@NotNull ExperimentStatusEnum status); + } + + public interface IsValidStage { + CreatedAtStage isValid(boolean isValid); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ExperimentListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage featureFlagName(Optional featureFlagName); + + _FinalStage featureFlagName(String featureFlagName); + + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Map featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot); + + _FinalStage allocations(List allocations); + + _FinalStage addAllocations(AllocationItem allocations); + + _FinalStage addAllAllocations(List allocations); + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + _FinalStage editableFields(List editableFields); + + _FinalStage addEditableFields(String editableFields); + + _FinalStage addAllEditableFields(List editableFields); + + /** + *

    Ramp experiment levels configuration.

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + _FinalStage currentLevel(@Nullable OptionalNullable currentLevel); + + _FinalStage currentLevel(Integer currentLevel); + + _FinalStage currentLevel(Optional currentLevel); + + _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + NameStage, + FeatureFlagIdStage, + AuthenticationFlowStage, + AllocationStrategyStage, + StatusStage, + IsValidStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String id; + + private String name; + + private String featureFlagId; + + private String authenticationFlow; + + private AllocationStrategyEnum allocationStrategy; + + private ExperimentStatusEnum status; + + private boolean isValid; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private OptionalNullable currentLevel = OptionalNullable.absent(); + + private Optional> levels = Optional.empty(); + + private List editableFields = new ArrayList<>(); + + private List allocations = new ArrayList<>(); + + private OptionalNullable> featureFlagSnapshot = OptionalNullable.absent(); + + private Optional defaultConfig = Optional.empty(); + + private Optional featureFlagName = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperimentListItem other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + featureFlagName(other.getFeatureFlagName()); + authenticationFlow(other.getAuthenticationFlow()); + allocationStrategy(other.getAllocationStrategy()); + status(other.getStatus()); + isValid(other.getIsValid()); + defaultConfig(other.getDefaultConfig()); + featureFlagSnapshot(other.getFeatureFlagSnapshot()); + allocations(other.getAllocations()); + editableFields(other.getEditableFields()); + levels(other.getLevels()); + currentLevel(other.getCurrentLevel()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("allocation_strategy") + public StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Objects.requireNonNull(allocationStrategy, "allocationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public IsValidStage status(@NotNull ExperimentStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_valid") + public CreatedAtStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel) { + if (currentLevel.isNull()) { + this.currentLevel = OptionalNullable.ofNull(); + } else if (currentLevel.isEmpty()) { + this.currentLevel = OptionalNullable.absent(); + } else { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Optional currentLevel) { + if (currentLevel.isPresent()) { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } else { + this.currentLevel = OptionalNullable.absent(); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Integer currentLevel) { + this.currentLevel = OptionalNullable.of(currentLevel); + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + @java.lang.Override + @JsonSetter(value = "current_level", nulls = Nulls.SKIP) + public _FinalStage currentLevel(@Nullable OptionalNullable currentLevel) { + this.currentLevel = currentLevel; + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEditableFields(List editableFields) { + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEditableFields(String editableFields) { + this.editableFields.add(editableFields); + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + @java.lang.Override + @JsonSetter(value = "editable_fields", nulls = Nulls.SKIP) + public _FinalStage editableFields(List editableFields) { + this.editableFields.clear(); + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAllocations(List allocations) { + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllocations(AllocationItem allocations) { + this.allocations.add(allocations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(List allocations) { + this.allocations.clear(); + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot( + com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot) { + if (featureFlagSnapshot.isNull()) { + this.featureFlagSnapshot = OptionalNullable.ofNull(); + } else if (featureFlagSnapshot.isEmpty()) { + this.featureFlagSnapshot = OptionalNullable.absent(); + } else { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot) { + if (featureFlagSnapshot.isPresent()) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } else { + this.featureFlagSnapshot = OptionalNullable.absent(); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Map featureFlagSnapshot) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_snapshot", nulls = Nulls.SKIP) + public _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot) { + this.featureFlagSnapshot = featureFlagSnapshot; + return this; + } + + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + @java.lang.Override + public _FinalStage featureFlagName(String featureFlagName) { + this.featureFlagName = Optional.ofNullable(featureFlagName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_name", nulls = Nulls.SKIP) + public _FinalStage featureFlagName(Optional featureFlagName) { + this.featureFlagName = featureFlagName; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public ExperimentListItem build() { + return new ExperimentListItem( + id, + name, + description, + featureFlagId, + featureFlagName, + authenticationFlow, + allocationStrategy, + status, + isValid, + defaultConfig, + featureFlagSnapshot, + allocations, + editableFields, + levels, + currentLevel, + startedAt, + endedAt, + createdAt, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ExperimentStatusEnum.java b/src/main/java/com/auth0/client/mgmt/types/ExperimentStatusEnum.java new file mode 100644 index 000000000..bed1c8288 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ExperimentStatusEnum.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExperimentStatusEnum { + public static final ExperimentStatusEnum COMPLETED = new ExperimentStatusEnum(Value.COMPLETED, "completed"); + + public static final ExperimentStatusEnum PAUSED = new ExperimentStatusEnum(Value.PAUSED, "paused"); + + public static final ExperimentStatusEnum DRAFT = new ExperimentStatusEnum(Value.DRAFT, "draft"); + + public static final ExperimentStatusEnum ARCHIVED = new ExperimentStatusEnum(Value.ARCHIVED, "archived"); + + public static final ExperimentStatusEnum ACTIVE = new ExperimentStatusEnum(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ExperimentStatusEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExperimentStatusEnum && this.string.equals(((ExperimentStatusEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPLETED: + return visitor.visitCompleted(); + case PAUSED: + return visitor.visitPaused(); + case DRAFT: + return visitor.visitDraft(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExperimentStatusEnum valueOf(String value) { + switch (value) { + case "completed": + return COMPLETED; + case "paused": + return PAUSED; + case "draft": + return DRAFT; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new ExperimentStatusEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + ACTIVE, + + PAUSED, + + COMPLETED, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitActive(); + + T visitPaused(); + + T visitCompleted(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ExperimentTransitionStatusEnum.java b/src/main/java/com/auth0/client/mgmt/types/ExperimentTransitionStatusEnum.java new file mode 100644 index 000000000..e121dc2a5 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ExperimentTransitionStatusEnum.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExperimentTransitionStatusEnum { + public static final ExperimentTransitionStatusEnum COMPLETED = + new ExperimentTransitionStatusEnum(Value.COMPLETED, "completed"); + + public static final ExperimentTransitionStatusEnum PAUSED = + new ExperimentTransitionStatusEnum(Value.PAUSED, "paused"); + + public static final ExperimentTransitionStatusEnum ARCHIVED = + new ExperimentTransitionStatusEnum(Value.ARCHIVED, "archived"); + + public static final ExperimentTransitionStatusEnum ACTIVE = + new ExperimentTransitionStatusEnum(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ExperimentTransitionStatusEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExperimentTransitionStatusEnum + && this.string.equals(((ExperimentTransitionStatusEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPLETED: + return visitor.visitCompleted(); + case PAUSED: + return visitor.visitPaused(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExperimentTransitionStatusEnum valueOf(String value) { + switch (value) { + case "completed": + return COMPLETED; + case "paused": + return PAUSED; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new ExperimentTransitionStatusEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + COMPLETED, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitCompleted(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityOverride.java b/src/main/java/com/auth0/client/mgmt/types/ExperimentValidationError.java similarity index 50% rename from src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityOverride.java rename to src/main/java/com/auth0/client/mgmt/types/ExperimentValidationError.java index ba95d29c9..e7d01da93 100644 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityOverride.java +++ b/src/main/java/com/auth0/client/mgmt/types/ExperimentValidationError.java @@ -17,39 +17,40 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = OrganizationTemplateRoleVisibilityOverride.Builder.class) -public final class OrganizationTemplateRoleVisibilityOverride { - private final String roleId; +@JsonDeserialize(builder = ExperimentValidationError.Builder.class) +public final class ExperimentValidationError { + private final String code; - private final OrganizationTemplateRoleVisibilityEnum access; + private final String message; private final Map additionalProperties; - private OrganizationTemplateRoleVisibilityOverride( - String roleId, OrganizationTemplateRoleVisibilityEnum access, Map additionalProperties) { - this.roleId = roleId; - this.access = access; + private ExperimentValidationError(String code, String message, Map additionalProperties) { + this.code = code; + this.message = message; this.additionalProperties = additionalProperties; } /** - * @return The role identifier. + * @return Machine-readable error code identifying the validation failure. */ - @JsonProperty("role_id") - public String getRoleId() { - return roleId; + @JsonProperty("code") + public String getCode() { + return code; } - @JsonProperty("access") - public OrganizationTemplateRoleVisibilityEnum getAccess() { - return access; + /** + * @return Human-readable description of the validation failure. + */ + @JsonProperty("message") + public String getMessage() { + return message; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof OrganizationTemplateRoleVisibilityOverride - && equalTo((OrganizationTemplateRoleVisibilityOverride) other); + return other instanceof ExperimentValidationError && equalTo((ExperimentValidationError) other); } @JsonAnyGetter @@ -57,13 +58,13 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(OrganizationTemplateRoleVisibilityOverride other) { - return roleId.equals(other.roleId) && access.equals(other.access); + private boolean equalTo(ExperimentValidationError other) { + return code.equals(other.code) && message.equals(other.message); } @java.lang.Override public int hashCode() { - return Objects.hash(this.roleId, this.access); + return Objects.hash(this.code, this.message); } @java.lang.Override @@ -71,25 +72,28 @@ public String toString() { return ObjectMappers.stringify(this); } - public static RoleIdStage builder() { + public static CodeStage builder() { return new Builder(); } - public interface RoleIdStage { + public interface CodeStage { /** - *

    The role identifier.

    + *

    Machine-readable error code identifying the validation failure.

    */ - AccessStage roleId(@NotNull String roleId); + MessageStage code(@NotNull String code); - Builder from(OrganizationTemplateRoleVisibilityOverride other); + Builder from(ExperimentValidationError other); } - public interface AccessStage { - _FinalStage access(@NotNull OrganizationTemplateRoleVisibilityEnum access); + public interface MessageStage { + /** + *

    Human-readable description of the validation failure.

    + */ + _FinalStage message(@NotNull String message); } public interface _FinalStage { - OrganizationTemplateRoleVisibilityOverride build(); + ExperimentValidationError build(); _FinalStage additionalProperty(String key, Object value); @@ -97,10 +101,10 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RoleIdStage, AccessStage, _FinalStage { - private String roleId; + public static final class Builder implements CodeStage, MessageStage, _FinalStage { + private String code; - private OrganizationTemplateRoleVisibilityEnum access; + private String message; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -108,33 +112,37 @@ public static final class Builder implements RoleIdStage, AccessStage, _FinalSta private Builder() {} @java.lang.Override - public Builder from(OrganizationTemplateRoleVisibilityOverride other) { - roleId(other.getRoleId()); - access(other.getAccess()); + public Builder from(ExperimentValidationError other) { + code(other.getCode()); + message(other.getMessage()); return this; } /** - *

    The role identifier.

    + *

    Machine-readable error code identifying the validation failure.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("role_id") - public AccessStage roleId(@NotNull String roleId) { - this.roleId = Objects.requireNonNull(roleId, "roleId must not be null"); + @JsonSetter("code") + public MessageStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); return this; } + /** + *

    Human-readable description of the validation failure.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - @JsonSetter("access") - public _FinalStage access(@NotNull OrganizationTemplateRoleVisibilityEnum access) { - this.access = Objects.requireNonNull(access, "access must not be null"); + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); return this; } @java.lang.Override - public OrganizationTemplateRoleVisibilityOverride build() { - return new OrganizationTemplateRoleVisibilityOverride(roleId, access, additionalProperties); + public ExperimentValidationError build() { + return new ExperimentValidationError(code, message, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/auth0/client/mgmt/types/FeatureFlag.java b/src/main/java/com/auth0/client/mgmt/types/FeatureFlag.java new file mode 100644 index 000000000..b9a5d4147 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/FeatureFlag.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeatureFlag.Builder.class) +public final class FeatureFlag { + private final String id; + + private final String name; + + private final Optional description; + + private final FeatureFlagTypeEnum type; + + private final FeatureFlagStatusEnum status; + + private final Optional> parameters; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private FeatureFlag( + String id, + String name, + Optional description, + FeatureFlagTypeEnum type, + FeatureFlagStatusEnum status, + Optional> parameters, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.status = status; + this.parameters = parameters; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public FeatureFlagTypeEnum getType() { + return type; + } + + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureFlag && equalTo((FeatureFlag) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureFlag other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && status.equals(other.status) + && parameters.equals(other.parameters) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.type, + this.status, + this.parameters, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(FeatureFlag other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + StatusStage type(@NotNull FeatureFlagTypeEnum type); + } + + public interface StatusStage { + CreatedAtStage status(@NotNull FeatureFlagStatusEnum status); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FeatureFlag build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional> parameters); + + _FinalStage parameters(Map parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, StatusStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private FeatureFlagTypeEnum type; + + private FeatureFlagStatusEnum status; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureFlag other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + status(other.getStatus()); + parameters(other.getParameters()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public StatusStage type(@NotNull FeatureFlagTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public CreatedAtStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public FeatureFlag build() { + return new FeatureFlag( + id, name, description, type, status, parameters, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParam.java b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParam.java new file mode 100644 index 000000000..859e5bc93 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParam.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeatureFlagConfigParam.Builder.class) +public final class FeatureFlagConfigParam { + private final FeatureFlagConfigParamTypeEnum type; + + private final Object value; + + private final Optional description; + + private final Map additionalProperties; + + private FeatureFlagConfigParam( + FeatureFlagConfigParamTypeEnum type, + Object value, + Optional description, + Map additionalProperties) { + this.type = type; + this.value = value; + this.description = description; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public FeatureFlagConfigParamTypeEnum getType() { + return type; + } + + @JsonProperty("value") + public Object getValue() { + return value; + } + + /** + * @return A human-readable description of the parameter + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureFlagConfigParam && equalTo((FeatureFlagConfigParam) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureFlagConfigParam other) { + return type.equals(other.type) && value.equals(other.value) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + ValueStage type(@NotNull FeatureFlagConfigParamTypeEnum type); + + Builder from(FeatureFlagConfigParam other); + } + + public interface ValueStage { + _FinalStage value(Object value); + } + + public interface _FinalStage { + FeatureFlagConfigParam build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    A human-readable description of the parameter

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, ValueStage, _FinalStage { + private FeatureFlagConfigParamTypeEnum type; + + private Object value; + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureFlagConfigParam other) { + type(other.getType()); + value(other.getValue()); + description(other.getDescription()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public ValueStage type(@NotNull FeatureFlagConfigParamTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + /** + *

    A human-readable description of the parameter

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A human-readable description of the parameter

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public FeatureFlagConfigParam build() { + return new FeatureFlagConfigParam(type, value, description, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParamTypeEnum.java b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParamTypeEnum.java new file mode 100644 index 000000000..e4b3545ca --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagConfigParamTypeEnum.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FeatureFlagConfigParamTypeEnum { + public static final FeatureFlagConfigParamTypeEnum NUMBER = + new FeatureFlagConfigParamTypeEnum(Value.NUMBER, "number"); + + public static final FeatureFlagConfigParamTypeEnum STRING = + new FeatureFlagConfigParamTypeEnum(Value.STRING, "string"); + + public static final FeatureFlagConfigParamTypeEnum BOOLEAN = + new FeatureFlagConfigParamTypeEnum(Value.BOOLEAN, "boolean"); + + public static final FeatureFlagConfigParamTypeEnum ARRAY = new FeatureFlagConfigParamTypeEnum(Value.ARRAY, "array"); + + public static final FeatureFlagConfigParamTypeEnum OBJECT = + new FeatureFlagConfigParamTypeEnum(Value.OBJECT, "object"); + + private final Value value; + + private final String string; + + FeatureFlagConfigParamTypeEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FeatureFlagConfigParamTypeEnum + && this.string.equals(((FeatureFlagConfigParamTypeEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NUMBER: + return visitor.visitNumber(); + case STRING: + return visitor.visitString(); + case BOOLEAN: + return visitor.visitBoolean(); + case ARRAY: + return visitor.visitArray(); + case OBJECT: + return visitor.visitObject(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FeatureFlagConfigParamTypeEnum valueOf(String value) { + switch (value) { + case "number": + return NUMBER; + case "string": + return STRING; + case "boolean": + return BOOLEAN; + case "array": + return ARRAY; + case "object": + return OBJECT; + default: + return new FeatureFlagConfigParamTypeEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + STRING, + + BOOLEAN, + + NUMBER, + + ARRAY, + + OBJECT, + + UNKNOWN + } + + public interface Visitor { + T visitString(); + + T visitBoolean(); + + T visitNumber(); + + T visitArray(); + + T visitObject(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/FeatureFlagStatusEnum.java b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagStatusEnum.java new file mode 100644 index 000000000..fd983e44a --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagStatusEnum.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FeatureFlagStatusEnum { + public static final FeatureFlagStatusEnum DRAFT = new FeatureFlagStatusEnum(Value.DRAFT, "draft"); + + public static final FeatureFlagStatusEnum ARCHIVED = new FeatureFlagStatusEnum(Value.ARCHIVED, "archived"); + + public static final FeatureFlagStatusEnum ACTIVE = new FeatureFlagStatusEnum(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + FeatureFlagStatusEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FeatureFlagStatusEnum + && this.string.equals(((FeatureFlagStatusEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DRAFT: + return visitor.visitDraft(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FeatureFlagStatusEnum valueOf(String value) { + switch (value) { + case "draft": + return DRAFT; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new FeatureFlagStatusEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + ACTIVE, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitActive(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/FeatureFlagTypeEnum.java b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagTypeEnum.java new file mode 100644 index 000000000..c45c26cad --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/FeatureFlagTypeEnum.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FeatureFlagTypeEnum { + public static final FeatureFlagTypeEnum SELF = new FeatureFlagTypeEnum(Value.SELF, "self"); + + public static final FeatureFlagTypeEnum AUTH0 = new FeatureFlagTypeEnum(Value.AUTH0, "auth0"); + + private final Value value; + + private final String string; + + FeatureFlagTypeEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FeatureFlagTypeEnum && this.string.equals(((FeatureFlagTypeEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case AUTH0: + return visitor.visitAuth0(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FeatureFlagTypeEnum valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "auth0": + return AUTH0; + default: + return new FeatureFlagTypeEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTH0, + + SELF, + + UNKNOWN + } + + public interface Visitor { + T visitAuth0(); + + T visitSelf(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/GetExperimentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/GetExperimentResponseContent.java new file mode 100644 index 000000000..8f8895c54 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/GetExperimentResponseContent.java @@ -0,0 +1,819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetExperimentResponseContent.Builder.class) +public final class GetExperimentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final Optional featureFlagName; + + private final String authenticationFlow; + + private final AllocationStrategyEnum allocationStrategy; + + private final ExperimentStatusEnum status; + + private final boolean isValid; + + private final Optional defaultConfig; + + private final OptionalNullable> featureFlagSnapshot; + + private final List allocations; + + private final List editableFields; + + private final Optional> levels; + + private final OptionalNullable currentLevel; + + private final Optional startedAt; + + private final Optional endedAt; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GetExperimentResponseContent( + String id, + String name, + Optional description, + String featureFlagId, + Optional featureFlagName, + String authenticationFlow, + AllocationStrategyEnum allocationStrategy, + ExperimentStatusEnum status, + boolean isValid, + Optional defaultConfig, + OptionalNullable> featureFlagSnapshot, + List allocations, + List editableFields, + Optional> levels, + OptionalNullable currentLevel, + Optional startedAt, + Optional endedAt, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.featureFlagName = featureFlagName; + this.authenticationFlow = authenticationFlow; + this.allocationStrategy = allocationStrategy; + this.status = status; + this.isValid = isValid; + this.defaultConfig = defaultConfig; + this.featureFlagSnapshot = featureFlagSnapshot; + this.allocations = allocations; + this.editableFields = editableFields; + this.levels = levels; + this.currentLevel = currentLevel; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("feature_flag_name") + public Optional getFeatureFlagName() { + return featureFlagName; + } + + @JsonProperty("authentication_flow") + public String getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonProperty("allocation_strategy") + public AllocationStrategyEnum getAllocationStrategy() { + return allocationStrategy; + } + + @JsonProperty("status") + public ExperimentStatusEnum getStatus() { + return status; + } + + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + public OptionalNullable> getFeatureFlagSnapshot() { + if (featureFlagSnapshot == null) { + return OptionalNullable.absent(); + } + return featureFlagSnapshot; + } + + @JsonProperty("allocations") + public List getAllocations() { + return allocations; + } + + /** + * @return Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic. + */ + @JsonProperty("editable_fields") + public List getEditableFields() { + return editableFields; + } + + /** + * @return Ramp experiment levels configuration. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + /** + * @return Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + public OptionalNullable getCurrentLevel() { + if (currentLevel == null) { + return OptionalNullable.absent(); + } + return currentLevel; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + private OptionalNullable> _getFeatureFlagSnapshot() { + return featureFlagSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + private OptionalNullable _getCurrentLevel() { + return currentLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetExperimentResponseContent && equalTo((GetExperimentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetExperimentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && featureFlagName.equals(other.featureFlagName) + && authenticationFlow.equals(other.authenticationFlow) + && allocationStrategy.equals(other.allocationStrategy) + && status.equals(other.status) + && isValid == other.isValid + && defaultConfig.equals(other.defaultConfig) + && featureFlagSnapshot.equals(other.featureFlagSnapshot) + && allocations.equals(other.allocations) + && editableFields.equals(other.editableFields) + && levels.equals(other.levels) + && currentLevel.equals(other.currentLevel) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.featureFlagId, + this.featureFlagName, + this.authenticationFlow, + this.allocationStrategy, + this.status, + this.isValid, + this.defaultConfig, + this.featureFlagSnapshot, + this.allocations, + this.editableFields, + this.levels, + this.currentLevel, + this.startedAt, + this.endedAt, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(GetExperimentResponseContent other); + } + + public interface NameStage { + FeatureFlagIdStage name(@NotNull String name); + } + + public interface FeatureFlagIdStage { + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow); + } + + public interface AllocationStrategyStage { + StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy); + } + + public interface StatusStage { + IsValidStage status(@NotNull ExperimentStatusEnum status); + } + + public interface IsValidStage { + CreatedAtStage isValid(boolean isValid); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GetExperimentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage featureFlagName(Optional featureFlagName); + + _FinalStage featureFlagName(String featureFlagName); + + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Map featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot); + + _FinalStage allocations(List allocations); + + _FinalStage addAllocations(AllocationItem allocations); + + _FinalStage addAllAllocations(List allocations); + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + _FinalStage editableFields(List editableFields); + + _FinalStage addEditableFields(String editableFields); + + _FinalStage addAllEditableFields(List editableFields); + + /** + *

    Ramp experiment levels configuration.

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + _FinalStage currentLevel(@Nullable OptionalNullable currentLevel); + + _FinalStage currentLevel(Integer currentLevel); + + _FinalStage currentLevel(Optional currentLevel); + + _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + NameStage, + FeatureFlagIdStage, + AuthenticationFlowStage, + AllocationStrategyStage, + StatusStage, + IsValidStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String id; + + private String name; + + private String featureFlagId; + + private String authenticationFlow; + + private AllocationStrategyEnum allocationStrategy; + + private ExperimentStatusEnum status; + + private boolean isValid; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private OptionalNullable currentLevel = OptionalNullable.absent(); + + private Optional> levels = Optional.empty(); + + private List editableFields = new ArrayList<>(); + + private List allocations = new ArrayList<>(); + + private OptionalNullable> featureFlagSnapshot = OptionalNullable.absent(); + + private Optional defaultConfig = Optional.empty(); + + private Optional featureFlagName = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetExperimentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + featureFlagName(other.getFeatureFlagName()); + authenticationFlow(other.getAuthenticationFlow()); + allocationStrategy(other.getAllocationStrategy()); + status(other.getStatus()); + isValid(other.getIsValid()); + defaultConfig(other.getDefaultConfig()); + featureFlagSnapshot(other.getFeatureFlagSnapshot()); + allocations(other.getAllocations()); + editableFields(other.getEditableFields()); + levels(other.getLevels()); + currentLevel(other.getCurrentLevel()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("allocation_strategy") + public StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Objects.requireNonNull(allocationStrategy, "allocationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public IsValidStage status(@NotNull ExperimentStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_valid") + public CreatedAtStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel) { + if (currentLevel.isNull()) { + this.currentLevel = OptionalNullable.ofNull(); + } else if (currentLevel.isEmpty()) { + this.currentLevel = OptionalNullable.absent(); + } else { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Optional currentLevel) { + if (currentLevel.isPresent()) { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } else { + this.currentLevel = OptionalNullable.absent(); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Integer currentLevel) { + this.currentLevel = OptionalNullable.of(currentLevel); + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + @java.lang.Override + @JsonSetter(value = "current_level", nulls = Nulls.SKIP) + public _FinalStage currentLevel(@Nullable OptionalNullable currentLevel) { + this.currentLevel = currentLevel; + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEditableFields(List editableFields) { + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEditableFields(String editableFields) { + this.editableFields.add(editableFields); + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + @java.lang.Override + @JsonSetter(value = "editable_fields", nulls = Nulls.SKIP) + public _FinalStage editableFields(List editableFields) { + this.editableFields.clear(); + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAllocations(List allocations) { + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllocations(AllocationItem allocations) { + this.allocations.add(allocations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(List allocations) { + this.allocations.clear(); + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot( + com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot) { + if (featureFlagSnapshot.isNull()) { + this.featureFlagSnapshot = OptionalNullable.ofNull(); + } else if (featureFlagSnapshot.isEmpty()) { + this.featureFlagSnapshot = OptionalNullable.absent(); + } else { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot) { + if (featureFlagSnapshot.isPresent()) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } else { + this.featureFlagSnapshot = OptionalNullable.absent(); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Map featureFlagSnapshot) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_snapshot", nulls = Nulls.SKIP) + public _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot) { + this.featureFlagSnapshot = featureFlagSnapshot; + return this; + } + + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + @java.lang.Override + public _FinalStage featureFlagName(String featureFlagName) { + this.featureFlagName = Optional.ofNullable(featureFlagName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_name", nulls = Nulls.SKIP) + public _FinalStage featureFlagName(Optional featureFlagName) { + this.featureFlagName = featureFlagName; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public GetExperimentResponseContent build() { + return new GetExperimentResponseContent( + id, + name, + description, + featureFlagId, + featureFlagName, + authenticationFlow, + allocationStrategy, + status, + isValid, + defaultConfig, + featureFlagSnapshot, + allocations, + editableFields, + levels, + currentLevel, + startedAt, + endedAt, + createdAt, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/GetFeatureFlagResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/GetFeatureFlagResponseContent.java new file mode 100644 index 000000000..8e4be0b79 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/GetFeatureFlagResponseContent.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetFeatureFlagResponseContent.Builder.class) +public final class GetFeatureFlagResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final FeatureFlagTypeEnum type; + + private final FeatureFlagStatusEnum status; + + private final Optional> parameters; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GetFeatureFlagResponseContent( + String id, + String name, + Optional description, + FeatureFlagTypeEnum type, + FeatureFlagStatusEnum status, + Optional> parameters, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.status = status; + this.parameters = parameters; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public FeatureFlagTypeEnum getType() { + return type; + } + + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFeatureFlagResponseContent && equalTo((GetFeatureFlagResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFeatureFlagResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && status.equals(other.status) + && parameters.equals(other.parameters) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.type, + this.status, + this.parameters, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(GetFeatureFlagResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + StatusStage type(@NotNull FeatureFlagTypeEnum type); + } + + public interface StatusStage { + CreatedAtStage status(@NotNull FeatureFlagStatusEnum status); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GetFeatureFlagResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional> parameters); + + _FinalStage parameters(Map parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, StatusStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private FeatureFlagTypeEnum type; + + private FeatureFlagStatusEnum status; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetFeatureFlagResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + status(other.getStatus()); + parameters(other.getParameters()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public StatusStage type(@NotNull FeatureFlagTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public CreatedAtStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public GetFeatureFlagResponseContent build() { + return new GetFeatureFlagResponseContent( + id, name, description, type, status, parameters, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/GetResourceServerResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/GetResourceServerResponseContent.java index 9e3a3bb7b..5a8866503 100644 --- a/src/main/java/com/auth0/client/mgmt/types/GetResourceServerResponseContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/GetResourceServerResponseContent.java @@ -62,6 +62,8 @@ public final class GetResourceServerResponseContent { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -94,6 +96,7 @@ private GetResourceServerResponseContent( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -119,6 +122,7 @@ private GetResourceServerResponseContent( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -276,6 +280,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -383,6 +395,7 @@ private boolean equalTo(GetResourceServerResponseContent other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -412,6 +425,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -468,6 +482,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -503,6 +519,7 @@ public Builder from(GetResourceServerResponseContent other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -827,6 +844,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -971,6 +1002,7 @@ public GetResourceServerResponseContent build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/GetSegmentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/GetSegmentResponseContent.java new file mode 100644 index 000000000..3e1adc643 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/GetSegmentResponseContent.java @@ -0,0 +1,297 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetSegmentResponseContent.Builder.class) +public final class GetSegmentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final SegmentTypeEnum type; + + private final List rules; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GetSegmentResponseContent( + String id, + String name, + Optional description, + SegmentTypeEnum type, + List rules, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.rules = rules; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public SegmentTypeEnum getType() { + return type; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetSegmentResponseContent && equalTo((GetSegmentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetSegmentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && rules.equals(other.rules) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, this.name, this.description, this.type, this.rules, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(GetSegmentResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + CreatedAtStage type(@NotNull SegmentTypeEnum type); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GetSegmentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage rules(List rules); + + _FinalStage addRules(SegmentRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private SegmentTypeEnum type; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private List rules = new ArrayList<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetSegmentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + rules(other.getRules()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public CreatedAtStage type(@NotNull SegmentTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(SegmentRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public GetSegmentResponseContent build() { + return new GetSegmentResponseContent( + id, name, description, type, rules, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/GetVariationResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/GetVariationResponseContent.java new file mode 100644 index 000000000..e6533cb40 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/GetVariationResponseContent.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetVariationResponseContent.Builder.class) +public final class GetVariationResponseContent { + private final String id; + + private final String featureFlagId; + + private final String name; + + private final Optional description; + + private final Map overrides; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GetVariationResponseContent( + String id, + String featureFlagId, + String name, + Optional description, + Map overrides, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.featureFlagId = featureFlagId; + this.name = name; + this.description = description; + this.overrides = overrides; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("overrides") + public Map getOverrides() { + return overrides; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetVariationResponseContent && equalTo((GetVariationResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetVariationResponseContent other) { + return id.equals(other.id) + && featureFlagId.equals(other.featureFlagId) + && name.equals(other.name) + && description.equals(other.description) + && overrides.equals(other.overrides) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.featureFlagId, + this.name, + this.description, + this.overrides, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + FeatureFlagIdStage id(@NotNull String id); + + Builder from(GetVariationResponseContent other); + } + + public interface FeatureFlagIdStage { + NameStage featureFlagId(@NotNull String featureFlagId); + } + + public interface NameStage { + CreatedAtStage name(@NotNull String name); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GetVariationResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage overrides(Map overrides); + + _FinalStage putAllOverrides(Map overrides); + + _FinalStage overrides(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, FeatureFlagIdStage, NameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String featureFlagId; + + private String name; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Map overrides = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetVariationResponseContent other) { + id(other.getId()); + featureFlagId(other.getFeatureFlagId()); + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public FeatureFlagIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public NameStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage overrides(String key, Object value) { + this.overrides.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllOverrides(Map overrides) { + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public _FinalStage overrides(Map overrides) { + this.overrides.clear(); + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public GetVariationResponseContent build() { + return new GetVariationResponseContent( + id, featureFlagId, name, description, overrides, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/IConnectionOptionsCommonSaml.java b/src/main/java/com/auth0/client/mgmt/types/IConnectionOptionsCommonSaml.java index 6550f1e03..e33cc2bff 100644 --- a/src/main/java/com/auth0/client/mgmt/types/IConnectionOptionsCommonSaml.java +++ b/src/main/java/com/auth0/client/mgmt/types/IConnectionOptionsCommonSaml.java @@ -39,5 +39,7 @@ public interface IConnectionOptionsCommonSaml { Optional> getThumbprints(); + Optional> getThumbprintsSha384(); + OptionalNullable>> getUpstreamParams(); } diff --git a/src/main/java/com/auth0/client/mgmt/types/ListExperimentsResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/ListExperimentsResponseContent.java new file mode 100644 index 000000000..a33c33aec --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ListExperimentsResponseContent.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperimentsResponseContent.Builder.class) +public final class ListExperimentsResponseContent { + private final List experiments; + + private final Optional next; + + private final Map additionalProperties; + + private ListExperimentsResponseContent( + List experiments, Optional next, Map additionalProperties) { + this.experiments = experiments; + this.next = next; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("experiments") + public List getExperiments() { + return experiments; + } + + /** + * @return Checkpoint token for the next page. Omitted when there are no further results. + */ + @JsonProperty("next") + public Optional getNext() { + return next; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperimentsResponseContent && equalTo((ListExperimentsResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperimentsResponseContent other) { + return experiments.equals(other.experiments) && next.equals(other.next); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experiments, this.next); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List experiments = new ArrayList<>(); + + private Optional next = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListExperimentsResponseContent other) { + experiments(other.getExperiments()); + next(other.getNext()); + return this; + } + + @JsonSetter(value = "experiments", nulls = Nulls.SKIP) + public Builder experiments(List experiments) { + this.experiments.clear(); + if (experiments != null) { + this.experiments.addAll(experiments); + } + return this; + } + + public Builder addExperiments(ExperimentListItem experiments) { + this.experiments.add(experiments); + return this; + } + + public Builder addAllExperiments(List experiments) { + if (experiments != null) { + this.experiments.addAll(experiments); + } + return this; + } + + /** + *

    Checkpoint token for the next page. Omitted when there are no further results.

    + */ + @JsonSetter(value = "next", nulls = Nulls.SKIP) + public Builder next(Optional next) { + this.next = next; + return this; + } + + public Builder next(String next) { + this.next = Optional.ofNullable(next); + return this; + } + + public ListExperimentsResponseContent build() { + return new ListExperimentsResponseContent(experiments, next, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ListFeatureFlagsResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/ListFeatureFlagsResponseContent.java new file mode 100644 index 000000000..3e75f3cb6 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ListFeatureFlagsResponseContent.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeatureFlagsResponseContent.Builder.class) +public final class ListFeatureFlagsResponseContent { + private final List featureFlags; + + private final Optional next; + + private final Map additionalProperties; + + private ListFeatureFlagsResponseContent( + List featureFlags, Optional next, Map additionalProperties) { + this.featureFlags = featureFlags; + this.next = next; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("feature_flags") + public List getFeatureFlags() { + return featureFlags; + } + + /** + * @return Checkpoint token for the next page. Omitted when there are no further results. + */ + @JsonProperty("next") + public Optional getNext() { + return next; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeatureFlagsResponseContent && equalTo((ListFeatureFlagsResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeatureFlagsResponseContent other) { + return featureFlags.equals(other.featureFlags) && next.equals(other.next); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.featureFlags, this.next); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List featureFlags = new ArrayList<>(); + + private Optional next = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListFeatureFlagsResponseContent other) { + featureFlags(other.getFeatureFlags()); + next(other.getNext()); + return this; + } + + @JsonSetter(value = "feature_flags", nulls = Nulls.SKIP) + public Builder featureFlags(List featureFlags) { + this.featureFlags.clear(); + if (featureFlags != null) { + this.featureFlags.addAll(featureFlags); + } + return this; + } + + public Builder addFeatureFlags(FeatureFlag featureFlags) { + this.featureFlags.add(featureFlags); + return this; + } + + public Builder addAllFeatureFlags(List featureFlags) { + if (featureFlags != null) { + this.featureFlags.addAll(featureFlags); + } + return this; + } + + /** + *

    Checkpoint token for the next page. Omitted when there are no further results.

    + */ + @JsonSetter(value = "next", nulls = Nulls.SKIP) + public Builder next(Optional next) { + this.next = next; + return this; + } + + public Builder next(String next) { + this.next = Optional.ofNullable(next); + return this; + } + + public ListFeatureFlagsResponseContent build() { + return new ListFeatureFlagsResponseContent(featureFlags, next, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ListSegmentsResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/ListSegmentsResponseContent.java new file mode 100644 index 000000000..25039c256 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ListSegmentsResponseContent.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSegmentsResponseContent.Builder.class) +public final class ListSegmentsResponseContent { + private final List segments; + + private final Optional next; + + private final Map additionalProperties; + + private ListSegmentsResponseContent( + List segments, Optional next, Map additionalProperties) { + this.segments = segments; + this.next = next; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("segments") + public List getSegments() { + return segments; + } + + /** + * @return Checkpoint token for the next page. Omitted when there are no further results. + */ + @JsonProperty("next") + public Optional getNext() { + return next; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSegmentsResponseContent && equalTo((ListSegmentsResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSegmentsResponseContent other) { + return segments.equals(other.segments) && next.equals(other.next); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.segments, this.next); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List segments = new ArrayList<>(); + + private Optional next = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSegmentsResponseContent other) { + segments(other.getSegments()); + next(other.getNext()); + return this; + } + + @JsonSetter(value = "segments", nulls = Nulls.SKIP) + public Builder segments(List segments) { + this.segments.clear(); + if (segments != null) { + this.segments.addAll(segments); + } + return this; + } + + public Builder addSegments(Segment segments) { + this.segments.add(segments); + return this; + } + + public Builder addAllSegments(List segments) { + if (segments != null) { + this.segments.addAll(segments); + } + return this; + } + + /** + *

    Checkpoint token for the next page. Omitted when there are no further results.

    + */ + @JsonSetter(value = "next", nulls = Nulls.SKIP) + public Builder next(Optional next) { + this.next = next; + return this; + } + + public Builder next(String next) { + this.next = Optional.ofNullable(next); + return this; + } + + public ListSegmentsResponseContent build() { + return new ListSegmentsResponseContent(segments, next, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksByIdentifierRequestParameters.java b/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksByIdentifierRequestParameters.java index 75e6e03a6..8cf8bc85c 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksByIdentifierRequestParameters.java +++ b/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksByIdentifierRequestParameters.java @@ -48,8 +48,8 @@ public String getIdentifier() { } /** - * @return If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list. + * @return If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state. */ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("consider_brute_force_enablement") @@ -114,8 +114,8 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    */ _FinalStage considerBruteForceEnablement(@Nullable OptionalNullable considerBruteForceEnablement); @@ -157,8 +157,8 @@ public _FinalStage identifier(@NotNull String identifier) { } /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -175,8 +175,8 @@ public _FinalStage considerBruteForceEnablement( } /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -190,8 +190,8 @@ public _FinalStage considerBruteForceEnablement(Optional considerBruteF } /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -201,8 +201,8 @@ public _FinalStage considerBruteForceEnablement(Boolean considerBruteForceEnable } /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    */ @java.lang.Override @JsonSetter(value = "consider_brute_force_enablement", nulls = Nulls.SKIP) diff --git a/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksRequestParameters.java b/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksRequestParameters.java index 2311b54a0..0f92c9e35 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksRequestParameters.java +++ b/src/main/java/com/auth0/client/mgmt/types/ListUserBlocksRequestParameters.java @@ -34,8 +34,8 @@ private ListUserBlocksRequestParameters( } /** - * @return If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list. + * @return If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state. */ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("consider_brute_force_enablement") @@ -96,8 +96,8 @@ public Builder from(ListUserBlocksRequestParameters other) { } /** - *

    If true and Brute Force Protection is enabled and configured to block logins, will return a list of blocked IP addresses. - * If true and Brute Force Protection is disabled, will return an empty list.

    + *

    If true, returns only blocks that are currently enforced (e.g. subject to protection status, IP allowlist, etc.). + * If false or omitted, returns all blocks regardless of enforcement state.

    */ @JsonSetter(value = "consider_brute_force_enablement", nulls = Nulls.SKIP) public Builder considerBruteForceEnablement(@Nullable OptionalNullable considerBruteForceEnablement) { diff --git a/src/main/java/com/auth0/client/mgmt/types/ListVariationsResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/ListVariationsResponseContent.java new file mode 100644 index 000000000..be4fb19c4 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ListVariationsResponseContent.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVariationsResponseContent.Builder.class) +public final class ListVariationsResponseContent { + private final List variations; + + private final Map additionalProperties; + + private ListVariationsResponseContent(List variations, Map additionalProperties) { + this.variations = variations; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("variations") + public List getVariations() { + return variations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVariationsResponseContent && equalTo((ListVariationsResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVariationsResponseContent other) { + return variations.equals(other.variations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.variations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List variations = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVariationsResponseContent other) { + variations(other.getVariations()); + return this; + } + + @JsonSetter(value = "variations", nulls = Nulls.SKIP) + public Builder variations(List variations) { + this.variations.clear(); + if (variations != null) { + this.variations.addAll(variations); + } + return this; + } + + public Builder addVariations(Variation variations) { + this.variations.add(variations); + return this; + } + + public Builder addAllVariations(List variations) { + if (variations != null) { + this.variations.addAll(variations); + } + return this; + } + + public ListVariationsResponseContent build() { + return new ListVariationsResponseContent(variations, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/OauthScope.java b/src/main/java/com/auth0/client/mgmt/types/OauthScope.java index 83fe96f95..2648fcbed 100644 --- a/src/main/java/com/auth0/client/mgmt/types/OauthScope.java +++ b/src/main/java/com/auth0/client/mgmt/types/OauthScope.java @@ -25,6 +25,9 @@ public final class OauthScope { public static final OauthScope DELETE_ROLE_MEMBERS = new OauthScope(Value.DELETE_ROLE_MEMBERS, "delete:role_members"); + public static final OauthScope READ_EXPERIMENTATION = + new OauthScope(Value.READ_EXPERIMENTATION, "read:experimentation"); + public static final OauthScope CREATE_CLIENT_GRANTS = new OauthScope(Value.CREATE_CLIENT_GRANTS, "create:client_grants"); @@ -254,6 +257,9 @@ public final class OauthScope { public static final OauthScope UPDATE_AGENTS = new OauthScope(Value.UPDATE_AGENTS, "update:agents"); + public static final OauthScope DELETE_EXPERIMENTATION = + new OauthScope(Value.DELETE_EXPERIMENTATION, "delete:experimentation"); + public static final OauthScope READ_ANOMALY_BLOCKS = new OauthScope(Value.READ_ANOMALY_BLOCKS, "read:anomaly_blocks"); @@ -451,9 +457,6 @@ public final class OauthScope { public static final OauthScope DELETE_RULES_CONFIGS = new OauthScope(Value.DELETE_RULES_CONFIGS, "delete:rules_configs"); - public static final OauthScope READ_ORGANIZATION_TEMPLATES = - new OauthScope(Value.READ_ORGANIZATION_TEMPLATES, "read:organization_templates"); - public static final OauthScope READ_USER_ATTRIBUTE_PROFILES = new OauthScope(Value.READ_USER_ATTRIBUTE_PROFILES, "read:user_attribute_profiles"); @@ -512,6 +515,9 @@ public final class OauthScope { public static final OauthScope DELETE_CURRENT_USER_DEVICE_CREDENTIALS = new OauthScope(Value.DELETE_CURRENT_USER_DEVICE_CREDENTIALS, "delete:current_user_device_credentials"); + public static final OauthScope CREATE_EXPERIMENTATION = + new OauthScope(Value.CREATE_EXPERIMENTATION, "create:experimentation"); + public static final OauthScope READ_EVENT_STREAMS = new OauthScope(Value.READ_EVENT_STREAMS, "read:event_streams"); public static final OauthScope CREATE_ORGANIZATION_GROUP_ROLES = @@ -717,6 +723,8 @@ public T visit(Visitor visitor) { return visitor.visitReadOrganizationMemberEffectiveRoles(); case DELETE_ROLE_MEMBERS: return visitor.visitDeleteRoleMembers(); + case READ_EXPERIMENTATION: + return visitor.visitReadExperimentation(); case CREATE_CLIENT_GRANTS: return visitor.visitCreateClientGrants(); case UPDATE_TOKEN_EXCHANGE_PROFILES: @@ -887,6 +895,8 @@ public T visit(Visitor visitor) { return visitor.visitUpdateOrganizationDiscoveryDomains(); case UPDATE_AGENTS: return visitor.visitUpdateAgents(); + case DELETE_EXPERIMENTATION: + return visitor.visitDeleteExperimentation(); case READ_ANOMALY_BLOCKS: return visitor.visitReadAnomalyBlocks(); case UPDATE_CLIENT_TOKEN_VAULT_PRIVILEGED_ACCESS: @@ -1039,8 +1049,6 @@ public T visit(Visitor visitor) { return visitor.visitCreateOrganizationConnections(); case DELETE_RULES_CONFIGS: return visitor.visitDeleteRulesConfigs(); - case READ_ORGANIZATION_TEMPLATES: - return visitor.visitReadOrganizationTemplates(); case READ_USER_ATTRIBUTE_PROFILES: return visitor.visitReadUserAttributeProfiles(); case READ_EMAIL_PROVIDER: @@ -1083,6 +1091,8 @@ public T visit(Visitor visitor) { return visitor.visitUpdateLogStreams(); case DELETE_CURRENT_USER_DEVICE_CREDENTIALS: return visitor.visitDeleteCurrentUserDeviceCredentials(); + case CREATE_EXPERIMENTATION: + return visitor.visitCreateExperimentation(); case READ_EVENT_STREAMS: return visitor.visitReadEventStreams(); case CREATE_ORGANIZATION_GROUP_ROLES: @@ -1224,6 +1234,8 @@ public static OauthScope valueOf(String value) { return READ_ORGANIZATION_MEMBER_EFFECTIVE_ROLES; case "delete:role_members": return DELETE_ROLE_MEMBERS; + case "read:experimentation": + return READ_EXPERIMENTATION; case "create:client_grants": return CREATE_CLIENT_GRANTS; case "update:token_exchange_profiles": @@ -1394,6 +1406,8 @@ public static OauthScope valueOf(String value) { return UPDATE_ORGANIZATION_DISCOVERY_DOMAINS; case "update:agents": return UPDATE_AGENTS; + case "delete:experimentation": + return DELETE_EXPERIMENTATION; case "read:anomaly_blocks": return READ_ANOMALY_BLOCKS; case "update:client_token_vault_privileged_access": @@ -1546,8 +1560,6 @@ public static OauthScope valueOf(String value) { return CREATE_ORGANIZATION_CONNECTIONS; case "delete:rules_configs": return DELETE_RULES_CONFIGS; - case "read:organization_templates": - return READ_ORGANIZATION_TEMPLATES; case "read:user_attribute_profiles": return READ_USER_ATTRIBUTE_PROFILES; case "read:email_provider": @@ -1590,6 +1602,8 @@ public static OauthScope valueOf(String value) { return UPDATE_LOG_STREAMS; case "delete:current_user_device_credentials": return DELETE_CURRENT_USER_DEVICE_CREDENTIALS; + case "create:experimentation": + return CREATE_EXPERIMENTATION; case "read:event_streams": return READ_EVENT_STREAMS; case "create:organization_group_roles": @@ -1882,8 +1896,14 @@ public enum Value { READ_EVENTS, + CREATE_EXPERIMENTATION, + + READ_EXPERIMENTATION, + UPDATE_EXPERIMENTATION, + DELETE_EXPERIMENTATION, + CREATE_FLOWS, READ_FLOWS, @@ -2204,8 +2224,6 @@ public enum Value { DELETE_ORGANIZATION_CLIENTS, - READ_ORGANIZATION_TEMPLATES, - CREATE_NETWORK_ACL_KEYS, READ_NETWORK_ACL_KEYS, @@ -2384,8 +2402,14 @@ public interface Visitor { T visitReadEvents(); + T visitCreateExperimentation(); + + T visitReadExperimentation(); + T visitUpdateExperimentation(); + T visitDeleteExperimentation(); + T visitCreateFlows(); T visitReadFlows(); @@ -2706,8 +2730,6 @@ public interface Visitor { T visitDeleteOrganizationClients(); - T visitReadOrganizationTemplates(); - T visitCreateNetworkAclKeys(); T visitReadNetworkAclKeys(); diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplate.java b/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplate.java deleted file mode 100644 index d0463bb15..000000000 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplate.java +++ /dev/null @@ -1,648 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.types; - -import com.auth0.client.mgmt.core.NullableNonemptyFilter; -import com.auth0.client.mgmt.core.ObjectMappers; -import com.auth0.client.mgmt.core.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.Nullable; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = OrganizationTemplate.Builder.class) -public final class OrganizationTemplate { - private final Optional id; - - private final Optional name; - - private final Optional isDefault; - - private final Optional organizationDeletionBehavior; - - private final Optional connectionDeletionBehavior; - - private final Optional enforcePermissionCeiling; - - private final Optional enforceSelfAssignmentRestriction; - - private final Optional connectionProfileId; - - private final Optional userAttributeProfileId; - - private final Optional> allowedStrategies; - - private final Optional invitationLandingClientId; - - private final Optional> adminRolesAssignment; - - private final OptionalNullable useForOrganizationDiscovery; - - private final OptionalNullable roleVisibilityPolicy; - - private final Optional createdAt; - - private final Optional updatedAt; - - private final Map additionalProperties; - - private OrganizationTemplate( - Optional id, - Optional name, - Optional isDefault, - Optional organizationDeletionBehavior, - Optional connectionDeletionBehavior, - Optional enforcePermissionCeiling, - Optional enforceSelfAssignmentRestriction, - Optional connectionProfileId, - Optional userAttributeProfileId, - Optional> allowedStrategies, - Optional invitationLandingClientId, - Optional> adminRolesAssignment, - OptionalNullable useForOrganizationDiscovery, - OptionalNullable roleVisibilityPolicy, - Optional createdAt, - Optional updatedAt, - Map additionalProperties) { - this.id = id; - this.name = name; - this.isDefault = isDefault; - this.organizationDeletionBehavior = organizationDeletionBehavior; - this.connectionDeletionBehavior = connectionDeletionBehavior; - this.enforcePermissionCeiling = enforcePermissionCeiling; - this.enforceSelfAssignmentRestriction = enforceSelfAssignmentRestriction; - this.connectionProfileId = connectionProfileId; - this.userAttributeProfileId = userAttributeProfileId; - this.allowedStrategies = allowedStrategies; - this.invitationLandingClientId = invitationLandingClientId; - this.adminRolesAssignment = adminRolesAssignment; - this.useForOrganizationDiscovery = useForOrganizationDiscovery; - this.roleVisibilityPolicy = roleVisibilityPolicy; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - /** - * @return Organization Template identifier. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The name of the organization template. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return Whether this is the default template applied to new organizations. - */ - @JsonProperty("is_default") - public Optional getIsDefault() { - return isDefault; - } - - @JsonProperty("organization_deletion_behavior") - public Optional getOrganizationDeletionBehavior() { - return organizationDeletionBehavior; - } - - @JsonProperty("connection_deletion_behavior") - public Optional getConnectionDeletionBehavior() { - return connectionDeletionBehavior; - } - - /** - * @return Whether to enforce permission ceiling for organizations using this template. - */ - @JsonProperty("enforce_permission_ceiling") - public Optional getEnforcePermissionCeiling() { - return enforcePermissionCeiling; - } - - /** - * @return Whether to enforce self-assignment restrictions for organizations using this template. - */ - @JsonProperty("enforce_self_assignment_restriction") - public Optional getEnforceSelfAssignmentRestriction() { - return enforceSelfAssignmentRestriction; - } - - /** - * @return The connection profile to apply to new connections. - */ - @JsonProperty("connection_profile_id") - public Optional getConnectionProfileId() { - return connectionProfileId; - } - - /** - * @return The user attribute profile to apply to organizations. - */ - @JsonProperty("user_attribute_profile_id") - public Optional getUserAttributeProfileId() { - return userAttributeProfileId; - } - - /** - * @return List of allowed connection strategies for this template. - */ - @JsonProperty("allowed_strategies") - public Optional> getAllowedStrategies() { - return allowedStrategies; - } - - /** - * @return The client ID for the invitation landing page. - */ - @JsonProperty("invitation_landing_client_id") - public Optional getInvitationLandingClientId() { - return invitationLandingClientId; - } - - /** - * @return Default admin roles to assign to organization creators. - */ - @JsonProperty("admin_roles_assignment") - public Optional> getAdminRolesAssignment() { - return adminRolesAssignment; - } - - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("use_for_organization_discovery") - public OptionalNullable getUseForOrganizationDiscovery() { - if (useForOrganizationDiscovery == null) { - return OptionalNullable.absent(); - } - return useForOrganizationDiscovery; - } - - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("role_visibility_policy") - public OptionalNullable getRoleVisibilityPolicy() { - if (roleVisibilityPolicy == null) { - return OptionalNullable.absent(); - } - return roleVisibilityPolicy; - } - - /** - * @return The ISO 8601 formatted timestamp representing when the template was created. - */ - @JsonProperty("created_at") - public Optional getCreatedAt() { - return createdAt; - } - - /** - * @return The ISO 8601 formatted timestamp representing when the template was last updated. - */ - @JsonProperty("updated_at") - public Optional getUpdatedAt() { - return updatedAt; - } - - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("use_for_organization_discovery") - private OptionalNullable _getUseForOrganizationDiscovery() { - return useForOrganizationDiscovery; - } - - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("role_visibility_policy") - private OptionalNullable _getRoleVisibilityPolicy() { - return roleVisibilityPolicy; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OrganizationTemplate && equalTo((OrganizationTemplate) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OrganizationTemplate other) { - return id.equals(other.id) - && name.equals(other.name) - && isDefault.equals(other.isDefault) - && organizationDeletionBehavior.equals(other.organizationDeletionBehavior) - && connectionDeletionBehavior.equals(other.connectionDeletionBehavior) - && enforcePermissionCeiling.equals(other.enforcePermissionCeiling) - && enforceSelfAssignmentRestriction.equals(other.enforceSelfAssignmentRestriction) - && connectionProfileId.equals(other.connectionProfileId) - && userAttributeProfileId.equals(other.userAttributeProfileId) - && allowedStrategies.equals(other.allowedStrategies) - && invitationLandingClientId.equals(other.invitationLandingClientId) - && adminRolesAssignment.equals(other.adminRolesAssignment) - && useForOrganizationDiscovery.equals(other.useForOrganizationDiscovery) - && roleVisibilityPolicy.equals(other.roleVisibilityPolicy) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.id, - this.name, - this.isDefault, - this.organizationDeletionBehavior, - this.connectionDeletionBehavior, - this.enforcePermissionCeiling, - this.enforceSelfAssignmentRestriction, - this.connectionProfileId, - this.userAttributeProfileId, - this.allowedStrategies, - this.invitationLandingClientId, - this.adminRolesAssignment, - this.useForOrganizationDiscovery, - this.roleVisibilityPolicy, - this.createdAt, - this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional id = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional isDefault = Optional.empty(); - - private Optional organizationDeletionBehavior = Optional.empty(); - - private Optional connectionDeletionBehavior = Optional.empty(); - - private Optional enforcePermissionCeiling = Optional.empty(); - - private Optional enforceSelfAssignmentRestriction = Optional.empty(); - - private Optional connectionProfileId = Optional.empty(); - - private Optional userAttributeProfileId = Optional.empty(); - - private Optional> allowedStrategies = Optional.empty(); - - private Optional invitationLandingClientId = Optional.empty(); - - private Optional> adminRolesAssignment = Optional.empty(); - - private OptionalNullable useForOrganizationDiscovery = - OptionalNullable.absent(); - - private OptionalNullable roleVisibilityPolicy = - OptionalNullable.absent(); - - private Optional createdAt = Optional.empty(); - - private Optional updatedAt = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(OrganizationTemplate other) { - id(other.getId()); - name(other.getName()); - isDefault(other.getIsDefault()); - organizationDeletionBehavior(other.getOrganizationDeletionBehavior()); - connectionDeletionBehavior(other.getConnectionDeletionBehavior()); - enforcePermissionCeiling(other.getEnforcePermissionCeiling()); - enforceSelfAssignmentRestriction(other.getEnforceSelfAssignmentRestriction()); - connectionProfileId(other.getConnectionProfileId()); - userAttributeProfileId(other.getUserAttributeProfileId()); - allowedStrategies(other.getAllowedStrategies()); - invitationLandingClientId(other.getInvitationLandingClientId()); - adminRolesAssignment(other.getAdminRolesAssignment()); - useForOrganizationDiscovery(other.getUseForOrganizationDiscovery()); - roleVisibilityPolicy(other.getRoleVisibilityPolicy()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - return this; - } - - /** - *

    Organization Template identifier.

    - */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - /** - *

    The name of the organization template.

    - */ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

    Whether this is the default template applied to new organizations.

    - */ - @JsonSetter(value = "is_default", nulls = Nulls.SKIP) - public Builder isDefault(Optional isDefault) { - this.isDefault = isDefault; - return this; - } - - public Builder isDefault(Boolean isDefault) { - this.isDefault = Optional.ofNullable(isDefault); - return this; - } - - @JsonSetter(value = "organization_deletion_behavior", nulls = Nulls.SKIP) - public Builder organizationDeletionBehavior( - Optional organizationDeletionBehavior) { - this.organizationDeletionBehavior = organizationDeletionBehavior; - return this; - } - - public Builder organizationDeletionBehavior(OrganizationDeletionBehaviorEnum organizationDeletionBehavior) { - this.organizationDeletionBehavior = Optional.ofNullable(organizationDeletionBehavior); - return this; - } - - @JsonSetter(value = "connection_deletion_behavior", nulls = Nulls.SKIP) - public Builder connectionDeletionBehavior(Optional connectionDeletionBehavior) { - this.connectionDeletionBehavior = connectionDeletionBehavior; - return this; - } - - public Builder connectionDeletionBehavior(ConnectionDeletionBehaviorEnum connectionDeletionBehavior) { - this.connectionDeletionBehavior = Optional.ofNullable(connectionDeletionBehavior); - return this; - } - - /** - *

    Whether to enforce permission ceiling for organizations using this template.

    - */ - @JsonSetter(value = "enforce_permission_ceiling", nulls = Nulls.SKIP) - public Builder enforcePermissionCeiling(Optional enforcePermissionCeiling) { - this.enforcePermissionCeiling = enforcePermissionCeiling; - return this; - } - - public Builder enforcePermissionCeiling(Boolean enforcePermissionCeiling) { - this.enforcePermissionCeiling = Optional.ofNullable(enforcePermissionCeiling); - return this; - } - - /** - *

    Whether to enforce self-assignment restrictions for organizations using this template.

    - */ - @JsonSetter(value = "enforce_self_assignment_restriction", nulls = Nulls.SKIP) - public Builder enforceSelfAssignmentRestriction(Optional enforceSelfAssignmentRestriction) { - this.enforceSelfAssignmentRestriction = enforceSelfAssignmentRestriction; - return this; - } - - public Builder enforceSelfAssignmentRestriction(Boolean enforceSelfAssignmentRestriction) { - this.enforceSelfAssignmentRestriction = Optional.ofNullable(enforceSelfAssignmentRestriction); - return this; - } - - /** - *

    The connection profile to apply to new connections.

    - */ - @JsonSetter(value = "connection_profile_id", nulls = Nulls.SKIP) - public Builder connectionProfileId(Optional connectionProfileId) { - this.connectionProfileId = connectionProfileId; - return this; - } - - public Builder connectionProfileId(String connectionProfileId) { - this.connectionProfileId = Optional.ofNullable(connectionProfileId); - return this; - } - - /** - *

    The user attribute profile to apply to organizations.

    - */ - @JsonSetter(value = "user_attribute_profile_id", nulls = Nulls.SKIP) - public Builder userAttributeProfileId(Optional userAttributeProfileId) { - this.userAttributeProfileId = userAttributeProfileId; - return this; - } - - public Builder userAttributeProfileId(String userAttributeProfileId) { - this.userAttributeProfileId = Optional.ofNullable(userAttributeProfileId); - return this; - } - - /** - *

    List of allowed connection strategies for this template.

    - */ - @JsonSetter(value = "allowed_strategies", nulls = Nulls.SKIP) - public Builder allowedStrategies(Optional> allowedStrategies) { - this.allowedStrategies = allowedStrategies; - return this; - } - - public Builder allowedStrategies(List allowedStrategies) { - this.allowedStrategies = Optional.ofNullable(allowedStrategies); - return this; - } - - /** - *

    The client ID for the invitation landing page.

    - */ - @JsonSetter(value = "invitation_landing_client_id", nulls = Nulls.SKIP) - public Builder invitationLandingClientId(Optional invitationLandingClientId) { - this.invitationLandingClientId = invitationLandingClientId; - return this; - } - - public Builder invitationLandingClientId(String invitationLandingClientId) { - this.invitationLandingClientId = Optional.ofNullable(invitationLandingClientId); - return this; - } - - /** - *

    Default admin roles to assign to organization creators.

    - */ - @JsonSetter(value = "admin_roles_assignment", nulls = Nulls.SKIP) - public Builder adminRolesAssignment(Optional> adminRolesAssignment) { - this.adminRolesAssignment = adminRolesAssignment; - return this; - } - - public Builder adminRolesAssignment(List adminRolesAssignment) { - this.adminRolesAssignment = Optional.ofNullable(adminRolesAssignment); - return this; - } - - @JsonSetter(value = "use_for_organization_discovery", nulls = Nulls.SKIP) - public Builder useForOrganizationDiscovery( - @Nullable - OptionalNullable useForOrganizationDiscovery) { - this.useForOrganizationDiscovery = useForOrganizationDiscovery; - return this; - } - - public Builder useForOrganizationDiscovery( - OrganizationTemplateUseForOrganizationDiscovery useForOrganizationDiscovery) { - this.useForOrganizationDiscovery = OptionalNullable.of(useForOrganizationDiscovery); - return this; - } - - public Builder useForOrganizationDiscovery( - Optional useForOrganizationDiscovery) { - if (useForOrganizationDiscovery.isPresent()) { - this.useForOrganizationDiscovery = OptionalNullable.of(useForOrganizationDiscovery.get()); - } else { - this.useForOrganizationDiscovery = OptionalNullable.absent(); - } - return this; - } - - public Builder useForOrganizationDiscovery( - com.auth0.client.mgmt.core.Nullable - useForOrganizationDiscovery) { - if (useForOrganizationDiscovery.isNull()) { - this.useForOrganizationDiscovery = OptionalNullable.ofNull(); - } else if (useForOrganizationDiscovery.isEmpty()) { - this.useForOrganizationDiscovery = OptionalNullable.absent(); - } else { - this.useForOrganizationDiscovery = OptionalNullable.of(useForOrganizationDiscovery.get()); - } - return this; - } - - @JsonSetter(value = "role_visibility_policy", nulls = Nulls.SKIP) - public Builder roleVisibilityPolicy( - @Nullable OptionalNullable roleVisibilityPolicy) { - this.roleVisibilityPolicy = roleVisibilityPolicy; - return this; - } - - public Builder roleVisibilityPolicy(OrganizationTemplateRoleVisibilityPolicy roleVisibilityPolicy) { - this.roleVisibilityPolicy = OptionalNullable.of(roleVisibilityPolicy); - return this; - } - - public Builder roleVisibilityPolicy(Optional roleVisibilityPolicy) { - if (roleVisibilityPolicy.isPresent()) { - this.roleVisibilityPolicy = OptionalNullable.of(roleVisibilityPolicy.get()); - } else { - this.roleVisibilityPolicy = OptionalNullable.absent(); - } - return this; - } - - public Builder roleVisibilityPolicy( - com.auth0.client.mgmt.core.Nullable roleVisibilityPolicy) { - if (roleVisibilityPolicy.isNull()) { - this.roleVisibilityPolicy = OptionalNullable.ofNull(); - } else if (roleVisibilityPolicy.isEmpty()) { - this.roleVisibilityPolicy = OptionalNullable.absent(); - } else { - this.roleVisibilityPolicy = OptionalNullable.of(roleVisibilityPolicy.get()); - } - return this; - } - - /** - *

    The ISO 8601 formatted timestamp representing when the template was created.

    - */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { - this.createdAt = createdAt; - return this; - } - - public Builder createdAt(OffsetDateTime createdAt) { - this.createdAt = Optional.ofNullable(createdAt); - return this; - } - - /** - *

    The ISO 8601 formatted timestamp representing when the template was last updated.

    - */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - public Builder updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); - return this; - } - - public OrganizationTemplate build() { - return new OrganizationTemplate( - id, - name, - isDefault, - organizationDeletionBehavior, - connectionDeletionBehavior, - enforcePermissionCeiling, - enforceSelfAssignmentRestriction, - connectionProfileId, - userAttributeProfileId, - allowedStrategies, - invitationLandingClientId, - adminRolesAssignment, - useForOrganizationDiscovery, - roleVisibilityPolicy, - createdAt, - updatedAt, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateAllowedStrategyEnum.java b/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateAllowedStrategyEnum.java deleted file mode 100644 index d2ffee493..000000000 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateAllowedStrategyEnum.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class OrganizationTemplateAllowedStrategyEnum { - public static final OrganizationTemplateAllowedStrategyEnum PINGFEDERATE = - new OrganizationTemplateAllowedStrategyEnum(Value.PINGFEDERATE, "pingfederate"); - - public static final OrganizationTemplateAllowedStrategyEnum OKTA = - new OrganizationTemplateAllowedStrategyEnum(Value.OKTA, "okta"); - - public static final OrganizationTemplateAllowedStrategyEnum SAMLP = - new OrganizationTemplateAllowedStrategyEnum(Value.SAMLP, "samlp"); - - public static final OrganizationTemplateAllowedStrategyEnum WAAD = - new OrganizationTemplateAllowedStrategyEnum(Value.WAAD, "waad"); - - public static final OrganizationTemplateAllowedStrategyEnum ADFS = - new OrganizationTemplateAllowedStrategyEnum(Value.ADFS, "adfs"); - - public static final OrganizationTemplateAllowedStrategyEnum OIDC = - new OrganizationTemplateAllowedStrategyEnum(Value.OIDC, "oidc"); - - public static final OrganizationTemplateAllowedStrategyEnum GOOGLE_APPS = - new OrganizationTemplateAllowedStrategyEnum(Value.GOOGLE_APPS, "google-apps"); - - private final Value value; - - private final String string; - - OrganizationTemplateAllowedStrategyEnum(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof OrganizationTemplateAllowedStrategyEnum - && this.string.equals(((OrganizationTemplateAllowedStrategyEnum) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PINGFEDERATE: - return visitor.visitPingfederate(); - case OKTA: - return visitor.visitOkta(); - case SAMLP: - return visitor.visitSamlp(); - case WAAD: - return visitor.visitWaad(); - case ADFS: - return visitor.visitAdfs(); - case OIDC: - return visitor.visitOidc(); - case GOOGLE_APPS: - return visitor.visitGoogleApps(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OrganizationTemplateAllowedStrategyEnum valueOf(String value) { - switch (value) { - case "pingfederate": - return PINGFEDERATE; - case "okta": - return OKTA; - case "samlp": - return SAMLP; - case "waad": - return WAAD; - case "adfs": - return ADFS; - case "oidc": - return OIDC; - case "google-apps": - return GOOGLE_APPS; - default: - return new OrganizationTemplateAllowedStrategyEnum(Value.UNKNOWN, value); - } - } - - public enum Value { - ADFS, - - GOOGLE_APPS, - - OIDC, - - OKTA, - - PINGFEDERATE, - - SAMLP, - - WAAD, - - UNKNOWN - } - - public interface Visitor { - T visitAdfs(); - - T visitGoogleApps(); - - T visitOidc(); - - T visitOkta(); - - T visitPingfederate(); - - T visitSamlp(); - - T visitWaad(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityEnum.java b/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityEnum.java deleted file mode 100644 index d3a4bf453..000000000 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityEnum.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class OrganizationTemplateRoleVisibilityEnum { - public static final OrganizationTemplateRoleVisibilityEnum HIDDEN = - new OrganizationTemplateRoleVisibilityEnum(Value.HIDDEN, "hidden"); - - public static final OrganizationTemplateRoleVisibilityEnum WRITE = - new OrganizationTemplateRoleVisibilityEnum(Value.WRITE, "write"); - - public static final OrganizationTemplateRoleVisibilityEnum READ_ONLY = - new OrganizationTemplateRoleVisibilityEnum(Value.READ_ONLY, "read_only"); - - private final Value value; - - private final String string; - - OrganizationTemplateRoleVisibilityEnum(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof OrganizationTemplateRoleVisibilityEnum - && this.string.equals(((OrganizationTemplateRoleVisibilityEnum) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case HIDDEN: - return visitor.visitHidden(); - case WRITE: - return visitor.visitWrite(); - case READ_ONLY: - return visitor.visitReadOnly(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OrganizationTemplateRoleVisibilityEnum valueOf(String value) { - switch (value) { - case "hidden": - return HIDDEN; - case "write": - return WRITE; - case "read_only": - return READ_ONLY; - default: - return new OrganizationTemplateRoleVisibilityEnum(Value.UNKNOWN, value); - } - } - - public enum Value { - WRITE, - - READ_ONLY, - - HIDDEN, - - UNKNOWN - } - - public interface Visitor { - T visitWrite(); - - T visitReadOnly(); - - T visitHidden(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityPolicy.java b/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityPolicy.java deleted file mode 100644 index 959553224..000000000 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateRoleVisibilityPolicy.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.types; - -import com.auth0.client.mgmt.core.ObjectMappers; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = OrganizationTemplateRoleVisibilityPolicy.Builder.class) -public final class OrganizationTemplateRoleVisibilityPolicy { - private final OrganizationTemplateRoleVisibilityEnum defaultValue; - - private final Optional> overrides; - - private final Map additionalProperties; - - private OrganizationTemplateRoleVisibilityPolicy( - OrganizationTemplateRoleVisibilityEnum defaultValue, - Optional> overrides, - Map additionalProperties) { - this.defaultValue = defaultValue; - this.overrides = overrides; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("default_value") - public OrganizationTemplateRoleVisibilityEnum getDefaultValue() { - return defaultValue; - } - - /** - * @return Role-specific visibility overrides. - */ - @JsonProperty("overrides") - public Optional> getOverrides() { - return overrides; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OrganizationTemplateRoleVisibilityPolicy - && equalTo((OrganizationTemplateRoleVisibilityPolicy) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OrganizationTemplateRoleVisibilityPolicy other) { - return defaultValue.equals(other.defaultValue) && overrides.equals(other.overrides); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.defaultValue, this.overrides); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DefaultValueStage builder() { - return new Builder(); - } - - public interface DefaultValueStage { - _FinalStage defaultValue(@NotNull OrganizationTemplateRoleVisibilityEnum defaultValue); - - Builder from(OrganizationTemplateRoleVisibilityPolicy other); - } - - public interface _FinalStage { - OrganizationTemplateRoleVisibilityPolicy build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

    Role-specific visibility overrides.

    - */ - _FinalStage overrides(Optional> overrides); - - _FinalStage overrides(List overrides); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DefaultValueStage, _FinalStage { - private OrganizationTemplateRoleVisibilityEnum defaultValue; - - private Optional> overrides = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(OrganizationTemplateRoleVisibilityPolicy other) { - defaultValue(other.getDefaultValue()); - overrides(other.getOverrides()); - return this; - } - - @java.lang.Override - @JsonSetter("default_value") - public _FinalStage defaultValue(@NotNull OrganizationTemplateRoleVisibilityEnum defaultValue) { - this.defaultValue = Objects.requireNonNull(defaultValue, "defaultValue must not be null"); - return this; - } - - /** - *

    Role-specific visibility overrides.

    - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage overrides(List overrides) { - this.overrides = Optional.ofNullable(overrides); - return this; - } - - /** - *

    Role-specific visibility overrides.

    - */ - @java.lang.Override - @JsonSetter(value = "overrides", nulls = Nulls.SKIP) - public _FinalStage overrides(Optional> overrides) { - this.overrides = overrides; - return this; - } - - @java.lang.Override - public OrganizationTemplateRoleVisibilityPolicy build() { - return new OrganizationTemplateRoleVisibilityPolicy(defaultValue, overrides, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateUseForOrganizationDiscovery.java b/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateUseForOrganizationDiscovery.java deleted file mode 100644 index 62db65e99..000000000 --- a/src/main/java/com/auth0/client/mgmt/types/OrganizationTemplateUseForOrganizationDiscovery.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.auth0.client.mgmt.types; - -import com.auth0.client.mgmt.core.ObjectMappers; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = OrganizationTemplateUseForOrganizationDiscovery.Builder.class) -public final class OrganizationTemplateUseForOrganizationDiscovery { - private final boolean defaultValue; - - private final Optional> allowedValues; - - private final Map additionalProperties; - - private OrganizationTemplateUseForOrganizationDiscovery( - boolean defaultValue, Optional> allowedValues, Map additionalProperties) { - this.defaultValue = defaultValue; - this.allowedValues = allowedValues; - this.additionalProperties = additionalProperties; - } - - /** - * @return The default value for organization discovery. - */ - @JsonProperty("default_value") - public boolean getDefaultValue() { - return defaultValue; - } - - /** - * @return The allowed values for organization discovery. - */ - @JsonProperty("allowed_values") - public Optional> getAllowedValues() { - return allowedValues; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OrganizationTemplateUseForOrganizationDiscovery - && equalTo((OrganizationTemplateUseForOrganizationDiscovery) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OrganizationTemplateUseForOrganizationDiscovery other) { - return defaultValue == other.defaultValue && allowedValues.equals(other.allowedValues); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.defaultValue, this.allowedValues); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DefaultValueStage builder() { - return new Builder(); - } - - public interface DefaultValueStage { - /** - *

    The default value for organization discovery.

    - */ - _FinalStage defaultValue(boolean defaultValue); - - Builder from(OrganizationTemplateUseForOrganizationDiscovery other); - } - - public interface _FinalStage { - OrganizationTemplateUseForOrganizationDiscovery build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

    The allowed values for organization discovery.

    - */ - _FinalStage allowedValues(Optional> allowedValues); - - _FinalStage allowedValues(List allowedValues); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DefaultValueStage, _FinalStage { - private boolean defaultValue; - - private Optional> allowedValues = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(OrganizationTemplateUseForOrganizationDiscovery other) { - defaultValue(other.getDefaultValue()); - allowedValues(other.getAllowedValues()); - return this; - } - - /** - *

    The default value for organization discovery.

    - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("default_value") - public _FinalStage defaultValue(boolean defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - *

    The allowed values for organization discovery.

    - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage allowedValues(List allowedValues) { - this.allowedValues = Optional.ofNullable(allowedValues); - return this; - } - - /** - *

    The allowed values for organization discovery.

    - */ - @java.lang.Override - @JsonSetter(value = "allowed_values", nulls = Nulls.SKIP) - public _FinalStage allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - @java.lang.Override - public OrganizationTemplateUseForOrganizationDiscovery build() { - return new OrganizationTemplateUseForOrganizationDiscovery( - defaultValue, allowedValues, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/auth0/client/mgmt/types/ResourceServer.java b/src/main/java/com/auth0/client/mgmt/types/ResourceServer.java index 44b57fbba..6cb2d1361 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ResourceServer.java +++ b/src/main/java/com/auth0/client/mgmt/types/ResourceServer.java @@ -62,6 +62,8 @@ public final class ResourceServer { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -94,6 +96,7 @@ private ResourceServer( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -119,6 +122,7 @@ private ResourceServer( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -276,6 +280,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -383,6 +395,7 @@ private boolean equalTo(ResourceServer other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -412,6 +425,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -468,6 +482,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -503,6 +519,7 @@ public Builder from(ResourceServer other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -827,6 +844,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -971,6 +1002,7 @@ public ResourceServer build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/ResourceServerSearchResponse.java b/src/main/java/com/auth0/client/mgmt/types/ResourceServerSearchResponse.java index 4af8f188d..f0aabc043 100644 --- a/src/main/java/com/auth0/client/mgmt/types/ResourceServerSearchResponse.java +++ b/src/main/java/com/auth0/client/mgmt/types/ResourceServerSearchResponse.java @@ -60,6 +60,8 @@ public final class ResourceServerSearchResponse { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -91,6 +93,7 @@ private ResourceServerSearchResponse( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -115,6 +118,7 @@ private ResourceServerSearchResponse( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -264,6 +268,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -370,6 +382,7 @@ private boolean equalTo(ResourceServerSearchResponse other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -398,6 +411,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -452,6 +466,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -486,6 +502,7 @@ public Builder from(ResourceServerSearchResponse other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -796,6 +813,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -939,6 +970,7 @@ public ResourceServerSearchResponse build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/Segment.java b/src/main/java/com/auth0/client/mgmt/types/Segment.java new file mode 100644 index 000000000..6f6056da2 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/Segment.java @@ -0,0 +1,296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Segment.Builder.class) +public final class Segment { + private final String id; + + private final String name; + + private final Optional description; + + private final SegmentTypeEnum type; + + private final List rules; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private Segment( + String id, + String name, + Optional description, + SegmentTypeEnum type, + List rules, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.rules = rules; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public SegmentTypeEnum getType() { + return type; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Segment && equalTo((Segment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Segment other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && rules.equals(other.rules) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, this.name, this.description, this.type, this.rules, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(Segment other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + CreatedAtStage type(@NotNull SegmentTypeEnum type); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Segment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage rules(List rules); + + _FinalStage addRules(SegmentRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private SegmentTypeEnum type; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private List rules = new ArrayList<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Segment other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + rules(other.getRules()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public CreatedAtStage type(@NotNull SegmentTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(SegmentRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public Segment build() { + return new Segment(id, name, description, type, rules, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentContainsExpression.java b/src/main/java/com/auth0/client/mgmt/types/SegmentContainsExpression.java new file mode 100644 index 000000000..95cf5c3e2 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentContainsExpression.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentContainsExpression.Builder.class) +public final class SegmentContainsExpression { + private final List contains; + + private final Map additionalProperties; + + private SegmentContainsExpression(List contains, Map additionalProperties) { + this.contains = contains; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("contains") + public List getContains() { + return contains; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentContainsExpression && equalTo((SegmentContainsExpression) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentContainsExpression other) { + return contains.equals(other.contains); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contains); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List contains = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentContainsExpression other) { + contains(other.getContains()); + return this; + } + + @JsonSetter(value = "contains", nulls = Nulls.SKIP) + public Builder contains(List contains) { + this.contains.clear(); + if (contains != null) { + this.contains.addAll(contains); + } + return this; + } + + public Builder addContains(String contains) { + this.contains.add(contains); + return this; + } + + public Builder addAllContains(List contains) { + if (contains != null) { + this.contains.addAll(contains); + } + return this; + } + + public SegmentContainsExpression build() { + return new SegmentContainsExpression(contains, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentEndsWithExpression.java b/src/main/java/com/auth0/client/mgmt/types/SegmentEndsWithExpression.java new file mode 100644 index 000000000..85139fa86 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentEndsWithExpression.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentEndsWithExpression.Builder.class) +public final class SegmentEndsWithExpression { + private final List endsWith; + + private final Map additionalProperties; + + private SegmentEndsWithExpression(List endsWith, Map additionalProperties) { + this.endsWith = endsWith; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ends_with") + public List getEndsWith() { + return endsWith; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentEndsWithExpression && equalTo((SegmentEndsWithExpression) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentEndsWithExpression other) { + return endsWith.equals(other.endsWith); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endsWith); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List endsWith = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentEndsWithExpression other) { + endsWith(other.getEndsWith()); + return this; + } + + @JsonSetter(value = "ends_with", nulls = Nulls.SKIP) + public Builder endsWith(List endsWith) { + this.endsWith.clear(); + if (endsWith != null) { + this.endsWith.addAll(endsWith); + } + return this; + } + + public Builder addEndsWith(String endsWith) { + this.endsWith.add(endsWith); + return this; + } + + public Builder addAllEndsWith(List endsWith) { + if (endsWith != null) { + this.endsWith.addAll(endsWith); + } + return this; + } + + public SegmentEndsWithExpression build() { + return new SegmentEndsWithExpression(endsWith, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentExistsExpression.java b/src/main/java/com/auth0/client/mgmt/types/SegmentExistsExpression.java new file mode 100644 index 000000000..551492edc --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentExistsExpression.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentExistsExpression.Builder.class) +public final class SegmentExistsExpression { + private final boolean exists; + + private final Map additionalProperties; + + private SegmentExistsExpression(boolean exists, Map additionalProperties) { + this.exists = exists; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exists") + public boolean getExists() { + return exists; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentExistsExpression && equalTo((SegmentExistsExpression) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentExistsExpression other) { + return exists == other.exists; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exists); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExistsStage builder() { + return new Builder(); + } + + public interface ExistsStage { + _FinalStage exists(boolean exists); + + Builder from(SegmentExistsExpression other); + } + + public interface _FinalStage { + SegmentExistsExpression build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExistsStage, _FinalStage { + private boolean exists; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SegmentExistsExpression other) { + exists(other.getExists()); + return this; + } + + @java.lang.Override + @JsonSetter("exists") + public _FinalStage exists(boolean exists) { + this.exists = exists; + return this; + } + + @java.lang.Override + public SegmentExistsExpression build() { + return new SegmentExistsExpression(exists, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentMatchConditions.java b/src/main/java/com/auth0/client/mgmt/types/SegmentMatchConditions.java new file mode 100644 index 000000000..efe14b1ba --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentMatchConditions.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentMatchConditions.Builder.class) +public final class SegmentMatchConditions { + private final Optional clientId; + + private final Optional connection; + + private final Optional connectionType; + + private final Optional organizationId; + + private final Optional domain; + + private final Optional deviceType; + + private final Optional browser; + + private final Optional platform; + + private final Optional userAgent; + + private final Optional country; + + private final Optional region; + + private final Map additionalProperties; + + private SegmentMatchConditions( + Optional clientId, + Optional connection, + Optional connectionType, + Optional organizationId, + Optional domain, + Optional deviceType, + Optional browser, + Optional platform, + Optional userAgent, + Optional country, + Optional region, + Map additionalProperties) { + this.clientId = clientId; + this.connection = connection; + this.connectionType = connectionType; + this.organizationId = organizationId; + this.domain = domain; + this.deviceType = deviceType; + this.browser = browser; + this.platform = platform; + this.userAgent = userAgent; + this.country = country; + this.region = region; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + @JsonProperty("connection") + public Optional getConnection() { + return connection; + } + + @JsonProperty("connection_type") + public Optional getConnectionType() { + return connectionType; + } + + @JsonProperty("organization_id") + public Optional getOrganizationId() { + return organizationId; + } + + @JsonProperty("domain") + public Optional getDomain() { + return domain; + } + + @JsonProperty("device_type") + public Optional getDeviceType() { + return deviceType; + } + + @JsonProperty("browser") + public Optional getBrowser() { + return browser; + } + + @JsonProperty("platform") + public Optional getPlatform() { + return platform; + } + + @JsonProperty("user_agent") + public Optional getUserAgent() { + return userAgent; + } + + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + @JsonProperty("region") + public Optional getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentMatchConditions && equalTo((SegmentMatchConditions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentMatchConditions other) { + return clientId.equals(other.clientId) + && connection.equals(other.connection) + && connectionType.equals(other.connectionType) + && organizationId.equals(other.organizationId) + && domain.equals(other.domain) + && deviceType.equals(other.deviceType) + && browser.equals(other.browser) + && platform.equals(other.platform) + && userAgent.equals(other.userAgent) + && country.equals(other.country) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.clientId, + this.connection, + this.connectionType, + this.organizationId, + this.domain, + this.deviceType, + this.browser, + this.platform, + this.userAgent, + this.country, + this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional connection = Optional.empty(); + + private Optional connectionType = Optional.empty(); + + private Optional organizationId = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional deviceType = Optional.empty(); + + private Optional browser = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional userAgent = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentMatchConditions other) { + clientId(other.getClientId()); + connection(other.getConnection()); + connectionType(other.getConnectionType()); + organizationId(other.getOrganizationId()); + domain(other.getDomain()); + deviceType(other.getDeviceType()); + browser(other.getBrowser()); + platform(other.getPlatform()); + userAgent(other.getUserAgent()); + country(other.getCountry()); + region(other.getRegion()); + return this; + } + + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(SegmentMatchExpression clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + @JsonSetter(value = "connection", nulls = Nulls.SKIP) + public Builder connection(Optional connection) { + this.connection = connection; + return this; + } + + public Builder connection(SegmentMatchExpression connection) { + this.connection = Optional.ofNullable(connection); + return this; + } + + @JsonSetter(value = "connection_type", nulls = Nulls.SKIP) + public Builder connectionType(Optional connectionType) { + this.connectionType = connectionType; + return this; + } + + public Builder connectionType(SegmentMatchExpression connectionType) { + this.connectionType = Optional.ofNullable(connectionType); + return this; + } + + @JsonSetter(value = "organization_id", nulls = Nulls.SKIP) + public Builder organizationId(Optional organizationId) { + this.organizationId = organizationId; + return this; + } + + public Builder organizationId(SegmentMatchExpression organizationId) { + this.organizationId = Optional.ofNullable(organizationId); + return this; + } + + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public Builder domain(Optional domain) { + this.domain = domain; + return this; + } + + public Builder domain(SegmentMatchExpression domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @JsonSetter(value = "device_type", nulls = Nulls.SKIP) + public Builder deviceType(Optional deviceType) { + this.deviceType = deviceType; + return this; + } + + public Builder deviceType(SegmentMatchExpression deviceType) { + this.deviceType = Optional.ofNullable(deviceType); + return this; + } + + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional browser) { + this.browser = browser; + return this; + } + + public Builder browser(SegmentMatchExpression browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public Builder platform(Optional platform) { + this.platform = platform; + return this; + } + + public Builder platform(SegmentMatchExpression platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @JsonSetter(value = "user_agent", nulls = Nulls.SKIP) + public Builder userAgent(Optional userAgent) { + this.userAgent = userAgent; + return this; + } + + public Builder userAgent(SegmentMatchExpression userAgent) { + this.userAgent = Optional.ofNullable(userAgent); + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(SegmentMatchExpression country) { + this.country = Optional.ofNullable(country); + return this; + } + + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(SegmentMatchExpression region) { + this.region = Optional.ofNullable(region); + return this; + } + + public SegmentMatchConditions build() { + return new SegmentMatchConditions( + clientId, + connection, + connectionType, + organizationId, + domain, + deviceType, + browser, + platform, + userAgent, + country, + region, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentMatchExpression.java b/src/main/java/com/auth0/client/mgmt/types/SegmentMatchExpression.java new file mode 100644 index 000000000..5cabcd75f --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentMatchExpression.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = SegmentMatchExpression.Deserializer.class) +public final class SegmentMatchExpression { + private final Object value; + + private final int type; + + private SegmentMatchExpression(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((List) this.value); + } else if (this.type == 1) { + return visitor.visit((SegmentContainsExpression) this.value); + } else if (this.type == 2) { + return visitor.visit((SegmentStartsWithExpression) this.value); + } else if (this.type == 3) { + return visitor.visit((SegmentEndsWithExpression) this.value); + } else if (this.type == 4) { + return visitor.visit((SegmentExistsExpression) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentMatchExpression && equalTo((SegmentMatchExpression) other); + } + + private boolean equalTo(SegmentMatchExpression other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static SegmentMatchExpression of(List value) { + return new SegmentMatchExpression(value, 0); + } + + public static SegmentMatchExpression of(SegmentContainsExpression value) { + return new SegmentMatchExpression(value, 1); + } + + public static SegmentMatchExpression of(SegmentStartsWithExpression value) { + return new SegmentMatchExpression(value, 2); + } + + public static SegmentMatchExpression of(SegmentEndsWithExpression value) { + return new SegmentMatchExpression(value, 3); + } + + public static SegmentMatchExpression of(SegmentExistsExpression value) { + return new SegmentMatchExpression(value, 4); + } + + public interface Visitor { + T visit(List value); + + T visit(SegmentContainsExpression value); + + T visit(SegmentStartsWithExpression value); + + T visit(SegmentEndsWithExpression value); + + T visit(SegmentExistsExpression value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(SegmentMatchExpression.class); + } + + @java.lang.Override + public SegmentMatchExpression deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map && ((Map) value).containsKey("contains")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SegmentContainsExpression.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map && ((Map) value).containsKey("starts_with")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SegmentStartsWithExpression.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map && ((Map) value).containsKey("ends_with")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SegmentEndsWithExpression.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map && ((Map) value).containsKey("exists")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SegmentExistsExpression.class)); + } catch (RuntimeException e) { + } + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentNotMatchConditions.java b/src/main/java/com/auth0/client/mgmt/types/SegmentNotMatchConditions.java new file mode 100644 index 000000000..bc69286ac --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentNotMatchConditions.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentNotMatchConditions.Builder.class) +public final class SegmentNotMatchConditions { + private final Optional clientId; + + private final Optional connection; + + private final Optional connectionType; + + private final Optional organizationId; + + private final Optional domain; + + private final Optional deviceType; + + private final Optional browser; + + private final Optional platform; + + private final Optional userAgent; + + private final Optional country; + + private final Optional region; + + private final Map additionalProperties; + + private SegmentNotMatchConditions( + Optional clientId, + Optional connection, + Optional connectionType, + Optional organizationId, + Optional domain, + Optional deviceType, + Optional browser, + Optional platform, + Optional userAgent, + Optional country, + Optional region, + Map additionalProperties) { + this.clientId = clientId; + this.connection = connection; + this.connectionType = connectionType; + this.organizationId = organizationId; + this.domain = domain; + this.deviceType = deviceType; + this.browser = browser; + this.platform = platform; + this.userAgent = userAgent; + this.country = country; + this.region = region; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + @JsonProperty("connection") + public Optional getConnection() { + return connection; + } + + @JsonProperty("connection_type") + public Optional getConnectionType() { + return connectionType; + } + + @JsonProperty("organization_id") + public Optional getOrganizationId() { + return organizationId; + } + + @JsonProperty("domain") + public Optional getDomain() { + return domain; + } + + @JsonProperty("device_type") + public Optional getDeviceType() { + return deviceType; + } + + @JsonProperty("browser") + public Optional getBrowser() { + return browser; + } + + @JsonProperty("platform") + public Optional getPlatform() { + return platform; + } + + @JsonProperty("user_agent") + public Optional getUserAgent() { + return userAgent; + } + + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + @JsonProperty("region") + public Optional getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentNotMatchConditions && equalTo((SegmentNotMatchConditions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentNotMatchConditions other) { + return clientId.equals(other.clientId) + && connection.equals(other.connection) + && connectionType.equals(other.connectionType) + && organizationId.equals(other.organizationId) + && domain.equals(other.domain) + && deviceType.equals(other.deviceType) + && browser.equals(other.browser) + && platform.equals(other.platform) + && userAgent.equals(other.userAgent) + && country.equals(other.country) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.clientId, + this.connection, + this.connectionType, + this.organizationId, + this.domain, + this.deviceType, + this.browser, + this.platform, + this.userAgent, + this.country, + this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional connection = Optional.empty(); + + private Optional connectionType = Optional.empty(); + + private Optional organizationId = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional deviceType = Optional.empty(); + + private Optional browser = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional userAgent = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentNotMatchConditions other) { + clientId(other.getClientId()); + connection(other.getConnection()); + connectionType(other.getConnectionType()); + organizationId(other.getOrganizationId()); + domain(other.getDomain()); + deviceType(other.getDeviceType()); + browser(other.getBrowser()); + platform(other.getPlatform()); + userAgent(other.getUserAgent()); + country(other.getCountry()); + region(other.getRegion()); + return this; + } + + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(SegmentMatchExpression clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + @JsonSetter(value = "connection", nulls = Nulls.SKIP) + public Builder connection(Optional connection) { + this.connection = connection; + return this; + } + + public Builder connection(SegmentMatchExpression connection) { + this.connection = Optional.ofNullable(connection); + return this; + } + + @JsonSetter(value = "connection_type", nulls = Nulls.SKIP) + public Builder connectionType(Optional connectionType) { + this.connectionType = connectionType; + return this; + } + + public Builder connectionType(SegmentMatchExpression connectionType) { + this.connectionType = Optional.ofNullable(connectionType); + return this; + } + + @JsonSetter(value = "organization_id", nulls = Nulls.SKIP) + public Builder organizationId(Optional organizationId) { + this.organizationId = organizationId; + return this; + } + + public Builder organizationId(SegmentMatchExpression organizationId) { + this.organizationId = Optional.ofNullable(organizationId); + return this; + } + + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public Builder domain(Optional domain) { + this.domain = domain; + return this; + } + + public Builder domain(SegmentMatchExpression domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @JsonSetter(value = "device_type", nulls = Nulls.SKIP) + public Builder deviceType(Optional deviceType) { + this.deviceType = deviceType; + return this; + } + + public Builder deviceType(SegmentMatchExpression deviceType) { + this.deviceType = Optional.ofNullable(deviceType); + return this; + } + + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional browser) { + this.browser = browser; + return this; + } + + public Builder browser(SegmentMatchExpression browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public Builder platform(Optional platform) { + this.platform = platform; + return this; + } + + public Builder platform(SegmentMatchExpression platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @JsonSetter(value = "user_agent", nulls = Nulls.SKIP) + public Builder userAgent(Optional userAgent) { + this.userAgent = userAgent; + return this; + } + + public Builder userAgent(SegmentMatchExpression userAgent) { + this.userAgent = Optional.ofNullable(userAgent); + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(SegmentMatchExpression country) { + this.country = Optional.ofNullable(country); + return this; + } + + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(SegmentMatchExpression region) { + this.region = Optional.ofNullable(region); + return this; + } + + public SegmentNotMatchConditions build() { + return new SegmentNotMatchConditions( + clientId, + connection, + connectionType, + organizationId, + domain, + deviceType, + browser, + platform, + userAgent, + country, + region, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentRule.java b/src/main/java/com/auth0/client/mgmt/types/SegmentRule.java new file mode 100644 index 000000000..0e6f81780 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentRule.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentRule.Builder.class) +public final class SegmentRule { + private final Optional match; + + private final Optional notMatch; + + private final Map additionalProperties; + + private SegmentRule( + Optional match, + Optional notMatch, + Map additionalProperties) { + this.match = match; + this.notMatch = notMatch; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("match") + public Optional getMatch() { + return match; + } + + @JsonProperty("not_match") + public Optional getNotMatch() { + return notMatch; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentRule && equalTo((SegmentRule) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentRule other) { + return match.equals(other.match) && notMatch.equals(other.notMatch); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.match, this.notMatch); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional match = Optional.empty(); + + private Optional notMatch = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentRule other) { + match(other.getMatch()); + notMatch(other.getNotMatch()); + return this; + } + + @JsonSetter(value = "match", nulls = Nulls.SKIP) + public Builder match(Optional match) { + this.match = match; + return this; + } + + public Builder match(SegmentMatchConditions match) { + this.match = Optional.ofNullable(match); + return this; + } + + @JsonSetter(value = "not_match", nulls = Nulls.SKIP) + public Builder notMatch(Optional notMatch) { + this.notMatch = notMatch; + return this; + } + + public Builder notMatch(SegmentNotMatchConditions notMatch) { + this.notMatch = Optional.ofNullable(notMatch); + return this; + } + + public SegmentRule build() { + return new SegmentRule(match, notMatch, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentStartsWithExpression.java b/src/main/java/com/auth0/client/mgmt/types/SegmentStartsWithExpression.java new file mode 100644 index 000000000..290c6db1d --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentStartsWithExpression.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SegmentStartsWithExpression.Builder.class) +public final class SegmentStartsWithExpression { + private final List startsWith; + + private final Map additionalProperties; + + private SegmentStartsWithExpression(List startsWith, Map additionalProperties) { + this.startsWith = startsWith; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("starts_with") + public List getStartsWith() { + return startsWith; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SegmentStartsWithExpression && equalTo((SegmentStartsWithExpression) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SegmentStartsWithExpression other) { + return startsWith.equals(other.startsWith); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.startsWith); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List startsWith = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SegmentStartsWithExpression other) { + startsWith(other.getStartsWith()); + return this; + } + + @JsonSetter(value = "starts_with", nulls = Nulls.SKIP) + public Builder startsWith(List startsWith) { + this.startsWith.clear(); + if (startsWith != null) { + this.startsWith.addAll(startsWith); + } + return this; + } + + public Builder addStartsWith(String startsWith) { + this.startsWith.add(startsWith); + return this; + } + + public Builder addAllStartsWith(List startsWith) { + if (startsWith != null) { + this.startsWith.addAll(startsWith); + } + return this; + } + + public SegmentStartsWithExpression build() { + return new SegmentStartsWithExpression(startsWith, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentTypeEnum.java b/src/main/java/com/auth0/client/mgmt/types/SegmentTypeEnum.java new file mode 100644 index 000000000..13c658eda --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentTypeEnum.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SegmentTypeEnum { + public static final SegmentTypeEnum SELF = new SegmentTypeEnum(Value.SELF, "self"); + + public static final SegmentTypeEnum AUTH0 = new SegmentTypeEnum(Value.AUTH0, "auth0"); + + private final Value value; + + private final String string; + + SegmentTypeEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SegmentTypeEnum && this.string.equals(((SegmentTypeEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case AUTH0: + return visitor.visitAuth0(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SegmentTypeEnum valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "auth0": + return AUTH0; + default: + return new SegmentTypeEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + AUTH0, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitAuth0(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/SegmentTypeFilterEnum.java b/src/main/java/com/auth0/client/mgmt/types/SegmentTypeFilterEnum.java new file mode 100644 index 000000000..6bf20a5cb --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/SegmentTypeFilterEnum.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SegmentTypeFilterEnum { + public static final SegmentTypeFilterEnum SELF = new SegmentTypeFilterEnum(Value.SELF, "self"); + + public static final SegmentTypeFilterEnum AUTH0 = new SegmentTypeFilterEnum(Value.AUTH0, "auth0"); + + private final Value value; + + private final String string; + + SegmentTypeFilterEnum(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SegmentTypeFilterEnum + && this.string.equals(((SegmentTypeFilterEnum) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case AUTH0: + return visitor.visitAuth0(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SegmentTypeFilterEnum valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "auth0": + return AUTH0; + default: + return new SegmentTypeFilterEnum(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTH0, + + SELF, + + UNKNOWN + } + + public interface Visitor { + T visitAuth0(); + + T visitSelf(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateConnectionOptions.java b/src/main/java/com/auth0/client/mgmt/types/UpdateConnectionOptions.java index f62463bba..0a0f28f75 100644 --- a/src/main/java/com/auth0/client/mgmt/types/UpdateConnectionOptions.java +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateConnectionOptions.java @@ -109,6 +109,10 @@ public final class UpdateConnectionOptions { private final OptionalNullable oidcMetadata; + private final Optional> thumbprints; + + private final Optional> thumbprintsSha384; + private final Map additionalProperties; private UpdateConnectionOptions( @@ -154,6 +158,8 @@ private UpdateConnectionOptions( Optional useOauthSpecScope, OptionalNullable discoveryUrl, OptionalNullable oidcMetadata, + Optional> thumbprints, + Optional> thumbprintsSha384, Map additionalProperties) { this.validation = validation; this.nonPersistentAttrs = nonPersistentAttrs; @@ -197,6 +203,8 @@ private UpdateConnectionOptions( this.useOauthSpecScope = useOauthSpecScope; this.discoveryUrl = discoveryUrl; this.oidcMetadata = oidcMetadata; + this.thumbprints = thumbprints; + this.thumbprintsSha384 = thumbprintsSha384; this.additionalProperties = additionalProperties; } @@ -496,6 +504,16 @@ public OptionalNullable getOidcMetadata() { return oidcMetadata; } + @JsonProperty("thumbprints") + public Optional> getThumbprints() { + return thumbprints; + } + + @JsonProperty("thumbprints_sha384") + public Optional> getThumbprintsSha384() { + return thumbprintsSha384; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("validation") private OptionalNullable _getValidation() { @@ -652,7 +670,9 @@ private boolean equalTo(UpdateConnectionOptions other) { && idTokenSessionExpirySupported.equals(other.idTokenSessionExpirySupported) && useOauthSpecScope.equals(other.useOauthSpecScope) && discoveryUrl.equals(other.discoveryUrl) - && oidcMetadata.equals(other.oidcMetadata); + && oidcMetadata.equals(other.oidcMetadata) + && thumbprints.equals(other.thumbprints) + && thumbprintsSha384.equals(other.thumbprintsSha384); } @java.lang.Override @@ -699,7 +719,9 @@ public int hashCode() { this.idTokenSessionExpirySupported, this.useOauthSpecScope, this.discoveryUrl, - this.oidcMetadata); + this.oidcMetadata, + this.thumbprints, + this.thumbprintsSha384); } @java.lang.Override @@ -803,6 +825,10 @@ public static final class Builder { private OptionalNullable oidcMetadata = OptionalNullable.absent(); + private Optional> thumbprints = Optional.empty(); + + private Optional> thumbprintsSha384 = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -851,6 +877,8 @@ public Builder from(UpdateConnectionOptions other) { useOauthSpecScope(other.getUseOauthSpecScope()); discoveryUrl(other.getDiscoveryUrl()); oidcMetadata(other.getOidcMetadata()); + thumbprints(other.getThumbprints()); + thumbprintsSha384(other.getThumbprintsSha384()); return this; } @@ -1713,6 +1741,28 @@ public Builder oidcMetadata(com.auth0.client.mgmt.core.Nullable> thumbprints) { + this.thumbprints = thumbprints; + return this; + } + + public Builder thumbprints(List thumbprints) { + this.thumbprints = Optional.ofNullable(thumbprints); + return this; + } + + @JsonSetter(value = "thumbprints_sha384", nulls = Nulls.SKIP) + public Builder thumbprintsSha384(Optional> thumbprintsSha384) { + this.thumbprintsSha384 = thumbprintsSha384; + return this; + } + + public Builder thumbprintsSha384(List thumbprintsSha384) { + this.thumbprintsSha384 = Optional.ofNullable(thumbprintsSha384); + return this; + } + public UpdateConnectionOptions build() { return new UpdateConnectionOptions( validation, @@ -1757,6 +1807,8 @@ public UpdateConnectionOptions build() { useOauthSpecScope, discoveryUrl, oidcMetadata, + thumbprints, + thumbprintsSha384, additionalProperties); } diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentResponseContent.java new file mode 100644 index 000000000..8ab3c66b5 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentResponseContent.java @@ -0,0 +1,819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperimentResponseContent.Builder.class) +public final class UpdateExperimentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final Optional featureFlagName; + + private final String authenticationFlow; + + private final AllocationStrategyEnum allocationStrategy; + + private final ExperimentStatusEnum status; + + private final boolean isValid; + + private final Optional defaultConfig; + + private final OptionalNullable> featureFlagSnapshot; + + private final List allocations; + + private final List editableFields; + + private final Optional> levels; + + private final OptionalNullable currentLevel; + + private final Optional startedAt; + + private final Optional endedAt; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateExperimentResponseContent( + String id, + String name, + Optional description, + String featureFlagId, + Optional featureFlagName, + String authenticationFlow, + AllocationStrategyEnum allocationStrategy, + ExperimentStatusEnum status, + boolean isValid, + Optional defaultConfig, + OptionalNullable> featureFlagSnapshot, + List allocations, + List editableFields, + Optional> levels, + OptionalNullable currentLevel, + Optional startedAt, + Optional endedAt, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.featureFlagName = featureFlagName; + this.authenticationFlow = authenticationFlow; + this.allocationStrategy = allocationStrategy; + this.status = status; + this.isValid = isValid; + this.defaultConfig = defaultConfig; + this.featureFlagSnapshot = featureFlagSnapshot; + this.allocations = allocations; + this.editableFields = editableFields; + this.levels = levels; + this.currentLevel = currentLevel; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("feature_flag_name") + public Optional getFeatureFlagName() { + return featureFlagName; + } + + @JsonProperty("authentication_flow") + public String getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonProperty("allocation_strategy") + public AllocationStrategyEnum getAllocationStrategy() { + return allocationStrategy; + } + + @JsonProperty("status") + public ExperimentStatusEnum getStatus() { + return status; + } + + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + public OptionalNullable> getFeatureFlagSnapshot() { + if (featureFlagSnapshot == null) { + return OptionalNullable.absent(); + } + return featureFlagSnapshot; + } + + @JsonProperty("allocations") + public List getAllocations() { + return allocations; + } + + /** + * @return Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic. + */ + @JsonProperty("editable_fields") + public List getEditableFields() { + return editableFields; + } + + /** + * @return Ramp experiment levels configuration. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + /** + * @return Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + public OptionalNullable getCurrentLevel() { + if (currentLevel == null) { + return OptionalNullable.absent(); + } + return currentLevel; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + private OptionalNullable> _getFeatureFlagSnapshot() { + return featureFlagSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + private OptionalNullable _getCurrentLevel() { + return currentLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperimentResponseContent && equalTo((UpdateExperimentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperimentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && featureFlagName.equals(other.featureFlagName) + && authenticationFlow.equals(other.authenticationFlow) + && allocationStrategy.equals(other.allocationStrategy) + && status.equals(other.status) + && isValid == other.isValid + && defaultConfig.equals(other.defaultConfig) + && featureFlagSnapshot.equals(other.featureFlagSnapshot) + && allocations.equals(other.allocations) + && editableFields.equals(other.editableFields) + && levels.equals(other.levels) + && currentLevel.equals(other.currentLevel) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.featureFlagId, + this.featureFlagName, + this.authenticationFlow, + this.allocationStrategy, + this.status, + this.isValid, + this.defaultConfig, + this.featureFlagSnapshot, + this.allocations, + this.editableFields, + this.levels, + this.currentLevel, + this.startedAt, + this.endedAt, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(UpdateExperimentResponseContent other); + } + + public interface NameStage { + FeatureFlagIdStage name(@NotNull String name); + } + + public interface FeatureFlagIdStage { + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow); + } + + public interface AllocationStrategyStage { + StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy); + } + + public interface StatusStage { + IsValidStage status(@NotNull ExperimentStatusEnum status); + } + + public interface IsValidStage { + CreatedAtStage isValid(boolean isValid); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateExperimentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage featureFlagName(Optional featureFlagName); + + _FinalStage featureFlagName(String featureFlagName); + + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Map featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot); + + _FinalStage allocations(List allocations); + + _FinalStage addAllocations(AllocationItem allocations); + + _FinalStage addAllAllocations(List allocations); + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + _FinalStage editableFields(List editableFields); + + _FinalStage addEditableFields(String editableFields); + + _FinalStage addAllEditableFields(List editableFields); + + /** + *

    Ramp experiment levels configuration.

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + _FinalStage currentLevel(@Nullable OptionalNullable currentLevel); + + _FinalStage currentLevel(Integer currentLevel); + + _FinalStage currentLevel(Optional currentLevel); + + _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + NameStage, + FeatureFlagIdStage, + AuthenticationFlowStage, + AllocationStrategyStage, + StatusStage, + IsValidStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String id; + + private String name; + + private String featureFlagId; + + private String authenticationFlow; + + private AllocationStrategyEnum allocationStrategy; + + private ExperimentStatusEnum status; + + private boolean isValid; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private OptionalNullable currentLevel = OptionalNullable.absent(); + + private Optional> levels = Optional.empty(); + + private List editableFields = new ArrayList<>(); + + private List allocations = new ArrayList<>(); + + private OptionalNullable> featureFlagSnapshot = OptionalNullable.absent(); + + private Optional defaultConfig = Optional.empty(); + + private Optional featureFlagName = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateExperimentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + featureFlagName(other.getFeatureFlagName()); + authenticationFlow(other.getAuthenticationFlow()); + allocationStrategy(other.getAllocationStrategy()); + status(other.getStatus()); + isValid(other.getIsValid()); + defaultConfig(other.getDefaultConfig()); + featureFlagSnapshot(other.getFeatureFlagSnapshot()); + allocations(other.getAllocations()); + editableFields(other.getEditableFields()); + levels(other.getLevels()); + currentLevel(other.getCurrentLevel()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("allocation_strategy") + public StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Objects.requireNonNull(allocationStrategy, "allocationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public IsValidStage status(@NotNull ExperimentStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_valid") + public CreatedAtStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel) { + if (currentLevel.isNull()) { + this.currentLevel = OptionalNullable.ofNull(); + } else if (currentLevel.isEmpty()) { + this.currentLevel = OptionalNullable.absent(); + } else { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Optional currentLevel) { + if (currentLevel.isPresent()) { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } else { + this.currentLevel = OptionalNullable.absent(); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Integer currentLevel) { + this.currentLevel = OptionalNullable.of(currentLevel); + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + @java.lang.Override + @JsonSetter(value = "current_level", nulls = Nulls.SKIP) + public _FinalStage currentLevel(@Nullable OptionalNullable currentLevel) { + this.currentLevel = currentLevel; + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEditableFields(List editableFields) { + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEditableFields(String editableFields) { + this.editableFields.add(editableFields); + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + @java.lang.Override + @JsonSetter(value = "editable_fields", nulls = Nulls.SKIP) + public _FinalStage editableFields(List editableFields) { + this.editableFields.clear(); + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAllocations(List allocations) { + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllocations(AllocationItem allocations) { + this.allocations.add(allocations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(List allocations) { + this.allocations.clear(); + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot( + com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot) { + if (featureFlagSnapshot.isNull()) { + this.featureFlagSnapshot = OptionalNullable.ofNull(); + } else if (featureFlagSnapshot.isEmpty()) { + this.featureFlagSnapshot = OptionalNullable.absent(); + } else { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot) { + if (featureFlagSnapshot.isPresent()) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } else { + this.featureFlagSnapshot = OptionalNullable.absent(); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Map featureFlagSnapshot) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_snapshot", nulls = Nulls.SKIP) + public _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot) { + this.featureFlagSnapshot = featureFlagSnapshot; + return this; + } + + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + @java.lang.Override + public _FinalStage featureFlagName(String featureFlagName) { + this.featureFlagName = Optional.ofNullable(featureFlagName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_name", nulls = Nulls.SKIP) + public _FinalStage featureFlagName(Optional featureFlagName) { + this.featureFlagName = featureFlagName; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateExperimentResponseContent build() { + return new UpdateExperimentResponseContent( + id, + name, + description, + featureFlagId, + featureFlagName, + authenticationFlow, + allocationStrategy, + status, + isValid, + defaultConfig, + featureFlagSnapshot, + allocations, + editableFields, + levels, + currentLevel, + startedAt, + endedAt, + createdAt, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentStatusResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentStatusResponseContent.java new file mode 100644 index 000000000..d23efd806 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateExperimentStatusResponseContent.java @@ -0,0 +1,820 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.NullableNonemptyFilter; +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.OptionalNullable; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperimentStatusResponseContent.Builder.class) +public final class UpdateExperimentStatusResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final String featureFlagId; + + private final Optional featureFlagName; + + private final String authenticationFlow; + + private final AllocationStrategyEnum allocationStrategy; + + private final ExperimentStatusEnum status; + + private final boolean isValid; + + private final Optional defaultConfig; + + private final OptionalNullable> featureFlagSnapshot; + + private final List allocations; + + private final List editableFields; + + private final Optional> levels; + + private final OptionalNullable currentLevel; + + private final Optional startedAt; + + private final Optional endedAt; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateExperimentStatusResponseContent( + String id, + String name, + Optional description, + String featureFlagId, + Optional featureFlagName, + String authenticationFlow, + AllocationStrategyEnum allocationStrategy, + ExperimentStatusEnum status, + boolean isValid, + Optional defaultConfig, + OptionalNullable> featureFlagSnapshot, + List allocations, + List editableFields, + Optional> levels, + OptionalNullable currentLevel, + Optional startedAt, + Optional endedAt, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.featureFlagId = featureFlagId; + this.featureFlagName = featureFlagName; + this.authenticationFlow = authenticationFlow; + this.allocationStrategy = allocationStrategy; + this.status = status; + this.isValid = isValid; + this.defaultConfig = defaultConfig; + this.featureFlagSnapshot = featureFlagSnapshot; + this.allocations = allocations; + this.editableFields = editableFields; + this.levels = levels; + this.currentLevel = currentLevel; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("feature_flag_name") + public Optional getFeatureFlagName() { + return featureFlagName; + } + + @JsonProperty("authentication_flow") + public String getAuthenticationFlow() { + return authenticationFlow; + } + + @JsonProperty("allocation_strategy") + public AllocationStrategyEnum getAllocationStrategy() { + return allocationStrategy; + } + + @JsonProperty("status") + public ExperimentStatusEnum getStatus() { + return status; + } + + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + @JsonProperty("default_config") + public Optional getDefaultConfig() { + return defaultConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + public OptionalNullable> getFeatureFlagSnapshot() { + if (featureFlagSnapshot == null) { + return OptionalNullable.absent(); + } + return featureFlagSnapshot; + } + + @JsonProperty("allocations") + public List getAllocations() { + return allocations; + } + + /** + * @return Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic. + */ + @JsonProperty("editable_fields") + public List getEditableFields() { + return editableFields; + } + + /** + * @return Ramp experiment levels configuration. + */ + @JsonProperty("levels") + public Optional> getLevels() { + return levels; + } + + /** + * @return Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active. + */ + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + public OptionalNullable getCurrentLevel() { + if (currentLevel == null) { + return OptionalNullable.absent(); + } + return currentLevel; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("feature_flag_snapshot") + private OptionalNullable> _getFeatureFlagSnapshot() { + return featureFlagSnapshot; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_level") + private OptionalNullable _getCurrentLevel() { + return currentLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperimentStatusResponseContent + && equalTo((UpdateExperimentStatusResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperimentStatusResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && featureFlagId.equals(other.featureFlagId) + && featureFlagName.equals(other.featureFlagName) + && authenticationFlow.equals(other.authenticationFlow) + && allocationStrategy.equals(other.allocationStrategy) + && status.equals(other.status) + && isValid == other.isValid + && defaultConfig.equals(other.defaultConfig) + && featureFlagSnapshot.equals(other.featureFlagSnapshot) + && allocations.equals(other.allocations) + && editableFields.equals(other.editableFields) + && levels.equals(other.levels) + && currentLevel.equals(other.currentLevel) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.featureFlagId, + this.featureFlagName, + this.authenticationFlow, + this.allocationStrategy, + this.status, + this.isValid, + this.defaultConfig, + this.featureFlagSnapshot, + this.allocations, + this.editableFields, + this.levels, + this.currentLevel, + this.startedAt, + this.endedAt, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(UpdateExperimentStatusResponseContent other); + } + + public interface NameStage { + FeatureFlagIdStage name(@NotNull String name); + } + + public interface FeatureFlagIdStage { + AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId); + } + + public interface AuthenticationFlowStage { + AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow); + } + + public interface AllocationStrategyStage { + StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy); + } + + public interface StatusStage { + IsValidStage status(@NotNull ExperimentStatusEnum status); + } + + public interface IsValidStage { + CreatedAtStage isValid(boolean isValid); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateExperimentStatusResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage featureFlagName(Optional featureFlagName); + + _FinalStage featureFlagName(String featureFlagName); + + _FinalStage defaultConfig(Optional defaultConfig); + + _FinalStage defaultConfig(DefaultConfigEnum defaultConfig); + + _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Map featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot); + + _FinalStage featureFlagSnapshot(com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot); + + _FinalStage allocations(List allocations); + + _FinalStage addAllocations(AllocationItem allocations); + + _FinalStage addAllAllocations(List allocations); + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + _FinalStage editableFields(List editableFields); + + _FinalStage addEditableFields(String editableFields); + + _FinalStage addAllEditableFields(List editableFields); + + /** + *

    Ramp experiment levels configuration.

    + */ + _FinalStage levels(Optional> levels); + + _FinalStage levels(List levels); + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + _FinalStage currentLevel(@Nullable OptionalNullable currentLevel); + + _FinalStage currentLevel(Integer currentLevel); + + _FinalStage currentLevel(Optional currentLevel); + + _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + NameStage, + FeatureFlagIdStage, + AuthenticationFlowStage, + AllocationStrategyStage, + StatusStage, + IsValidStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String id; + + private String name; + + private String featureFlagId; + + private String authenticationFlow; + + private AllocationStrategyEnum allocationStrategy; + + private ExperimentStatusEnum status; + + private boolean isValid; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private OptionalNullable currentLevel = OptionalNullable.absent(); + + private Optional> levels = Optional.empty(); + + private List editableFields = new ArrayList<>(); + + private List allocations = new ArrayList<>(); + + private OptionalNullable> featureFlagSnapshot = OptionalNullable.absent(); + + private Optional defaultConfig = Optional.empty(); + + private Optional featureFlagName = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateExperimentStatusResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + featureFlagId(other.getFeatureFlagId()); + featureFlagName(other.getFeatureFlagName()); + authenticationFlow(other.getAuthenticationFlow()); + allocationStrategy(other.getAllocationStrategy()); + status(other.getStatus()); + isValid(other.getIsValid()); + defaultConfig(other.getDefaultConfig()); + featureFlagSnapshot(other.getFeatureFlagSnapshot()); + allocations(other.getAllocations()); + editableFields(other.getEditableFields()); + levels(other.getLevels()); + currentLevel(other.getCurrentLevel()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public FeatureFlagIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public AuthenticationFlowStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("authentication_flow") + public AllocationStrategyStage authenticationFlow(@NotNull String authenticationFlow) { + this.authenticationFlow = Objects.requireNonNull(authenticationFlow, "authenticationFlow must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("allocation_strategy") + public StatusStage allocationStrategy(@NotNull AllocationStrategyEnum allocationStrategy) { + this.allocationStrategy = Objects.requireNonNull(allocationStrategy, "allocationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public IsValidStage status(@NotNull ExperimentStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_valid") + public CreatedAtStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(com.auth0.client.mgmt.core.Nullable currentLevel) { + if (currentLevel.isNull()) { + this.currentLevel = OptionalNullable.ofNull(); + } else if (currentLevel.isEmpty()) { + this.currentLevel = OptionalNullable.absent(); + } else { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Optional currentLevel) { + if (currentLevel.isPresent()) { + this.currentLevel = OptionalNullable.of(currentLevel.get()); + } else { + this.currentLevel = OptionalNullable.absent(); + } + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentLevel(Integer currentLevel) { + this.currentLevel = OptionalNullable.of(currentLevel); + return this; + } + + /** + *

    Read-only. The active exposure percentage for the current ramp step. Null when no ramp schedule is active.

    + */ + @java.lang.Override + @JsonSetter(value = "current_level", nulls = Nulls.SKIP) + public _FinalStage currentLevel(@Nullable OptionalNullable currentLevel) { + this.currentLevel = currentLevel; + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage levels(List levels) { + this.levels = Optional.ofNullable(levels); + return this; + } + + /** + *

    Ramp experiment levels configuration.

    + */ + @java.lang.Override + @JsonSetter(value = "levels", nulls = Nulls.SKIP) + public _FinalStage levels(Optional> levels) { + this.levels = levels; + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEditableFields(List editableFields) { + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEditableFields(String editableFields) { + this.editableFields.add(editableFields); + return this; + } + + /** + *

    Fields that may be mutated given the experiment's current status. Computed at response time; always current with the API's enforcement logic.

    + */ + @java.lang.Override + @JsonSetter(value = "editable_fields", nulls = Nulls.SKIP) + public _FinalStage editableFields(List editableFields) { + this.editableFields.clear(); + if (editableFields != null) { + this.editableFields.addAll(editableFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAllocations(List allocations) { + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllocations(AllocationItem allocations) { + this.allocations.add(allocations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allocations", nulls = Nulls.SKIP) + public _FinalStage allocations(List allocations) { + this.allocations.clear(); + if (allocations != null) { + this.allocations.addAll(allocations); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot( + com.auth0.client.mgmt.core.Nullable> featureFlagSnapshot) { + if (featureFlagSnapshot.isNull()) { + this.featureFlagSnapshot = OptionalNullable.ofNull(); + } else if (featureFlagSnapshot.isEmpty()) { + this.featureFlagSnapshot = OptionalNullable.absent(); + } else { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Optional> featureFlagSnapshot) { + if (featureFlagSnapshot.isPresent()) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot.get()); + } else { + this.featureFlagSnapshot = OptionalNullable.absent(); + } + return this; + } + + @java.lang.Override + public _FinalStage featureFlagSnapshot(Map featureFlagSnapshot) { + this.featureFlagSnapshot = OptionalNullable.of(featureFlagSnapshot); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_snapshot", nulls = Nulls.SKIP) + public _FinalStage featureFlagSnapshot(@Nullable OptionalNullable> featureFlagSnapshot) { + this.featureFlagSnapshot = featureFlagSnapshot; + return this; + } + + @java.lang.Override + public _FinalStage defaultConfig(DefaultConfigEnum defaultConfig) { + this.defaultConfig = Optional.ofNullable(defaultConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_config", nulls = Nulls.SKIP) + public _FinalStage defaultConfig(Optional defaultConfig) { + this.defaultConfig = defaultConfig; + return this; + } + + @java.lang.Override + public _FinalStage featureFlagName(String featureFlagName) { + this.featureFlagName = Optional.ofNullable(featureFlagName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_flag_name", nulls = Nulls.SKIP) + public _FinalStage featureFlagName(Optional featureFlagName) { + this.featureFlagName = featureFlagName; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateExperimentStatusResponseContent build() { + return new UpdateExperimentStatusResponseContent( + id, + name, + description, + featureFlagId, + featureFlagName, + authenticationFlow, + allocationStrategy, + status, + isValid, + defaultConfig, + featureFlagSnapshot, + allocations, + editableFields, + levels, + currentLevel, + startedAt, + endedAt, + createdAt, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagResponseContent.java new file mode 100644 index 000000000..b1cf9f7d1 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagResponseContent.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateFeatureFlagResponseContent.Builder.class) +public final class UpdateFeatureFlagResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final FeatureFlagTypeEnum type; + + private final FeatureFlagStatusEnum status; + + private final Optional> parameters; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateFeatureFlagResponseContent( + String id, + String name, + Optional description, + FeatureFlagTypeEnum type, + FeatureFlagStatusEnum status, + Optional> parameters, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.status = status; + this.parameters = parameters; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public FeatureFlagTypeEnum getType() { + return type; + } + + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateFeatureFlagResponseContent && equalTo((UpdateFeatureFlagResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateFeatureFlagResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && status.equals(other.status) + && parameters.equals(other.parameters) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.type, + this.status, + this.parameters, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(UpdateFeatureFlagResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + StatusStage type(@NotNull FeatureFlagTypeEnum type); + } + + public interface StatusStage { + CreatedAtStage status(@NotNull FeatureFlagStatusEnum status); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateFeatureFlagResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional> parameters); + + _FinalStage parameters(Map parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, StatusStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private FeatureFlagTypeEnum type; + + private FeatureFlagStatusEnum status; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateFeatureFlagResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + status(other.getStatus()); + parameters(other.getParameters()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public StatusStage type(@NotNull FeatureFlagTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public CreatedAtStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateFeatureFlagResponseContent build() { + return new UpdateFeatureFlagResponseContent( + id, name, description, type, status, parameters, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagStatusResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagStatusResponseContent.java new file mode 100644 index 000000000..fe2624e4d --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateFeatureFlagStatusResponseContent.java @@ -0,0 +1,314 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateFeatureFlagStatusResponseContent.Builder.class) +public final class UpdateFeatureFlagStatusResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final FeatureFlagTypeEnum type; + + private final FeatureFlagStatusEnum status; + + private final Optional> parameters; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateFeatureFlagStatusResponseContent( + String id, + String name, + Optional description, + FeatureFlagTypeEnum type, + FeatureFlagStatusEnum status, + Optional> parameters, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.status = status; + this.parameters = parameters; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public FeatureFlagTypeEnum getType() { + return type; + } + + @JsonProperty("status") + public FeatureFlagStatusEnum getStatus() { + return status; + } + + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateFeatureFlagStatusResponseContent + && equalTo((UpdateFeatureFlagStatusResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateFeatureFlagStatusResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && status.equals(other.status) + && parameters.equals(other.parameters) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.description, + this.type, + this.status, + this.parameters, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(UpdateFeatureFlagStatusResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + StatusStage type(@NotNull FeatureFlagTypeEnum type); + } + + public interface StatusStage { + CreatedAtStage status(@NotNull FeatureFlagStatusEnum status); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateFeatureFlagStatusResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional> parameters); + + _FinalStage parameters(Map parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, StatusStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private FeatureFlagTypeEnum type; + + private FeatureFlagStatusEnum status; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateFeatureFlagStatusResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + status(other.getStatus()); + parameters(other.getParameters()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public StatusStage type(@NotNull FeatureFlagTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public CreatedAtStage status(@NotNull FeatureFlagStatusEnum status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateFeatureFlagStatusResponseContent build() { + return new UpdateFeatureFlagStatusResponseContent( + id, name, description, type, status, parameters, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerRequestContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerRequestContent.java index 4c4c41859..f546361d2 100644 --- a/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerRequestContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerRequestContent.java @@ -54,6 +54,8 @@ public final class UpdateResourceServerRequestContent { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -80,6 +82,7 @@ private UpdateResourceServerRequestContent( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -100,6 +103,7 @@ private UpdateResourceServerRequestContent( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -228,6 +232,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -330,6 +342,7 @@ private boolean equalTo(UpdateResourceServerRequestContent other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -354,6 +367,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -401,6 +415,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -430,6 +446,7 @@ public Builder from(UpdateResourceServerRequestContent other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -721,6 +738,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -847,6 +878,7 @@ public UpdateResourceServerRequestContent build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerResponseContent.java index f4dd376f5..47f5444ed 100644 --- a/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerResponseContent.java +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateResourceServerResponseContent.java @@ -62,6 +62,8 @@ public final class UpdateResourceServerResponseContent { private final OptionalNullable consentPolicy; + private final Optional requireConsentNonRepudiation; + private final OptionalNullable> authorizationDetails; private final OptionalNullable proofOfPossession; @@ -94,6 +96,7 @@ private UpdateResourceServerResponseContent( OptionalNullable accessToken, OptionalNullable tokenEncryption, OptionalNullable consentPolicy, + Optional requireConsentNonRepudiation, OptionalNullable> authorizationDetails, OptionalNullable proofOfPossession, Optional subjectTypeAuthorization, @@ -119,6 +122,7 @@ private UpdateResourceServerResponseContent( this.accessToken = accessToken; this.tokenEncryption = tokenEncryption; this.consentPolicy = consentPolicy; + this.requireConsentNonRepudiation = requireConsentNonRepudiation; this.authorizationDetails = authorizationDetails; this.proofOfPossession = proofOfPossession; this.subjectTypeAuthorization = subjectTypeAuthorization; @@ -276,6 +280,14 @@ public OptionalNullable getConsentPolicy() { return consentPolicy; } + /** + * @return When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled. + */ + @JsonProperty("require_consent_non_repudiation") + public Optional getRequireConsentNonRepudiation() { + return requireConsentNonRepudiation; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("authorization_details") public OptionalNullable> getAuthorizationDetails() { @@ -384,6 +396,7 @@ private boolean equalTo(UpdateResourceServerResponseContent other) { && accessToken.equals(other.accessToken) && tokenEncryption.equals(other.tokenEncryption) && consentPolicy.equals(other.consentPolicy) + && requireConsentNonRepudiation.equals(other.requireConsentNonRepudiation) && authorizationDetails.equals(other.authorizationDetails) && proofOfPossession.equals(other.proofOfPossession) && subjectTypeAuthorization.equals(other.subjectTypeAuthorization) @@ -413,6 +426,7 @@ public int hashCode() { this.accessToken, this.tokenEncryption, this.consentPolicy, + this.requireConsentNonRepudiation, this.authorizationDetails, this.proofOfPossession, this.subjectTypeAuthorization, @@ -469,6 +483,8 @@ public static final class Builder { private OptionalNullable consentPolicy = OptionalNullable.absent(); + private Optional requireConsentNonRepudiation = Optional.empty(); + private OptionalNullable> authorizationDetails = OptionalNullable.absent(); private OptionalNullable proofOfPossession = OptionalNullable.absent(); @@ -504,6 +520,7 @@ public Builder from(UpdateResourceServerResponseContent other) { accessToken(other.getAccessToken()); tokenEncryption(other.getTokenEncryption()); consentPolicy(other.getConsentPolicy()); + requireConsentNonRepudiation(other.getRequireConsentNonRepudiation()); authorizationDetails(other.getAuthorizationDetails()); proofOfPossession(other.getProofOfPossession()); subjectTypeAuthorization(other.getSubjectTypeAuthorization()); @@ -828,6 +845,20 @@ public Builder consentPolicy( return this; } + /** + *

    When true, the resource server requires every consent approval to be digitally signed, so the approver cannot later deny a consent they granted. When false, consent decisions do not need a signature. Defaults to false. A configured value is still returned even after the related entitlement is disabled.

    + */ + @JsonSetter(value = "require_consent_non_repudiation", nulls = Nulls.SKIP) + public Builder requireConsentNonRepudiation(Optional requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = requireConsentNonRepudiation; + return this; + } + + public Builder requireConsentNonRepudiation(Boolean requireConsentNonRepudiation) { + this.requireConsentNonRepudiation = Optional.ofNullable(requireConsentNonRepudiation); + return this; + } + @JsonSetter(value = "authorization_details", nulls = Nulls.SKIP) public Builder authorizationDetails(@Nullable OptionalNullable> authorizationDetails) { this.authorizationDetails = authorizationDetails; @@ -972,6 +1003,7 @@ public UpdateResourceServerResponseContent build() { accessToken, tokenEncryption, consentPolicy, + requireConsentNonRepudiation, authorizationDetails, proofOfPossession, subjectTypeAuthorization, diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateSegmentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateSegmentResponseContent.java new file mode 100644 index 000000000..1aaba1b28 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateSegmentResponseContent.java @@ -0,0 +1,297 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateSegmentResponseContent.Builder.class) +public final class UpdateSegmentResponseContent { + private final String id; + + private final String name; + + private final Optional description; + + private final SegmentTypeEnum type; + + private final List rules; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateSegmentResponseContent( + String id, + String name, + Optional description, + SegmentTypeEnum type, + List rules, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + this.rules = rules; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("type") + public SegmentTypeEnum getType() { + return type; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateSegmentResponseContent && equalTo((UpdateSegmentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateSegmentResponseContent other) { + return id.equals(other.id) + && name.equals(other.name) + && description.equals(other.description) + && type.equals(other.type) + && rules.equals(other.rules) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, this.name, this.description, this.type, this.rules, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(UpdateSegmentResponseContent other); + } + + public interface NameStage { + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + CreatedAtStage type(@NotNull SegmentTypeEnum type); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateSegmentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage rules(List rules); + + _FinalStage addRules(SegmentRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, TypeStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String name; + + private SegmentTypeEnum type; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private List rules = new ArrayList<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateSegmentResponseContent other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + type(other.getType()); + rules(other.getRules()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public CreatedAtStage type(@NotNull SegmentTypeEnum type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(SegmentRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateSegmentResponseContent build() { + return new UpdateSegmentResponseContent( + id, name, description, type, rules, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/UpdateVariationResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/UpdateVariationResponseContent.java new file mode 100644 index 000000000..a01bdc275 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/UpdateVariationResponseContent.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVariationResponseContent.Builder.class) +public final class UpdateVariationResponseContent { + private final String id; + + private final String featureFlagId; + + private final String name; + + private final Optional description; + + private final Map overrides; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private UpdateVariationResponseContent( + String id, + String featureFlagId, + String name, + Optional description, + Map overrides, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.featureFlagId = featureFlagId; + this.name = name; + this.description = description; + this.overrides = overrides; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("overrides") + public Map getOverrides() { + return overrides; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVariationResponseContent && equalTo((UpdateVariationResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVariationResponseContent other) { + return id.equals(other.id) + && featureFlagId.equals(other.featureFlagId) + && name.equals(other.name) + && description.equals(other.description) + && overrides.equals(other.overrides) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.featureFlagId, + this.name, + this.description, + this.overrides, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + FeatureFlagIdStage id(@NotNull String id); + + Builder from(UpdateVariationResponseContent other); + } + + public interface FeatureFlagIdStage { + NameStage featureFlagId(@NotNull String featureFlagId); + } + + public interface NameStage { + CreatedAtStage name(@NotNull String name); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpdateVariationResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage overrides(Map overrides); + + _FinalStage putAllOverrides(Map overrides); + + _FinalStage overrides(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, FeatureFlagIdStage, NameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String featureFlagId; + + private String name; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Map overrides = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVariationResponseContent other) { + id(other.getId()); + featureFlagId(other.getFeatureFlagId()); + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public FeatureFlagIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public NameStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage overrides(String key, Object value) { + this.overrides.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllOverrides(Map overrides) { + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public _FinalStage overrides(Map overrides) { + this.overrides.clear(); + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public UpdateVariationResponseContent build() { + return new UpdateVariationResponseContent( + id, featureFlagId, name, description, overrides, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/ValidateExperimentResponseContent.java b/src/main/java/com/auth0/client/mgmt/types/ValidateExperimentResponseContent.java new file mode 100644 index 000000000..82fb412f3 --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/ValidateExperimentResponseContent.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateExperimentResponseContent.Builder.class) +public final class ValidateExperimentResponseContent { + private final boolean isValid; + + private final List errors; + + private final Map additionalProperties; + + private ValidateExperimentResponseContent( + boolean isValid, List errors, Map additionalProperties) { + this.isValid = isValid; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the experiment is ready to be activated. + */ + @JsonProperty("is_valid") + public boolean getIsValid() { + return isValid; + } + + /** + * @return List of validation errors preventing activation. Empty when is_valid is true. + */ + @JsonProperty("errors") + public List getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateExperimentResponseContent && equalTo((ValidateExperimentResponseContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateExperimentResponseContent other) { + return isValid == other.isValid && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.isValid, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IsValidStage builder() { + return new Builder(); + } + + public interface IsValidStage { + /** + *

    Whether the experiment is ready to be activated.

    + */ + _FinalStage isValid(boolean isValid); + + Builder from(ValidateExperimentResponseContent other); + } + + public interface _FinalStage { + ValidateExperimentResponseContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    List of validation errors preventing activation. Empty when is_valid is true.

    + */ + _FinalStage errors(List errors); + + _FinalStage addErrors(ExperimentValidationError errors); + + _FinalStage addAllErrors(List errors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IsValidStage, _FinalStage { + private boolean isValid; + + private List errors = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateExperimentResponseContent other) { + isValid(other.getIsValid()); + errors(other.getErrors()); + return this; + } + + /** + *

    Whether the experiment is ready to be activated.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_valid") + public _FinalStage isValid(boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + *

    List of validation errors preventing activation. Empty when is_valid is true.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllErrors(List errors) { + if (errors != null) { + this.errors.addAll(errors); + } + return this; + } + + /** + *

    List of validation errors preventing activation. Empty when is_valid is true.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addErrors(ExperimentValidationError errors) { + this.errors.add(errors); + return this; + } + + /** + *

    List of validation errors preventing activation. Empty when is_valid is true.

    + */ + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors(List errors) { + this.errors.clear(); + if (errors != null) { + this.errors.addAll(errors); + } + return this; + } + + @java.lang.Override + public ValidateExperimentResponseContent build() { + return new ValidateExperimentResponseContent(isValid, errors, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/auth0/client/mgmt/types/Variation.java b/src/main/java/com/auth0/client/mgmt/types/Variation.java new file mode 100644 index 000000000..99e4e71ea --- /dev/null +++ b/src/main/java/com/auth0/client/mgmt/types/Variation.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.auth0.client.mgmt.types; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Variation.Builder.class) +public final class Variation { + private final String id; + + private final String featureFlagId; + + private final String name; + + private final Optional description; + + private final Map overrides; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private Variation( + String id, + String featureFlagId, + String name, + Optional description, + Map overrides, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.id = id; + this.featureFlagId = featureFlagId; + this.name = name; + this.description = description; + this.overrides = overrides; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("feature_flag_id") + public String getFeatureFlagId() { + return featureFlagId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("overrides") + public Map getOverrides() { + return overrides; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Variation && equalTo((Variation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Variation other) { + return id.equals(other.id) + && featureFlagId.equals(other.featureFlagId) + && name.equals(other.name) + && description.equals(other.description) + && overrides.equals(other.overrides) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.featureFlagId, + this.name, + this.description, + this.overrides, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + FeatureFlagIdStage id(@NotNull String id); + + Builder from(Variation other); + } + + public interface FeatureFlagIdStage { + NameStage featureFlagId(@NotNull String featureFlagId); + } + + public interface NameStage { + CreatedAtStage name(@NotNull String name); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Variation build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage overrides(Map overrides); + + _FinalStage putAllOverrides(Map overrides); + + _FinalStage overrides(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, FeatureFlagIdStage, NameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String featureFlagId; + + private String name; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Map overrides = new LinkedHashMap<>(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Variation other) { + id(other.getId()); + featureFlagId(other.getFeatureFlagId()); + name(other.getName()); + description(other.getDescription()); + overrides(other.getOverrides()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public FeatureFlagIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_flag_id") + public NameStage featureFlagId(@NotNull String featureFlagId) { + this.featureFlagId = Objects.requireNonNull(featureFlagId, "featureFlagId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage overrides(String key, Object value) { + this.overrides.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllOverrides(Map overrides) { + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "overrides", nulls = Nulls.SKIP) + public _FinalStage overrides(Map overrides) { + this.overrides.clear(); + if (overrides != null) { + this.overrides.putAll(overrides); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public Variation build() { + return new Variation( + id, featureFlagId, name, description, overrides, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/test/java/com/auth0/client/mgmt/ExperimentationExperimentsWireTest.java b/src/test/java/com/auth0/client/mgmt/ExperimentationExperimentsWireTest.java index 74c6c5a07..d55bd50d1 100644 --- a/src/test/java/com/auth0/client/mgmt/ExperimentationExperimentsWireTest.java +++ b/src/test/java/com/auth0/client/mgmt/ExperimentationExperimentsWireTest.java @@ -1,8 +1,22 @@ package com.auth0.client.mgmt; import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.SyncPagingIterable; import com.auth0.client.mgmt.experimentation.types.AdvanceRampRequestContent; +import com.auth0.client.mgmt.experimentation.types.CreateExperimentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListExperimentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateExperimentStatusRequestContent; import com.auth0.client.mgmt.types.AdvanceRampResponseContent; +import com.auth0.client.mgmt.types.AuthenticationFlowEnum; +import com.auth0.client.mgmt.types.CreateExperimentResponseContent; +import com.auth0.client.mgmt.types.ExperimentListItem; +import com.auth0.client.mgmt.types.ExperimentStatusEnum; +import com.auth0.client.mgmt.types.ExperimentTransitionStatusEnum; +import com.auth0.client.mgmt.types.GetExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentResponseContent; +import com.auth0.client.mgmt.types.UpdateExperimentStatusResponseContent; +import com.auth0.client.mgmt.types.ValidateExperimentResponseContent; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import okhttp3.mockwebserver.MockResponse; @@ -33,6 +47,386 @@ public void teardown() throws Exception { server.shutdown(); } + @Test + public void testList() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"experiments\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"feature_flag_id\":\"feature_flag_id\",\"feature_flag_name\":\"feature_flag_name\",\"authentication_flow\":\"authentication_flow\",\"allocation_strategy\":\"percentage\",\"status\":\"draft\",\"is_valid\":true,\"default_config\":\"tenant\",\"feature_flag_snapshot\":{\"key\":\"value\"},\"allocations\":[{}],\"editable_fields\":[\"editable_fields\"],\"levels\":[1],\"current_level\":1,\"started_at\":\"2024-01-15T09:30:00Z\",\"ended_at\":\"2024-01-15T09:30:00Z\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}],\"next\":\"next\"}")); + SyncPagingIterable response = client.experimentation() + .experiments() + .list(ListExperimentsRequestParameters.builder() + .from("from") + .take(1) + .status(ExperimentStatusEnum.DRAFT) + .authenticationFlow("authentication_flow") + .featureFlagId("feature_flag_id") + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + // Pagination response validated via MockWebServer + // The SDK correctly parses the response into a SyncPagingIterable + } + + @Test + public void testCreate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"feature_flag_id\":\"feature_flag_id\",\"feature_flag_name\":\"feature_flag_name\",\"authentication_flow\":\"authentication_flow\",\"allocation_strategy\":\"percentage\",\"status\":\"draft\",\"is_valid\":true,\"default_config\":\"tenant\",\"feature_flag_snapshot\":{\"key\":\"value\"},\"allocations\":[{\"variation_id\":\"variation_id\",\"variation_name\":\"variation_name\",\"segment_id\":\"segment_id\",\"segment_name\":\"segment_name\",\"weight\":1,\"priority\":1,\"is_control\":true,\"is_fallback\":true,\"variation_snapshot\":{\"key\":\"value\"},\"segment_snapshot\":{\"key\":\"value\"}}],\"editable_fields\":[\"editable_fields\"],\"levels\":[1],\"current_level\":1,\"started_at\":\"2024-01-15T09:30:00Z\",\"ended_at\":\"2024-01-15T09:30:00Z\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + CreateExperimentResponseContent response = client.experimentation() + .experiments() + .create(CreateExperimentRequestContent.builder() + .name("name") + .featureFlagId("feature_flag_id") + .authenticationFlow(AuthenticationFlowEnum.AUTHENTICATION) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + + "{\n" + + " \"name\": \"name\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"authentication_flow\": \"authentication\"\n" + + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"feature_flag_name\": \"feature_flag_name\",\n" + + " \"authentication_flow\": \"authentication_flow\",\n" + + " \"allocation_strategy\": \"percentage\",\n" + + " \"status\": \"draft\",\n" + + " \"is_valid\": true,\n" + + " \"default_config\": \"tenant\",\n" + + " \"feature_flag_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"allocations\": [\n" + + " {\n" + + " \"variation_id\": \"variation_id\",\n" + + " \"variation_name\": \"variation_name\",\n" + + " \"segment_id\": \"segment_id\",\n" + + " \"segment_name\": \"segment_name\",\n" + + " \"weight\": 1,\n" + + " \"priority\": 1,\n" + + " \"is_control\": true,\n" + + " \"is_fallback\": true,\n" + + " \"variation_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"segment_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"editable_fields\": [\n" + + " \"editable_fields\"\n" + + " ],\n" + + " \"levels\": [\n" + + " 1\n" + + " ],\n" + + " \"current_level\": 1,\n" + + " \"started_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"ended_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testGet() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"feature_flag_id\":\"feature_flag_id\",\"feature_flag_name\":\"feature_flag_name\",\"authentication_flow\":\"authentication_flow\",\"allocation_strategy\":\"percentage\",\"status\":\"draft\",\"is_valid\":true,\"default_config\":\"tenant\",\"feature_flag_snapshot\":{\"key\":\"value\"},\"allocations\":[{\"variation_id\":\"variation_id\",\"variation_name\":\"variation_name\",\"segment_id\":\"segment_id\",\"segment_name\":\"segment_name\",\"weight\":1,\"priority\":1,\"is_control\":true,\"is_fallback\":true,\"variation_snapshot\":{\"key\":\"value\"},\"segment_snapshot\":{\"key\":\"value\"}}],\"editable_fields\":[\"editable_fields\"],\"levels\":[1],\"current_level\":1,\"started_at\":\"2024-01-15T09:30:00Z\",\"ended_at\":\"2024-01-15T09:30:00Z\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + GetExperimentResponseContent response = + client.experimentation().experiments().get("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"feature_flag_name\": \"feature_flag_name\",\n" + + " \"authentication_flow\": \"authentication_flow\",\n" + + " \"allocation_strategy\": \"percentage\",\n" + + " \"status\": \"draft\",\n" + + " \"is_valid\": true,\n" + + " \"default_config\": \"tenant\",\n" + + " \"feature_flag_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"allocations\": [\n" + + " {\n" + + " \"variation_id\": \"variation_id\",\n" + + " \"variation_name\": \"variation_name\",\n" + + " \"segment_id\": \"segment_id\",\n" + + " \"segment_name\": \"segment_name\",\n" + + " \"weight\": 1,\n" + + " \"priority\": 1,\n" + + " \"is_control\": true,\n" + + " \"is_fallback\": true,\n" + + " \"variation_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"segment_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"editable_fields\": [\n" + + " \"editable_fields\"\n" + + " ],\n" + + " \"levels\": [\n" + + " 1\n" + + " ],\n" + + " \"current_level\": 1,\n" + + " \"started_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"ended_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testDelete() throws Exception { + server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); + client.experimentation().experiments().delete("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("DELETE", request.getMethod()); + } + + @Test + public void testUpdate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"feature_flag_id\":\"feature_flag_id\",\"feature_flag_name\":\"feature_flag_name\",\"authentication_flow\":\"authentication_flow\",\"allocation_strategy\":\"percentage\",\"status\":\"draft\",\"is_valid\":true,\"default_config\":\"tenant\",\"feature_flag_snapshot\":{\"key\":\"value\"},\"allocations\":[{\"variation_id\":\"variation_id\",\"variation_name\":\"variation_name\",\"segment_id\":\"segment_id\",\"segment_name\":\"segment_name\",\"weight\":1,\"priority\":1,\"is_control\":true,\"is_fallback\":true,\"variation_snapshot\":{\"key\":\"value\"},\"segment_snapshot\":{\"key\":\"value\"}}],\"editable_fields\":[\"editable_fields\"],\"levels\":[1],\"current_level\":1,\"started_at\":\"2024-01-15T09:30:00Z\",\"ended_at\":\"2024-01-15T09:30:00Z\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateExperimentResponseContent response = client.experimentation() + .experiments() + .update("id", UpdateExperimentRequestParameters.builder().build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("PATCH", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"feature_flag_name\": \"feature_flag_name\",\n" + + " \"authentication_flow\": \"authentication_flow\",\n" + + " \"allocation_strategy\": \"percentage\",\n" + + " \"status\": \"draft\",\n" + + " \"is_valid\": true,\n" + + " \"default_config\": \"tenant\",\n" + + " \"feature_flag_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"allocations\": [\n" + + " {\n" + + " \"variation_id\": \"variation_id\",\n" + + " \"variation_name\": \"variation_name\",\n" + + " \"segment_id\": \"segment_id\",\n" + + " \"segment_name\": \"segment_name\",\n" + + " \"weight\": 1,\n" + + " \"priority\": 1,\n" + + " \"is_control\": true,\n" + + " \"is_fallback\": true,\n" + + " \"variation_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"segment_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"editable_fields\": [\n" + + " \"editable_fields\"\n" + + " ],\n" + + " \"levels\": [\n" + + " 1\n" + + " ],\n" + + " \"current_level\": 1,\n" + + " \"started_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"ended_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + @Test public void testAdvanceRamp() throws Exception { server.enqueue(new MockResponse() @@ -116,6 +510,187 @@ else if (actualResponseNode.has("kind")) } } + @Test + public void testUpdateStatus() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"feature_flag_id\":\"feature_flag_id\",\"feature_flag_name\":\"feature_flag_name\",\"authentication_flow\":\"authentication_flow\",\"allocation_strategy\":\"percentage\",\"status\":\"draft\",\"is_valid\":true,\"default_config\":\"tenant\",\"feature_flag_snapshot\":{\"key\":\"value\"},\"allocations\":[{\"variation_id\":\"variation_id\",\"variation_name\":\"variation_name\",\"segment_id\":\"segment_id\",\"segment_name\":\"segment_name\",\"weight\":1,\"priority\":1,\"is_control\":true,\"is_fallback\":true,\"variation_snapshot\":{\"key\":\"value\"},\"segment_snapshot\":{\"key\":\"value\"}}],\"editable_fields\":[\"editable_fields\"],\"levels\":[1],\"current_level\":1,\"started_at\":\"2024-01-15T09:30:00Z\",\"ended_at\":\"2024-01-15T09:30:00Z\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateExperimentStatusResponseContent response = client.experimentation() + .experiments() + .updateStatus( + "id", + UpdateExperimentStatusRequestContent.builder() + .status(ExperimentTransitionStatusEnum.ACTIVE) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{\n" + " \"status\": \"active\"\n" + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"feature_flag_name\": \"feature_flag_name\",\n" + + " \"authentication_flow\": \"authentication_flow\",\n" + + " \"allocation_strategy\": \"percentage\",\n" + + " \"status\": \"draft\",\n" + + " \"is_valid\": true,\n" + + " \"default_config\": \"tenant\",\n" + + " \"feature_flag_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"allocations\": [\n" + + " {\n" + + " \"variation_id\": \"variation_id\",\n" + + " \"variation_name\": \"variation_name\",\n" + + " \"segment_id\": \"segment_id\",\n" + + " \"segment_name\": \"segment_name\",\n" + + " \"weight\": 1,\n" + + " \"priority\": 1,\n" + + " \"is_control\": true,\n" + + " \"is_fallback\": true,\n" + + " \"variation_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"segment_snapshot\": {\n" + + " \"key\": \"value\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"editable_fields\": [\n" + + " \"editable_fields\"\n" + + " ],\n" + + " \"levels\": [\n" + + " 1\n" + + " ],\n" + + " \"current_level\": 1,\n" + + " \"started_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"ended_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testValidate() throws Exception { + server.enqueue(new MockResponse() + .setResponseCode(200) + .setBody("{\"is_valid\":true,\"errors\":[{\"code\":\"code\",\"message\":\"message\"}]}")); + ValidateExperimentResponseContent response = + client.experimentation().experiments().validate("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"is_valid\": true,\n" + + " \"errors\": [\n" + + " {\n" + + " \"code\": \"code\",\n" + + " \"message\": \"message\"\n" + + " }\n" + + " ]\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + /** * Compares two JsonNodes with numeric equivalence and null safety. * For objects, checks that all fields in 'expected' exist in 'actual' with matching values. diff --git a/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsVariationsWireTest.java b/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsVariationsWireTest.java new file mode 100644 index 000000000..d6deb9260 --- /dev/null +++ b/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsVariationsWireTest.java @@ -0,0 +1,398 @@ +package com.auth0.client.mgmt; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.experimentation.featureflags.types.CreateVariationRequestContent; +import com.auth0.client.mgmt.experimentation.featureflags.types.UpdateVariationRequestContent; +import com.auth0.client.mgmt.types.CreateVariationResponseContent; +import com.auth0.client.mgmt.types.GetVariationResponseContent; +import com.auth0.client.mgmt.types.ListVariationsResponseContent; +import com.auth0.client.mgmt.types.UpdateVariationResponseContent; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ExperimentationFeatureFlagsVariationsWireTest { + private MockWebServer server; + private ManagementApi client; + private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; + + @BeforeEach + public void setup() throws Exception { + server = new MockWebServer(); + server.start(); + client = ManagementApi.builder() + .url(server.url("/").toString()) + .token("test-token") + .build(); + } + + @AfterEach + public void teardown() throws Exception { + server.shutdown(); + } + + @Test + public void testList() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"variations\":[{\"id\":\"id\",\"feature_flag_id\":\"feature_flag_id\",\"name\":\"name\",\"description\":\"description\",\"overrides\":{\"key\":\"value\"},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}]}")); + ListVariationsResponseContent response = + client.experimentation().featureFlags().variations().list("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"variations\": [\n" + + " {\n" + + " \"id\": \"id\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"overrides\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + " }\n" + + " ]\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testCreate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"feature_flag_id\":\"feature_flag_id\",\"name\":\"name\",\"description\":\"description\",\"overrides\":{\"key\":\"value\"},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + CreateVariationResponseContent response = client.experimentation() + .featureFlags() + .variations() + .create( + "id", + CreateVariationRequestContent.builder() + .name("name") + .overrides(new HashMap() { + { + put("key", "value"); + } + }) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + + "{\n" + + " \"name\": \"name\",\n" + + " \"overrides\": {\n" + + " \"key\": \"value\"\n" + + " }\n" + + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"overrides\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testGet() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"feature_flag_id\":\"feature_flag_id\",\"name\":\"name\",\"description\":\"description\",\"overrides\":{\"key\":\"value\"},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + GetVariationResponseContent response = + client.experimentation().featureFlags().variations().get("id", "vid"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"overrides\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testDelete() throws Exception { + server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); + client.experimentation().featureFlags().variations().delete("id", "vid"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("DELETE", request.getMethod()); + } + + @Test + public void testUpdate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"feature_flag_id\":\"feature_flag_id\",\"name\":\"name\",\"description\":\"description\",\"overrides\":{\"key\":\"value\"},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateVariationResponseContent response = client.experimentation() + .featureFlags() + .variations() + .update("id", "vid", UpdateVariationRequestContent.builder().build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("PATCH", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"feature_flag_id\": \"feature_flag_id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"overrides\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + /** + * Compares two JsonNodes with numeric equivalence and null safety. + * For objects, checks that all fields in 'expected' exist in 'actual' with matching values. + * Allows 'actual' to have extra fields (e.g., default values added during serialization). + */ + private boolean jsonEquals(JsonNode expected, JsonNode actual) { + if (expected == null && actual == null) return true; + if (expected == null || actual == null) return false; + if (expected.equals(actual)) return true; + if (expected.isNumber() && actual.isNumber()) + return Math.abs(expected.doubleValue() - actual.doubleValue()) < 1e-10; + if (expected.isObject() && actual.isObject()) { + java.util.Iterator> iter = expected.fields(); + while (iter.hasNext()) { + java.util.Map.Entry entry = iter.next(); + JsonNode actualValue = actual.get(entry.getKey()); + if (actualValue == null) { + if (!entry.getValue().isNull()) return false; + } else if (!jsonEquals(entry.getValue(), actualValue)) return false; + } + return true; + } + if (expected.isArray() && actual.isArray()) { + if (expected.size() != actual.size()) return false; + for (int i = 0; i < expected.size(); i++) { + if (!jsonEquals(expected.get(i), actual.get(i))) return false; + } + return true; + } + return false; + } +} diff --git a/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsWireTest.java b/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsWireTest.java new file mode 100644 index 000000000..151400af0 --- /dev/null +++ b/src/test/java/com/auth0/client/mgmt/ExperimentationFeatureFlagsWireTest.java @@ -0,0 +1,474 @@ +package com.auth0.client.mgmt; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.types.CreateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListFeatureFlagsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagRequestContent; +import com.auth0.client.mgmt.experimentation.types.UpdateFeatureFlagStatusRequestContent; +import com.auth0.client.mgmt.types.CreateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.FeatureFlag; +import com.auth0.client.mgmt.types.FeatureFlagConfigParam; +import com.auth0.client.mgmt.types.FeatureFlagStatusEnum; +import com.auth0.client.mgmt.types.FeatureFlagTypeEnum; +import com.auth0.client.mgmt.types.GetFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagResponseContent; +import com.auth0.client.mgmt.types.UpdateFeatureFlagStatusResponseContent; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ExperimentationFeatureFlagsWireTest { + private MockWebServer server; + private ManagementApi client; + private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; + + @BeforeEach + public void setup() throws Exception { + server = new MockWebServer(); + server.start(); + client = ManagementApi.builder() + .url(server.url("/").toString()) + .token("test-token") + .build(); + } + + @AfterEach + public void teardown() throws Exception { + server.shutdown(); + } + + @Test + public void testList() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"feature_flags\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"auth0\",\"status\":\"draft\",\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}],\"next\":\"next\"}")); + SyncPagingIterable response = client.experimentation() + .featureFlags() + .list(ListFeatureFlagsRequestParameters.builder() + .from("from") + .take(1) + .type(FeatureFlagTypeEnum.AUTH0) + .status(FeatureFlagStatusEnum.DRAFT) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + // Pagination response validated via MockWebServer + // The SDK correctly parses the response into a SyncPagingIterable + } + + @Test + public void testCreate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"auth0\",\"status\":\"draft\",\"parameters\":{\"key\":{\"type\":\"string\",\"value\":{\"key\":\"value\"},\"description\":\"description\"}},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + CreateFeatureFlagResponseContent response = client.experimentation() + .featureFlags() + .create(CreateFeatureFlagRequestContent.builder() + .name("name") + .parameters(new HashMap()) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{\n" + " \"name\": \"name\",\n" + " \"parameters\": {}\n" + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"auth0\",\n" + + " \"status\": \"draft\",\n" + + " \"parameters\": {\n" + + " \"key\": {\n" + + " \"type\": \"string\",\n" + + " \"value\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"description\": \"description\"\n" + + " }\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testGet() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"auth0\",\"status\":\"draft\",\"parameters\":{\"key\":{\"type\":\"string\",\"value\":{\"key\":\"value\"},\"description\":\"description\"}},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + GetFeatureFlagResponseContent response = + client.experimentation().featureFlags().get("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"auth0\",\n" + + " \"status\": \"draft\",\n" + + " \"parameters\": {\n" + + " \"key\": {\n" + + " \"type\": \"string\",\n" + + " \"value\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"description\": \"description\"\n" + + " }\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testDelete() throws Exception { + server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); + client.experimentation().featureFlags().delete("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("DELETE", request.getMethod()); + } + + @Test + public void testUpdate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"auth0\",\"status\":\"draft\",\"parameters\":{\"key\":{\"type\":\"string\",\"value\":{\"key\":\"value\"},\"description\":\"description\"}},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateFeatureFlagResponseContent response = client.experimentation() + .featureFlags() + .update("id", UpdateFeatureFlagRequestContent.builder().build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("PATCH", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"auth0\",\n" + + " \"status\": \"draft\",\n" + + " \"parameters\": {\n" + + " \"key\": {\n" + + " \"type\": \"string\",\n" + + " \"value\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"description\": \"description\"\n" + + " }\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testUpdateStatus() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"auth0\",\"status\":\"draft\",\"parameters\":{\"key\":{\"type\":\"string\",\"value\":{\"key\":\"value\"},\"description\":\"description\"}},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateFeatureFlagStatusResponseContent response = client.experimentation() + .featureFlags() + .updateStatus( + "id", + UpdateFeatureFlagStatusRequestContent.builder() + .status(FeatureFlagStatusEnum.DRAFT) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{\n" + " \"status\": \"draft\"\n" + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"auth0\",\n" + + " \"status\": \"draft\",\n" + + " \"parameters\": {\n" + + " \"key\": {\n" + + " \"type\": \"string\",\n" + + " \"value\": {\n" + + " \"key\": \"value\"\n" + + " },\n" + + " \"description\": \"description\"\n" + + " }\n" + + " },\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + /** + * Compares two JsonNodes with numeric equivalence and null safety. + * For objects, checks that all fields in 'expected' exist in 'actual' with matching values. + * Allows 'actual' to have extra fields (e.g., default values added during serialization). + */ + private boolean jsonEquals(JsonNode expected, JsonNode actual) { + if (expected == null && actual == null) return true; + if (expected == null || actual == null) return false; + if (expected.equals(actual)) return true; + if (expected.isNumber() && actual.isNumber()) + return Math.abs(expected.doubleValue() - actual.doubleValue()) < 1e-10; + if (expected.isObject() && actual.isObject()) { + java.util.Iterator> iter = expected.fields(); + while (iter.hasNext()) { + java.util.Map.Entry entry = iter.next(); + JsonNode actualValue = actual.get(entry.getKey()); + if (actualValue == null) { + if (!entry.getValue().isNull()) return false; + } else if (!jsonEquals(entry.getValue(), actualValue)) return false; + } + return true; + } + if (expected.isArray() && actual.isArray()) { + if (expected.size() != actual.size()) return false; + for (int i = 0; i < expected.size(); i++) { + if (!jsonEquals(expected.get(i), actual.get(i))) return false; + } + return true; + } + return false; + } +} diff --git a/src/test/java/com/auth0/client/mgmt/ExperimentationSegmentsWireTest.java b/src/test/java/com/auth0/client/mgmt/ExperimentationSegmentsWireTest.java new file mode 100644 index 000000000..e16eef68a --- /dev/null +++ b/src/test/java/com/auth0/client/mgmt/ExperimentationSegmentsWireTest.java @@ -0,0 +1,349 @@ +package com.auth0.client.mgmt; + +import com.auth0.client.mgmt.core.ObjectMappers; +import com.auth0.client.mgmt.core.SyncPagingIterable; +import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent; +import com.auth0.client.mgmt.experimentation.types.ListSegmentsRequestParameters; +import com.auth0.client.mgmt.experimentation.types.UpdateSegmentRequestContent; +import com.auth0.client.mgmt.types.CreateSegmentResponseContent; +import com.auth0.client.mgmt.types.GetSegmentResponseContent; +import com.auth0.client.mgmt.types.Segment; +import com.auth0.client.mgmt.types.SegmentRule; +import com.auth0.client.mgmt.types.SegmentTypeFilterEnum; +import com.auth0.client.mgmt.types.UpdateSegmentResponseContent; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Arrays; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ExperimentationSegmentsWireTest { + private MockWebServer server; + private ManagementApi client; + private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; + + @BeforeEach + public void setup() throws Exception { + server = new MockWebServer(); + server.start(); + client = ManagementApi.builder() + .url(server.url("/").toString()) + .token("test-token") + .build(); + } + + @AfterEach + public void teardown() throws Exception { + server.shutdown(); + } + + @Test + public void testList() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"segments\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"self\",\"rules\":[{}],\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}],\"next\":\"next\"}")); + SyncPagingIterable response = client.experimentation() + .segments() + .list(ListSegmentsRequestParameters.builder() + .from("from") + .take(1) + .type(SegmentTypeFilterEnum.AUTH0) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + // Pagination response validated via MockWebServer + // The SDK correctly parses the response into a SyncPagingIterable + } + + @Test + public void testCreate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"self\",\"rules\":[{}],\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + CreateSegmentResponseContent response = client.experimentation() + .segments() + .create(CreateSegmentRequestContent.builder() + .name("name") + .rules(Arrays.asList(SegmentRule.builder().build())) + .build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("POST", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = + "" + "{\n" + " \"name\": \"name\",\n" + " \"rules\": [\n" + " {}\n" + " ]\n" + "}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"self\",\n" + + " \"rules\": [\n" + + " {}\n" + + " ],\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testGet() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"self\",\"rules\":[{}],\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + GetSegmentResponseContent response = client.experimentation().segments().get("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("GET", request.getMethod()); + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"self\",\n" + + " \"rules\": [\n" + + " {}\n" + + " ],\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + @Test + public void testDelete() throws Exception { + server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); + client.experimentation().segments().delete("id"); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("DELETE", request.getMethod()); + } + + @Test + public void testUpdate() throws Exception { + server.enqueue( + new MockResponse() + .setResponseCode(200) + .setBody( + "{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"type\":\"self\",\"rules\":[{}],\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); + UpdateSegmentResponseContent response = client.experimentation() + .segments() + .update("id", UpdateSegmentRequestContent.builder().build()); + RecordedRequest request = server.takeRequest(); + Assertions.assertNotNull(request); + Assertions.assertEquals("PATCH", request.getMethod()); + // Validate request body + String actualRequestBody = request.getBody().readUtf8(); + String expectedRequestBody = "" + "{}"; + JsonNode actualJson = objectMapper.readTree(actualRequestBody); + JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); + Assertions.assertTrue(jsonEquals(expectedJson, actualJson), "Request body structure does not match expected"); + if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { + String discriminator = null; + if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); + else if (actualJson.has("_type")) + discriminator = actualJson.get("_type").asText(); + else if (actualJson.has("kind")) + discriminator = actualJson.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualJson.isNull()) { + Assertions.assertTrue( + actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), + "request should be a valid JSON value"); + } + + if (actualJson.isArray()) { + Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); + } + if (actualJson.isObject()) { + Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); + } + + // Validate response body + Assertions.assertNotNull(response, "Response should not be null"); + String actualResponseJson = objectMapper.writeValueAsString(response); + String expectedResponseBody = "" + + "{\n" + + " \"id\": \"id\",\n" + + " \"name\": \"name\",\n" + + " \"description\": \"description\",\n" + + " \"type\": \"self\",\n" + + " \"rules\": [\n" + + " {}\n" + + " ],\n" + + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" + + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" + + "}"; + JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); + JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); + Assertions.assertTrue( + jsonEquals(expectedResponseNode, actualResponseNode), + "Response body structure does not match expected"); + if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { + String discriminator = null; + if (actualResponseNode.has("type")) + discriminator = actualResponseNode.get("type").asText(); + else if (actualResponseNode.has("_type")) + discriminator = actualResponseNode.get("_type").asText(); + else if (actualResponseNode.has("kind")) + discriminator = actualResponseNode.get("kind").asText(); + Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); + Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); + } + + if (!actualResponseNode.isNull()) { + Assertions.assertTrue( + actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), + "response should be a valid JSON value"); + } + + if (actualResponseNode.isArray()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); + } + if (actualResponseNode.isObject()) { + Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); + } + } + + /** + * Compares two JsonNodes with numeric equivalence and null safety. + * For objects, checks that all fields in 'expected' exist in 'actual' with matching values. + * Allows 'actual' to have extra fields (e.g., default values added during serialization). + */ + private boolean jsonEquals(JsonNode expected, JsonNode actual) { + if (expected == null && actual == null) return true; + if (expected == null || actual == null) return false; + if (expected.equals(actual)) return true; + if (expected.isNumber() && actual.isNumber()) + return Math.abs(expected.doubleValue() - actual.doubleValue()) < 1e-10; + if (expected.isObject() && actual.isObject()) { + java.util.Iterator> iter = expected.fields(); + while (iter.hasNext()) { + java.util.Map.Entry entry = iter.next(); + JsonNode actualValue = actual.get(entry.getKey()); + if (actualValue == null) { + if (!entry.getValue().isNull()) return false; + } else if (!jsonEquals(entry.getValue(), actualValue)) return false; + } + return true; + } + if (expected.isArray() && actual.isArray()) { + if (expected.size() != actual.size()) return false; + for (int i = 0; i < expected.size(); i++) { + if (!jsonEquals(expected.get(i), actual.get(i))) return false; + } + return true; + } + return false; + } +} diff --git a/src/test/java/com/auth0/client/mgmt/OrganizationsOrganizationTemplateWireTest.java b/src/test/java/com/auth0/client/mgmt/OrganizationsOrganizationTemplateWireTest.java deleted file mode 100644 index d5881459e..000000000 --- a/src/test/java/com/auth0/client/mgmt/OrganizationsOrganizationTemplateWireTest.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.auth0.client.mgmt; - -import com.auth0.client.mgmt.core.ObjectMappers; -import com.auth0.client.mgmt.types.OrganizationTemplate; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class OrganizationsOrganizationTemplateWireTest { - private MockWebServer server; - private ManagementApi client; - private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; - - @BeforeEach - public void setup() throws Exception { - server = new MockWebServer(); - server.start(); - client = ManagementApi.builder() - .url(server.url("/").toString()) - .token("test-token") - .build(); - } - - @AfterEach - public void teardown() throws Exception { - server.shutdown(); - } - - @Test - public void testGet() throws Exception { - server.enqueue( - new MockResponse() - .setResponseCode(200) - .setBody( - "{\"id\":\"id\",\"name\":\"name\",\"is_default\":true,\"organization_deletion_behavior\":\"allow\",\"connection_deletion_behavior\":\"allow\",\"enforce_permission_ceiling\":true,\"enforce_self_assignment_restriction\":true,\"connection_profile_id\":\"connection_profile_id\",\"user_attribute_profile_id\":\"user_attribute_profile_id\",\"allowed_strategies\":[\"adfs\"],\"invitation_landing_client_id\":\"invitation_landing_client_id\",\"admin_roles_assignment\":[\"admin_roles_assignment\"],\"use_for_organization_discovery\":{\"default_value\":true,\"allowed_values\":[true]},\"role_visibility_policy\":{\"default_value\":\"write\",\"overrides\":[{\"role_id\":\"role_id\",\"access\":\"write\"}]},\"created_at\":\"2024-01-15T09:30:00Z\",\"updated_at\":\"2024-01-15T09:30:00Z\"}")); - OrganizationTemplate response = - client.organizations().organizationTemplate().get("id"); - RecordedRequest request = server.takeRequest(); - Assertions.assertNotNull(request); - Assertions.assertEquals("GET", request.getMethod()); - - // Validate response body - Assertions.assertNotNull(response, "Response should not be null"); - String actualResponseJson = objectMapper.writeValueAsString(response); - String expectedResponseBody = "" - + "{\n" - + " \"id\": \"id\",\n" - + " \"name\": \"name\",\n" - + " \"is_default\": true,\n" - + " \"organization_deletion_behavior\": \"allow\",\n" - + " \"connection_deletion_behavior\": \"allow\",\n" - + " \"enforce_permission_ceiling\": true,\n" - + " \"enforce_self_assignment_restriction\": true,\n" - + " \"connection_profile_id\": \"connection_profile_id\",\n" - + " \"user_attribute_profile_id\": \"user_attribute_profile_id\",\n" - + " \"allowed_strategies\": [\n" - + " \"adfs\"\n" - + " ],\n" - + " \"invitation_landing_client_id\": \"invitation_landing_client_id\",\n" - + " \"admin_roles_assignment\": [\n" - + " \"admin_roles_assignment\"\n" - + " ],\n" - + " \"use_for_organization_discovery\": {\n" - + " \"default_value\": true,\n" - + " \"allowed_values\": [\n" - + " true\n" - + " ]\n" - + " },\n" - + " \"role_visibility_policy\": {\n" - + " \"default_value\": \"write\",\n" - + " \"overrides\": [\n" - + " {\n" - + " \"role_id\": \"role_id\",\n" - + " \"access\": \"write\"\n" - + " }\n" - + " ]\n" - + " },\n" - + " \"created_at\": \"2024-01-15T09:30:00Z\",\n" - + " \"updated_at\": \"2024-01-15T09:30:00Z\"\n" - + "}"; - JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); - JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); - Assertions.assertTrue( - jsonEquals(expectedResponseNode, actualResponseNode), - "Response body structure does not match expected"); - if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { - String discriminator = null; - if (actualResponseNode.has("type")) - discriminator = actualResponseNode.get("type").asText(); - else if (actualResponseNode.has("_type")) - discriminator = actualResponseNode.get("_type").asText(); - else if (actualResponseNode.has("kind")) - discriminator = actualResponseNode.get("kind").asText(); - Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); - Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); - } - - if (!actualResponseNode.isNull()) { - Assertions.assertTrue( - actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), - "response should be a valid JSON value"); - } - - if (actualResponseNode.isArray()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); - } - if (actualResponseNode.isObject()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); - } - } - - @Test - public void testAssignOrganizationTemplate() throws Exception { - server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); - client.organizations().organizationTemplate().assignOrganizationTemplate("id", "template_id"); - RecordedRequest request = server.takeRequest(); - Assertions.assertNotNull(request); - Assertions.assertEquals("PUT", request.getMethod()); - } - - @Test - public void testUnassignOrganizationTemplate() throws Exception { - server.enqueue(new MockResponse().setResponseCode(200).setBody("{}")); - client.organizations().organizationTemplate().unassignOrganizationTemplate("id", "template_id"); - RecordedRequest request = server.takeRequest(); - Assertions.assertNotNull(request); - Assertions.assertEquals("DELETE", request.getMethod()); - } - - /** - * Compares two JsonNodes with numeric equivalence and null safety. - * For objects, checks that all fields in 'expected' exist in 'actual' with matching values. - * Allows 'actual' to have extra fields (e.g., default values added during serialization). - */ - private boolean jsonEquals(JsonNode expected, JsonNode actual) { - if (expected == null && actual == null) return true; - if (expected == null || actual == null) return false; - if (expected.equals(actual)) return true; - if (expected.isNumber() && actual.isNumber()) - return Math.abs(expected.doubleValue() - actual.doubleValue()) < 1e-10; - if (expected.isObject() && actual.isObject()) { - java.util.Iterator> iter = expected.fields(); - while (iter.hasNext()) { - java.util.Map.Entry entry = iter.next(); - JsonNode actualValue = actual.get(entry.getKey()); - if (actualValue == null) { - if (!entry.getValue().isNull()) return false; - } else if (!jsonEquals(entry.getValue(), actualValue)) return false; - } - return true; - } - if (expected.isArray() && actual.isArray()) { - if (expected.size() != actual.size()) return false; - for (int i = 0; i < expected.size(); i++) { - if (!jsonEquals(expected.get(i), actual.get(i))) return false; - } - return true; - } - return false; - } -} diff --git a/src/test/java/com/auth0/client/mgmt/ResourceServersWireTest.java b/src/test/java/com/auth0/client/mgmt/ResourceServersWireTest.java index 8af38c25e..e0cdefec4 100644 --- a/src/test/java/com/auth0/client/mgmt/ResourceServersWireTest.java +++ b/src/test/java/com/auth0/client/mgmt/ResourceServersWireTest.java @@ -51,7 +51,7 @@ public void testList() throws Exception { new MockResponse() .setResponseCode(200) .setBody( - "{\"start\":1.1,\"limit\":1.1,\"total\":1.1,\"resource_servers\":[{\"id\":\"id\",\"name\":\"name\",\"is_system\":true,\"identifier\":\"identifier\",\"scopes\":[{\"value\":\"value\"}],\"signing_alg\":\"HS256\",\"signing_secret\":\"signing_secret\",\"allow_offline_access\":true,\"allow_online_access\":true,\"allow_online_access_with_ephemeral_sessions\":true,\"skip_consent_for_verifiable_first_party_clients\":true,\"token_lifetime\":1,\"token_lifetime_for_web\":1,\"enforce_policies\":true,\"token_lifetime_for_anonymous_access_tokens\":1,\"token_dialect\":\"access_token\",\"token_encryption\":{\"format\":\"compact-nested-jwe\",\"encryption_key\":{\"alg\":\"RSA-OAEP-256\",\"pem\":\"pem\"}},\"consent_policy\":\"transactional-authorization-with-mfa\",\"proof_of_possession\":{\"mechanism\":\"mtls\",\"required\":true},\"authorization_policy\":{\"policy_id\":\"policy_id\"},\"client_id\":\"client_id\"}]}")); + "{\"start\":1.1,\"limit\":1.1,\"total\":1.1,\"resource_servers\":[{\"id\":\"id\",\"name\":\"name\",\"is_system\":true,\"identifier\":\"identifier\",\"scopes\":[{\"value\":\"value\"}],\"signing_alg\":\"HS256\",\"signing_secret\":\"signing_secret\",\"allow_offline_access\":true,\"allow_online_access\":true,\"allow_online_access_with_ephemeral_sessions\":true,\"skip_consent_for_verifiable_first_party_clients\":true,\"token_lifetime\":1,\"token_lifetime_for_web\":1,\"enforce_policies\":true,\"token_lifetime_for_anonymous_access_tokens\":1,\"token_dialect\":\"access_token\",\"token_encryption\":{\"format\":\"compact-nested-jwe\",\"encryption_key\":{\"alg\":\"RSA-OAEP-256\",\"pem\":\"pem\"}},\"consent_policy\":\"transactional-authorization-with-mfa\",\"require_consent_non_repudiation\":true,\"proof_of_possession\":{\"mechanism\":\"mtls\",\"required\":true},\"authorization_policy\":{\"policy_id\":\"policy_id\"},\"client_id\":\"client_id\"}]}")); SyncPagingIterable response = client.resourceServers() .list(ListResourceServerRequestParameters.builder() .page(1) @@ -154,7 +154,7 @@ public void testSearch() throws Exception { new MockResponse() .setResponseCode(200) .setBody( - "{\"resource_servers\":[{\"id\":\"id\",\"name\":\"name\",\"is_system\":true,\"identifier\":\"identifier\",\"scopes\":[{\"value\":\"value\"}],\"signing_alg\":\"HS256\",\"allow_offline_access\":true,\"allow_online_access\":true,\"allow_online_access_with_ephemeral_sessions\":true,\"skip_consent_for_verifiable_first_party_clients\":true,\"token_lifetime\":1,\"token_lifetime_for_web\":1,\"enforce_policies\":true,\"token_lifetime_for_anonymous_access_tokens\":1,\"token_dialect\":\"access_token\",\"token_encryption\":{\"format\":\"compact-nested-jwe\",\"encryption_key\":{\"alg\":\"RSA-OAEP-256\",\"pem\":\"pem\"}},\"consent_policy\":\"transactional-authorization-with-mfa\",\"proof_of_possession\":{\"mechanism\":\"mtls\",\"required\":true},\"authorization_policy\":{\"policy_id\":\"policy_id\"},\"client_id\":\"client_id\"}],\"next\":\"next\"}")); + "{\"resource_servers\":[{\"id\":\"id\",\"name\":\"name\",\"is_system\":true,\"identifier\":\"identifier\",\"scopes\":[{\"value\":\"value\"}],\"signing_alg\":\"HS256\",\"allow_offline_access\":true,\"allow_online_access\":true,\"allow_online_access_with_ephemeral_sessions\":true,\"skip_consent_for_verifiable_first_party_clients\":true,\"token_lifetime\":1,\"token_lifetime_for_web\":1,\"enforce_policies\":true,\"token_lifetime_for_anonymous_access_tokens\":1,\"token_dialect\":\"access_token\",\"token_encryption\":{\"format\":\"compact-nested-jwe\",\"encryption_key\":{\"alg\":\"RSA-OAEP-256\",\"pem\":\"pem\"}},\"consent_policy\":\"transactional-authorization-with-mfa\",\"require_consent_non_repudiation\":true,\"proof_of_possession\":{\"mechanism\":\"mtls\",\"required\":true},\"authorization_policy\":{\"policy_id\":\"policy_id\"},\"client_id\":\"client_id\"}],\"next\":\"next\"}")); SyncPagingIterable response = client.resourceServers() .search(SearchResourceServersRequestParameters.builder() .q("q") diff --git a/src/test/java/com/auth0/client/mgmt/UndiscriminatedUnionTest.java b/src/test/java/com/auth0/client/mgmt/UndiscriminatedUnionTest.java index bb20b6bee..07e342781 100644 --- a/src/test/java/com/auth0/client/mgmt/UndiscriminatedUnionTest.java +++ b/src/test/java/com/auth0/client/mgmt/UndiscriminatedUnionTest.java @@ -26,6 +26,11 @@ import com.auth0.client.mgmt.types.LogStreamSplunkSink; import com.auth0.client.mgmt.types.LogStreamSumoSink; import com.auth0.client.mgmt.types.PhoneProviderConfiguration; +import com.auth0.client.mgmt.types.SegmentContainsExpression; +import com.auth0.client.mgmt.types.SegmentEndsWithExpression; +import com.auth0.client.mgmt.types.SegmentExistsExpression; +import com.auth0.client.mgmt.types.SegmentMatchExpression; +import com.auth0.client.mgmt.types.SegmentStartsWithExpression; import com.auth0.client.mgmt.types.TwilioProviderConfiguration; import org.junit.jupiter.api.Test; @@ -151,4 +156,40 @@ public void testPhoneProviderConfiguration_CustomProviderConfiguration() throws union.get() instanceof CustomProviderConfiguration, "Expected CustomProviderConfiguration but got different variant"); } + + @Test + public void testSegmentMatchExpression_SegmentContainsExpression() throws Exception { + String json = "{\"contains\":[]}"; + SegmentMatchExpression union = ObjectMappers.JSON_MAPPER.readValue(json, SegmentMatchExpression.class); + assertTrue( + union.get() instanceof SegmentContainsExpression, + "Expected SegmentContainsExpression but got different variant"); + } + + @Test + public void testSegmentMatchExpression_SegmentStartsWithExpression() throws Exception { + String json = "{\"starts_with\":[]}"; + SegmentMatchExpression union = ObjectMappers.JSON_MAPPER.readValue(json, SegmentMatchExpression.class); + assertTrue( + union.get() instanceof SegmentStartsWithExpression, + "Expected SegmentStartsWithExpression but got different variant"); + } + + @Test + public void testSegmentMatchExpression_SegmentEndsWithExpression() throws Exception { + String json = "{\"ends_with\":[]}"; + SegmentMatchExpression union = ObjectMappers.JSON_MAPPER.readValue(json, SegmentMatchExpression.class); + assertTrue( + union.get() instanceof SegmentEndsWithExpression, + "Expected SegmentEndsWithExpression but got different variant"); + } + + @Test + public void testSegmentMatchExpression_SegmentExistsExpression() throws Exception { + String json = "{\"exists\":true}"; + SegmentMatchExpression union = ObjectMappers.JSON_MAPPER.readValue(json, SegmentMatchExpression.class); + assertTrue( + union.get() instanceof SegmentExistsExpression, + "Expected SegmentExistsExpression but got different variant"); + } } diff --git a/src/test/resources/wire-tests/ResourceServersWireTest_testCreate_response.json b/src/test/resources/wire-tests/ResourceServersWireTest_testCreate_response.json index 63400d60c..63dcdc2dc 100644 --- a/src/test/resources/wire-tests/ResourceServersWireTest_testCreate_response.json +++ b/src/test/resources/wire-tests/ResourceServersWireTest_testCreate_response.json @@ -40,6 +40,7 @@ } }, "consent_policy": "transactional-authorization-with-mfa", + "require_consent_non_repudiation": true, "authorization_details": [ { "key": "value" diff --git a/src/test/resources/wire-tests/ResourceServersWireTest_testGet_response.json b/src/test/resources/wire-tests/ResourceServersWireTest_testGet_response.json index 63400d60c..63dcdc2dc 100644 --- a/src/test/resources/wire-tests/ResourceServersWireTest_testGet_response.json +++ b/src/test/resources/wire-tests/ResourceServersWireTest_testGet_response.json @@ -40,6 +40,7 @@ } }, "consent_policy": "transactional-authorization-with-mfa", + "require_consent_non_repudiation": true, "authorization_details": [ { "key": "value" diff --git a/src/test/resources/wire-tests/ResourceServersWireTest_testUpdate_response.json b/src/test/resources/wire-tests/ResourceServersWireTest_testUpdate_response.json index 63400d60c..63dcdc2dc 100644 --- a/src/test/resources/wire-tests/ResourceServersWireTest_testUpdate_response.json +++ b/src/test/resources/wire-tests/ResourceServersWireTest_testUpdate_response.json @@ -40,6 +40,7 @@ } }, "consent_policy": "transactional-authorization-with-mfa", + "require_consent_non_repudiation": true, "authorization_details": [ { "key": "value" From b91e084c41528f3417b2cceb204edb024a10f70c Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 05:57:55 +0000 Subject: [PATCH 2/3] [fern-replay] advance lockfile --- .fern/replay.lock | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.fern/replay.lock b/.fern/replay.lock index 16094f86d..abf849e09 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -54,5 +54,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.11.1 -current_generation: 52b481b4c8ac54e43f7ad6639899321570ea73b3 + - commit_sha: 72c6c335cb93c52314a459f895a03fa2a0730e87 + tree_hash: e485efdbc833d45f6f6c69c79cbff62e8a99bfa4 + timestamp: 2026-09-29T05:57:51.188Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.11.1 +current_generation: 72c6c335cb93c52314a459f895a03fa2a0730e87 patches: [] From ec75f8a639a4d663659ec421215f50cc67bab600 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Wed, 30 Sep 2026 16:52:57 +0530 Subject: [PATCH 3/3] bump jackson version --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 31e01aa78..2cf3e780f 100644 --- a/build.gradle +++ b/build.gradle @@ -22,9 +22,9 @@ logger.lifecycle("Using version ${version} for ${name} group $group") dependencies { // Core dependencies api 'com.squareup.okhttp3:okhttp:5.2.1' - api 'com.fasterxml.jackson.core:jackson-databind:2.21.6' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.21.6' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.6' + api 'com.fasterxml.jackson.core:jackson-databind:2.21.7' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.21.7' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.7' // Dependencies for legacy management code from auth0-real implementation 'com.squareup.okhttp3:logging-interceptor:5.2.1'