apiv1

package
v0.0.0-...-4a6608b Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	ApiKeyAuthScopes      = "ApiKeyAuth.Scopes"
	UploadTokenAuthScopes = "UploadTokenAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router fiber.Router, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router fiber.Router, si ServerInterface, options FiberServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type APIServer

type APIServer struct{}

APIServer implements the ServerInterface

func NewAPIServer

func NewAPIServer() *APIServer

NewAPIServer creates a new API server instance

func (*APIServer) GetImage

func (s *APIServer) GetImage(c *fiber.Ctx, uuid string) error

GetImage returns metadata for an image resource by UUID (API key protected). Delegates to the existing controller for consistent response shape.

func (*APIServer) GetImageStatus

func (s *APIServer) GetImageStatus(c *fiber.Ctx, uuid string) error

GetImageStatus returns processing status for an image (JSON)

func (*APIServer) GetPing

func (s *APIServer) GetPing(c *fiber.Ctx) error

GetPing handles the ping endpoint

func (*APIServer) GetUserProfile

func (s *APIServer) GetUserProfile(c *fiber.Ctx) error

GetUserProfile returns account information for the authenticated user (API key). Security is enforced via API key middleware attached in the router.

func (*APIServer) PostDirectUpload

func (s *APIServer) PostDirectUpload(c *fiber.Ctx) error

PostDirectUpload handles token-authenticated direct uploads. Clients should prefer the `upload_url` returned by POST /upload/sessions. This route is kept as a compatible alias for environments where /api/v1 is used directly.

func (*APIServer) PostUserUploadSession

func (s *APIServer) PostUserUploadSession(c *fiber.Ctx) error

PostUserUploadSession issues a direct upload session via API key authentication. Security is enforced via API key middleware attached in the router.

type BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

type Error

type Error struct {
	// Details Additional error details
	Details *string `json:"details,omitempty"`

	// Error Error type identifier
	Error string `json:"error"`

	// Message Human-readable error message
	Message string `json:"message"`
}

Error defines model for Error.

type FiberServerOptions

type FiberServerOptions struct {
	BaseURL     string
	Middlewares []MiddlewareFunc
}

FiberServerOptions provides options for the Fiber server.

type Forbidden

type Forbidden = Error

Forbidden defines model for Forbidden.

type FormatVariants

type FormatVariants struct {
	Medium   *VariantSize `json:"medium,omitempty"`
	Original *VariantSize `json:"original,omitempty"`
	Small    *VariantSize `json:"small,omitempty"`
}

FormatVariants defines model for FormatVariants.

type ImageResource

type ImageResource struct {
	// AvailableVariants List of available variant-families for this image
	AvailableVariants *[]ImageResourceAvailableVariants `json:"available_variants,omitempty"`
	ImageUuid         string                            `json:"image_uuid"`

	// Url Direct URL to the original image file
	Url *string `json:"url,omitempty"`

	// Variants URLs of available variants grouped by family
	Variants *struct {
		Avif     *FormatVariants `json:"avif,omitempty"`
		Original *FormatVariants `json:"original,omitempty"`
		Webp     *FormatVariants `json:"webp,omitempty"`
	} `json:"variants,omitempty"`

	// ViewUrl Share page URL (HTML view)
	ViewUrl *string `json:"view_url,omitempty"`
}

ImageResource defines model for ImageResource.

type ImageResourceAvailableVariants

type ImageResourceAvailableVariants string

ImageResourceAvailableVariants defines model for ImageResource.AvailableVariants.

const (
	ImageResourceAvailableVariantsAvif     ImageResourceAvailableVariants = "avif"
	ImageResourceAvailableVariantsOriginal ImageResourceAvailableVariants = "original"
	ImageResourceAvailableVariantsWebp     ImageResourceAvailableVariants = "webp"
)

Defines values for ImageResourceAvailableVariants.

type InternalError

type InternalError = Error

InternalError defines model for InternalError.

type MiddlewareFunc

type MiddlewareFunc fiber.Handler

type NotFound

type NotFound = Error

NotFound defines model for NotFound.

type PayloadTooLarge

type PayloadTooLarge = Error

PayloadTooLarge defines model for PayloadTooLarge.

type Pong

type Pong struct {
	// Ping Simple response confirming API availability
	Ping string `json:"ping"`
}

Pong defines model for Pong.

type PostDirectUploadMultipartBody

type PostDirectUploadMultipartBody struct {
	File openapi_types.File `json:"file"`

	// Token Alternative to Authorization header: pass upload token as multipart field
	Token *string `json:"token,omitempty"`
}

