server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0, GPL-3.0-or-later Imports: 23 Imported by: 0

Documentation

Overview

Package server provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.5.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewIngestImageRequest

func NewIngestImageRequest(req models.NewImage, allowedImageFormats []string) ingest.Request

Types

type BoundingBox

type BoundingBox struct {
	// Height height of the bounding box
	Height float32 `json:"height"`

	// Id ID of the bounding box
	Id string `json:"id"`

	// Label label
	Label string `json:"label"`

	// Width width of the bounding box
	Width float32 `json:"width"`

	// Xc x coordinate of the center point
	Xc float32 `json:"xc"`

	// Yc y coordinate of the center point
	Yc float32 `json:"yc"`
}

BoundingBox defines model for BoundingBox.

type Collection

type Collection struct {
	// Description Description of the collection
	Description *string `json:"description,omitempty"`

	// Name Name of the collection
	Name *string `json:"name,omitempty"`
}

Collection defines model for Collection.

type CreateCollectionJSONRequestBody

type CreateCollectionJSONRequestBody = NewCollection

CreateCollectionJSONRequestBody defines body for CreateCollection for application/json ContentType.

type CreateLabelJSONRequestBody

type CreateLabelJSONRequestBody = NewLabel

CreateLabelJSONRequestBody defines body for CreateLabel for application/json ContentType.

type Error

type Error struct {
	// Code Error code
	Code int32 `json:"code"`

	// Message Error message
	Message string `json:"message"`
}

Error defines model for Error.

type HTTPPrincipalProvider

type HTTPPrincipalProvider interface {
	Provide(*http.Request) (*p.Principal, error)
}

type Image

type Image struct {
	BoundingBoxes *[]BoundingBox `json:"bounding_boxes,omitempty"`

	// Collection name of collection in which the image belongs
	Collection string `json:"collection"`

	// Id ID of the image
	Id     string    `json:"id"`
	Labels *[]string `json:"labels,omitempty"`
}

Image defines model for Image.

type ImageIngestionResponse

type ImageIngestionResponse struct {
	// Id ID of ingested image
	Id *string `json:"id,omitempty"`
}

ImageIngestionResponse defines model for ImageIngestionResponse.

type IngestImageJSONRequestBody

type IngestImageJSONRequestBody = NewImage

IngestImageJSONRequestBody defines body for IngestImage for application/json ContentType.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Label

type Label struct {
	// Description Description of the label
	Description *string `json:"description,omitempty"`

	// Name Name of the label
	Name *string `json:"name,omitempty"`
}

Label defines model for Label.

type ListCollectionsParams

type ListCollectionsParams struct {
	// Page page number
	Page *int64 `form:"page,omitempty" json:"page,omitempty"`

	// PageSize maximum number of collections to return
	PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`
}

ListCollectionsParams defines parameters for ListCollections.

type ListCollectionsResponse

type ListCollectionsResponse struct {
	Data       *[]Collection `json:"data,omitempty"`
	Pagination Pagination    `json:"pagination"`
}

ListCollectionsResponse defines model for ListCollectionsResponse.

type ListImagesParams

type ListImagesParams struct {
	// Page page number
	Page *int64 `form:"page,omitempty" json:"page,omitempty"`

	// PageSize maximum number of collections to return
	PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`

	// Collection name of collection
	Collection *string `form:"collection,omitempty" json:"collection,omitempty"`
}

ListImagesParams defines parameters for ListImages.

type ListImagesResponse

type ListImagesResponse struct {
	Images     []Image    `json:"images"`
	Pagination Pagination `json:"pagination"`
}

ListImagesResponse defines model for ListImagesResponse.

type ListLabelsParams

