diff --git a/Dockerfile b/Dockerfile index 77ff9810b..f5615f71c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ ARG CGO_CPPFLAGS="-I/open-vds/Dist/OpenVDS/include" ARG CGO_LDFLAGS="-L/open-vds/Dist/OpenVDS/lib" RUN go build -a ./... RUN GOBIN=/tools go install github.com/swaggo/swag/cmd/swag@latest -RUN /tools/swag init -g cmd/query/main.go +RUN /tools/swag init -g cmd/query/main.go --md docs FROM builder as tester diff --git a/api/query.go b/api/query.go index d387cf0dc..e329aa34a 100644 --- a/api/query.go +++ b/api/query.go @@ -90,6 +90,13 @@ func (e *Endpoint) Health(ctx *gin.Context) { ctx.String(http.StatusOK, "I am up and running") } +// SliceGet godoc +// @Summary Fetch a slice from a VDS +// @description.markdown slice +// @Param query query string True "Urlencoded/escaped SliceQuery" +// @Produce multipart/mixed +// @Success 200 {object} vds.Metadata "(Example below only for metadata part)" +// @Router /slice [get] func (e *Endpoint) SliceGet(ctx *gin.Context) { var query SliceQuery if err := parseGetRequest(ctx, &query); err != nil { @@ -99,6 +106,14 @@ func (e *Endpoint) SliceGet(ctx *gin.Context) { e.slice(ctx, query) } +// SlicePost godoc +// @Summary Fetch metadata related to a single slice +// @description.markdown slice +// @Param body body SliceQuery True "Query Parameters" +// @Accept application/json +// @Produce multipart/mixed +// @Success 200 {object} vds.Metadata "(Example below only for metadata part)" +// @Router /slice [post] func (e *Endpoint) SlicePost(ctx *gin.Context) { var query SliceQuery if err := ctx.ShouldBind(&query); err != nil { diff --git a/docs/slice.md b/docs/slice.md new file mode 100644 index 000000000..e4d183bd1 --- /dev/null +++ b/docs/slice.md @@ -0,0 +1,22 @@ +# Fetch a slice form a VDS + +Fetch a slice in any direction. Support 0-indexing of lines +and index-by-annotation such as inline and crossline numbers +and depth intervals. See model SliceData for more info +on request parameters. + +## Response +On success (200) the response consists of two parts, metadata +and data + +### Metadata part +*Content-Type: application/json* +Metadata related to the returned slice, such as axis +dimensions, labels and units and data type. See the +Metadata data model. + +### Data part +*Content-Type: application/octet-stream* +A raw byte array containing the slice itself. The byte array needs to be parsed +into a 2D array before use. Shape and type information is found in the metadata +part. Data is always little endian.