api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentHandler

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

ContentHandler handles HTTP requests for content

func NewContentHandler

func NewContentHandler(
	contentService *service.ContentService,
	objectService *service.ObjectService,
) *ContentHandler

NewContentHandler creates a new content handler

func (*ContentHandler) CreateContent

func (h *ContentHandler) CreateContent(w http.ResponseWriter, r *http.Request)

CreateContent creates a new content

func (*ContentHandler) CreateDerivedContent

func (h *ContentHandler) CreateDerivedContent(w http.ResponseWriter, r *http.Request)

CreateDerivedContent creates a new derived content from a parent content

func (*ContentHandler) CreateObject

func (h *ContentHandler) CreateObject(w http.ResponseWriter, r *http.Request)

CreateObject creates a new object for a content

func (*ContentHandler) DeleteContent

func (h *ContentHandler) DeleteContent(w http.ResponseWriter, r *http.Request)

DeleteContent deletes a content by ID

func (*ContentHandler) GetContent

func (h *ContentHandler) GetContent(w http.ResponseWriter, r *http.Request)

GetContent retrieves a content by ID

func (*ContentHandler) GetDerivedContent

func (h *ContentHandler) GetDerivedContent(w http.ResponseWriter, r *http.Request)

GetDerivedContent retrieves all content directly derived from a specific parent

func (*ContentHandler) GetDerivedContentTree

func (h *ContentHandler) GetDerivedContentTree(w http.ResponseWriter, r *http.Request)

GetDerivedContentTree retrieves the entire tree of derived content

func (*ContentHandler) GetDownload

func (h *ContentHandler) GetDownload(w http.ResponseWriter, r *http.Request)

GetDownload gets a download URL for a content

func (*ContentHandler) GetMetadata

func (h *ContentHandler) GetMetadata(w http.ResponseWriter, r *http.Request)

GetMetadata retrieves metadata for a content

func (*ContentHandler) ListContents

func (h *ContentHandler) ListContents(w http.ResponseWriter, r *http.Request)

ListContents lists contents by owner ID and tenant ID

func (*ContentHandler) ListObjects

func (h *ContentHandler) ListObjects(w http.ResponseWriter, r *http.Request)

ListObjects lists objects for a content

func (*ContentHandler) Routes

func (h *ContentHandler) Routes() chi.Router

Routes returns the routes for content

func (*ContentHandler) UpdateMetadata

func (h *ContentHandler) UpdateMetadata(w http.ResponseWriter, r *http.Request)

UpdateMetadata updates metadata for a content

type ContentMetadataRequest

