handler

package
v0.0.0-...-aecede4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	Details    any    `json:"details,omitempty"`
	Suggestion string `json:"suggestion,omitempty"`
	Category   string `json:"category,omitempty"`
	Severity   string `json:"severity,omitempty"`
	Retryable  bool   `json:"retryable,omitempty"`
}

APIError represents detailed error information

type APIErrorResponse

type APIErrorResponse struct {
	Success   bool     `json:"success"`
	Error     APIError `json:"error"`
	RequestID string   `json:"requestId,omitempty"`
}

APIErrorResponse represents a structured error response

type APIHandler

type APIHandler struct {
	// contains filtered or unexported fields
}

APIHandler handles API requests with dependency injection

func NewAPIHandler

func NewAPIHandler(profileProvider ProfileProvider, s3ServiceCreator S3ServiceCreator, logger *slog.Logger) *APIHandler

NewAPIHandler creates a new API handler with dependencies

func NewAPIHandlerWithShutdown

func NewAPIHandlerWithShutdown(profileProvider ProfileProvider, s3ServiceCreator S3ServiceCreator, shutdownCh chan<- struct{}, logger *slog.Logger) *APIHandler

NewAPIHandlerWithShutdown creates a new API handler with shutdown channel

func (*APIHandler) HandleBucketCreate

func (h *APIHandler) HandleBucketCreate(w http.ResponseWriter, r *http.Request)

HandleBucketCreate handles POST /api/buckets/create

func (*APIHandler) HandleBuckets

func (h *APIHandler) HandleBuckets(w http.ResponseWriter, r *http.Request)

HandleBuckets handles GET /api/buckets

func (*APIHandler) HandleFolderCreate

func (h *APIHandler) HandleFolderCreate(w http.ResponseWriter, r *http.Request)

HandleFolderCreate handles POST /api/objects/folder/create

func (*APIHandler) HandleHealth

func (h *APIHandler) HandleHealth(w http.ResponseWriter, r *http.Request)

HandleHealth handles POST /api/health

func (*APIHandler) HandleObjectsDelete

func (h *APIHandler) HandleObjectsDelete(w http.ResponseWriter, r *http.Request)

HandleObjectsDelete handles POST /api/objects/delete

func (*APIHandler) HandleObjectsDownload

func (h *APIHandler) HandleObjectsDownload(w http.ResponseWriter, r *http.Request)

HandleObjectsDownload handles POST /api/objects/download

func (*APIHandler) HandleObjectsList

func (h *APIHandler) HandleObjectsList(w http.ResponseWriter, r *http.Request)

HandleObjectsList handles POST /api/objects/list

func (*APIHandler) HandleObjectsUpload

func (h *APIHandler) HandleObjectsUpload(w http.ResponseWriter, r *http.Request)

HandleObjectsUpload handles POST /api/objects/upload

func (*APIHandler) HandleProfiles

func (h *APIHandler) HandleProfiles(w http.ResponseWriter, r *http.Request)

HandleProfiles handles GET /api/profiles

func (*APIHandler) HandleSettings

func (h *APIHandler) HandleSettings(w http.ResponseWriter, r *http.Request)

HandleSettings handles POST /api/settings

func (*APIHandler) HandleShutdown

func (h *APIHandler) HandleShutdown(w http.ResponseWriter, r *http.Request)

HandleShutdown handles POST /api/shutdown

func (*APIHandler) HandleStatus

func (h *APIHandler) HandleStatus(w http.ResponseWriter, r *http.Request)

HandleStatus handles POST /api/status

type APIResponse

type APIResponse struct {
	Success   bool   `json:"success"`
	Data      any    `json:"data,omitempty"`
	Error     string `json:"error,omitempty"`
	RequestID string `json:"requestId,omitempty"`
}

APIResponse represents a standard API response

type CreateBucketRequest

type CreateBucketRequest struct {
	Name string `json:"name"`
}

CreateBucketRequest represents the request for creating a bucket

type CreateFolderRequest

type CreateFolderRequest struct {
	Bucket string `json:"bucket"`
	Prefix string `json:"prefix"`
}

CreateFolderRequest represents the request for creating a folder

type DeleteObjectsRequest

type DeleteObjectsRequest struct {
	Bucket string   `json:"bucket"`
	Keys   []string `json:"keys"`
}

DeleteObjectsRequest represents the request payload for deleting objects

type DownloadObjectRequest

type DownloadObjectRequest struct {
	Bucket string   `json:"bucket"`
	Type   string   `json:"type"`             // "files" or "folder"
	Keys   []string `json:"keys,omitempty"`   // for files (single or multiple)
	Prefix string   `json:"prefix,omitempty"` // for folder
}

DownloadObjectRequest represents the request for downloading objects

type ListObjectsRequest

type ListObjectsRequest struct {
	Bucket            string `json:"bucket"`
	Prefix            string `json:"prefix,omitempty"`
	Delimiter         string `json:"delimiter,omitempty"`
	MaxKeys           int32  `json:"maxKeys,omitempty"`
	ContinuationToken string `json:"continuationToken,omitempty"`
}

ListObjectsRequest represents the request for listing objects

type ProfileProvider

type ProfileProvider interface {
	GetProfiles() ([]string, error)
}

ProfileProvider interface for dependency injection

type S3ServiceCreator

type S3ServiceCreator func(ctx context.Context, cfg service.S3Config) (service.S3Operations, error)

S3ServiceCreator is a function type for creating S3 services

type UploadFileInfo

type UploadFileInfo struct {
	Key  string `json:"key"`  // S3 object key
	File string `json:"file"` // multipart form field name
}

UploadFileInfo represents information for a single file upload

type UploadObjectsRequest

type UploadObjectsRequest struct {
	Bucket  string           `json:"bucket"`
	Uploads []UploadFileInfo `json:"uploads"`
}

UploadObjectsRequest represents the request for uploading multiple objects

Jump to

Keyboard shortcuts

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