PostDirectUploadMultipartBody defines parameters for PostDirectUpload.

type PostDirectUploadMultipartRequestBody

type PostDirectUploadMultipartRequestBody PostDirectUploadMultipartBody

PostDirectUploadMultipartRequestBody defines body for PostDirectUpload for multipart/form-data ContentType.

type PostUserUploadSessionJSONRequestBody

type PostUserUploadSessionJSONRequestBody = UploadSessionRequest

PostUserUploadSessionJSONRequestBody defines body for PostUserUploadSession for application/json ContentType.

type ServerInterface

type ServerInterface interface {
	// Get image resource
	// (GET /images/{uuid})
	GetImage(c *fiber.Ctx, uuid string) error
	// Get processing status
	// (GET /images/{uuid}/status)
	GetImageStatus(c *fiber.Ctx, uuid string) error
	// Health check endpoint
	// (GET /ping)
	GetPing(c *fiber.Ctx) error
	// Direct storage upload
	// (POST /upload)
	PostDirectUpload(c *fiber.Ctx) error
	// Issue direct upload session
	// (POST /upload/sessions)
	PostUserUploadSession(c *fiber.Ctx) error
	// Get authenticated user profile
	// (GET /user/profile)
	GetUserProfile(c *fiber.Ctx) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetImage

func (siw *ServerInterfaceWrapper) GetImage(c *fiber.Ctx) error

GetImage operation middleware

func (*ServerInterfaceWrapper) GetImageStatus

func (siw *ServerInterfaceWrapper) GetImageStatus(c *fiber.Ctx) error

GetImageStatus operation middleware

func (*ServerInterfaceWrapper) GetPing

func (siw *ServerInterfaceWrapper) GetPing(c *fiber.Ctx) error

GetPing operation middleware

func (*ServerInterfaceWrapper) GetUserProfile

func (siw *ServerInterfaceWrapper) GetUserProfile(c *fiber.Ctx) error

GetUserProfile operation middleware

func (*ServerInterfaceWrapper) PostDirectUpload

func (siw *ServerInterfaceWrapper) PostDirectUpload(c *fiber.Ctx) error

PostDirectUpload operation middleware

func (*ServerInterfaceWrapper) PostUserUploadSession

func (siw *ServerInterfaceWrapper) PostUserUploadSession(c *fiber.Ctx) error

PostUserUploadSession operation middleware

type ServiceUnavailable

type ServiceUnavailable = Error

ServiceUnavailable defines model for ServiceUnavailable.

type StorageUploadResponse

type StorageUploadResponse struct {
	// AvailableVariants List of available variant-families for this image
	AvailableVariants *[]StorageUploadResponseAvailableVariants `json:"available_variants,omitempty"`

	// Duplicate Indicates the uploaded file already exists for this user
	Duplicate *bool `json:"duplicate,omitempty"`

	// ImageUuid UUID of the uploaded image
	ImageUuid *string `json:"image_uuid,omitempty"`

	// Url Direct URL to the original image file
	Url *string `json:"url,omitempty"`

	// Variants URLs of available variants grouped by family
	Variants *struct {
		Avif     *FormatVariants `json:"avif,omitempty"`
		Original *FormatVariants `json:"original,omitempty"`
		Webp     *FormatVariants `json:"webp,omitempty"`
	} `json:"variants,omitempty"`

	// ViewUrl Share page URL (HTML view)
	ViewUrl *string `json:"view_url,omitempty"`
}

StorageUploadResponse defines model for StorageUploadResponse.

type StorageUploadResponseAvailableVariants

type StorageUploadResponseAvailableVariants string

StorageUploadResponseAvailableVariants defines model for StorageUploadResponse.AvailableVariants.

const (
	StorageUploadResponseAvailableVariantsAvif     StorageUploadResponseAvailableVariants = "avif"
	StorageUploadResponseAvailableVariantsOriginal StorageUploadResponseAvailableVariants = "original"
	StorageUploadResponseAvailableVariantsWebp     StorageUploadResponseAvailableVariants = "webp"
)

Defines values for StorageUploadResponseAvailableVariants.

type TooManyRequests

type TooManyRequests = Error

TooManyRequests defines model for TooManyRequests.

type Unauthorized

type Unauthorized = Error

Unauthorized defines model for Unauthorized.

type UnsupportedMediaType

type UnsupportedMediaType = Error

UnsupportedMediaType defines model for UnsupportedMediaType.

type UploadSessionRequest

type UploadSessionRequest struct {
	// FileSize File size in bytes.
	FileSize int64 `json:"file_size"`
}

UploadSessionRequest defines model for UploadSessionRequest.

type UploadSessionResponse

type UploadSessionResponse struct {
	// ExpiresAt Expiration time as a Unix timestamp (seconds).
	ExpiresAt int64 `json:"expires_at"`

	// MaxBytes Maximum file size in bytes accepted with this token.
	MaxBytes int64 `json:"max_bytes"`

	// PoolId Identifier of the selected storage pool.
	PoolId int64 `json:"pool_id"`

	// Token Time-limited upload token (Bearer token).
	Token string `json:"token"`

	// UploadUrl Absolute URL of the upload endpoint.
	UploadUrl string `json:"upload_url"`
}

UploadSessionResponse defines model for UploadSessionResponse.

type UserAccount

type UserAccount struct {
	// ApiKeyLastUsedAt Last usage timestamp of the current API key
	ApiKeyLastUsedAt *time.Time `json:"api_key_last_used_at"`

	// CreatedAt Registration timestamp
	CreatedAt time.Time `json:"created_at"`

	// Email Linked email address
	Email openapi_types.Email `json:"email"`

	// Id User ID
	Id int64 `json:"id"`

	// LastLoginAt Timestamp of the last login (if available)
	LastLoginAt *time.Time        `json:"last_login_at"`
	Limits      UserAccountLimits `json:"limits"`

	// Plan Current subscription plan
	Plan        string                 `json:"plan"`
	Preferences UserAccountPreferences `json:"preferences"`
	Stats       UserAccountStats       `json:"stats"`

	// Status Account status
	Status string `json:"status"`

	// Username User display name
	Username string `json:"username"`
}

UserAccount defines model for UserAccount.

type UserAccountLimits

type UserAccountLimits struct {
	// AllowedThumbnailFormats Available thumbnail formats
	AllowedThumbnailFormats []string `json:"allowed_thumbnail_formats"`

	// CanMultiUpload Whether multi-upload is allowed
	CanMultiUpload bool `json:"can_multi_upload"`

	// DirectUploadEnabled Global setting for direct uploads
	DirectUploadEnabled bool `json:"direct_upload_enabled"`

	// ImageUploadEnabled Global setting for image uploads
	ImageUploadEnabled bool `json:"image_upload_enabled"`

	// MaxUploadBytes Maximum upload size per file (in bytes)
	MaxUploadBytes int64 `json:"max_upload_bytes"`

	// StorageQuotaBytes Total available storage (null if unlimited)
	StorageQuotaBytes *int64 `json:"storage_quota_bytes"`
}

UserAccountLimits defines model for UserAccountLimits.

type UserAccountPreferences

type UserAccountPreferences struct {
	// ThumbnailAvif Prefers AVIF thumbnails
	ThumbnailAvif bool `json:"thumbnail_avif"`

	// ThumbnailOriginal Prefers original thumbnails
	ThumbnailOriginal bool `json:"thumbnail_original"`

	// ThumbnailWebp Prefers WebP thumbnails
	ThumbnailWebp bool `json:"thumbnail_webp"`
}

UserAccountPreferences defines model for UserAccountPreferences.

type UserAccountStats

type UserAccountStats struct {
	Albums struct {
		// Count Number of created albums
		Count int64 `json:"count"`
	} `json:"albums"`
	Images struct {
		// Count Number of stored images
		Count int64 `json:"count"`

		// StorageRemainingBytes Remaining storage in bytes (null if unlimited)
		StorageRemainingBytes *int64 `json:"storage_remaining_bytes"`

		// StorageUsedBytes Used storage in bytes
		StorageUsedBytes int64 `json:"storage_used_bytes"`
	} `json:"images"`
}

UserAccountStats defines model for UserAccountStats.

type VariantSize

type VariantSize struct {
	// Animated Whether this asset is animated (e.g., GIF/WebP)
	Animated *bool `json:"animated,omitempty"`

	// Bytes File size in bytes if known
	Bytes *int64 `json:"bytes,omitempty"`

	// Height Pixel height if known
	Height *int `json:"height,omitempty"`

	// MimeType MIME type of this asset
	MimeType *string `json:"mime_type,omitempty"`
	Url      string  `json:"url"`

	// Width Pixel width if known
	Width *int `json:"width,omitempty"`
}

VariantSize defines model for VariantSize.

Jump to

Keyboard shortcuts

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