dev.openfga.sdk.api.client.model.ClientListRelationsResponse Maven / Gradle / Ivy
/*
* 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: [email protected]
*
* 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.client.model;
import java.util.List;
import java.util.stream.Collectors;
public class ClientListRelationsResponse {
private final List relations;
public ClientListRelationsResponse(List relations) {
this.relations = relations;
}
public List getRelations() {
return relations;
}
public static ClientListRelationsResponse fromBatchCheckResponses(List responses)
throws Throwable {
// If any response ultimately failed (with retries) we throw the first exception encountered.
var failedResponse = responses.stream()
.filter(response -> response.getThrowable() != null)
.findFirst();
if (failedResponse.isPresent()) {
throw failedResponse.get().getThrowable();
}
var relations = responses.stream()
.filter(ClientBatchCheckResponse::getAllowed)
.map(ClientBatchCheckResponse::getRelation)
.collect(Collectors.toList());
return new ClientListRelationsResponse(relations);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy