use of com.nexblocks.authguard.api.dto.entities.ApiKeyDTO in project AuthGuard by AuthGuard.
the class ApiKeysRoute method getById.
@Override
public void getById(final Context context) {
final String apiKeyId = context.pathParam("id");
final Optional<ApiKeyDTO> apiKey = apiKeysService.getById(apiKeyId).map(restMapper::toDTO);
if (apiKey.isPresent()) {
context.status(200).json(apiKey.get());
} else {
context.status(404).json(new Error(ErrorCode.API_KEY_DOES_NOT_EXIST.getCode(), "API key does not exist"));
}
}
use of com.nexblocks.authguard.api.dto.entities.ApiKeyDTO in project AuthGuard by AuthGuard.
the class ApiKeysRoute method deleteById.
@Override
public void deleteById(final Context context) {
final String apiKeyId = context.pathParam("id");
final Optional<ApiKeyDTO> apiKey = apiKeysService.delete(apiKeyId).map(restMapper::toDTO);
if (apiKey.isPresent()) {
context.status(200).json(apiKey.get());
} else {
context.status(404).json(new Error(ErrorCode.API_KEY_DOES_NOT_EXIST.getCode(), "API key does not exist"));
}
}