Refine search
@GET @Path("mapi/trades/{pairs}") @Produces(MediaType.APPLICATION_JSON) DSXTradesWrapper getTrades( @PathParam("pairs") String pairs, @DefaultValue("150") @QueryParam("limit") int limit, @DefaultValue("1") @QueryParam("ignore_invalid") int ignoreInvalid, @DefaultValue("LIVE") @QueryParam("mode") String mode) throws IOException;
@Override public String getValueOf(QueryParam a) { return a.value(); }
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public SubstringTesterResponse substringTester(@QueryParam("begin_index") @Min(0) int beginIndex, @QueryParam("end_index") @Min(1) int endIndex, @QueryParam("string") @NotNull String string) { return doSubstringTest(string, beginIndex, endIndex); }
@DELETE @Path("/v1/proxy") @Produces(APPLICATION_JSON) public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(noContent(), response)); }
@GET @Timed public JsonTesterResponse get(@QueryParam("string") @NotEmpty String string, @QueryParam("flatten") @DefaultValue("false") boolean flatten, @QueryParam("list_separator") @NotEmpty String listSeparator, @QueryParam("key_separator") @NotEmpty String keySeparator, @QueryParam("replace_key_whitespace") boolean replaceKeyWhitespace, @QueryParam("key_whitespace_replacement") String keyWhitespaceReplacement, @QueryParam("key_prefix") String keyPrefix, @QueryParam("kv_separator") @NotEmpty String kvSeparator) { return testJsonExtractor(string, flatten, listSeparator, keySeparator, kvSeparator, replaceKeyWhitespace, keyWhitespaceReplacement, keyPrefix); }
@Path("start") @POST public Response post(@DefaultValue("0") @QueryParam("testSources") int testSources, @Context Sse sse) { final Process process = new Process(testSources, sse); processes.put(process.getId(), process); Executors.newSingleThreadExecutor().execute(process); final URI processIdUri = UriBuilder.fromResource(DomainResource.class).path("process/{id}").build(process.getId()); return Response.created(processIdUri).build(); }
@GET public List<BasicQueryInfo> getAllQueryInfo(@QueryParam("state") String stateFilter) { QueryState expectedState = stateFilter == null ? null : QueryState.valueOf(stateFilter.toUpperCase(Locale.ENGLISH)); ImmutableList.Builder<BasicQueryInfo> builder = new ImmutableList.Builder<>(); for (BasicQueryInfo queryInfo : queryManager.getQueries()) { if (stateFilter == null || queryInfo.getState() == expectedState) { builder.add(queryInfo); } } return builder.build(); }
/** * Derives member's name and type from it's annotations */ public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) { for (Annotation a : memberAnnotations) { if (a instanceof QueryParam) { return Optional.of("query param " + ((QueryParam) a).value()); } else if (a instanceof PathParam) { return Optional.of("path param " + ((PathParam) a).value()); } else if (a instanceof HeaderParam) { return Optional.of("header " + ((HeaderParam) a).value()); } else if (a instanceof CookieParam) { return Optional.of("cookie " + ((CookieParam) a).value()); } else if (a instanceof FormParam) { return Optional.of("form field " + ((FormParam) a).value()); } else if (a instanceof Context) { return Optional.of("context"); } else if (a instanceof MatrixParam) { return Optional.of("matrix param " + ((MatrixParam) a).value()); } } return Optional.empty(); }
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public SplitAndIndexTesterResponse splitAndIndexTester(@QueryParam("split_by") @NotNull String splitBy, @QueryParam("index") @Min(0) int index, @QueryParam("string") @NotNull String string) { return doSplitAndIndexTest(string, splitBy, index); }
@GET @ApiOperation(value = "Get the cluster traffic stats") public TrafficCounterService.TrafficHistogram get(@ApiParam(name = "days", value = "For how many days the traffic stats should be returned") @QueryParam("days") @DefaultValue("30") int days, @ApiParam(name = "daily", value = "Whether the traffic should be aggregate to daily values") @QueryParam("daily") @DefaultValue("false") boolean daily) { final TrafficCounterService.TrafficHistogram trafficHistogram = trafficCounterService.clusterTrafficOfLastDays(Duration.standardDays(days), daily ? TrafficCounterService.Interval.DAILY : TrafficCounterService.Interval.HOURLY); return trafficHistogram; } }
@Path("start") @POST public Response post(@DefaultValue("0") @QueryParam("testSources") int testSources) { final Process process = new Process(testSources); processes.put(process.getId(), process); Executors.newSingleThreadExecutor().execute(process); final URI processIdUri = UriBuilder.fromResource(DomainResource.class).path("process/{id}").build(process.getId()); return Response.created(processIdUri).build(); }
@GET @Timed(name = "get-requests-timed") @Metered(name = "get-requests-metered") @CacheControl(maxAge = 1, maxAgeUnit = TimeUnit.DAYS) public Saying sayHello(@QueryParam("name") Optional<String> name) { return new Saying(counter.incrementAndGet(), template.render(name)); }
@GET @Path("mapi/ticker/{pairs}") @Produces(MediaType.APPLICATION_JSON) DSXTickerWrapper getTicker( @PathParam("pairs") String pairs, @DefaultValue("1") @QueryParam("ignore_invalid") int ignoreInvalid, @DefaultValue("LIVE") @QueryParam("mode") String mode) throws IOException;
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public RegexTesterResponse regexTester(@QueryParam("regex") @NotEmpty String regex, @QueryParam("string") @NotNull String string) { return doTestRegex(string, regex); }
@GET @Timed @ApiOperation(value = "Get the most recent alarms of all streams.") @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ObjectId.") }) public AlertListSummary listRecent(@ApiParam(name = "since", value = "Optional parameter to define a lower date boundary. (UNIX timestamp)", required = false) @QueryParam("since") @DefaultValue("0") @Min(0) int sinceTs, @ApiParam(name = "limit", value = "Maximum number of alerts to return.", required = false) @QueryParam("limit") @DefaultValue("300") @Min(1) int limit) throws NotFoundException { final DateTime since = new DateTime(sinceTs * 1000L, DateTimeZone.UTC); final List<AlertSummary> alerts = getAlertSummaries(alertService.loadRecentOfStreams(getAllowedStreamIds(), since, limit).stream()); return AlertListSummary.create(alerts.size(), alerts); }
@Override public String getValueOf(QueryParam a) { return a.value(); }
@GET @Path("api/3/depth/{pairs}") @Produces(MediaType.APPLICATION_JSON) WexDepthWrapper getDepth( @PathParam("pairs") String pairs, @DefaultValue("150") @QueryParam("limit") int limit, @DefaultValue("1") @QueryParam("ignore_invalid") int ignoreInvalid) throws IOException;
@GET @Produces(MediaType.APPLICATION_JSON) public List<QueryStateInfo> getQueryStateInfos(@QueryParam("user") String user) { List<BasicQueryInfo> queryInfos = queryManager.getQueries(); if (!isNullOrEmpty(user)) { queryInfos = queryInfos.stream() .filter(queryInfo -> Pattern.matches(user, queryInfo.getSession().getUser())) .collect(toImmutableList()); } return queryInfos.stream() .filter(queryInfo -> !queryInfo.getState().isDone()) .map(this::getQueryStateInfo) .collect(toImmutableList()); }
@GET @Path("api/3/trades/{pairs}") @Produces(MediaType.APPLICATION_JSON) WexTradesWrapper getTrades( @PathParam("pairs") String pairs, @DefaultValue("1") @QueryParam("limit") int limit, @DefaultValue("1") @QueryParam("ignore_invalid") int ignoreInvalid) throws IOException; }
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Map<String, String> naturalDateTester(@QueryParam("string") @NotEmpty String string) { try { return new NaturalDateParser().parse(string).asMap(); } catch (NaturalDateParser.DateNotParsableException e) { LOG.debug("Could not parse from natural date: " + string, e); throw new WebApplicationException(e, 422); } } }