@JsonCreator public FilterQuery(@ApiParam(value = "filter", required = false) String filter, @ApiParam(value = "event_filters", required = false) List<UserStorage.EventFilter> event_filter, @ApiParam(value = "sorting", required = false) UserStorage.Sorting sorting) { this.filter = filter; this.event_filter = event_filter; this.sorting = sorting; } }
@ApiOperation(value = "Get logs", authorizations = @Authorization(value = "master_key")) @JsonRequest @Path("/get_logs") public List<JSCodeJDBCLoggerService.LogEntry> getLogs(@Named("project") RequestContext context, @ApiParam("identifier") String identifier, @ApiParam(value = "start", required = false) Instant start, @ApiParam(value = "end", required = false) Instant end) { return loggerService.getLogs(context, start, end, "webhook." + context.project + "." + identifier); }
@JsonRequest @ProtectEndpoint(writeOperation = true) @Path("/save-api-keys") public ApiKeyService.ProjectApiKeys createApiKeys( @Named("user_id") Project project, @ApiParam("read_key") String readKey, @ApiParam("write_key") String writeKey, @ApiParam("master_key") String masterKey) { service.saveApiKeys(project.userId, project.project, readKey, writeKey, masterKey); return ApiKeyService.ProjectApiKeys.create(masterKey, readKey, writeKey); }
@ApiOperation(value = "Add file data-source", authorizations = @Authorization(value = "master_key")) @Path("/add/file") @JsonRequest public SuccessMessage addFile(@Named("project") RequestContext context, @ApiParam("tableName") String tableName, @ApiParam("options") CustomDataSourceService.DiscoverableRemoteTable hook) { return service.addFile(context.project, tableName, hook); }
@JsonRequest @Path("/get") @ApiOperation(value = "Get reports", tags = "rakam-ui", authorizations = @Authorization(value = "read_key")) public CustomReport get(@ApiParam("report_type") String reportType, @Named("user_id") Project project, @ApiParam(value = "name") String name) { return metadata.get(reportType, project.project, name); } }
@ApiOperation(value = "Schema of table in data-sources", authorizations = @Authorization(value = "read_key")) @Path("/schema/table") @JsonRequest public CompletableFuture<List<SchemaField>> schemaDatabases(@Named("project") RequestContext context, @ApiParam("schema") String schema, @ApiParam("table") String table) { return service.schemaTable(context.project, schema, table); }
@JsonRequest @Path("/register") public Response register(@ApiParam("email") String email, @ApiParam(value = "name", required = false) String name, @ApiParam("password") String password) { // TODO: implement captcha https://github.com/VividCortex/angular-recaptcha https://developers.google.com/recaptcha/docs/verify // keep a counter for ip in local nodes final WebUser user = service.createUser(email, password, name, null, null, null, false); return getLoginResponseForUser(encryptionConfig.getSecretKey(), user, config.getCookieDuration()); }
@JsonRequest @ApiOperation(value = "Perform action for single user", authorizations = @Authorization(value = "read_key")) @Path("/single") public CompletableFuture<Boolean> send(@Named("project") RequestContext context, @ApiParam("user") String userId, @ApiParam("config") EmailActionConfig config) { return httpService.getUser(context, userId).thenApply(user -> send(context.project, user, config)); }
@ApiOperation(value = "Add file data-source", authorizations = @Authorization(value = "master_key")) @Path("/remove/file") @JsonRequest public SuccessMessage removeFile(@Named("project") RequestContext context, @ApiParam("tableName") String tableName) { return service.removeFile(context.project, tableName); }
@ApiOperation(value = "Check lock key", authorizations = @Authorization(value = "master_key") ) @JsonRequest @Path("/lock_key") public boolean checkLockKey(@ApiParam(value = "lock_key", required = false) String lockKey) { return Objects.equals(lockKey, projectConfig.getLockKey()); }
@JsonRequest @ApiOperation(value = "Get report", authorizations = @Authorization(value = "read_key")) @Path("/get") public ABTestingReport get(@Named("project") RequestContext context, @ApiParam("id") int id) { return metadata.get(context.project, id); }
@JsonRequest @ApiOperation(value = "Test query", authorizations = @Authorization(value = "read_key")) @Path("/metadata") public CompletableFuture<List<SchemaField>> metadata(@Named("project") RequestContext context, @ApiParam("query") String query) { return executorService.metadata(context, query); }
@ApiOperation(value = "Add file data-source", authorizations = @Authorization(value = "master_key")) @Path("/remove/database") @JsonRequest public SuccessMessage removeDatabase(@Named("project") RequestContext context, @ApiParam("schemaName") String schemaName) { return service.removeDatabase(context.project, schemaName); }
@JsonRequest @ApiOperation(value = "Create multiple new users", authorizations = @Authorization(value = "write_key"), notes = "Returns user ids. User id may be string or numeric.") @Path("/batch/create") public List<Object> createUsers(@Named("project") RequestContext context, @ApiParam("users") List<User> users) { try { return service.batchCreate(context, users); } catch (Exception e) { throw new RakamException(e.getMessage(), BAD_REQUEST); } }
@JsonRequest @ApiOperation(value = "Delete report", authorizations = @Authorization(value = "master_key")) @Path("/delete") public SuccessMessage delete(@Named("project") RequestContext context, @ApiParam("id") int id) { metadata.delete(context.project, id); return SuccessMessage.success(); }
@Path("/delete") @ApiOperation(value = "Delete Report", authorizations = @Authorization(value = "read_key")) @JsonRequest @ProtectEndpoint(writeOperation = true) public SuccessMessage delete(@com.google.inject.name.Named("user_id") UIPermissionParameterProvider.Project project, @ApiParam("name") String name) { if (!database.isPresent()) { throw new RakamException("Custom page feature is not implemented", NOT_IMPLEMENTED); } database.get().delete(project.project, name); return SuccessMessage.success(); }
@JsonRequest @ApiOperation(value = "Get Report") @Path("/set-default") public SuccessMessage setDefault(@Named("user_id") Project project, @ApiParam("id") int id) { try (Handle handle = dbi.open()) { userDefaultService.set(handle, project, "DASHBOARD", id); return SuccessMessage.success(); } }
public <T> T get(Handle handle, @Named("user_id") UIPermissionParameterProvider.Project project, @ApiParam("name") String name) { return (T) handle.createQuery("SELECT value FROM ui_user_defaults WHERE user_id = :user AND project_id = :project AND name = :name") .bind("project", project.project) .bind("user", project.userId) .bind("name", name.toUpperCase(Locale.ENGLISH)) .map((index, r, ctx) -> { return JsonHelper.read(r.getString(1), Object.class); }).first(); }