use of com.thoughtworks.go.server.service.AccessTokenFilter in project gocd by gocd.
the class AbstractUserAccessTokenControllerV1 method getAllAccessTokens.
public String getAllAccessTokens(Request request, Response response) throws Exception {
String filterValue = request.queryParams("filter");
AccessTokenFilter filter = AccessTokenFilter.fromString(filterValue);
if (filter == null) {
throw HaltApiResponses.haltBecauseQueryParamIsUnknown("filter", filterValue, Arrays.stream(AccessTokenFilter.values()).map(Object::toString).toArray(String[]::new));
}
List<AccessToken> allTokens = allTokens(filter);
return writerForTopLevelObject(request, response, outputWriter -> AccessTokensRepresenter.toJSON(outputWriter, urlContext(), allTokens));
}
Aggregations