Skip to content

Commit

Permalink
Add slice endpoint documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ErlendHaa committed Aug 12, 2022
1 parent af5ce9e commit 89221c1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions docs/slice.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 89221c1

Please sign in to comment.