@Path("/get_online_users") @POST @JsonRequest @ApiOperation(value = "Get connected users", authorizations = @Authorization(value = "read_key") ) public CompletableFuture<Collection<Map<String, Object>>> getConnectedUsers(@Named("project") RequestContext context) { Collection<Object> connectedUsers = webSocketService.getConnectedUsers(context.project); return CompletableFuture.completedFuture(connectedUsers.stream() .map(id -> ImmutableMap.of(config.getIdentifierColumn(), id)) .collect(Collectors.toList())); }
@Path("/list") @ApiOperation(value = "Get Report", authorizations = @Authorization(value = "read_key")) @JsonRequest public List<CustomPageDatabase.Page> list(@Named("user_id") UIPermissionParameterProvider.Project project) { if (!database.isPresent()) { return null; } return database.get().list(project.project); } }
@JsonRequest @ApiOperation(value = "Get collection schema", authorizations = @Authorization(value = "read_key")) @Path("/schema") public List<Collection> schema(@Named("project") RequestContext context, @ApiParam(value = "names", required = false) Set<String> names) { return metastore.getCollections(context.project).entrySet().stream() .filter(entry -> names == null || names.contains(entry.getKey())) .map(entry -> new Collection(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); }
@JsonRequest @ApiOperation(value = "List views", authorizations = @Authorization(value = "read_key")) @Path("/list") public List<MaterializedView> listViews(@Named("project") RequestContext context) { return service.list(context.project); }
@JsonRequest @ApiOperation(value = "Get schemas", authorizations = @Authorization(value = "read_key")) @Path("/schema") public List<MaterializedViewSchema> getSchemaOfView(@Named("project") RequestContext context, @ApiParam(value = "names", required = false) List<String> tableNames) { return service.getSchemas(context, Optional.ofNullable(tableNames)).entrySet().stream() .map(entry -> new MaterializedViewSchema(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); }
@ApiOperation(value = "Get file", authorizations = @Authorization(value = "master_key")) @Path("/list/file") @JsonRequest public Map<String, RemoteTable> getFiles(@Named("project") RequestContext context) { return service.getFiles(context.project); }
@ApiOperation(value = "List installed modules", authorizations = @Authorization(value = "master_key") ) @GET @Path("/configurations") @JsonRequest public List<ModuleDescriptor> getConfigurations() { return systemRegistry.getModules(); }
@ApiOperation(value = "Get data-source", authorizations = @Authorization(value = "master_key")) @Path("/get/database") @JsonRequest public CustomDataSource getDatabase(@Named("project") RequestContext context, String schema) { return service.getDatabase(context.project, schema); }
@JsonRequest @ProtectEndpoint(writeOperation = true) @Path("/delete-project") @DELETE public SuccessMessage deleteProject(@Named("user_id") Project project) { service.deleteProject(project.userId, project.project); return SuccessMessage.success(); }
@ApiOperation(value = "Add data-source", authorizations = @Authorization(value = "master_key")) @Path("/add/database") @JsonRequest public SuccessMessage addDatabase(@Named("project") RequestContext context, @BodyParam CustomDataSource hook) { return service.addDatabase(context.project, hook); }
@ApiOperation(value = "Get hook", authorizations = @Authorization(value = "master_key")) @Path("/get") @JsonRequest public WebHook get(@Named("project") RequestContext context, @ApiParam("identifier") String identifier) { return get(context.project, identifier); }
@Path("/get") @ApiOperation(value = "Get Report", authorizations = @Authorization(value = "read_key")) @JsonRequest public Map<String, String> get(@com.google.inject.name.Named("user_id") UIPermissionParameterProvider.Project project, @ApiParam("slug") String slug) { if (!database.isPresent()) { throw new RakamException("Custom page feature is not implemented", NOT_IMPLEMENTED); } return database.get().get(project.project, slug); }
@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 API Keys", authorizations = @Authorization(value = "master_key")) @Path("/create-api-keys") public ProjectApiKeys createApiKeys(@Named("project") RequestContext context) { return transformKeys(apiKeyService.createApiKeys(context.project)); }
@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); } }
@Path("/save") @POST @JsonRequest @ProtectEndpoint(writeOperation = true) @ApiOperation(value = "Save Report", authorizations = @Authorization(value = "read_key"), response = SuccessMessage.class, request = CustomPageDatabase.Page.class) public SuccessMessage save( @Named("user_id") UIPermissionParameterProvider.Project project, @BodyParam CustomPageDatabase.Page report) { database.get().save(project.userId, project.project, report); return SuccessMessage.success(); }