Search in sources :

Example 1 with AccessTokenFilter

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));
}
Also used : AccessTokenFilter(com.thoughtworks.go.server.service.AccessTokenFilter) AccessToken(com.thoughtworks.go.domain.AccessToken)

Aggregations

AccessToken (com.thoughtworks.go.domain.AccessToken)1 AccessTokenFilter (com.thoughtworks.go.server.service.AccessTokenFilter)1