list(
}
/**
- * Creates a new connection according to the JSON object received in <code>body</code>.<br/>
+ * Creates a new connection according to the JSON object received in <code>body</code>.
+ * <b>Note:</b> If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.
*/
public CreateConnectionResponseContent create(CreateConnectionRequestContent request) {
return this.rawClient.create(request).body();
}
/**
- * Creates a new connection according to the JSON object received in <code>body</code>.<br/>
+ * Creates a new connection according to the JSON object received in <code>body</code>.
+ * <b>Note:</b> If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.
*/
public CreateConnectionResponseContent create(
CreateConnectionRequestContent request, RequestOptions requestOptions) {
@@ -154,6 +156,7 @@ public GetConnectionResponseContent get(
/**
* Removes a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
+ * <b>Note:</b> If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent <a href="https://auth0.com/docs/api/management/v2/connections/post-connections">create connection</a> requests, if they use an identical connection name.
*/
public void delete(String id) {
this.rawClient.delete(id).body();
@@ -161,6 +164,7 @@ public void delete(String id) {
/**
* Removes a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
+ * <b>Note:</b> If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent <a href="https://auth0.com/docs/api/management/v2/connections/post-connections">create connection</a> requests, if they use an identical connection name.
*/
public void delete(String id, RequestOptions requestOptions) {
this.rawClient.delete(id, requestOptions).body();
@@ -205,14 +209,14 @@ public void checkStatus(String id, RequestOptions requestOptions) {
this.rawClient.checkStatus(id, requestOptions).body();
}
- public ClientsClient clients() {
- return this.clientsClient.get();
- }
-
public DirectoryProvisioningClient directoryProvisioning() {
return this.directoryProvisioningClient.get();
}
+ public ClientsClient clients() {
+ return this.clientsClient.get();
+ }
+
public KeysClient keys() {
return this.keysClient.get();
}
diff --git a/src/main/java/com/auth0/client/mgmt/RawClientGrantsClient.java b/src/main/java/com/auth0/client/mgmt/RawClientGrantsClient.java
index 0911c9ce..b288b691 100644
--- a/src/main/java/com/auth0/client/mgmt/RawClientGrantsClient.java
+++ b/src/main/java/com/auth0/client/mgmt/RawClientGrantsClient.java
@@ -21,6 +21,7 @@
import com.auth0.client.mgmt.types.ClientGrantResponseContent;
import com.auth0.client.mgmt.types.CreateClientGrantRequestContent;
import com.auth0.client.mgmt.types.CreateClientGrantResponseContent;
+import com.auth0.client.mgmt.types.GetClientGrantResponseContent;
import com.auth0.client.mgmt.types.ListClientGrantPaginatedResponseContent;
import com.auth0.client.mgmt.types.ListClientGrantsRequestParameters;
import com.auth0.client.mgmt.types.UpdateClientGrantRequestContent;
@@ -219,6 +220,68 @@ public ManagementApiHttpResponse create(
}
}
+ /**
+ * Retrieve a single <a href="https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants">client grant</a>, including the
+ * scopes associated with the application/API pair.
+ */
+ public ManagementApiHttpResponse get(String id) {
+ return get(id, null);
+ }
+
+ /**
+ * Retrieve a single <a href="https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants">client grant</a>, including the
+ * scopes associated with the application/API pair.
+ */
+ public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("client-grants")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetClientGrantResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
/**
* Delete the <a href="https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow">Client Credential Flow</a> from your machine-to-machine application.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/RawConnectionsClient.java b/src/main/java/com/auth0/client/mgmt/RawConnectionsClient.java
index 67750ac8..9f698a3b 100644
--- a/src/main/java/com/auth0/client/mgmt/RawConnectionsClient.java
+++ b/src/main/java/com/auth0/client/mgmt/RawConnectionsClient.java
@@ -186,14 +186,16 @@ public ManagementApiHttpResponse> list(
}
/**
- * Creates a new connection according to the JSON object received in <code>body</code>.<br/>
+ * Creates a new connection according to the JSON object received in <code>body</code>.
+ * <b>Note:</b> If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.
*/
public ManagementApiHttpResponse create(CreateConnectionRequestContent request) {
return create(request, null);
}
/**
- * Creates a new connection according to the JSON object received in <code>body</code>.<br/>
+ * Creates a new connection according to the JSON object received in <code>body</code>.
+ * <b>Note:</b> If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.
*/
public ManagementApiHttpResponse create(
CreateConnectionRequestContent request, RequestOptions requestOptions) {
@@ -337,6 +339,7 @@ public ManagementApiHttpResponse get(
/**
* Removes a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
+ * <b>Note:</b> If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent <a href="https://auth0.com/docs/api/management/v2/connections/post-connections">create connection</a> requests, if they use an identical connection name.
*/
public ManagementApiHttpResponse delete(String id) {
return delete(id, null);
@@ -344,6 +347,7 @@ public ManagementApiHttpResponse delete(String id) {
/**
* Removes a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
+ * <b>Note:</b> If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent <a href="https://auth0.com/docs/api/management/v2/connections/post-connections">create connection</a> requests, if they use an identical connection name.
*/
public ManagementApiHttpResponse delete(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
diff --git a/src/main/java/com/auth0/client/mgmt/RawRolesClient.java b/src/main/java/com/auth0/client/mgmt/RawRolesClient.java
index 6845e898..db4021f6 100644
--- a/src/main/java/com/auth0/client/mgmt/RawRolesClient.java
+++ b/src/main/java/com/auth0/client/mgmt/RawRolesClient.java
@@ -13,6 +13,7 @@
import com.auth0.client.mgmt.core.RequestOptions;
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;
@@ -188,6 +189,9 @@ public ManagementApiHttpResponse create(
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);
diff --git a/src/main/java/com/auth0/client/mgmt/actions/AsyncModulesClient.java b/src/main/java/com/auth0/client/mgmt/actions/AsyncModulesClient.java
new file mode 100644
index 00000000..78c6f991
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/AsyncModulesClient.java
@@ -0,0 +1,160 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.modules.AsyncVersionsClient;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+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.types.ActionModuleAction;
+import com.auth0.client.mgmt.types.ActionModuleListItem;
+import com.auth0.client.mgmt.types.CreateActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleResponseContent;
+import com.auth0.client.mgmt.types.RollbackActionModuleResponseContent;
+import com.auth0.client.mgmt.types.UpdateActionModuleResponseContent;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
+
+public class AsyncModulesClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawModulesClient rawClient;
+
+ protected final Supplier versionsClient;
+
+ public AsyncModulesClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawModulesClient(clientOptions);
+ this.versionsClient = Suppliers.memoize(() -> new AsyncVersionsClient(clientOptions));
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawModulesClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture> list() {
+ return this.rawClient.list().thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture> list(GetActionModulesRequestParameters request) {
+ return this.rawClient.list(request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture> list(
+ GetActionModulesRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CompletableFuture create() {
+ return this.rawClient.create().thenApply(response -> response.body());
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CompletableFuture create(RequestOptions requestOptions) {
+ return this.rawClient.create(requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public CompletableFuture get(String id) {
+ return this.rawClient.get(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public CompletableFuture get(String id, RequestOptions requestOptions) {
+ return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public CompletableFuture delete(String id) {
+ return this.rawClient.delete(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public CompletableFuture delete(String id, RequestOptions requestOptions) {
+ return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture update(String id) {
+ return this.rawClient.update(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture update(String id, RequestOptions requestOptions) {
+ return this.rawClient.update(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture> listActions(String id) {
+ return this.rawClient.listActions(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture> listActions(
+ String id, GetActionModuleActionsRequestParameters request) {
+ return this.rawClient.listActions(id, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture> listActions(
+ String id, GetActionModuleActionsRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.listActions(id, request, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public CompletableFuture rollback(String id) {
+ return this.rawClient.rollback(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public CompletableFuture rollback(String id, RequestOptions requestOptions) {
+ return this.rawClient.rollback(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ public AsyncVersionsClient versions() {
+ return this.versionsClient.get();
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/AsyncRawModulesClient.java b/src/main/java/com/auth0/client/mgmt/actions/AsyncRawModulesClient.java
new file mode 100644
index 00000000..ac0ace6f
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/AsyncRawModulesClient.java
@@ -0,0 +1,738 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+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.QueryStringMapper;
+import com.auth0.client.mgmt.core.RequestOptions;
+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.PreconditionFailedError;
+import com.auth0.client.mgmt.errors.TooManyRequestsError;
+import com.auth0.client.mgmt.errors.UnauthorizedError;
+import com.auth0.client.mgmt.types.ActionModuleAction;
+import com.auth0.client.mgmt.types.ActionModuleListItem;
+import com.auth0.client.mgmt.types.CreateActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleActionsResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModulesResponseContent;
+import com.auth0.client.mgmt.types.RollbackActionModuleResponseContent;
+import com.auth0.client.mgmt.types.UpdateActionModuleResponseContent;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+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 AsyncRawModulesClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawModulesClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture>> list() {
+ return list(GetActionModulesRequestParameters.builder().build());
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture>> list(
+ GetActionModulesRequestParameters request) {
+ return list(request, null);
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public CompletableFuture>> list(
+ GetActionModulesRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules");
+ QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().orElse(0), false);
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "per_page", request.getPerPage().orElse(50), false);
+ 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);
+ }
+ 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()) {
+ GetActionModulesResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetActionModulesResponseContent.class);
+ int newPageNumber = request.getPage()
+ .map((Integer page) -> page + 1)
+ .orElse(1);
+ GetActionModulesRequestParameters nextRequest = GetActionModulesRequestParameters.builder()
+ .from(request)
+ .page(newPageNumber)
+ .build();
+ List result =
+ parsedResponse.getModules().orElse(Collections.emptyList());
+ future.complete(new ManagementApiHttpResponse<>(
+ new SyncPagingIterable(true, 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 (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 Actions Module for reusable code across actions.
+ */
+ public CompletableFuture> create() {
+ return create(null);
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CompletableFuture> create(
+ RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, CreateActionModuleResponseContent.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 (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 details of a specific Actions Module by its unique identifier.
+ */
+ public CompletableFuture> get(String id) {
+ return get(id, null);
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public CompletableFuture> get(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleResponseContent.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 (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 Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public CompletableFuture> delete(String id) {
+ return delete(id, null);
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public CompletableFuture> delete(String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 412:
+ future.completeExceptionally(new PreconditionFailedError(
+ 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 (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;
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture> update(String id) {
+ return update(id, null);
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture> update(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("PATCH", 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);
+ }
+ 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, UpdateActionModuleResponseContent.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 (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;
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture>> listActions(String id) {
+ return listActions(id, GetActionModuleActionsRequestParameters.builder().build());
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture>> listActions(
+ String id, GetActionModuleActionsRequestParameters request) {
+ return listActions(id, request, null);
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public CompletableFuture>> listActions(
+ String id, GetActionModuleActionsRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("actions");
+ QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().orElse(0), false);
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "per_page", request.getPerPage().orElse(50), false);
+ 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);
+ }
+ 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()) {
+ GetActionModuleActionsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetActionModuleActionsResponseContent.class);
+ int newPageNumber = request.getPage()
+ .map((Integer page) -> page + 1)
+ .orElse(1);
+ GetActionModuleActionsRequestParameters nextRequest =
+ GetActionModuleActionsRequestParameters.builder()
+ .from(request)
+ .page(newPageNumber)
+ .build();
+ List result =
+ parsedResponse.getActions().orElse(Collections.emptyList());
+ future.complete(new ManagementApiHttpResponse<>(
+ new SyncPagingIterable(true, result, parsedResponse, () -> {
+ try {
+ return listActions(id, 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 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 (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;
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public CompletableFuture> rollback(String id) {
+ return rollback(id, null);
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public CompletableFuture> rollback(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("rollback")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, RollbackActionModuleResponseContent.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 (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/actions/ModulesClient.java b/src/main/java/com/auth0/client/mgmt/actions/ModulesClient.java
new file mode 100644
index 00000000..4a137e02
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/ModulesClient.java
@@ -0,0 +1,159 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.modules.VersionsClient;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+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.types.ActionModuleAction;
+import com.auth0.client.mgmt.types.ActionModuleListItem;
+import com.auth0.client.mgmt.types.CreateActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleResponseContent;
+import com.auth0.client.mgmt.types.RollbackActionModuleResponseContent;
+import com.auth0.client.mgmt.types.UpdateActionModuleResponseContent;
+import java.util.function.Supplier;
+
+public class ModulesClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawModulesClient rawClient;
+
+ protected final Supplier versionsClient;
+
+ public ModulesClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawModulesClient(clientOptions);
+ this.versionsClient = Suppliers.memoize(() -> new VersionsClient(clientOptions));
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawModulesClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public SyncPagingIterable list() {
+ return this.rawClient.list().body();
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public SyncPagingIterable list(GetActionModulesRequestParameters request) {
+ return this.rawClient.list(request).body();
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public SyncPagingIterable list(
+ GetActionModulesRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.list(request, requestOptions).body();
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CreateActionModuleResponseContent create() {
+ return this.rawClient.create().body();
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CreateActionModuleResponseContent create(RequestOptions requestOptions) {
+ return this.rawClient.create(requestOptions).body();
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public GetActionModuleResponseContent get(String id) {
+ return this.rawClient.get(id).body();
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public GetActionModuleResponseContent get(String id, RequestOptions requestOptions) {
+ return this.rawClient.get(id, requestOptions).body();
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public void delete(String id) {
+ this.rawClient.delete(id).body();
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public void delete(String id, RequestOptions requestOptions) {
+ this.rawClient.delete(id, requestOptions).body();
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public UpdateActionModuleResponseContent update(String id) {
+ return this.rawClient.update(id).body();
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public UpdateActionModuleResponseContent update(String id, RequestOptions requestOptions) {
+ return this.rawClient.update(id, requestOptions).body();
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public SyncPagingIterable listActions(String id) {
+ return this.rawClient.listActions(id).body();
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public SyncPagingIterable listActions(
+ String id, GetActionModuleActionsRequestParameters request) {
+ return this.rawClient.listActions(id, request).body();
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public SyncPagingIterable listActions(
+ String id, GetActionModuleActionsRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.listActions(id, request, requestOptions).body();
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public RollbackActionModuleResponseContent rollback(String id) {
+ return this.rawClient.rollback(id).body();
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public RollbackActionModuleResponseContent rollback(String id, RequestOptions requestOptions) {
+ return this.rawClient.rollback(id, requestOptions).body();
+ }
+
+ public VersionsClient versions() {
+ return this.versionsClient.get();
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/RawModulesClient.java b/src/main/java/com/auth0/client/mgmt/actions/RawModulesClient.java
new file mode 100644
index 00000000..79329dc8
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/RawModulesClient.java
@@ -0,0 +1,543 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+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.QueryStringMapper;
+import com.auth0.client.mgmt.core.RequestOptions;
+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.PreconditionFailedError;
+import com.auth0.client.mgmt.errors.TooManyRequestsError;
+import com.auth0.client.mgmt.errors.UnauthorizedError;
+import com.auth0.client.mgmt.types.ActionModuleAction;
+import com.auth0.client.mgmt.types.ActionModuleListItem;
+import com.auth0.client.mgmt.types.CreateActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleActionsResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleResponseContent;
+import com.auth0.client.mgmt.types.GetActionModulesResponseContent;
+import com.auth0.client.mgmt.types.RollbackActionModuleResponseContent;
+import com.auth0.client.mgmt.types.UpdateActionModuleResponseContent;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+
+public class RawModulesClient {
+ protected final ClientOptions clientOptions;
+
+ public RawModulesClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public ManagementApiHttpResponse> list() {
+ return list(GetActionModulesRequestParameters.builder().build());
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public ManagementApiHttpResponse> list(
+ GetActionModulesRequestParameters request) {
+ return list(request, null);
+ }
+
+ /**
+ * Retrieve a paginated list of all Actions Modules with optional filtering and totals.
+ */
+ public ManagementApiHttpResponse> list(
+ GetActionModulesRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules");
+ QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().orElse(0), false);
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "per_page", request.getPerPage().orElse(50), false);
+ 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);
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ GetActionModulesResponseContent parsedResponse =
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetActionModulesResponseContent.class);
+ int newPageNumber =
+ request.getPage().map((Integer page) -> page + 1).orElse(1);
+ GetActionModulesRequestParameters nextRequest = GetActionModulesRequestParameters.builder()
+ .from(request)
+ .page(newPageNumber)
+ .build();
+ List result = parsedResponse.getModules().orElse(Collections.emptyList());
+ return new ManagementApiHttpResponse<>(
+ new SyncPagingIterable(
+ true, 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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public ManagementApiHttpResponse create() {
+ return create(null);
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public ManagementApiHttpResponse create(RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, CreateActionModuleResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public ManagementApiHttpResponse get(String id) {
+ return get(id, null);
+ }
+
+ /**
+ * Retrieve details of a specific Actions Module by its unique identifier.
+ */
+ public ManagementApiHttpResponse get(String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public ManagementApiHttpResponse delete(String id) {
+ return delete(id, null);
+ }
+
+ /**
+ * Permanently delete an Actions Module. This will fail if the module is still in use by any actions.
+ */
+ public ManagementApiHttpResponse delete(String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 412:
+ throw new PreconditionFailedError(
+ 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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public ManagementApiHttpResponse update(String id) {
+ return update(id, null);
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public ManagementApiHttpResponse update(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("PATCH", 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);
+ }
+ 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, UpdateActionModuleResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public ManagementApiHttpResponse> listActions(String id) {
+ return listActions(id, GetActionModuleActionsRequestParameters.builder().build());
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public ManagementApiHttpResponse> listActions(
+ String id, GetActionModuleActionsRequestParameters request) {
+ return listActions(id, request, null);
+ }
+
+ /**
+ * Lists all actions that are using a specific Actions Module, showing which deployed action versions reference this Actions Module.
+ */
+ public ManagementApiHttpResponse> listActions(
+ String id, GetActionModuleActionsRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("actions");
+ QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().orElse(0), false);
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "per_page", request.getPerPage().orElse(50), false);
+ 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);
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ GetActionModuleActionsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, GetActionModuleActionsResponseContent.class);
+ int newPageNumber =
+ request.getPage().map((Integer page) -> page + 1).orElse(1);
+ GetActionModuleActionsRequestParameters nextRequest = GetActionModuleActionsRequestParameters.builder()
+ .from(request)
+ .page(newPageNumber)
+ .build();
+ List result = parsedResponse.getActions().orElse(Collections.emptyList());
+ return new ManagementApiHttpResponse<>(
+ new SyncPagingIterable(
+ true, result, parsedResponse, () -> listActions(id, 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 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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public ManagementApiHttpResponse rollback(String id) {
+ return rollback(id, null);
+ }
+
+ /**
+ * Rolls back an Actions Module's draft to a previously created version. This action copies the code, dependencies, and secrets from the specified version into the current draft.
+ */
+ public ManagementApiHttpResponse rollback(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("rollback")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, RollbackActionModuleResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/modules/AsyncRawVersionsClient.java b/src/main/java/com/auth0/client/mgmt/actions/modules/AsyncRawVersionsClient.java
new file mode 100644
index 00000000..5f3d9265
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/modules/AsyncRawVersionsClient.java
@@ -0,0 +1,319 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.modules;
+
+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.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.PreconditionFailedError;
+import com.auth0.client.mgmt.errors.TooManyRequestsError;
+import com.auth0.client.mgmt.errors.UnauthorizedError;
+import com.auth0.client.mgmt.types.CreateActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionsResponseContent;
+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 AsyncRawVersionsClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawVersionsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public CompletableFuture> list(String id) {
+ return list(id, null);
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public CompletableFuture> list(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleVersionsResponseContent.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 (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;
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CompletableFuture> create(String id) {
+ return create(id, null);
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CompletableFuture> create(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, CreateActionModuleVersionResponseContent.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 412:
+ future.completeExceptionally(new PreconditionFailedError(
+ 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 (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 the details of a specific, immutable version of an Actions Module.
+ */
+ public CompletableFuture> get(
+ String id, String versionId) {
+ return get(id, versionId, null);
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public CompletableFuture> get(
+ String id, String versionId, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .addPathSegment(versionId)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleVersionResponseContent.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 (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/actions/modules/AsyncVersionsClient.java b/src/main/java/com/auth0/client/mgmt/actions/modules/AsyncVersionsClient.java
new file mode 100644
index 00000000..babd8613
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/modules/AsyncVersionsClient.java
@@ -0,0 +1,73 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.modules;
+
+import com.auth0.client.mgmt.core.ClientOptions;
+import com.auth0.client.mgmt.core.RequestOptions;
+import com.auth0.client.mgmt.types.CreateActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionsResponseContent;
+import java.util.concurrent.CompletableFuture;
+
+public class AsyncVersionsClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawVersionsClient rawClient;
+
+ public AsyncVersionsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawVersionsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawVersionsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public CompletableFuture list(String id) {
+ return this.rawClient.list(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public CompletableFuture list(String id, RequestOptions requestOptions) {
+ return this.rawClient.list(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CompletableFuture create(String id) {
+ return this.rawClient.create(id).thenApply(response -> response.body());
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CompletableFuture create(
+ String id, RequestOptions requestOptions) {
+ return this.rawClient.create(id, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public CompletableFuture get(String id, String versionId) {
+ return this.rawClient.get(id, versionId).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public CompletableFuture get(
+ String id, String versionId, RequestOptions requestOptions) {
+ return this.rawClient.get(id, versionId, requestOptions).thenApply(response -> response.body());
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/modules/RawVersionsClient.java b/src/main/java/com/auth0/client/mgmt/actions/modules/RawVersionsClient.java
new file mode 100644
index 00000000..d84ee113
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/modules/RawVersionsClient.java
@@ -0,0 +1,240 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.modules;
+
+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.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.PreconditionFailedError;
+import com.auth0.client.mgmt.errors.TooManyRequestsError;
+import com.auth0.client.mgmt.errors.UnauthorizedError;
+import com.auth0.client.mgmt.types.CreateActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionsResponseContent;
+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 RawVersionsClient {
+ protected final ClientOptions clientOptions;
+
+ public RawVersionsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public ManagementApiHttpResponse list(String id) {
+ return list(id, null);
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public ManagementApiHttpResponse list(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleVersionsResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public ManagementApiHttpResponse create(String id) {
+ return create(id, null);
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public ManagementApiHttpResponse create(
+ String id, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, CreateActionModuleVersionResponseContent.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 412:
+ throw new PreconditionFailedError(
+ 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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public ManagementApiHttpResponse get(String id, String versionId) {
+ return get(id, versionId, null);
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public ManagementApiHttpResponse get(
+ String id, String versionId, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("versions")
+ .addPathSegment(versionId)
+ .build();
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .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);
+ }
+ 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, GetActionModuleVersionResponseContent.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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/modules/VersionsClient.java b/src/main/java/com/auth0/client/mgmt/actions/modules/VersionsClient.java
new file mode 100644
index 00000000..66561ad1
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/modules/VersionsClient.java
@@ -0,0 +1,70 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.modules;
+
+import com.auth0.client.mgmt.core.ClientOptions;
+import com.auth0.client.mgmt.core.RequestOptions;
+import com.auth0.client.mgmt.types.CreateActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionResponseContent;
+import com.auth0.client.mgmt.types.GetActionModuleVersionsResponseContent;
+
+public class VersionsClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawVersionsClient rawClient;
+
+ public VersionsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawVersionsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawVersionsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public GetActionModuleVersionsResponseContent list(String id) {
+ return this.rawClient.list(id).body();
+ }
+
+ /**
+ * List all published versions of a specific Actions Module.
+ */
+ public GetActionModuleVersionsResponseContent list(String id, RequestOptions requestOptions) {
+ return this.rawClient.list(id, requestOptions).body();
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CreateActionModuleVersionResponseContent create(String id) {
+ return this.rawClient.create(id).body();
+ }
+
+ /**
+ * Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
+ */
+ public CreateActionModuleVersionResponseContent create(String id, RequestOptions requestOptions) {
+ return this.rawClient.create(id, requestOptions).body();
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public GetActionModuleVersionResponseContent get(String id, String versionId) {
+ return this.rawClient.get(id, versionId).body();
+ }
+
+ /**
+ * Retrieve the details of a specific, immutable version of an Actions Module.
+ */
+ public GetActionModuleVersionResponseContent get(String id, String versionId, RequestOptions requestOptions) {
+ return this.rawClient.get(id, versionId, requestOptions).body();
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModuleActionsRequestParameters.java b/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModuleActionsRequestParameters.java
new file mode 100644
index 00000000..363e8755
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModuleActionsRequestParameters.java
@@ -0,0 +1,178 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.types;
+
+import com.auth0.client.mgmt.core.Nullable;
+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;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = GetActionModuleActionsRequestParameters.Builder.class)
+public final class GetActionModuleActionsRequestParameters {
+ private final OptionalNullable page;
+
+ private final OptionalNullable perPage;
+
+ private final Map additionalProperties;
+
+ private GetActionModuleActionsRequestParameters(
+ OptionalNullable page,
+ OptionalNullable perPage,
+ Map additionalProperties) {
+ this.page = page;
+ this.perPage = perPage;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Page index of the results to return. First page is 0.
+ */
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("page")
+ public OptionalNullable getPage() {
+ return page;
+ }
+
+ /**
+ * @return Number of results per page.
+ */
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("per_page")
+ public OptionalNullable getPerPage() {
+ return perPage;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof GetActionModuleActionsRequestParameters
+ && equalTo((GetActionModuleActionsRequestParameters) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(GetActionModuleActionsRequestParameters other) {
+ return page.equals(other.page) && perPage.equals(other.perPage);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.page, this.perPage);
+ }
+
+ @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 page = OptionalNullable.absent();
+
+ private OptionalNullable perPage = OptionalNullable.absent();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(GetActionModuleActionsRequestParameters other) {
+ page(other.getPage());
+ perPage(other.getPerPage());
+ return this;
+ }
+
+ /**
+ * Page index of the results to return. First page is 0.
+ */
+ @JsonSetter(value = "page", nulls = Nulls.SKIP)
+ public Builder page(OptionalNullable page) {
+ this.page = page;
+ return this;
+ }
+
+ public Builder page(Integer page) {
+ this.page = OptionalNullable.of(page);
+ return this;
+ }
+
+ public Builder page(Optional page) {
+ if (page.isPresent()) {
+ this.page = OptionalNullable.of(page.get());
+ } else {
+ this.page = OptionalNullable.absent();
+ }
+ return this;
+ }
+
+ public Builder page(Nullable page) {
+ if (page.isNull()) {
+ this.page = OptionalNullable.ofNull();
+ } else if (page.isEmpty()) {
+ this.page = OptionalNullable.absent();
+ } else {
+ this.page = OptionalNullable.of(page.get());
+ }
+ return this;
+ }
+
+ /**
+ * Number of results per page.
+ */
+ @JsonSetter(value = "per_page", nulls = Nulls.SKIP)
+ public Builder perPage(OptionalNullable perPage) {
+ this.perPage = perPage;
+ return this;
+ }
+
+ public Builder perPage(Integer perPage) {
+ this.perPage = OptionalNullable.of(perPage);
+ return this;
+ }
+
+ public Builder perPage(Optional perPage) {
+ if (perPage.isPresent()) {
+ this.perPage = OptionalNullable.of(perPage.get());
+ } else {
+ this.perPage = OptionalNullable.absent();
+ }
+ return this;
+ }
+
+ public Builder perPage(Nullable perPage) {
+ if (perPage.isNull()) {
+ this.perPage = OptionalNullable.ofNull();
+ } else if (perPage.isEmpty()) {
+ this.perPage = OptionalNullable.absent();
+ } else {
+ this.perPage = OptionalNullable.of(perPage.get());
+ }
+ return this;
+ }
+
+ public GetActionModuleActionsRequestParameters build() {
+ return new GetActionModuleActionsRequestParameters(page, perPage, additionalProperties);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModulesRequestParameters.java b/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModulesRequestParameters.java
new file mode 100644
index 00000000..1c3fdddf
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/types/GetActionModulesRequestParameters.java
@@ -0,0 +1,177 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.types;
+
+import com.auth0.client.mgmt.core.Nullable;
+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;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = GetActionModulesRequestParameters.Builder.class)
+public final class GetActionModulesRequestParameters {
+ private final OptionalNullable page;
+
+ private final OptionalNullable perPage;
+
+ private final Map additionalProperties;
+
+ private GetActionModulesRequestParameters(
+ OptionalNullable page,
+ OptionalNullable perPage,
+ Map additionalProperties) {
+ this.page = page;
+ this.perPage = perPage;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Page index of the results to return. First page is 0.
+ */
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("page")
+ public OptionalNullable getPage() {
+ return page;
+ }
+
+ /**
+ * @return Number of results per page. Paging is disabled if parameter not sent.
+ */
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("per_page")
+ public OptionalNullable getPerPage() {
+ return perPage;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof GetActionModulesRequestParameters && equalTo((GetActionModulesRequestParameters) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(GetActionModulesRequestParameters other) {
+ return page.equals(other.page) && perPage.equals(other.perPage);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.page, this.perPage);
+ }
+
+ @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 page = OptionalNullable.absent();
+
+ private OptionalNullable perPage = OptionalNullable.absent();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(GetActionModulesRequestParameters other) {
+ page(other.getPage());
+ perPage(other.getPerPage());
+ return this;
+ }
+
+ /**
+ * Page index of the results to return. First page is 0.
+ */
+ @JsonSetter(value = "page", nulls = Nulls.SKIP)
+ public Builder page(OptionalNullable page) {
+ this.page = page;
+ return this;
+ }
+
+ public Builder page(Integer page) {
+ this.page = OptionalNullable.of(page);
+ return this;
+ }
+
+ public Builder page(Optional page) {
+ if (page.isPresent()) {
+ this.page = OptionalNullable.of(page.get());
+ } else {
+ this.page = OptionalNullable.absent();
+ }
+ return this;
+ }
+
+ public Builder page(Nullable page) {
+ if (page.isNull()) {
+ this.page = OptionalNullable.ofNull();
+ } else if (page.isEmpty()) {
+ this.page = OptionalNullable.absent();
+ } else {
+ this.page = OptionalNullable.of(page.get());
+ }
+ return this;
+ }
+
+ /**
+ * Number of results per page. Paging is disabled if parameter not sent.
+ */
+ @JsonSetter(value = "per_page", nulls = Nulls.SKIP)
+ public Builder perPage(OptionalNullable perPage) {
+ this.perPage = perPage;
+ return this;
+ }
+
+ public Builder perPage(Integer perPage) {
+ this.perPage = OptionalNullable.of(perPage);
+ return this;
+ }
+
+ public Builder perPage(Optional perPage) {
+ if (perPage.isPresent()) {
+ this.perPage = OptionalNullable.of(perPage.get());
+ } else {
+ this.perPage = OptionalNullable.absent();
+ }
+ return this;
+ }
+
+ public Builder perPage(Nullable perPage) {
+ if (perPage.isNull()) {
+ this.perPage = OptionalNullable.ofNull();
+ } else if (perPage.isEmpty()) {
+ this.perPage = OptionalNullable.absent();
+ } else {
+ this.perPage = OptionalNullable.of(perPage.get());
+ }
+ return this;
+ }
+
+ public GetActionModulesRequestParameters build() {
+ return new GetActionModulesRequestParameters(page, perPage, additionalProperties);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/connections/AsyncDirectoryProvisioningClient.java b/src/main/java/com/auth0/client/mgmt/connections/AsyncDirectoryProvisioningClient.java
index 081890a0..75de74fe 100644
--- a/src/main/java/com/auth0/client/mgmt/connections/AsyncDirectoryProvisioningClient.java
+++ b/src/main/java/com/auth0/client/mgmt/connections/AsyncDirectoryProvisioningClient.java
@@ -4,12 +4,15 @@
package com.auth0.client.mgmt.connections;
import com.auth0.client.mgmt.connections.directoryprovisioning.AsyncSynchronizationsClient;
+import com.auth0.client.mgmt.connections.types.ListDirectoryProvisioningsRequestParameters;
import com.auth0.client.mgmt.core.ClientOptions;
import com.auth0.client.mgmt.core.OptionalNullable;
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.types.CreateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.DirectoryProvisioning;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningDefaultMappingResponseContent;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningResponseContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningRequestContent;
@@ -37,6 +40,29 @@ public AsyncRawDirectoryProvisioningClient withRawResponse() {
return this.rawClient;
}
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture> list() {
+ return this.rawClient.list().thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture> list(
+ ListDirectoryProvisioningsRequestParameters request) {
+ return this.rawClient.list(request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture> list(
+ ListDirectoryProvisioningsRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Retrieve the directory provisioning configuration of a connection.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/connections/AsyncRawDirectoryProvisioningClient.java b/src/main/java/com/auth0/client/mgmt/connections/AsyncRawDirectoryProvisioningClient.java
index 4583cc2f..c117f49b 100644
--- a/src/main/java/com/auth0/client/mgmt/connections/AsyncRawDirectoryProvisioningClient.java
+++ b/src/main/java/com/auth0/client/mgmt/connections/AsyncRawDirectoryProvisioningClient.java
@@ -3,6 +3,7 @@
*/
package com.auth0.client.mgmt.connections;
+import com.auth0.client.mgmt.connections.types.ListDirectoryProvisioningsRequestParameters;
import com.auth0.client.mgmt.core.ClientOptions;
import com.auth0.client.mgmt.core.ManagementApiException;
import com.auth0.client.mgmt.core.ManagementApiHttpResponse;
@@ -10,7 +11,9 @@
import com.auth0.client.mgmt.core.MediaTypes;
import com.auth0.client.mgmt.core.ObjectMappers;
import com.auth0.client.mgmt.core.OptionalNullable;
+import com.auth0.client.mgmt.core.QueryStringMapper;
import com.auth0.client.mgmt.core.RequestOptions;
+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;
@@ -19,13 +22,18 @@
import com.auth0.client.mgmt.errors.UnauthorizedError;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.DirectoryProvisioning;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningDefaultMappingResponseContent;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.ListDirectoryProvisioningsResponseContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningResponseContent;
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;
@@ -44,6 +52,118 @@ public AsyncRawDirectoryProvisioningClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture>> list() {
+ return list(ListDirectoryProvisioningsRequestParameters.builder().build());
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture>> list(
+ ListDirectoryProvisioningsRequestParameters request) {
+ return list(request, null);
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public CompletableFuture>> list(
+ ListDirectoryProvisioningsRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("connections-directory-provisionings");
+ if (!request.getFrom().isAbsent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "from", request.getFrom().orElse(null), false);
+ }
+ QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false);
+ 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);
+ }
+ 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()) {
+ ListDirectoryProvisioningsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, ListDirectoryProvisioningsResponseContent.class);
+ Optional startingAfter = parsedResponse.getNext();
+ ListDirectoryProvisioningsRequestParameters nextRequest =
+ ListDirectoryProvisioningsRequestParameters.builder()
+ .from(request)
+ .from(startingAfter)
+ .build();
+ List result = parsedResponse.getDirectoryProvisionings();
+ 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 (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 the directory provisioning configuration of a connection.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/connections/DirectoryProvisioningClient.java b/src/main/java/com/auth0/client/mgmt/connections/DirectoryProvisioningClient.java
index 84eba9b0..8acf645d 100644
--- a/src/main/java/com/auth0/client/mgmt/connections/DirectoryProvisioningClient.java
+++ b/src/main/java/com/auth0/client/mgmt/connections/DirectoryProvisioningClient.java
@@ -4,12 +4,15 @@
package com.auth0.client.mgmt.connections;
import com.auth0.client.mgmt.connections.directoryprovisioning.SynchronizationsClient;
+import com.auth0.client.mgmt.connections.types.ListDirectoryProvisioningsRequestParameters;
import com.auth0.client.mgmt.core.ClientOptions;
import com.auth0.client.mgmt.core.OptionalNullable;
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.types.CreateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.DirectoryProvisioning;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningDefaultMappingResponseContent;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningResponseContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningRequestContent;
@@ -36,6 +39,28 @@ public RawDirectoryProvisioningClient withRawResponse() {
return this.rawClient;
}
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public SyncPagingIterable list() {
+ return this.rawClient.list().body();
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public SyncPagingIterable list(ListDirectoryProvisioningsRequestParameters request) {
+ return this.rawClient.list(request).body();
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public SyncPagingIterable list(
+ ListDirectoryProvisioningsRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.list(request, requestOptions).body();
+ }
+
/**
* Retrieve the directory provisioning configuration of a connection.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/connections/RawDirectoryProvisioningClient.java b/src/main/java/com/auth0/client/mgmt/connections/RawDirectoryProvisioningClient.java
index 60df8df9..794586fa 100644
--- a/src/main/java/com/auth0/client/mgmt/connections/RawDirectoryProvisioningClient.java
+++ b/src/main/java/com/auth0/client/mgmt/connections/RawDirectoryProvisioningClient.java
@@ -3,6 +3,7 @@
*/
package com.auth0.client.mgmt.connections;
+import com.auth0.client.mgmt.connections.types.ListDirectoryProvisioningsRequestParameters;
import com.auth0.client.mgmt.core.ClientOptions;
import com.auth0.client.mgmt.core.ManagementApiException;
import com.auth0.client.mgmt.core.ManagementApiHttpResponse;
@@ -10,7 +11,9 @@
import com.auth0.client.mgmt.core.MediaTypes;
import com.auth0.client.mgmt.core.ObjectMappers;
import com.auth0.client.mgmt.core.OptionalNullable;
+import com.auth0.client.mgmt.core.QueryStringMapper;
import com.auth0.client.mgmt.core.RequestOptions;
+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;
@@ -19,12 +22,16 @@
import com.auth0.client.mgmt.errors.UnauthorizedError;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.CreateDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.DirectoryProvisioning;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningDefaultMappingResponseContent;
import com.auth0.client.mgmt.types.GetDirectoryProvisioningResponseContent;
+import com.auth0.client.mgmt.types.ListDirectoryProvisioningsResponseContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningRequestContent;
import com.auth0.client.mgmt.types.UpdateDirectoryProvisioningResponseContent;
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;
@@ -40,6 +47,90 @@ public RawDirectoryProvisioningClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public ManagementApiHttpResponse> list() {
+ return list(ListDirectoryProvisioningsRequestParameters.builder().build());
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public ManagementApiHttpResponse> list(
+ ListDirectoryProvisioningsRequestParameters request) {
+ return list(request, null);
+ }
+
+ /**
+ * Retrieve a list of directory provisioning configurations of a tenant.
+ */
+ public ManagementApiHttpResponse> list(
+ ListDirectoryProvisioningsRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("connections-directory-provisionings");
+ if (!request.getFrom().isAbsent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "from", request.getFrom().orElse(null), false);
+ }
+ QueryStringMapper.addQueryParameter(httpUrl, "take", request.getTake().orElse(50), false);
+ 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);
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ ListDirectoryProvisioningsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, ListDirectoryProvisioningsResponseContent.class);
+ Optional startingAfter = parsedResponse.getNext();
+ ListDirectoryProvisioningsRequestParameters nextRequest =
+ ListDirectoryProvisioningsRequestParameters.builder()
+ .from(request)
+ .from(startingAfter)
+ .build();
+ List result = parsedResponse.getDirectoryProvisionings();
+ 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 (IOException e) {
+ throw new ManagementException("Network error executing HTTP request", e);
+ }
+ }
+
/**
* Retrieve the directory provisioning configuration of a connection.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/connections/types/ListDirectoryProvisioningsRequestParameters.java b/src/main/java/com/auth0/client/mgmt/connections/types/ListDirectoryProvisioningsRequestParameters.java
new file mode 100644
index 00000000..c2f5a05b
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/connections/types/ListDirectoryProvisioningsRequestParameters.java
@@ -0,0 +1,185 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.connections.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 = ListDirectoryProvisioningsRequestParameters.Builder.class)
+public final class ListDirectoryProvisioningsRequestParameters {
+ private final OptionalNullable from;
+
+ private final OptionalNullable take;
+
+ private final Map additionalProperties;
+
+ private ListDirectoryProvisioningsRequestParameters(
+ OptionalNullable from, OptionalNullable take, Map additionalProperties) {
+ this.from = from;
+ this.take = take;
+ 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 results per page. Defaults to 50.
+ */
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("take")
+ public OptionalNullable getTake() {
+ return take;
+ }
+
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("from")
+ private OptionalNullable _getFrom() {
+ return from;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListDirectoryProvisioningsRequestParameters
+ && equalTo((ListDirectoryProvisioningsRequestParameters) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListDirectoryProvisioningsRequestParameters other) {
+ return from.equals(other.from) && take.equals(other.take);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.from, this.take);
+ }
+
+ @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();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ListDirectoryProvisioningsRequestParameters other) {
+ from(other.getFrom());
+ take(other.getTake());
+ 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 results per page. Defaults to 50.
+ */
+ @JsonSetter(value = "take", nulls = Nulls.SKIP)
+ public Builder take(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;
+ }
+
+ public ListDirectoryProvisioningsRequestParameters build() {
+ return new ListDirectoryProvisioningsRequestParameters(from, take, additionalProperties);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/errors/PreconditionFailedError.java b/src/main/java/com/auth0/client/mgmt/errors/PreconditionFailedError.java
new file mode 100644
index 00000000..e3db2599
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/errors/PreconditionFailedError.java
@@ -0,0 +1,32 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.errors;
+
+import com.auth0.client.mgmt.core.ManagementApiException;
+import okhttp3.Response;
+
+public final class PreconditionFailedError extends ManagementApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final Object body;
+
+ public PreconditionFailedError(Object body) {
+ super("PreconditionFailedError", 412, body);
+ this.body = body;
+ }
+
+ public PreconditionFailedError(Object body, Response rawResponse) {
+ super("PreconditionFailedError", 412, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @java.lang.Override
+ public Object body() {
+ return this.body;
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/eventstreams/types/CreateEventStreamRedeliveryRequestContent.java b/src/main/java/com/auth0/client/mgmt/eventstreams/types/CreateEventStreamRedeliveryRequestContent.java
index a076ccb1..04e89961 100644
--- a/src/main/java/com/auth0/client/mgmt/eventstreams/types/CreateEventStreamRedeliveryRequestContent.java
+++ b/src/main/java/com/auth0/client/mgmt/eventstreams/types/CreateEventStreamRedeliveryRequestContent.java
@@ -4,6 +4,7 @@
package com.auth0.client.mgmt.eventstreams.types;
import com.auth0.client.mgmt.core.ObjectMappers;
+import com.auth0.client.mgmt.types.EventStreamDeliveryStatusEnum;
import com.auth0.client.mgmt.types.EventStreamEventTypeEnum;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
@@ -27,7 +28,7 @@ public final class CreateEventStreamRedeliveryRequestContent {
private final Optional dateTo;
- private final Optional> statuses;
+ private final Optional> statuses;
private final Optional> eventTypes;
@@ -36,7 +37,7 @@ public final class CreateEventStreamRedeliveryRequestContent {
private CreateEventStreamRedeliveryRequestContent(
Optional dateFrom,
Optional dateTo,
- Optional> statuses,
+ Optional> statuses,
Optional> eventTypes,
Map additionalProperties) {
this.dateFrom = dateFrom;
@@ -66,7 +67,7 @@ public Optional getDateTo() {
* @return Filter by status
*/
@JsonProperty("statuses")
- public Optional> getStatuses() {
+ public Optional> getStatuses() {
return statuses;
}
@@ -117,7 +118,7 @@ public static final class Builder {
private Optional dateTo = Optional.empty();
- private Optional> statuses = Optional.empty();
+ private Optional> statuses = Optional.empty();
private Optional> eventTypes = Optional.empty();
@@ -166,12 +167,12 @@ public Builder dateTo(OffsetDateTime dateTo) {
* Filter by status
*/
@JsonSetter(value = "statuses", nulls = Nulls.SKIP)
- public Builder statuses(Optional> statuses) {
+ public Builder statuses(Optional> statuses) {
this.statuses = statuses;
return this;
}
- public Builder statuses(List statuses) {
+ public Builder statuses(List statuses) {
this.statuses = Optional.ofNullable(statuses);
return this;
}
diff --git a/src/main/java/com/auth0/client/mgmt/flows/types/ExecutionsGetRequest.java b/src/main/java/com/auth0/client/mgmt/flows/types/ExecutionsGetRequest.java
index 63b19089..e15dc76d 100644
--- a/src/main/java/com/auth0/client/mgmt/flows/types/ExecutionsGetRequest.java
+++ b/src/main/java/com/auth0/client/mgmt/flows/types/ExecutionsGetRequest.java
@@ -25,11 +25,12 @@
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExecutionsGetRequest.Builder.class)
public final class ExecutionsGetRequest {
- private final Optional> hydrate;
+ private final Optional> hydrate;
private final Map