1 package de.dlr.shepard.endpoints; 2 3 import java.io.IOException; 4 import java.io.InputStream; 5 6 import org.glassfish.jersey.media.multipart.FormDataContentDisposition; 7 8 import de.dlr.shepard.influxDB.FillOption; 9 import de.dlr.shepard.influxDB.SingleValuedUnaryFunction; 10 import de.dlr.shepard.influxDB.Timeseries; 11 import de.dlr.shepard.influxDB.TimeseriesPayload; 12 import de.dlr.shepard.neo4Core.io.PermissionsIO; 13 import de.dlr.shepard.neo4Core.io.RolesIO; 14 import de.dlr.shepard.neo4Core.io.TimeseriesContainerIO; 15 import de.dlr.shepard.neo4Core.orderBy.ContainerAttributes; 16 import de.dlr.shepard.util.Constants; 17 import io.swagger.v3.oas.annotations.Operation; 18 import io.swagger.v3.oas.annotations.Parameter; 19 import io.swagger.v3.oas.annotations.media.ArraySchema; 20 import io.swagger.v3.oas.annotations.media.Content; 21 import io.swagger.v3.oas.annotations.media.Schema; 22 import io.swagger.v3.oas.annotations.parameters.RequestBody; 23 import io.swagger.v3.oas.annotations.responses.ApiResponse; 24 import io.swagger.v3.oas.annotations.tags.Tag; 25 import jakarta.validation.Valid; 26 import jakarta.ws.rs.core.MediaType; 27 import jakarta.ws.rs.core.Response; 28 29 public interface TimeseriesRest { 30 31 @Tag(name = Constants.TIMESERIES) 32 @Operation(description = "Get all timeseries containers") 33 @ApiResponse(description = "ok", responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TimeseriesContainerIO.class)))) 34 @ApiResponse(description = "not found", responseCode = "404") 35 Response getAllTimeseriesContainers(String name, Integer page, Integer size, ContainerAttributes orderAttribute, 36 Boolean orderDesc); 37 38 @Tag(name = Constants.TIMESERIES) 39 @Operation(description = "Get timeseries container") 40 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = TimeseriesContainerIO.class))) 41 @ApiResponse(description = "not found", responseCode = "404") 42 Response getTimeseriesContainer(long timeseriesContainerId); 43 44 @Tag(name = Constants.TIMESERIES) 45 @Operation(description = "Create a new timeseries container") 46 @ApiResponse(description = "created", responseCode = "201", content = @Content(schema = @Schema(implementation = TimeseriesContainerIO.class))) 47 @ApiResponse(description = "not found", responseCode = "404") 48 Response createTimeseriesContainer( 49 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TimeseriesContainerIO.class))) @Valid TimeseriesContainerIO timeseriesContainer); 50 51 @Tag(name = Constants.TIMESERIES) 52 @Operation(description = "Delete timeseries container") 53 @ApiResponse(description = "deleted", responseCode = "204") 54 @ApiResponse(description = "not found", responseCode = "404") 55 Response deleteTimeseriesContainer(long timeseriesContainerId); 56 57 @Tag(name = Constants.TIMESERIES) 58 @Operation(description = "Upload timeseries to container") 59 @ApiResponse(description = "created", responseCode = "201", content = @Content(schema = @Schema(implementation = Timeseries.class))) 60 @ApiResponse(description = "not found", responseCode = "404") 61 Response createTimeseries(long timeseriesId, 62 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = TimeseriesPayload.class))) @Valid TimeseriesPayload payload); 63 64 @Tag(name = Constants.TIMESERIES) 65 @Operation(description = "Get timeseries available") 66 @ApiResponse(description = "ok", responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Timeseries.class)))) 67 Response getTimeseriesAvailable(long timeseriesContainerId); 68 69 @Tag(name = Constants.TIMESERIES) 70 @Operation(description = "Get timeseries payload") 71 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = TimeseriesPayload.class))) 72 @ApiResponse(description = "not found", responseCode = "404") 73 Response getTimeseries(long timeseriesContainerId, String measurement, String location, String device, 74 String symbolicName, String field, long start, long end, SingleValuedUnaryFunction function, Long groupBy, 75 FillOption fillOption); 76 77 @Tag(name = Constants.TIMESERIES) 78 @Operation(description = "Export timeseries payload") 79 @ApiResponse(description = "ok", responseCode = "200", content = @Content(mediaType = MediaType.APPLICATION_OCTET_STREAM, schema = @Schema(type = "string", format = "binary"))) 80 @ApiResponse(description = "not found", responseCode = "404") 81 Response exportTimeseries(long timeseriesContainerId, String measurement, String location, String device, 82 String symbolicName, String field, long start, long end, SingleValuedUnaryFunction function, Long groupBy, 83 FillOption fillOption) throws IOException; 84 85 @Tag(name = Constants.TIMESERIES) 86 @Operation(description = "Import timeseries payload") 87 @ApiResponse(description = "ok", responseCode = "200") 88 @ApiResponse(description = "not found", responseCode = "404") 89 Response importTimeseries(long timeseriesContainerId, 90 @Parameter(required = true, schema = @Schema(type = "string", format = "binary", description = "Timeseries as CSV")) InputStream fileInputStream, 91 @Parameter(hidden = true) FormDataContentDisposition fileMetaData) throws IOException; 92 93 @Tag(name = Constants.TIMESERIES) 94 @Operation(description = "Get permissions") 95 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsIO.class))) 96 @ApiResponse(description = "not found", responseCode = "404") 97 Response getTimeseriesPermissions(long timeseriesContainerId); 98 99 @Tag(name = Constants.TIMESERIES) 100 @Operation(description = "Edit permissions") 101 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsIO.class))) 102 @ApiResponse(description = "not found", responseCode = "404") 103 Response editTimeseriesPermissions(long timeseriesContainerId, 104 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PermissionsIO.class))) @Valid PermissionsIO permissions); 105 106 @Tag(name = Constants.TIMESERIES) 107 @Operation(description = "Get roles") 108 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = RolesIO.class))) 109 @ApiResponse(description = "not found", responseCode = "404") 110 Response getTimeseriesRoles(long timeseriesContainerId); 111 }