Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
538 changes: 464 additions & 74 deletions reference.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
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.eventstreams.AsyncDeliveriesClient;
import com.auth0.client.mgmt.eventstreams.AsyncRedeliveriesClient;
import com.auth0.client.mgmt.types.CreateEventStreamResponseContent;
import com.auth0.client.mgmt.types.CreateEventStreamTestEventRequestContent;
import com.auth0.client.mgmt.types.CreateEventStreamTestEventResponseContent;
import com.auth0.client.mgmt.types.EventStreamResponseContent;
import com.auth0.client.mgmt.types.EventStreamsCreateRequest;
import com.auth0.client.mgmt.types.GetEventStreamResponseContent;
import com.auth0.client.mgmt.types.ListEventStreamsRequestParameters;
import com.auth0.client.mgmt.types.ListEventStreamsResponseContent;
import com.auth0.client.mgmt.types.UpdateEventStreamRequestContent;
import com.auth0.client.mgmt.types.UpdateEventStreamResponseContent;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -43,15 +44,16 @@ public AsyncRawEventStreamsClient withRawResponse() {
return this.rawClient;
}

public CompletableFuture<ListEventStreamsResponseContent> list() {
public CompletableFuture<SyncPagingIterable<EventStreamResponseContent>> list() {
return this.rawClient.list().thenApply(response -> response.body());
}

public CompletableFuture<ListEventStreamsResponseContent> list(ListEventStreamsRequestParameters request) {
public CompletableFuture<SyncPagingIterable<EventStreamResponseContent>> list(
ListEventStreamsRequestParameters request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}

public CompletableFuture<ListEventStreamsResponseContent> list(
public CompletableFuture<SyncPagingIterable<EventStreamResponseContent>> list(
ListEventStreamsRequestParameters request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}
Expand Down
76 changes: 76 additions & 0 deletions src/main/java/com/auth0/client/mgmt/AsyncGroupsClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.auth0.client.mgmt;

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.groups.AsyncMembersClient;
import com.auth0.client.mgmt.types.GetGroupResponseContent;
import com.auth0.client.mgmt.types.Group;
import com.auth0.client.mgmt.types.ListGroupsRequestParameters;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

public class AsyncGroupsClient {
protected final ClientOptions clientOptions;

private final AsyncRawGroupsClient rawClient;

protected final Supplier<AsyncMembersClient> membersClient;

public AsyncGroupsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawGroupsClient(clientOptions);
this.membersClient = Suppliers.memoize(() -> new AsyncMembersClient(clientOptions));
}

/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawGroupsClient withRawResponse() {
return this.rawClient;
}

/**
* List all groups in your tenant.
*/
public CompletableFuture<SyncPagingIterable<Group>> list() {
return this.rawClient.list().thenApply(response -> response.body());
}

/**
* List all groups in your tenant.
*/
public CompletableFuture<SyncPagingIterable<Group>> list(ListGroupsRequestParameters request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}

/**
* List all groups in your tenant.
*/
public CompletableFuture<SyncPagingIterable<Group>> list(
ListGroupsRequestParameters request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}

/**
* Retrieve a group by its ID.
*/
public CompletableFuture<GetGroupResponseContent> get(String id) {
return this.rawClient.get(id).thenApply(response -> response.body());
}

/**
* Retrieve a group by its ID.
*/
public CompletableFuture<GetGroupResponseContent> get(String id, RequestOptions requestOptions) {
return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
}

public AsyncMembersClient members() {
return this.membersClient.get();
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/auth0/client/mgmt/AsyncManagementApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class AsyncManagementApi {

protected final Supplier<AsyncUserGrantsClient> userGrantsClient;

protected final Supplier<AsyncGroupsClient> groupsClient;

protected final Supplier<AsyncHooksClient> hooksClient;

protected final Supplier<AsyncJobsClient> jobsClient;
Expand Down Expand Up @@ -117,6 +119,7 @@ public AsyncManagementApi(ClientOptions clientOptions) {
this.flowsClient = Suppliers.memoize(() -> new AsyncFlowsClient(clientOptions));
this.formsClient = Suppliers.memoize(() -> new AsyncFormsClient(clientOptions));
this.userGrantsClient = Suppliers.memoize(() -> new AsyncUserGrantsClient(clientOptions));
this.groupsClient = Suppliers.memoize(() -> new AsyncGroupsClient(clientOptions));
this.hooksClient = Suppliers.memoize(() -> new AsyncHooksClient(clientOptions));
this.jobsClient = Suppliers.memoize(() -> new AsyncJobsClient(clientOptions));
this.logStreamsClient = Suppliers.memoize(() -> new AsyncLogStreamsClient(clientOptions));
Expand Down Expand Up @@ -200,6 +203,10 @@ public AsyncUserGrantsClient userGrants() {
return this.userGrantsClient.get();
}

public AsyncGroupsClient groups() {
return this.groupsClient.get();
}

public AsyncHooksClient hooks() {
return this.hooksClient.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -20,6 +21,7 @@
import com.auth0.client.mgmt.types.CreateEventStreamResponseContent;
import com.auth0.client.mgmt.types.CreateEventStreamTestEventRequestContent;
import com.auth0.client.mgmt.types.CreateEventStreamTestEventResponseContent;
import com.auth0.client.mgmt.types.EventStreamResponseContent;
import com.auth0.client.mgmt.types.EventStreamsCreateRequest;
import com.auth0.client.mgmt.types.GetEventStreamResponseContent;
import com.auth0.client.mgmt.types.ListEventStreamsRequestParameters;
Expand All @@ -28,7 +30,11 @@
import com.auth0.client.mgmt.types.UpdateEventStreamResponseContent;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.Collections;
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;
Expand All @@ -47,16 +53,16 @@ public AsyncRawEventStreamsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}

public CompletableFuture<ManagementApiHttpResponse<ListEventStreamsResponseContent>> list() {
public CompletableFuture<ManagementApiHttpResponse<SyncPagingIterable<EventStreamResponseContent>>> list() {
return list(ListEventStreamsRequestParameters.builder().build());
}

public CompletableFuture<ManagementApiHttpResponse<ListEventStreamsResponseContent>> list(
public CompletableFuture<ManagementApiHttpResponse<SyncPagingIterable<EventStreamResponseContent>>> list(
ListEventStreamsRequestParameters request) {
return list(request, null);
}

public CompletableFuture<ManagementApiHttpResponse<ListEventStreamsResponseContent>> list(
public CompletableFuture<ManagementApiHttpResponse<SyncPagingIterable<EventStreamResponseContent>>> list(
ListEventStreamsRequestParameters request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
Expand All @@ -76,17 +82,34 @@ public CompletableFuture<ManagementApiHttpResponse<ListEventStreamsResponseConte
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ManagementApiHttpResponse<ListEventStreamsResponseContent>> future =
CompletableFuture<ManagementApiHttpResponse<SyncPagingIterable<EventStreamResponseContent>>> 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()) {
ListEventStreamsResponseContent parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
responseBodyString, ListEventStreamsResponseContent.class);
Optional<String> startingAfter = parsedResponse.getNext();
ListEventStreamsRequestParameters nextRequest = ListEventStreamsRequestParameters.builder()
.from(request)
.from(startingAfter)
.build();
List<EventStreamResponseContent> result =
parsedResponse.getEventStreams().orElse(Collections.emptyList());
future.complete(new ManagementApiHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBodyString, ListEventStreamsResponseContent.class),
new SyncPagingIterable<EventStreamResponseContent>(
startingAfter.isPresent(), result, parsedResponse, () -> {
try {
return list(nextRequest, requestOptions)
.get()
.body();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}),
response));
return;
}
Expand Down
Loading
Loading