type ContentMetadataRequest struct {
	ContentType string                 `json:"content_type"`
	Title       string                 `json:"title,omitempty"`
	Description string                 `json:"description,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	FileSize    int64                  `json:"file_size,omitempty"`
	CreatedBy   string                 `json:"created_by,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

ContentMetadataRequest is the request body for updating content metadata

type ContentMetadataResponse

type ContentMetadataResponse struct {
	ContentID         string                 `json:"content_id"`
	MimeType          string                 `json:"mime_type"`
	FileName          string                 `json:"file_name,omitempty"`
	Tags              []string               `json:"tags,omitempty"`
	FileSize          int64                  `json:"file_size,omitempty"`
	Checksum          string                 `json:"checksum,omitempty"`
	ChecksumAlgorithm string                 `json:"checksum_algorithm,omitempty"`
	Metadata          map[string]interface{} `json:"metadata,omitempty"`
}

ContentMetadataResponse is the response body for content metadata

type ContentResponse

type ContentResponse struct {
	ID             string    `json:"id"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	OwnerID        string    `json:"owner_id"`
	TenantID       string    `json:"tenant_id"`
	Status         string    `json:"status"`
	DerivationType string    `json:"derivation_type"`
}

ContentResponse is the response body for a content

type CreateContentRequest

type CreateContentRequest struct {
	OwnerID  string `json:"owner_id"`
	TenantID string `json:"tenant_id"`
}

CreateContentRequest is the request body for creating a content

type CreateDerivedContentRequest

type CreateDerivedContentRequest struct {
	OwnerID  string `json:"owner_id"`
	TenantID string `json:"tenant_id"`
}

CreateDerivedContentRequest is the request body for creating derived content

type CreateObjectRequest

type CreateObjectRequest struct {
	StorageBackendName string `json:"storage_backend_name"`
	Version            int    `json:"version"`
}

CreateObjectRequest is the request body for creating an object

type CreateStandaloneObjectRequest

type CreateStandaloneObjectRequest struct {
	ContentID          string `json:"content_id"`
	StorageBackendName string `json:"storage_backend_name"`
	Version            int    `json:"version"`
}

CreateStandaloneObjectRequest represents a request to create an object directly

type CreateStorageBackendRequest

type CreateStorageBackendRequest struct {
	Name   string                 `json:"name"`
	Type   string                 `json:"type"`
	Config map[string]interface{} `json:"config"`
}

CreateStorageBackendRequest is the request body for creating a storage backend

type ListContentsRequest

type ListContentsRequest struct {
	OwnerID  string `json:"owner_id"`
	TenantID string `json:"tenant_id"`
}

ListContentsRequest is the query parameters for listing contents

type ObjectHandler

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

ObjectHandler handles HTTP requests for objects

func NewObjectHandler

func NewObjectHandler(objectService *service.ObjectService) *ObjectHandler

NewObjectHandler creates a new object handler

func (*ObjectHandler) CreateObject

func (h *ObjectHandler) CreateObject(w http.ResponseWriter, r *http.Request)

CreateObject creates a new object

func (*ObjectHandler) DeleteObject

func (h *ObjectHandler) DeleteObject(w http.ResponseWriter, r *http.Request)

DeleteObject deletes an object by ID

func (*ObjectHandler) DownloadObject

func (h *ObjectHandler) DownloadObject(w http.ResponseWriter, r *http.Request)

DownloadObject downloads content from an object

func (*ObjectHandler) GetMetadata

func (h *ObjectHandler) GetMetadata(w http.ResponseWriter, r *http.Request)

GetMetadata retrieves metadata for an object

func (*ObjectHandler) GetObject

func (h *ObjectHandler) GetObject(w http.ResponseWriter, r *http.Request)

GetObject retrieves an object by ID

func (*ObjectHandler) Routes

func (h *ObjectHandler) Routes() chi.Router

Routes returns the routes for objects

func (*ObjectHandler) UpdateMetadata

func (h *ObjectHandler) UpdateMetadata(w http.ResponseWriter, r *http.Request)

UpdateMetadata updates metadata for an object

func (*ObjectHandler) UploadObject

func (h *ObjectHandler) UploadObject(w http.ResponseWriter, r *http.Request)

UploadObject uploads content to an object

type ObjectResponse

type ObjectResponse struct {
	ID                 string    `json:"id"`
	ContentID          string    `json:"content_id"`
	StorageBackendName string    `json:"storage_backend_name"`
	Version            int       `json:"version"`
	ObjectKey          string    `json:"object_key"`
	Status             string    `json:"status"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

ObjectResponse is the response body for an object

type StandaloneObjectResponse

type StandaloneObjectResponse struct {
	ID                 string    `json:"id"`
	ContentID          string    `json:"content_id"`
	StorageBackendName string    `json:"storage_backend_name"`
	Version            int       `json:"version"`
	ObjectKey          string    `json:"object_key"`
	Status             string    `json:"status"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

StandaloneObjectResponse is the response body for an object

type StorageBackendHandler

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

StorageBackendHandler handles HTTP requests for storage backends

func NewStorageBackendHandler

func NewStorageBackendHandler(storageBackendService *service.StorageBackendService) *StorageBackendHandler

NewStorageBackendHandler creates a new storage backend handler

func (*StorageBackendHandler) CreateStorageBackend

func (h *StorageBackendHandler) CreateStorageBackend(w http.ResponseWriter, r *http.Request)

CreateStorageBackend creates a new storage backend

func (*StorageBackendHandler) DeleteStorageBackend

func (h *StorageBackendHandler) DeleteStorageBackend(w http.ResponseWriter, r *http.Request)

DeleteStorageBackend deletes a storage backend

func (*StorageBackendHandler) GetStorageBackend

func (h *StorageBackendHandler) GetStorageBackend(w http.ResponseWriter, r *http.Request)

GetStorageBackend retrieves a storage backend by name

func (*StorageBackendHandler) ListStorageBackends

func (h *StorageBackendHandler) ListStorageBackends(w http.ResponseWriter, r *http.Request)

ListStorageBackends lists all storage backends

func (*StorageBackendHandler) Routes

func (h *StorageBackendHandler) Routes() chi.Router

Routes returns the routes for storage backends

func (*StorageBackendHandler) UpdateStorageBackend

func (h *StorageBackendHandler) UpdateStorageBackend(w http.ResponseWriter, r *http.Request)

UpdateStorageBackend updates a storage backend

type StorageBackendResponse

type StorageBackendResponse struct {
	Name      string                 `json:"name"`
	Type      string                 `json:"type"`
	Config    map[string]interface{} `json:"config"`
	IsActive  bool                   `json:"is_active"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
}

StorageBackendResponse is the response body for a storage backend

type UpdateStorageBackendRequest

type UpdateStorageBackendRequest struct {
	Type     string                 `json:"type"`
	Config   map[string]interface{} `json:"config"`
	IsActive bool                   `json:"is_active"`
}

UpdateStorageBackendRequest is the request body for updating a storage backend

Jump to

Keyboard shortcuts

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