Documentation
¶
Overview ¶
Package httpapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
Index ¶
- Constants
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewRouter(cfg *config.Config, st *store.Store, mediaMgr *media.Manager, ...) http.Handler
- func WithPrincipal(ctx context.Context, p *Principal) context.Context
- type APIKey
- type APIKeyStore
- type Asset
- type AssetId
- type AssetSearchResponse
- type AssetUpdate
- type AssetVariantUrls
- type ChiServerOptions
- type Error
- type GetMediaVariantParamsVariant
- type Health
- type HealthStatus
- type IncludeDeleted
- type InvalidParamFormatError
- type ListTagsParams
- type MediaVariant
- type MiddlewareFunc
- type Page
- type PageSize
- type Principal
- type Query
- type RequiredHeaderError
- type RequiredParamError
- type SearchAssetsParams
- type SearchAssetsParamsSort
- type Server
- func (s *Server) DeleteAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (s *Server) GetAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (s *Server) GetHealthz(w http.ResponseWriter, _ *http.Request)
- func (s *Server) GetMediaVariant(w http.ResponseWriter, r *http.Request, id AssetId, ...)
- func (s *Server) GetReadyz(w http.ResponseWriter, _ *http.Request)
- func (s *Server) ListTags(w http.ResponseWriter, r *http.Request, params ListTagsParams)
- func (s *Server) SearchAssets(w http.ResponseWriter, r *http.Request, params SearchAssetsParams)
- func (s *Server) UpdateAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (s *Server) UploadAsset(w http.ResponseWriter, r *http.Request)
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) DeleteAsset(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAsset(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetHealthz(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMediaVariant(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetReadyz(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListTags(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SearchAssets(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateAsset(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UploadAsset(w http.ResponseWriter, r *http.Request)
- type Sort
- type Tag
- type TagFilter
- type TagListResponse
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) DeleteAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (_ Unimplemented) GetAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (_ Unimplemented) GetHealthz(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) GetMediaVariant(w http.ResponseWriter, r *http.Request, id AssetId, ...)
- func (_ Unimplemented) GetReadyz(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) ListTags(w http.ResponseWriter, r *http.Request, params ListTagsParams)
- func (_ Unimplemented) SearchAssets(w http.ResponseWriter, r *http.Request, params SearchAssetsParams)
- func (_ Unimplemented) UpdateAsset(w http.ResponseWriter, r *http.Request, id AssetId)
- func (_ Unimplemented) UploadAsset(w http.ResponseWriter, r *http.Request)
- type UnmarshalingParamError
- type UpdateAssetJSONRequestBody
- type UploadAssetMultipartBody
- type UploadAssetMultipartRequestBody
Constants ¶
const ( PermCanSearch = "can_search" PermCanUpload = "can_upload" PermCanUpdate = "can_update" PermCanDelete = "can_delete" )
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
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, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type APIKeyStore ¶
type APIKeyStore struct {
// contains filtered or unexported fields
}
func LoadAPIKeys ¶
func LoadAPIKeys(path string) (*APIKeyStore, error)
type Asset ¶
type Asset struct {
Bytes int64 `json:"bytes"`
Caption string `json:"caption"`
CreatedAt time.Time `json:"createdAt"`
Credit string `json:"credit"`
DeletedAt *time.Time `json:"deletedAt"`
Height int `json:"height"`
Id int64 `json:"id"`
Mime string `json:"mime"`
OriginalFilename *string `json:"originalFilename,omitempty"`
// Sha256 Hex-encoded SHA-256 of the original bytes (optional to expose).
Sha256 *string `json:"sha256,omitempty"`
Source string `json:"source"`
Tags []string `json:"tags"`
Title string `json:"title"`
UpdatedAt time.Time `json:"updatedAt"`
UsageNotes string `json:"usageNotes"`
Variants AssetVariantUrls `json:"variants"`
Width int `json:"width"`
}
Asset defines model for Asset.
type AssetSearchResponse ¶
type AssetSearchResponse struct {
Items []Asset `json:"items"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
Total int `json:"total"`
}
AssetSearchResponse defines model for AssetSearchResponse.
type AssetUpdate ¶
type AssetUpdate struct {
Caption *string `json:"caption,omitempty"`
Credit *string `json:"credit,omitempty"`
Source *string `json:"source,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Title *string `json:"title,omitempty"`
UsageNotes *string `json:"usageNotes,omitempty"`
}
AssetUpdate defines model for AssetUpdate.
type AssetVariantUrls ¶
type AssetVariantUrls struct {
Content string `json:"content"`
Original string `json:"original"`
Thumb string `json:"thumb"`
}
AssetVariantUrls defines model for AssetVariantUrls.
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type Error ¶
type Error struct {
Code string `json:"code"`
Details *map[string]interface{} `json:"details,omitempty"`
Message string `json:"message"`
}
Error defines model for Error.
type GetMediaVariantParamsVariant ¶
type GetMediaVariantParamsVariant string
GetMediaVariantParamsVariant defines parameters for GetMediaVariant.
const ( GetMediaVariantParamsVariantContent GetMediaVariantParamsVariant = "content" GetMediaVariantParamsVariantOriginal GetMediaVariantParamsVariant = "original" GetMediaVariantParamsVariantThumb GetMediaVariantParamsVariant = "thumb" )
Defines values for GetMediaVariantParamsVariant.
type Health ¶
type Health struct {
Status HealthStatus `json:"status"`
}
Health defines model for Health.
type HealthStatus ¶
type HealthStatus string
HealthStatus defines model for Health.Status.
const (
Ok HealthStatus = "ok"
)
Defines values for HealthStatus.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListTagsParams ¶
type ListTagsParams struct {
// Prefix Prefix filter for tag autocomplete.
Prefix *string `form:"prefix,omitempty" json:"prefix,omitempty"`
Page *Page `form:"page,omitempty" json:"page,omitempty"`
PageSize *int `form:"pageSize,omitempty" json:"pageSize,omitempty"`
}
ListTagsParams defines parameters for ListTags.
type MediaVariant ¶
type MediaVariant string
MediaVariant defines model for MediaVariant.
const ( MediaVariantContent MediaVariant = "content" MediaVariantOriginal MediaVariant = "original" MediaVariantThumb MediaVariant = "thumb" )
Defines values for MediaVariant.
type Principal ¶
func (*Principal) HasPermission ¶
type RequiredHeaderError ¶
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 SearchAssetsParams ¶
type SearchAssetsParams struct {
// Q Full-text query (searched across title, caption, and tags).
Q *Query `form:"q,omitempty" json:"q,omitempty"`
// Tag Filter by tag name. Repeatable to require multiple tags.
Tag *TagFilter `form:"tag,omitempty" json:"tag,omitempty"`
Page *Page `form:"page,omitempty" json:"page,omitempty"`
PageSize *PageSize `form:"pageSize,omitempty" json:"pageSize,omitempty"`
// Sort Sort order for search results.
Sort *SearchAssetsParamsSort `form:"sort,omitempty" json:"sort,omitempty"`
// IncludeDeleted Include soft-deleted assets in results (admin use).
IncludeDeleted *IncludeDeleted `form:"includeDeleted,omitempty" json:"includeDeleted,omitempty"`
}
SearchAssetsParams defines parameters for SearchAssets.
type SearchAssetsParamsSort ¶
type SearchAssetsParamsSort string
SearchAssetsParamsSort defines parameters for SearchAssets.
const ( SearchAssetsParamsSortNewest SearchAssetsParamsSort = "newest" SearchAssetsParamsSortOldest SearchAssetsParamsSort = "oldest" SearchAssetsParamsSortRelevance SearchAssetsParamsSort = "relevance" )
Defines values for SearchAssetsParamsSort.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) DeleteAsset ¶
func (*Server) GetHealthz ¶
func (s *Server) GetHealthz(w http.ResponseWriter, _ *http.Request)
func (*Server) GetMediaVariant ¶
func (s *Server) GetMediaVariant(w http.ResponseWriter, r *http.Request, id AssetId, variant GetMediaVariantParamsVariant)
func (*Server) ListTags ¶
func (s *Server) ListTags(w http.ResponseWriter, r *http.Request, params ListTagsParams)
func (*Server) SearchAssets ¶
func (s *Server) SearchAssets(w http.ResponseWriter, r *http.Request, params SearchAssetsParams)
func (*Server) UpdateAsset ¶
func (*Server) UploadAsset ¶
func (s *Server) UploadAsset(w http.ResponseWriter, r *http.Request)
type ServerInterface ¶
type ServerInterface interface {
// Search and browse assets
// (GET /api/assets)
SearchAssets(w http.ResponseWriter, r *http.Request, params SearchAssetsParams)
// Upload a new asset
// (POST /api/assets)
UploadAsset(w http.ResponseWriter, r *http.Request)
// Soft delete an asset
// (DELETE /api/assets/{id})
DeleteAsset(w http.ResponseWriter, r *http.Request, id AssetId)
// Get an asset by id
// (GET /api/assets/{id})
GetAsset(w http.ResponseWriter, r *http.Request, id AssetId)
// Update asset metadata
// (PATCH /api/assets/{id})
UpdateAsset(w http.ResponseWriter, r *http.Request, id AssetId)
// List tags (optionally by prefix)
// (GET /api/tags)
ListTags(w http.ResponseWriter, r *http.Request, params ListTagsParams)
// Liveness check
// (GET /healthz)
GetHealthz(w http.ResponseWriter, r *http.Request)
// Serve image bytes for an asset variant
// (GET /media/{id}/{variant})
GetMediaVariant(w http.ResponseWriter, r *http.Request, id AssetId, variant GetMediaVariantParamsVariant)
// Readiness check
// (GET /readyz)
GetReadyz(w http.ResponseWriter, r *http.Request)
}
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) DeleteAsset ¶
func (siw *ServerInterfaceWrapper) DeleteAsset(w http.ResponseWriter, r *http.Request)
DeleteAsset operation middleware
func (*ServerInterfaceWrapper) GetAsset ¶
func (siw *ServerInterfaceWrapper) GetAsset(w http.ResponseWriter, r *http.Request)
GetAsset operation middleware
func (*ServerInterfaceWrapper) GetHealthz ¶
func (siw *ServerInterfaceWrapper) GetHealthz(w http.ResponseWriter, r *http.Request)
GetHealthz operation middleware
func (*ServerInterfaceWrapper) GetMediaVariant ¶
func (siw *ServerInterfaceWrapper) GetMediaVariant(w http.ResponseWriter, r *http.Request)
GetMediaVariant operation middleware
func (*ServerInterfaceWrapper) GetReadyz ¶
func (siw *ServerInterfaceWrapper) GetReadyz(w http.ResponseWriter, r *http.Request)
GetReadyz operation middleware
func (*ServerInterfaceWrapper) ListTags ¶
func (siw *ServerInterfaceWrapper) ListTags(w http.ResponseWriter, r *http.Request)
ListTags operation middleware
func (*ServerInterfaceWrapper) SearchAssets ¶
func (siw *ServerInterfaceWrapper) SearchAssets(w http.ResponseWriter, r *http.Request)
SearchAssets operation middleware
func (*ServerInterfaceWrapper) UpdateAsset ¶
func (siw *ServerInterfaceWrapper) UpdateAsset(w http.ResponseWriter, r *http.Request)
UpdateAsset operation middleware
func (*ServerInterfaceWrapper) UploadAsset ¶
func (siw *ServerInterfaceWrapper) UploadAsset(w http.ResponseWriter, r *http.Request)
UploadAsset operation middleware
type TagListResponse ¶
type TagListResponse struct {
Items []Tag `json:"items"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
Total int `json:"total"`
}
TagListResponse defines model for TagListResponse.
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) DeleteAsset ¶
func (_ Unimplemented) DeleteAsset(w http.ResponseWriter, r *http.Request, id AssetId)
Soft delete an asset (DELETE /api/assets/{id})
func (Unimplemented) GetAsset ¶
func (_ Unimplemented) GetAsset(w http.ResponseWriter, r *http.Request, id AssetId)
Get an asset by id (GET /api/assets/{id})
func (Unimplemented) GetHealthz ¶
func (_ Unimplemented) GetHealthz(w http.ResponseWriter, r *http.Request)
Liveness check (GET /healthz)
func (Unimplemented) GetMediaVariant ¶
func (_ Unimplemented) GetMediaVariant(w http.ResponseWriter, r *http.Request, id AssetId, variant GetMediaVariantParamsVariant)
Serve image bytes for an asset variant (GET /media/{id}/{variant})
func (Unimplemented) GetReadyz ¶
func (_ Unimplemented) GetReadyz(w http.ResponseWriter, r *http.Request)
Readiness check (GET /readyz)
func (Unimplemented) ListTags ¶
func (_ Unimplemented) ListTags(w http.ResponseWriter, r *http.Request, params ListTagsParams)
List tags (optionally by prefix) (GET /api/tags)
func (Unimplemented) SearchAssets ¶
func (_ Unimplemented) SearchAssets(w http.ResponseWriter, r *http.Request, params SearchAssetsParams)
Search and browse assets (GET /api/assets)
func (Unimplemented) UpdateAsset ¶
func (_ Unimplemented) UpdateAsset(w http.ResponseWriter, r *http.Request, id AssetId)
Update asset metadata (PATCH /api/assets/{id})
func (Unimplemented) UploadAsset ¶
func (_ Unimplemented) UploadAsset(w http.ResponseWriter, r *http.Request)
Upload a new asset (POST /api/assets)
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateAssetJSONRequestBody ¶
type UpdateAssetJSONRequestBody = AssetUpdate
UpdateAssetJSONRequestBody defines body for UpdateAsset for application/json ContentType.
type UploadAssetMultipartBody ¶
type UploadAssetMultipartBody struct {
Caption *string `json:"caption,omitempty"`
Credit *string `json:"credit,omitempty"`
File openapi_types.File `json:"file"`
Source *string `json:"source,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Title *string `json:"title,omitempty"`
UsageNotes *string `json:"usageNotes,omitempty"`
}
UploadAssetMultipartBody defines parameters for UploadAsset.
type UploadAssetMultipartRequestBody ¶
type UploadAssetMultipartRequestBody UploadAssetMultipartBody
UploadAssetMultipartRequestBody defines body for UploadAsset for multipart/form-data ContentType.