api

package
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_STORAGE_BACKEND = "s3-deafult"

Variables

This section is empty.

Functions

func GetLatestVersionObject

func GetLatestVersionObject(objects []*simplecontent.Object) *simplecontent.Object

GetLatestVersionObject returns the object with the highest version number from a slice of objects. If there are multiple objects with the same highest version, it returns the first one found.

Types

type ContentHandler

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

ContentHandler handles HTTP requests for content using pkg/simplecontent

func NewContentHandler

func NewContentHandler(service simplecontent.Service, storageService simplecontent.StorageService) *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) GetContentDetails

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

GetContentDetails retrieves detailed content information with URLs

func (*ContentHandler) GetContentsByIDs

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

GetContentsByIDs retrieves multiple contents by their IDs

func (*ContentHandler) ListObjects

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

ListObjects lists objects for a content Query parameters:

  • latest=true: Only return the latest version object (default: true)

func (*ContentHandler) Routes

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

Routes returns the routes for content

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"`
	MimeType     string    `json:"mime_type"`
	FileSize     int64     `json:"file_size"`
	FileName     string    `json:"file_name"`
	DocumentType string    `json:"document_type"`
}

ContentResponse is the response body for a content

type CreateContentRequest

type CreateContentRequest struct {
	OwnerID      string `json:"owner_id"`
	TenantID     string `json:"tenant_id"`
	DocumentType string `json:"document_type"`
	FileName     string `json:"file_name"`
	OwnerType    string `json:"owner_type"`
	MimeType     string `json:"mime_type"`
	FileSize     int64  `json:"file_size"`
}

CreateContentRequest is the request body for creating a content

type CreateDerivedContentRequest

type CreateDerivedContentRequest struct {
	DerivedContentID   uuid.UUID              `json:"derived_content_id"`
	DerivationType     string                 `json:"derivation_type"`
	DerivationParams   map[string]interface{} `json:"derivation_params"`
	ProcessingMetadata map[string]interface{} `json:"processing_metadata"`
	OwnerID            string                 `json:"owner_id"`
	TenantID           string                 `json:"tenant_id"`
}

CreateDerivedContentRequest is the request body for creating derived content

type CreateDerivedContentResponse

type CreateDerivedContentResponse struct {
	ParentContentID  string `json:"parent_content_id"`
	DerivedContentID string `json:"derived_content_id"`
	DerivationType   string `json:"derivation_type"`
}

CreateDerivedContentResponse is the response body for derived content creation

type CreateFileRequest

type CreateFileRequest struct {
	OwnerID            string `json:"owner_id"`
	OwnerType          string `json:"owner_type"`
	TenantID           string `json:"tenant_id"`
	FileName           string `json:"file_name"`
	MimeType           string `json:"mime_type,omitempty"`
	FileSize           int64  `json:"file_size,omitempty"`
	DocumentType       string `json:"document_type,omitempty"`
	StorageBackendName string `json:"storage_backend_name,omitempty"`
}

CreateFileRequest represents the request to create a new file

type CreateFileResponse

type CreateFileResponse struct {
	ContentID string    `json:"content_id"`
	ObjectID  string    `json:"object_id"`
	UploadURL string    `json:"upload_url"`
	CreatedAt time.Time `json:"created_at"`
	Status    string    `json:"status"`
}

CreateFileResponse represents the response after creating a file

type CreateObjectRequest

type CreateObjectRequest struct {
	StorageBackendName string `json:"storage_backend_name"`
	Version            int    `json:"version"`
	ObjectKey          string `json:"object_key"`
	MimeType           string `json:"mime_type"`
	FileSize           int64  `json:"file_size"`
	FileName           string `json:"file_name"`
}

CreateObjectRequest is the request body for creating an object

type FileInfoResponse

type FileInfoResponse struct {
	ContentID   string                 `json:"content_id"`
	FileName    string                 `json:"file_name"`
	PreviewURL  string                 `json:"preview_url"`
	DownloadURL string                 `json:"download_url"`
	Metadata    map[string]interface{} `json:"metadata"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Status      string                 `json:"status"`
	MimeType    string                 `json:"mime_type"`
	FileSize    int64                  `json:"file_size"`
	OwnerID     string                 `json:"owner_id"`
	OwnerType   string                 `json:"owner_type"`
	TenantID    string                 `json:"tenant_id"`
}

FileInfoResponse represents file information including URLs

type FilesHandler

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

FilesHandler handles file upload and management API endpoints using pkg/simplecontent

func NewFilesHandler

func NewFilesHandler(service simplecontent.Service, storageService simplecontent.StorageService) *FilesHandler

func (*FilesHandler) CompleteUpload

func (h *FilesHandler) CompleteUpload(w http.ResponseWriter, r *http.Request)

CompleteUpload marks a client-side upload as complete

func (*FilesHandler) CreateFile

func (h *FilesHandler) CreateFile(w http.ResponseWriter, r *http.Request)

CreateFile creates a new content and returns upload URL

func (*FilesHandler) GetFileInfo

func (h *FilesHandler) GetFileInfo(w http.ResponseWriter, r *http.Request)

GetFileInfo returns file information including preview and download URLs

func (*FilesHandler) GetFilesByContentIDs

func (h *FilesHandler) GetFilesByContentIDs(w http.ResponseWriter, r *http.Request)

GetFilesByContentIDs retrieves multiple files by their IDs

func (*FilesHandler) Routes

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

Routes returns the router for files endpoints

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"`
	UploadURL          string    `json:"upload_url"`
}

ObjectResponse is the response body for an object

type UpdateMetadataRequest

type UpdateMetadataRequest struct {
	Title       string                 `json:"title,omitempty"`
	Description string                 `json:"description,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

UpdateMetadataRequest represents the request to update file metadata

Jump to

Keyboard shortcuts

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