handlers

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

handlers package handles HTTP requests.

handlers package handles HTTP requests.

handlers package handles HTTP requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAnnotation

func CreateAnnotation(ctx *fiber.Ctx) error

CreateAnnotation creates a new annotation.

func CreateCaptureSource

func CreateCaptureSource(ctx *fiber.Ctx) error

CreateCaptureSource creates a new capture source.

func CreateVideoStream

func CreateVideoStream(ctx *fiber.Ctx) error

CreateVideoStream creates a new video stream. BUG: start and end time are required but this is not being enforced. https://github.com/ausocean/openfish/issues/18

func DeleteCaptureSource

func DeleteCaptureSource(ctx *fiber.Ctx) error

DeleteCaptureSource deletes a capture source.

func DeleteVideoStream

func DeleteVideoStream(ctx *fiber.Ctx) error

DeleteVideoStream deletes a video stream. BUG: endpoint returns 200 ok for nonexistent IDs. https://github.com/ausocean/openfish/issues/17

func EndVideoStream

func EndVideoStream(ctx *fiber.Ctx) error

EndVideoStream updates the video stream's duration.

func GetAnnotationByID

func GetAnnotationByID(ctx *fiber.Ctx) error

GetAnnotationByID gets an annotation when provided with an ID.

func GetAnnotations

func GetAnnotations(ctx *fiber.Ctx) error

GetAnnotations gets a list of annotations, filtering by timespan, capturesource, observer & observation if specified.

func GetCaptureSourceByID

func GetCaptureSourceByID(ctx *fiber.Ctx) error

GetCaptureSourceByID gets a capture source when provided with an ID.

func GetCaptureSources

func GetCaptureSources(ctx *fiber.Ctx) error

GetCaptureSources gets a list of capture sources, filtering by name, location if specified.

func GetVideoStreamByID

func GetVideoStreamByID(ctx *fiber.Ctx) error

GetVideoStreamByID gets a video stream when provided with an ID.

func GetVideoStreams

func GetVideoStreams(ctx *fiber.Ctx) error

GetVideoStreams gets a list of video streams, filtering by timespan, capture source if specified.

func StartVideoStream

func StartVideoStream(ctx *fiber.Ctx) error

StartVideoStream creates a new video stream at the current time.

func UpdateCaptureSource

func UpdateCaptureSource(ctx *fiber.Ctx) error

UpdateCaptureSource updates a capture source.

func UpdateVideoStream

func UpdateVideoStream(ctx *fiber.Ctx) error

UpdateVideoStream updates a video stream.

Types

type AnnotationResult

type AnnotationResult struct {
	ID            *int               `json:"id,omitempty"`
	VideoStreamID *int               `json:"videostreamId,omitempty"`
	TimeSpan      *model.TimeSpan    `json:"timespan,omitempty"`
	BoundingBox   *model.BoundingBox `json:"boundingBox,omitempty"`
	Observer      *string            `json:"observer,omitempty"`
	Observation   map[string]string  `json:"observation,omitempty"`
}

AnnotationResult describes the JSON format for annotations in API responses. Fields use pointers because they are optional (this is what the format URL param is for).

func FromAnnotation

func FromAnnotation(annotation *model.Annotation, id int, format *api.Format) AnnotationResult

FromAnnotation creates an AnnotationResult from a model.Annotation and key, formatting it according to the requested format.

type CaptureSourceResult

type CaptureSourceResult struct {
	ID             *int    `json:"id,omitempty"`
	Name           *string `json:"name,omitempty"`
	Location       *string `json:"location,omitempty"`
	CameraHardware *string `json:"camera_hardware,omitempty"`
	SiteID         *int64  `json:"site_id,omitempty"`
}

CaptureSourceResult describes the JSON format for capture sources in API responses. Fields use pointers because they are optional (this is what the format URL param is for).

func FromCaptureSource

func FromCaptureSource(captureSource *model.CaptureSource, id int, format *api.Format) CaptureSourceResult

FromCaptureSource creates a CaptureSourceResult from a model.CaptureSource and key, formatting it according to the requested format.

type CreateAnnotationBody

type CreateAnnotationBody struct {
	VideoStreamID int                `json:"videostreamId"`
	TimeSpan      model.TimeSpan     `json:"timespan"`
	BoundingBox   *model.BoundingBox `json:"boundingBox"` // Optional.
	Observer      string             `json:"observer"`
	Observation   map[string]string  `json:"observation"`
}

