From 7b23edd877036b3beb2e27250b3e59a034adb173 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Fri, 14 Jun 2024 11:23:35 +0100 Subject: [PATCH] chore!: remove excluded users from ListUsers response Co-authored-by: Will Vedder --- .openapi-generator/FILES | 2 - README.md | 3 - docs/ListUsersResponse.md | 1 - docs/ObjectOrUserset.md | 14 -- docs/OpenFgaApi.md | 4 +- .../java/dev/openfga/sdk/api/OpenFgaApi.java | 4 +- .../client/model/ClientListUsersResponse.java | 1 - .../sdk/api/model/ListUsersResponse.java | 58 +------ .../sdk/api/model/ObjectOrUserset.java | 164 ------------------ .../sdk/api/client/OpenFgaClientTest.java | 4 +- 10 files changed, 8 insertions(+), 247 deletions(-) delete mode 100644 docs/ObjectOrUserset.md delete mode 100644 src/main/java/dev/openfga/sdk/api/model/ObjectOrUserset.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index c0c1e87..7fb7f8d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -51,7 +51,6 @@ docs/Node.md docs/Nodes.md docs/NotFoundErrorCode.md docs/NullValue.md -docs/ObjectOrUserset.md docs/ObjectRelation.md docs/OpenFgaApi.md docs/PathUnknownErrorMessageResponse.md @@ -220,7 +219,6 @@ src/main/java/dev/openfga/sdk/api/model/Node.java src/main/java/dev/openfga/sdk/api/model/Nodes.java src/main/java/dev/openfga/sdk/api/model/NotFoundErrorCode.java src/main/java/dev/openfga/sdk/api/model/NullValue.java -src/main/java/dev/openfga/sdk/api/model/ObjectOrUserset.java src/main/java/dev/openfga/sdk/api/model/ObjectRelation.java src/main/java/dev/openfga/sdk/api/model/PathUnknownErrorMessageResponse.java src/main/java/dev/openfga/sdk/api/model/ReadAssertionsResponse.java diff --git a/README.md b/README.md index 8ee4462..bf83b4f 100644 --- a/README.md +++ b/README.md @@ -806,7 +806,6 @@ var options = new ClientListUsersOptions() var response = fgaClient.listUsers(request, options).get(); // response.getUsers() = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...] -// response.getExcludedUsers = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ] ``` #### Assertions @@ -973,8 +972,6 @@ public class Example { - [NullValue](https://github.com/openfga/java-sdk/blob/main/docs/NullValue.md) -- [ObjectOrUserset](https://github.com/openfga/java-sdk/blob/main/docs/ObjectOrUserset.md) - - [ObjectRelation](https://github.com/openfga/java-sdk/blob/main/docs/ObjectRelation.md) - [PathUnknownErrorMessageResponse](https://github.com/openfga/java-sdk/blob/main/docs/PathUnknownErrorMessageResponse.md) diff --git a/docs/ListUsersResponse.md b/docs/ListUsersResponse.md index 5da7fe1..96f58c4 100644 --- a/docs/ListUsersResponse.md +++ b/docs/ListUsersResponse.md @@ -8,7 +8,6 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**users** | [**List<User>**](User.md) | | | -|**excludedUsers** | [**List<ObjectOrUserset>**](ObjectOrUserset.md) | | | diff --git a/docs/ObjectOrUserset.md b/docs/ObjectOrUserset.md deleted file mode 100644 index 8b7c942..0000000 --- a/docs/ObjectOrUserset.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# ObjectOrUserset - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**_object** | [**FgaObject**](FgaObject.md) | | [optional] | -|**userset** | [**UsersetUser**](UsersetUser.md) | | [optional] | - - - diff --git a/docs/OpenFgaApi.md b/docs/OpenFgaApi.md index c98f138..4fc19af 100644 --- a/docs/OpenFgaApi.md +++ b/docs/OpenFgaApi.md @@ -1144,7 +1144,7 @@ No authorization required [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. -The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the `but not` operator, some results are marked as excluded from the main set of results. These exclusions are returned in the `excluded_users` property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. +The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. `user:*`), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. ### Example @@ -1218,7 +1218,7 @@ No authorization required [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. -The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the `but not` operator, some results are marked as excluded from the main set of results. These exclusions are returned in the `excluded_users` property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. +The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. `user:*`), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. ### Example diff --git a/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java b/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java index c4fc555..36fd059 100644 --- a/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java +++ b/src/main/java/dev/openfga/sdk/api/OpenFgaApi.java @@ -393,7 +393,7 @@ private CompletableFuture> listStores( /** * [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. - * The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the `but not` operator, some results are marked as excluded from the main set of results. These exclusions are returned in the `excluded_users` property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. + * The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. `user:*`), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. * @param storeId (required) * @param body (required) * @return CompletableFuture<ApiResponse<ListUsersResponse>> @@ -406,7 +406,7 @@ public CompletableFuture> listUsers(String storeI /** * [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. - * The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the `but not` operator, some results are marked as excluded from the main set of results. These exclusions are returned in the `excluded_users` property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. + * The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `--experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. `user:*`), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users. * @param storeId (required) * @param body (required) * @param configurationOverride Override the {@link Configuration} this OpenFgaApi was constructed with diff --git a/src/main/java/dev/openfga/sdk/api/client/model/ClientListUsersResponse.java b/src/main/java/dev/openfga/sdk/api/client/model/ClientListUsersResponse.java index 9288588..3f73bb6 100644 --- a/src/main/java/dev/openfga/sdk/api/client/model/ClientListUsersResponse.java +++ b/src/main/java/dev/openfga/sdk/api/client/model/ClientListUsersResponse.java @@ -28,7 +28,6 @@ public ClientListUsersResponse(ApiResponse apiResponse) { this.rawResponse = apiResponse.getRawResponse(); ListUsersResponse response = apiResponse.getData(); this.setUsers(response.getUsers()); - this.setExcludedUsers(response.getExcludedUsers()); } public int getStatusCode() { diff --git a/src/main/java/dev/openfga/sdk/api/model/ListUsersResponse.java b/src/main/java/dev/openfga/sdk/api/model/ListUsersResponse.java index ac4d732..9c3d815 100644 --- a/src/main/java/dev/openfga/sdk/api/model/ListUsersResponse.java +++ b/src/main/java/dev/openfga/sdk/api/model/ListUsersResponse.java @@ -23,14 +23,11 @@ /** * ListUsersResponse */ -@JsonPropertyOrder({ListUsersResponse.JSON_PROPERTY_USERS, ListUsersResponse.JSON_PROPERTY_EXCLUDED_USERS}) +@JsonPropertyOrder({ListUsersResponse.JSON_PROPERTY_USERS}) public class ListUsersResponse { public static final String JSON_PROPERTY_USERS = "users"; private List users = new ArrayList<>(); - public static final String JSON_PROPERTY_EXCLUDED_USERS = "excluded_users"; - private List excludedUsers = new ArrayList<>(); - public ListUsersResponse() {} public ListUsersResponse users(List users) { @@ -63,36 +60,6 @@ public void setUsers(List users) { this.users = users; } - public ListUsersResponse excludedUsers(List excludedUsers) { - this.excludedUsers = excludedUsers; - return this; - } - - public ListUsersResponse addExcludedUsersItem(ObjectOrUserset excludedUsersItem) { - if (this.excludedUsers == null) { - this.excludedUsers = new ArrayList<>(); - } - this.excludedUsers.add(excludedUsersItem); - return this; - } - - /** - * Get excludedUsers - * @return excludedUsers - **/ - @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_EXCLUDED_USERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getExcludedUsers() { - return excludedUsers; - } - - @JsonProperty(JSON_PROPERTY_EXCLUDED_USERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setExcludedUsers(List excludedUsers) { - this.excludedUsers = excludedUsers; - } - /** * Return true if this ListUsersResponse object is equal to o. */ @@ -105,13 +72,12 @@ public boolean equals(Object o) { return false; } ListUsersResponse listUsersResponse = (ListUsersResponse) o; - return Objects.equals(this.users, listUsersResponse.users) - && Objects.equals(this.excludedUsers, listUsersResponse.excludedUsers); + return Objects.equals(this.users, listUsersResponse.users); } @Override public int hashCode() { - return Objects.hash(users, excludedUsers); + return Objects.hash(users); } @Override @@ -119,7 +85,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ListUsersResponse {\n"); sb.append(" users: ").append(toIndentedString(users)).append("\n"); - sb.append(" excludedUsers: ").append(toIndentedString(excludedUsers)).append("\n"); sb.append("}"); return sb.toString(); } @@ -184,23 +149,6 @@ public String toUrlQueryString(String prefix) { } } - // add `excluded_users` to the URL query string - if (getExcludedUsers() != null) { - for (int i = 0; i < getExcludedUsers().size(); i++) { - if (getExcludedUsers().get(i) != null) { - joiner.add(getExcludedUsers() - .get(i) - .toUrlQueryString(String.format( - "%sexcluded_users%s%s", - prefix, - suffix, - "".equals(suffix) - ? "" - : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); - } - } - } - return joiner.toString(); } } diff --git a/src/main/java/dev/openfga/sdk/api/model/ObjectOrUserset.java b/src/main/java/dev/openfga/sdk/api/model/ObjectOrUserset.java deleted file mode 100644 index 9f9e2c9..0000000 --- a/src/main/java/dev/openfga/sdk/api/model/ObjectOrUserset.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * OpenFGA - * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. - * - * The version of the OpenAPI document: 1.x - * Contact: community@openfga.dev - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package dev.openfga.sdk.api.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.Objects; -import java.util.StringJoiner; - -/** - * ObjectOrUserset - */ -@JsonPropertyOrder({ObjectOrUserset.JSON_PROPERTY_OBJECT, ObjectOrUserset.JSON_PROPERTY_USERSET}) -public class ObjectOrUserset { - public static final String JSON_PROPERTY_OBJECT = "object"; - private FgaObject _object; - - public static final String JSON_PROPERTY_USERSET = "userset"; - private UsersetUser userset; - - public ObjectOrUserset() {} - - public ObjectOrUserset _object(FgaObject _object) { - this._object = _object; - return this; - } - - /** - * Get _object - * @return _object - **/ - @javax.annotation.Nullable - @JsonProperty(JSON_PROPERTY_OBJECT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public FgaObject getObject() { - return _object; - } - - @JsonProperty(JSON_PROPERTY_OBJECT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setObject(FgaObject _object) { - this._object = _object; - } - - public ObjectOrUserset userset(UsersetUser userset) { - this.userset = userset; - return this; - } - - /** - * Get userset - * @return userset - **/ - @javax.annotation.Nullable - @JsonProperty(JSON_PROPERTY_USERSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UsersetUser getUserset() { - return userset; - } - - @JsonProperty(JSON_PROPERTY_USERSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUserset(UsersetUser userset) { - this.userset = userset; - } - - /** - * Return true if this ObjectOrUserset object is equal to o. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ObjectOrUserset objectOrUserset = (ObjectOrUserset) o; - return Objects.equals(this._object, objectOrUserset._object) - && Objects.equals(this.userset, objectOrUserset.userset); - } - - @Override - public int hashCode() { - return Objects.hash(_object, userset); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ObjectOrUserset {\n"); - sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); - sb.append(" userset: ").append(toIndentedString(userset)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - /** - * Convert the instance into URL query string. - * - * @return URL query string - */ - public String toUrlQueryString() { - return toUrlQueryString(null); - } - - /** - * Convert the instance into URL query string. - * - * @param prefix prefix of the query string - * @return URL query string - */ - public String toUrlQueryString(String prefix) { - String suffix = ""; - String containerSuffix = ""; - String containerPrefix = ""; - if (prefix == null) { - // style=form, explode=true, e.g. /pet?name=cat&type=manx - prefix = ""; - } else { - // deepObject style e.g. /pet?id[name]=cat&id[type]=manx - prefix = prefix + "["; - suffix = "]"; - containerSuffix = "]"; - containerPrefix = "["; - } - - StringJoiner joiner = new StringJoiner("&"); - - // add `object` to the URL query string - if (getObject() != null) { - joiner.add(getObject().toUrlQueryString(prefix + "object" + suffix)); - } - - // add `userset` to the URL query string - if (getUserset() != null) { - joiner.add(getUserset().toUrlQueryString(prefix + "userset" + suffix)); - } - - return joiner.toString(); - } -} diff --git a/src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java b/src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java index 81453a0..7425cf6 100644 --- a/src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java +++ b/src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java @@ -2344,7 +2344,7 @@ public void listUsersTest() throws Exception { .withBody(is(expectedBody)) .doReturn( 200, - "{\"excluded_users\":null,\"users\":[{\"object\":{\"id\":\"81684243-9356-4421-8fbf-a4f8d36aa31b\",\"type\":\"user\"}},{\"userset\":{\"id\":\"fga\",\"relation\":\"member\",\"type\":\"team\"}},{\"wildcard\":{\"type\":\"user\"}}]}"); + "{\"users\":[{\"object\":{\"id\":\"81684243-9356-4421-8fbf-a4f8d36aa31b\",\"type\":\"user\"}},{\"userset\":{\"id\":\"fga\",\"relation\":\"member\",\"type\":\"team\"}},{\"wildcard\":{\"type\":\"user\"}}]}"); ClientListUsersRequest request = new ClientListUsersRequest() ._object(new FgaObject().type(DEFAULT_TYPE).id(DEFAULT_ID)) @@ -2370,8 +2370,6 @@ public void listUsersTest() throws Exception { new UsersetUser().type("team").id("fga").relation("member")), new User().wildcard(new TypedWildcard().type("user"))), response.getUsers()); - - assertNull(response.getExcludedUsers()); } /**