Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultPage is the default gallery page number. DefaultPage = 1 // DefaultPerPage is the default gallery page size. DefaultPerPage = 20 // MaxUploadSize is the maximum accepted upload size in bytes (10 MB). MaxUploadSize = 10 << 20 )
Variables ¶
View Source
var ( // ErrQueryRequired indicates that the search query is required. ErrQueryRequired = errors.New("query parameter 'q' is required") // ErrAssetKeyRequired indicates that the asset key is required. ErrAssetKeyRequired = errors.New("query parameter 'key' is required") // ErrUploadEmpty indicates that an upload body was empty. ErrUploadEmpty = errors.New("gallery upload is empty") )
Functions ¶
This section is empty.
Types ¶
type AssetPayload ¶
AssetPayload is a binary gallery asset resolved for HTTP serving.
type AssetsPage ¶
type AssetsPage struct {
Assets []*entity.GalleryAsset
Total int
Page int
PerPage int
}
AssetsPage holds a paginated list of gallery assets.
type DeleteAssetCmd ¶
DeleteAssetCmd is the command for deleting a gallery asset.
type GalleryUseCase ¶
type GalleryUseCase interface {
// ListAssets returns a paginated list of assets for the workspace.
ListAssets(ctx context.Context, cmd ListAssetsCmd) (*AssetsPage, error)
// SearchAssets returns assets matching the search query.
SearchAssets(ctx context.Context, cmd SearchAssetsCmd) (*AssetsPage, error)
// UploadAsset uploads a new image and registers it in the gallery.
// Deduplicates by SHA-256: returns the existing asset if the content is identical.
UploadAsset(ctx context.Context, cmd UploadAssetCmd) (*entity.GalleryAsset, error)
// DeleteAsset removes an asset from storage and from the gallery registry.
DeleteAsset(ctx context.Context, cmd DeleteAssetCmd) error
// GetAssetURL returns a resolvable HTTP URL for the given asset key.
GetAssetURL(ctx context.Context, cmd GetAssetURLCmd) (string, error)
// ServeAsset resolves an owned asset and returns its payload for direct HTTP serving.
ServeAsset(ctx context.Context, cmd ServeAssetCmd) (*AssetPayload, error)
}
GalleryUseCase defines the input port for gallery operations.
type GetAssetURLCmd ¶
GetAssetURLCmd is the command for resolving a gallery asset URL.
type ListAssetsCmd ¶
ListAssetsCmd is the command for listing gallery assets.
type SearchAssetsCmd ¶
SearchAssetsCmd is the command for searching gallery assets.
type ServeAssetCmd ¶
ServeAssetCmd is the command for resolving gallery asset bytes for HTTP streaming.
Click to show internal directories.
Click to hide internal directories.