CreateAnnotationBody describes the JSON format required for the CreateAnnotation endpoint.

ID is omitted because it is chosen automatically. BoundingBox is optional because some annotations might not be described by a rectangular area.

type CreateCaptureSourceBody

type CreateCaptureSourceBody struct {
	Name           string `json:"name"`
	Location       string `json:"location"`
	CameraHardware string `json:"camera_hardware"`
	SiteID         *int64 `json:"site_id"` // Optional.
}

CreateCaptureSourceBody describes the JSON format required for the CreateCaptureSource endpoint. ID is omitted because it is chosen automatically. All other fields are required.

type CreateVideoStreamBody

type CreateVideoStreamBody struct {
	StartTime     time.Time `json:"startTime"`
	EndTime       time.Time `json:"endTime"`
	StreamUrl     string    `json:"stream_url"`
	CaptureSource int64     `json:"capturesource"`
}

CreateVideoStreamBody describes the JSON format required for the CreateVideoStream endpoint.

ID is omitted because it is chosen automatically.

type GetAnnotationsQuery

type GetAnnotationsQuery struct {
	TimeSpan      *string           `query:"timespan"`       // Optional. TODO: choose more appropriate type.
	CaptureSource *int64            `query:"capture_source"` // Optional.
	Observer      *string           `query:"observer"`       // Optional.
	Observation   map[string]string `query:"observation"`    // Optional.
	api.LimitAndOffset
	api.Format
}

GetAnnotationsQuery describes the URL query parameters required for the GetAnnotations endpoint.

type GetCaptureSourcesQuery

type GetCaptureSourcesQuery struct {
	Name     *string `query:"name"`     // Optional.
	Location *string `query:"location"` // Optional.
	api.LimitAndOffset
}

GetCaptureSourcesQuery describes the URL query parameters required for the GetCaptureSources endpoint.

type GetVideoStreamsQuery

type GetVideoStreamsQuery struct {
	CaptureSource *int64          `query:"capturesource"` // Optional.
	TimeSpan      *model.TimeSpan `query:"timespan"`      // Optional.
	api.LimitAndOffset
}

GetVideoStreamsQuery describes the URL query parameters required for the GetVideoStreams endpoint.

type StartVideoStreamBody

type StartVideoStreamBody struct {
	StreamUrl     string `json:"stream_url"`
	CaptureSource int64  `json:"capturesource"`
}

StartVideoStreamBody describes the JSON format required for the StartVideoStream endpoint.

ID is omitted because it is chosen automatically. Datetime is omitted because it uses the current time. Duration is omitted because it will be set once the stream concludes.

type UpdateCaptureSourceBody

type UpdateCaptureSourceBody struct {
	Name           *string `json:"name"`            // Optional.
	Location       *string `json:"location"`        // Optional.
	CameraHardware *string `json:"camera_hardware"` // Optional.
	SiteID         *int64  `json:"site_id"`         // Optional.
}

UpdateCaptureSourceBody describes the JSON format required for the UpdateCaptureSource endpoint.

type UpdateVideoStreamBody

type UpdateVideoStreamBody struct {
	StartTime     *time.Time `json:"startTime"`     // Optional.
	EndTime       *time.Time `json:"endTime"`       // Optional.
	StreamUrl     *string    `json:"stream_url"`    // Optional.
	CaptureSource *int64     `json:"capturesource"` // Optional.
}

UpdateVideoStreamBody describes the JSON format required for the UpdateVideoStream endpoint.

type VideoStreamResult

type VideoStreamResult struct {
	ID            *int64     `json:"id,omitempty"`
	StartTime     *time.Time `json:"startTime,omitempty"`
	EndTime       *time.Time `json:"endTime,omitempty"`
	StreamUrl     *string    `json:"stream_url,omitempty"`
	CaptureSource *int64     `json:"capturesource,omitempty"`
}

VideoStreamResult describes the JSON format for video streams in API responses. Fields use pointers because they are optional (this is what the format URL param is for).

func FromVideoStream

func FromVideoStream(videoStream *model.VideoStream, id int64, format *api.Format) VideoStreamResult

FromVideoStream creates a VideoStreamResult from a model.VideoStream and key, formatting it according to the requested format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL