apiv1

package
v0.0.0-...-e3ca868 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 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"
	BearerAuthScopes      = "BearerAuth.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 is documented in the public spec to describe the storage upload endpoint, but the actual upload should be performed against the `upload_url` returned by POST /upload/sessions. We don't serve storage uploads on the public v1 base path.

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 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 Größe der Datei in Bytes.
	FileSize int64 `json:"file_size"`
}

UploadSessionRequest defines model for UploadSessionRequest.

type UploadSessionResponse

type UploadSessionResponse struct {
	// ExpiresAt Ablaufzeit als Unix-Timestamp (Sekunden).
	ExpiresAt int64 `json:"expires_at"`

	// MaxBytes Maximale Dateigröße in Bytes, die mit diesem Token akzeptiert wird.
	MaxBytes int64 `json:"max_bytes"`

	// PoolId Interne ID des Storage-Pools.
	PoolId int64 `json:"pool_id"`

	// Token Zeitlich begrenzter Upload-Token (Bearer Token).
	Token string `json:"token"`

	// UploadUrl Vollständige URL zum Storage-Endpunkt.
	UploadUrl string `json:"upload_url"`
}

UploadSessionResponse defines model for UploadSessionResponse.

type UserAccount

type UserAccount struct {
	// ApiKeyLastUsedAt Letzte Verwendung des aktuellen API-Schlüssels
	ApiKeyLastUsedAt *time.Time `json:"api_key_last_used_at"`

	// CreatedAt Registrierungszeitpunkt
	CreatedAt time.Time `json:"created_at"`

	// Email Verknüpfte E-Mail-Adresse
	Email openapi_types.Email `json:"email"`

	// Id Benutzer-ID
	Id int64 `json:"id"`

	// LastLoginAt Zeitpunkt der letzten Anmeldung (falls vorhanden)
	LastLoginAt *time.Time        `json:"last_login_at"`
	Limits      UserAccountLimits `json:"limits"`

	// Plan Aktueller Paketplan
	Plan        string                 `json:"plan"`
	Preferences UserAccountPreferences `json:"preferences"`
	Stats       UserAccountStats       `json:"stats"`

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

	// Username Anzeigename des Benutzers
	Username string `json:"username"`
}

UserAccount defines model for UserAccount.

type UserAccountLimits

type UserAccountLimits struct {
	// AllowedThumbnailFormats Verfügbare Thumbnail-Formate
	AllowedThumbnailFormats []string `json:"allowed_thumbnail_formats"`

	// CanMultiUpload Darf Mehrfach-Uploads durchführen
	CanMultiUpload bool `json:"can_multi_upload"`

	// DirectUploadEnabled Globale Einstellung für Direkt-Uploads
	DirectUploadEnabled bool `json:"direct_upload_enabled"`

	// ImageUploadEnabled Globale Einstellung für Bild-Uploads
	ImageUploadEnabled bool `json:"image_upload_enabled"`

	// MaxUploadBytes Maximale Uploadgröße pro Datei (in Bytes)
	MaxUploadBytes int64 `json:"max_upload_bytes"`

	// StorageQuotaBytes Gesamtverfügbarer Speicher (null bei unbegrenzt)
	StorageQuotaBytes *int64 `json:"storage_quota_bytes"`
}

UserAccountLimits defines model for UserAccountLimits.

type UserAccountPreferences

type UserAccountPreferences struct {
	// ThumbnailAvif Bevorzugt AVIF-Thumbnails
	ThumbnailAvif bool `json:"thumbnail_avif"`

	// ThumbnailOriginal Bevorzugt Original-Thumbnails
	ThumbnailOriginal bool `json:"thumbnail_original"`

	// ThumbnailWebp Bevorzugt WebP-Thumbnails
	ThumbnailWebp bool `json:"thumbnail_webp"`
}

UserAccountPreferences defines model for UserAccountPreferences.

type UserAccountStats

type UserAccountStats struct {
	Albums struct {
		// Count Anzahl erstellter Alben
		Count int64 `json:"count"`
	} `json:"albums"`
	Images struct {
		// Count Anzahl gespeicherter Bilder
		Count int64 `json:"count"`

		// StorageRemainingBytes Verbleibender Speicherplatz (null bei unbegrenzt)
		StorageRemainingBytes *int64 `json:"storage_remaining_bytes"`

		// StorageUsedBytes Belegter Speicher 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