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 0911c9ce9..b288b691b 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 67750ac80..9f698a3b2 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 6845e898f..db4021f68 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 000000000..3352e6f8d
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/AsyncModulesClient.java
@@ -0,0 +1,175 @@
+/**
+ * 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.CreateActionModuleRequestContent;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+import com.auth0.client.mgmt.actions.types.RollbackActionModuleRequestParameters;
+import com.auth0.client.mgmt.actions.types.UpdateActionModuleRequestContent;
+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(CreateActionModuleRequestContent request) {
+ return this.rawClient.create(request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CompletableFuture create(
+ CreateActionModuleRequestContent request, RequestOptions requestOptions) {
+ return this.rawClient.create(request, 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, UpdateActionModuleRequestContent request) {
+ return this.rawClient.update(id, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture update(
+ String id, UpdateActionModuleRequestContent request, RequestOptions requestOptions) {
+ return this.rawClient.update(id, request, 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, RollbackActionModuleRequestParameters request) {
+ return this.rawClient.rollback(id, request).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, RollbackActionModuleRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.rollback(id, request, 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 000000000..f0c070a23
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/AsyncRawModulesClient.java
@@ -0,0 +1,776 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.types.CreateActionModuleRequestContent;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+import com.auth0.client.mgmt.actions.types.RollbackActionModuleRequestParameters;
+import com.auth0.client.mgmt.actions.types.UpdateActionModuleRequestContent;
+import com.auth0.client.mgmt.core.ClientOptions;
+import com.auth0.client.mgmt.core.ManagementApiException;
+import com.auth0.client.mgmt.core.ManagementApiHttpResponse;
+import com.auth0.client.mgmt.core.ManagementException;
+import com.auth0.client.mgmt.core.MediaTypes;
+import com.auth0.client.mgmt.core.ObjectMappers;
+import com.auth0.client.mgmt.core.QueryStringMapper;
+import com.auth0.client.mgmt.core.RequestOptions;
+import com.auth0.client.mgmt.core.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(
+ CreateActionModuleRequestContent request) {
+ return create(request, null);
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CompletableFuture> create(
+ CreateActionModuleRequestContent request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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, UpdateActionModuleRequestContent.builder().build());
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture> update(
+ String id, UpdateActionModuleRequestContent request) {
+ return update(id, request, null);
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public CompletableFuture> update(
+ String id, UpdateActionModuleRequestContent request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("PATCH", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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, RollbackActionModuleRequestParameters request) {
+ return rollback(id, request, 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, RollbackActionModuleRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("rollback")
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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 000000000..ab5b9c43f
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/ModulesClient.java
@@ -0,0 +1,172 @@
+/**
+ * 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.CreateActionModuleRequestContent;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+import com.auth0.client.mgmt.actions.types.RollbackActionModuleRequestParameters;
+import com.auth0.client.mgmt.actions.types.UpdateActionModuleRequestContent;
+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(CreateActionModuleRequestContent request) {
+ return this.rawClient.create(request).body();
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public CreateActionModuleResponseContent create(
+ CreateActionModuleRequestContent request, RequestOptions requestOptions) {
+ return this.rawClient.create(request, 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, UpdateActionModuleRequestContent request) {
+ return this.rawClient.update(id, request).body();
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public UpdateActionModuleResponseContent update(
+ String id, UpdateActionModuleRequestContent request, RequestOptions requestOptions) {
+ return this.rawClient.update(id, request, 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, RollbackActionModuleRequestParameters request) {
+ return this.rawClient.rollback(id, request).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, RollbackActionModuleRequestParameters request, RequestOptions requestOptions) {
+ return this.rawClient.rollback(id, request, 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 000000000..e212f80b9
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/RawModulesClient.java
@@ -0,0 +1,582 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions;
+
+import com.auth0.client.mgmt.actions.types.CreateActionModuleRequestContent;
+import com.auth0.client.mgmt.actions.types.GetActionModuleActionsRequestParameters;
+import com.auth0.client.mgmt.actions.types.GetActionModulesRequestParameters;
+import com.auth0.client.mgmt.actions.types.RollbackActionModuleRequestParameters;
+import com.auth0.client.mgmt.actions.types.UpdateActionModuleRequestContent;
+import com.auth0.client.mgmt.core.ClientOptions;
+import com.auth0.client.mgmt.core.ManagementApiException;
+import com.auth0.client.mgmt.core.ManagementApiHttpResponse;
+import com.auth0.client.mgmt.core.ManagementException;
+import com.auth0.client.mgmt.core.MediaTypes;
+import com.auth0.client.mgmt.core.ObjectMappers;
+import com.auth0.client.mgmt.core.QueryStringMapper;
+import com.auth0.client.mgmt.core.RequestOptions;
+import com.auth0.client.mgmt.core.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(
+ CreateActionModuleRequestContent request) {
+ return create(request, null);
+ }
+
+ /**
+ * Create a new Actions Module for reusable code across actions.
+ */
+ public ManagementApiHttpResponse create(
+ CreateActionModuleRequestContent request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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, UpdateActionModuleRequestContent.builder().build());
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public ManagementApiHttpResponse update(
+ String id, UpdateActionModuleRequestContent request) {
+ return update(id, request, null);
+ }
+
+ /**
+ * Update properties of an existing Actions Module, such as code, dependencies, or secrets.
+ */
+ public ManagementApiHttpResponse update(
+ String id, UpdateActionModuleRequestContent request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("PATCH", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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, RollbackActionModuleRequestParameters request) {
+ return rollback(id, request, 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, RollbackActionModuleRequestParameters request, RequestOptions requestOptions) {
+ HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("actions/modules")
+ .addPathSegment(id)
+ .addPathSegments("rollback")
+ .build();
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
+ } catch (JsonProcessingException e) {
+ throw new ManagementException("Failed to serialize request", e);
+ }
+ Request okhttpRequest = new Request.Builder()
+ .url(httpUrl)
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json")
+ .build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ 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 000000000..5f3d9265d
--- /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 000000000..babd86139
--- /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 000000000..d84ee1139
--- /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 000000000..66561ad14
--- /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/CreateActionModuleRequestContent.java b/src/main/java/com/auth0/client/mgmt/actions/types/CreateActionModuleRequestContent.java
new file mode 100644
index 000000000..f2e77d219
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/types/CreateActionModuleRequestContent.java
@@ -0,0 +1,328 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.types;
+
+import com.auth0.client.mgmt.core.ObjectMappers;
+import com.auth0.client.mgmt.types.ActionModuleDependencyRequest;
+import com.auth0.client.mgmt.types.ActionModuleSecretRequest;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = CreateActionModuleRequestContent.Builder.class)
+public final class CreateActionModuleRequestContent {
+ private final String name;
+
+ private final String code;
+
+ private final Optional> secrets;
+
+ private final Optional> dependencies;
+
+ private final Optional apiVersion;
+
+ private final Optional publish;
+
+ private final Map additionalProperties;
+
+ private CreateActionModuleRequestContent(
+ String name,
+ String code,
+ Optional> secrets,
+ Optional> dependencies,
+ Optional apiVersion,
+ Optional publish,
+ Map additionalProperties) {
+ this.name = name;
+ this.code = code;
+ this.secrets = secrets;
+ this.dependencies = dependencies;
+ this.apiVersion = apiVersion;
+ this.publish = publish;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return The name of the action module.
+ */
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return The source code of the action module.
+ */
+ @JsonProperty("code")
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * @return The secrets to associate with the action module.
+ */
+ @JsonProperty("secrets")
+ public Optional> getSecrets() {
+ return secrets;
+ }
+
+ /**
+ * @return The npm dependencies of the action module.
+ */
+ @JsonProperty("dependencies")
+ public Optional> getDependencies() {
+ return dependencies;
+ }
+
+ /**
+ * @return The API version of the module.
+ */
+ @JsonProperty("api_version")
+ public Optional getApiVersion() {
+ return apiVersion;
+ }
+
+ /**
+ * @return Whether to publish the module immediately after creation.
+ */
+ @JsonProperty("publish")
+ public Optional getPublish() {
+ return publish;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof CreateActionModuleRequestContent && equalTo((CreateActionModuleRequestContent) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(CreateActionModuleRequestContent other) {
+ return name.equals(other.name)
+ && code.equals(other.code)
+ && secrets.equals(other.secrets)
+ && dependencies.equals(other.dependencies)
+ && apiVersion.equals(other.apiVersion)
+ && publish.equals(other.publish);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.name, this.code, this.secrets, this.dependencies, this.apiVersion, this.publish);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static NameStage builder() {
+ return new Builder();
+ }
+
+ public interface NameStage {
+ /**
+ * The name of the action module.
+ */
+ CodeStage name(@NotNull String name);
+
+ Builder from(CreateActionModuleRequestContent other);
+ }
+
+ public interface CodeStage {
+ /**
+ * The source code of the action module.
+ */
+ _FinalStage code(@NotNull String code);
+ }
+
+ public interface _FinalStage {
+ CreateActionModuleRequestContent build();
+
+ /**
+ * The secrets to associate with the action module.
+ */
+ _FinalStage secrets(Optional> secrets);
+
+ _FinalStage secrets(List secrets);
+
+ /**
+ * The npm dependencies of the action module.
+ */
+ _FinalStage dependencies(Optional> dependencies);
+
+ _FinalStage dependencies(List dependencies);
+
+ /**
+ * The API version of the module.
+ */
+ _FinalStage apiVersion(Optional apiVersion);
+
+ _FinalStage apiVersion(String apiVersion);
+
+ /**
+ * Whether to publish the module immediately after creation.
+ */
+ _FinalStage publish(Optional publish);
+
+ _FinalStage publish(Boolean publish);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements NameStage, CodeStage, _FinalStage {
+ private String name;
+
+ private String code;
+
+ private Optional publish = Optional.empty();
+
+ private Optional apiVersion = Optional.empty();
+
+ private Optional> dependencies = Optional.empty();
+
+ private Optional> secrets = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(CreateActionModuleRequestContent other) {
+ name(other.getName());
+ code(other.getCode());
+ secrets(other.getSecrets());
+ dependencies(other.getDependencies());
+ apiVersion(other.getApiVersion());
+ publish(other.getPublish());
+ return this;
+ }
+
+ /**
+ * The name of the action module.
+ * The name of the action module.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("name")
+ public CodeStage name(@NotNull String name) {
+ this.name = Objects.requireNonNull(name, "name must not be null");
+ return this;
+ }
+
+ /**
+ * The source code of the action module.
+ * The source code of the action module.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("code")
+ public _FinalStage code(@NotNull String code) {
+ this.code = Objects.requireNonNull(code, "code must not be null");
+ return this;
+ }
+
+ /**
+ * Whether to publish the module immediately after creation.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage publish(Boolean publish) {
+ this.publish = Optional.ofNullable(publish);
+ return this;
+ }
+
+ /**
+ * Whether to publish the module immediately after creation.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "publish", nulls = Nulls.SKIP)
+ public _FinalStage publish(Optional publish) {
+ this.publish = publish;
+ return this;
+ }
+
+ /**
+ * The API version of the module.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage apiVersion(String apiVersion) {
+ this.apiVersion = Optional.ofNullable(apiVersion);
+ return this;
+ }
+
+ /**
+ * The API version of the module.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "api_version", nulls = Nulls.SKIP)
+ public _FinalStage apiVersion(Optional apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ /**
+ * The npm dependencies of the action module.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage dependencies(List dependencies) {
+ this.dependencies = Optional.ofNullable(dependencies);
+ return this;
+ }
+
+ /**
+ * The npm dependencies of the action module.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "dependencies", nulls = Nulls.SKIP)
+ public _FinalStage dependencies(Optional> dependencies) {
+ this.dependencies = dependencies;
+ return this;
+ }
+
+ /**
+ * The secrets to associate with the action module.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage secrets(List secrets) {
+ this.secrets = Optional.ofNullable(secrets);
+ return this;
+ }
+
+ /**
+ * The secrets to associate with the action module.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "secrets", nulls = Nulls.SKIP)
+ public _FinalStage secrets(Optional> secrets) {
+ this.secrets = secrets;
+ return this;
+ }
+
+ @java.lang.Override
+ public CreateActionModuleRequestContent build() {
+ return new CreateActionModuleRequestContent(
+ name, code, secrets, dependencies, apiVersion, publish, additionalProperties);
+ }
+ }
+}
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 000000000..363e8755f
--- /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 000000000..1c3fdddfe
--- /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/actions/types/RollbackActionModuleRequestParameters.java b/src/main/java/com/auth0/client/mgmt/actions/types/RollbackActionModuleRequestParameters.java
new file mode 100644
index 000000000..dfd5cac48
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/types/RollbackActionModuleRequestParameters.java
@@ -0,0 +1,114 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.types;
+
+import com.auth0.client.mgmt.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = RollbackActionModuleRequestParameters.Builder.class)
+public final class RollbackActionModuleRequestParameters {
+ private final String moduleVersionId;
+
+ private final Map additionalProperties;
+
+ private RollbackActionModuleRequestParameters(String moduleVersionId, Map additionalProperties) {
+ this.moduleVersionId = moduleVersionId;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return The unique ID of the module version to roll back to.
+ */
+ @JsonProperty("module_version_id")
+ public String getModuleVersionId() {
+ return moduleVersionId;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof RollbackActionModuleRequestParameters
+ && equalTo((RollbackActionModuleRequestParameters) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(RollbackActionModuleRequestParameters other) {
+ return moduleVersionId.equals(other.moduleVersionId);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.moduleVersionId);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static ModuleVersionIdStage builder() {
+ return new Builder();
+ }
+
+ public interface ModuleVersionIdStage {
+ /**
+ * The unique ID of the module version to roll back to.
+ */
+ _FinalStage moduleVersionId(@NotNull String moduleVersionId);
+
+ Builder from(RollbackActionModuleRequestParameters other);
+ }
+
+ public interface _FinalStage {
+ RollbackActionModuleRequestParameters build();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder implements ModuleVersionIdStage, _FinalStage {
+ private String moduleVersionId;
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ @java.lang.Override
+ public Builder from(RollbackActionModuleRequestParameters other) {
+ moduleVersionId(other.getModuleVersionId());
+ return this;
+ }
+
+ /**
+ * The unique ID of the module version to roll back to.
+ * The unique ID of the module version to roll back to.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ @JsonSetter("module_version_id")
+ public _FinalStage moduleVersionId(@NotNull String moduleVersionId) {
+ this.moduleVersionId = Objects.requireNonNull(moduleVersionId, "moduleVersionId must not be null");
+ return this;
+ }
+
+ @java.lang.Override
+ public RollbackActionModuleRequestParameters build() {
+ return new RollbackActionModuleRequestParameters(moduleVersionId, additionalProperties);
+ }
+ }
+}
diff --git a/src/main/java/com/auth0/client/mgmt/actions/types/UpdateActionModuleRequestContent.java b/src/main/java/com/auth0/client/mgmt/actions/types/UpdateActionModuleRequestContent.java
new file mode 100644
index 000000000..0df1aa38c
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/actions/types/UpdateActionModuleRequestContent.java
@@ -0,0 +1,164 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.auth0.client.mgmt.actions.types;
+
+import com.auth0.client.mgmt.core.ObjectMappers;
+import com.auth0.client.mgmt.types.ActionModuleDependencyRequest;
+import com.auth0.client.mgmt.types.ActionModuleSecretRequest;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = UpdateActionModuleRequestContent.Builder.class)
+public final class UpdateActionModuleRequestContent {
+ private final Optional code;
+
+ private final Optional> secrets;
+
+ private final Optional> dependencies;
+
+ private final Map additionalProperties;
+
+ private UpdateActionModuleRequestContent(
+ Optional code,
+ Optional> secrets,
+ Optional> dependencies,
+ Map additionalProperties) {
+ this.code = code;
+ this.secrets = secrets;
+ this.dependencies = dependencies;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return The source code of the action module.
+ */
+ @JsonProperty("code")
+ public Optional getCode() {
+ return code;
+ }
+
+ /**
+ * @return The secrets to associate with the action module.
+ */
+ @JsonProperty("secrets")
+ public Optional> getSecrets() {
+ return secrets;
+ }
+
+ /**
+ * @return The npm dependencies of the action module.
+ */
+ @JsonProperty("dependencies")
+ public Optional> getDependencies() {
+ return dependencies;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof UpdateActionModuleRequestContent && equalTo((UpdateActionModuleRequestContent) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(UpdateActionModuleRequestContent other) {
+ return code.equals(other.code) && secrets.equals(other.secrets) && dependencies.equals(other.dependencies);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.code, this.secrets, this.dependencies);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional code = Optional.empty();
+
+ private Optional> secrets = Optional.empty();
+
+ private Optional> dependencies = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(UpdateActionModuleRequestContent other) {
+ code(other.getCode());
+ secrets(other.getSecrets());
+ dependencies(other.getDependencies());
+ return this;
+ }
+
+ /**
+ * The source code of the action module.
+ */
+ @JsonSetter(value = "code", nulls = Nulls.SKIP)
+ public Builder code(Optional code) {
+ this.code = code;
+ return this;
+ }
+
+ public Builder code(String code) {
+ this.code = Optional.ofNullable(code);
+ return this;
+ }
+
+ /**
+ * The secrets to associate with the action module.
+ */
+ @JsonSetter(value = "secrets", nulls = Nulls.SKIP)
+ public Builder secrets(Optional> secrets) {
+ this.secrets = secrets;
+ return this;
+ }
+
+ public Builder secrets(List secrets) {
+ this.secrets = Optional.ofNullable(secrets);
+ return this;
+ }
+
+ /**
+ * The npm dependencies of the action module.
+ */
+ @JsonSetter(value = "dependencies", nulls = Nulls.SKIP)
+ public Builder dependencies(Optional> dependencies) {
+ this.dependencies = dependencies;
+ return this;
+ }
+
+ public Builder dependencies(List dependencies) {
+ this.dependencies = Optional.ofNullable(dependencies);
+ return this;
+ }
+
+ public UpdateActionModuleRequestContent build() {
+ return new UpdateActionModuleRequestContent(code, secrets, dependencies, 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 081890a0d..75de74fe3 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 4583cc2f3..c117f49b0 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