type ListLabelsParams struct {
	// Page page number
	Page *int64 `form:"page,omitempty" json:"page,omitempty"`

	// PageSize maximum number of labels to return
	PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`
}

ListLabelsParams defines parameters for ListLabels.

type ListLabelsResponse

type ListLabelsResponse struct {
	Data       *[]Label   `json:"data,omitempty"`
	Pagination Pagination `json:"pagination"`
}

ListLabelsResponse defines model for ListLabelsResponse.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type NewBoundingBox

type NewBoundingBox struct {
	// Height height of the bounding box
	Height float32 `json:"height"`

	// Label label
	Label string `json:"label"`

	// Width width of the bounding box
	Width float32 `json:"width"`

	// Xc x coordinate of the center point
	Xc float32 `json:"xc"`

	// Yc y coordinate of the center point
	Yc float32 `json:"yc"`
}

NewBoundingBox defines model for NewBoundingBox.

type NewCollection

type NewCollection struct {
	// Description Description of the collection
	Description *string `json:"description,omitempty"`

	// Name Name of the collection
	Name string `json:"name"`
}

NewCollection defines model for NewCollection.

type NewImage

type NewImage struct {
	BoundingBoxes *[]NewBoundingBox `json:"bounding_boxes,omitempty"`

	// Collection name of collection in which to add the image
	Collection string `json:"collection"`

	// Data base64 encoded image raw bytes
	Data   string    `json:"data"`
	Labels *[]string `json:"labels,omitempty"`
}

NewImage defines model for NewImage.

type NewLabel

type NewLabel struct {
	// Description Description of the label
	Description *string `json:"description,omitempty"`

	// Name Name of the label
	Name string `json:"name"`
}

NewLabel defines model for NewLabel.

type Pagination

type Pagination struct {
	// Page current page number
	Page int64 `json:"page"`

	// PageSize maximum number of items per page
	PageSize int `json:"page_size"`

	// TotalItems total number of items
	TotalItems int64 `json:"total_items"`

	// TotalPages total number of pages
	TotalPages int64 `json:"total_pages"`
}

Pagination defines model for Pagination.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type Server

type Server struct {
	*u.Interactors
}

func NewServer

func NewServer(interactors *u.Interactors) *Server

func (*Server) CreateCollection

func (s *Server) CreateCollection(w http.ResponseWriter, r *http.Request)

func (*Server) CreateLabel

func (s *Server) CreateLabel(w http.ResponseWriter, r *http.Request)

func (*Server) DeleteCollectionByName

func (s *Server) DeleteCollectionByName(w http.ResponseWriter, r *http.Request, name string)

func (*Server) DeleteLabelByName

func (s *Server) DeleteLabelByName(w http.ResponseWriter, r *http.Request, name string)

func (*Server) FindCollectionByName

func (s *Server) FindCollectionByName(w http.ResponseWriter, r *http.Request, name string)

func (*Server) FindLabelByName

func (s *Server) FindLabelByName(w http.ResponseWriter, r *http.Request, name string)

func (*Server) IngestImage

func (s *Server) IngestImage(w http.ResponseWriter, r *http.Request)

func (*Server) ListCollections

func (s *Server) ListCollections(w http.ResponseWriter, r *http.Request, params ListCollectionsParams)

func (*Server) ListImages

func (s *Server) ListImages(w http.ResponseWriter, r *http.Request, params ListImagesParams)

func (*Server) ListLabels

func (s *Server) ListLabels(w http.ResponseWriter, r *http.Request, params ListLabelsParams)

func (*Server) ReadImage

func (s *Server) ReadImage(w http.ResponseWriter, r *http.Request, collectionName, imageId string)

func (*Server) UpdateCollectionByName

func (s *Server) UpdateCollectionByName(w http.ResponseWriter, r *http.Request, name string)

type ServerInterface

type ServerInterface interface {
	// List collections
	// (GET /collections)
	ListCollections(w http.ResponseWriter, r *http.Request, params ListCollectionsParams)
	// Create a new collection
	// (POST /collections)
	CreateCollection(w http.ResponseWriter, r *http.Request)
	// Delete a collection by name
	// (DELETE /collections/{name})
	DeleteCollectionByName(w http.ResponseWriter, r *http.Request, name string)
	// Find a collection by name
	// (GET /collections/{name})
	FindCollectionByName(w http.ResponseWriter, r *http.Request, name string)
	// Update a collection
	// (PUT /collections/{name})
	UpdateCollectionByName(w http.ResponseWriter, r *http.Request, name string)
	// List images
	// (GET /images)
	ListImages(w http.ResponseWriter, r *http.Request, params ListImagesParams)
	// Ingest a new image
	// (POST /images)
	IngestImage(w http.ResponseWriter, r *http.Request)
	// Read image meta-data
	// (GET /images/{collection_name}/{image_id})
	ReadImage(w http.ResponseWriter, r *http.Request, collectionName string, imageId string)
	// List labels
	// (GET /labels)
	ListLabels(w http.ResponseWriter, r *http.Request, params ListLabelsParams)
	// Create a new label
	// (POST /labels)
	CreateLabel(w http.ResponseWriter, r *http.Request)
	// Delete a label by name
	// (DELETE /labels/{name})
	DeleteLabelByName(w http.ResponseWriter, r *http.Request, name string)
	// Find a label by name
	// (GET /labels/{name})
	FindLabelByName(w http.ResponseWriter, r *http.Request, name string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateCollection

func (siw *ServerInterfaceWrapper) CreateCollection(w http.ResponseWriter, r *http.Request)

CreateCollection operation middleware

func (*ServerInterfaceWrapper) CreateLabel

func (siw *ServerInterfaceWrapper) CreateLabel(w http.ResponseWriter, r *http.Request)

CreateLabel operation middleware

func (*ServerInterfaceWrapper) DeleteCollectionByName

func (siw *ServerInterfaceWrapper) DeleteCollectionByName(w http.ResponseWriter, r *http.Request)

DeleteCollectionByName operation middleware

func (*ServerInterfaceWrapper) DeleteLabelByName

func (siw *ServerInterfaceWrapper) DeleteLabelByName(w http.ResponseWriter, r *http.Request)

DeleteLabelByName operation middleware

func (*ServerInterfaceWrapper) FindCollectionByName

func (siw *ServerInterfaceWrapper) FindCollectionByName(w http.ResponseWriter, r *http.Request)

FindCollectionByName operation middleware

func (*ServerInterfaceWrapper) FindLabelByName

func (siw *ServerInterfaceWrapper) FindLabelByName(w http.ResponseWriter, r *http.Request)

FindLabelByName operation middleware

func (*ServerInterfaceWrapper) IngestImage

func (siw *ServerInterfaceWrapper) IngestImage(w http.ResponseWriter, r *http.Request)

IngestImage operation middleware

func (*ServerInterfaceWrapper) ListCollections

func (siw *ServerInterfaceWrapper) ListCollections(w http.ResponseWriter, r *http.Request)

ListCollections operation middleware

func (*ServerInterfaceWrapper) ListImages

func (siw *ServerInterfaceWrapper) ListImages(w http.ResponseWriter, r *http.Request)

ListImages operation middleware

func (*ServerInterfaceWrapper) ListLabels

func (siw *ServerInterfaceWrapper) ListLabels(w http.ResponseWriter, r *http.Request)

ListLabels operation middleware

func (*ServerInterfaceWrapper) ReadImage

func (siw *ServerInterfaceWrapper) ReadImage(w http.ResponseWriter, r *http.Request)

ReadImage operation middleware

func (*ServerInterfaceWrapper) UpdateCollectionByName

func (siw *ServerInterfaceWrapper) UpdateCollectionByName(w http.ResponseWriter, r *http.Request)

UpdateCollectionByName operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateCollection

type UpdateCollection struct {
	// Description New description of the collection
	Description string `json:"description"`

	// Name New name of the collection
	Name string `json:"name"`
}

UpdateCollection defines model for UpdateCollection.

type UpdateCollectionByNameJSONRequestBody

type UpdateCollectionByNameJSONRequestBody = UpdateCollection

UpdateCollectionByNameJSONRequestBody defines body for UpdateCollectionByName for application/json ContentType.

Jump to

Keyboard shortcuts

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