-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added ListUsersRequest CHANGELOG_BEGIN CHANGELOG_END * Add code change CHANGELOG_BEGIN Allow to list all users by providing page token and page size in the Java bindings CHANGELOG_END * added test cases to cover the new method
- Loading branch information
1 parent
62c64c6
commit a516be7
Showing
4 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ge-support/java/bindings/src/main/java/com/daml/ledger/javaapi/data/ListUsersRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.javaapi.data; | ||
|
||
import com.daml.ledger.api.v1.admin.UserManagementServiceOuterClass; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
|
||
public final class ListUsersRequest { | ||
|
||
private final Optional<String> pageToken; | ||
|
||
private final Integer pageSize; | ||
|
||
public ListUsersRequest(@NonNull Optional<String> pageToken, @NonNull Integer pageSize) { | ||
this.pageToken = pageToken; | ||
this.pageSize = pageSize; | ||
} | ||
|
||
public Optional<String> getPageToken() { | ||
return pageToken; | ||
} | ||
|
||
public Integer getPageSize() { | ||
return pageSize; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ListUsersRequest{" + "pageToken=" + pageToken + ", pageSize=" + pageSize + '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ListUsersRequest that = (ListUsersRequest) o; | ||
return Objects.equals(pageToken, that.pageToken) && Objects.equals(pageSize, that.pageSize); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(pageToken, pageSize); | ||
} | ||
|
||
public UserManagementServiceOuterClass.ListUsersRequest toProto() { | ||
UserManagementServiceOuterClass.ListUsersRequest.Builder builder = | ||
UserManagementServiceOuterClass.ListUsersRequest.newBuilder(); | ||
pageToken.ifPresent(builder::setPageToken); | ||
builder.setPageSize(pageSize); | ||
return builder.build(); | ||
} | ||
} |