api

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Deprecated: This service is deprecated and will be removed in a future version. Please use the new module instead.

Deprecated: This service is deprecated and will be removed in a future version. Please use the new module instead.

Deprecated: This service is deprecated and will be removed in a future version. Please use the new module instead.

Deprecated: This service is deprecated and will be removed in a future version. Please use the new module instead.

Index

Constants

View Source
const MAX_CONTENTS_PER_REQUEST = 50

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) GetContentsByIDs added in v0.0.8

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

GetContentsByIDs retrieves multiple contents by their IDs

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 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

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

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"`
	DerivationType string `json:"derivation_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 {
	ParentContentID    uuid.UUID              `json:"parent_content_id"`
	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"`
}

CreateDerivedContentRequest is the request body for creating derived content

type CreateDerivedContentResponse added in v0.0.15

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

type CreateFileRequest added in v0.0.7

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"`
}

CreateFileRequest represents the request to create a new file

type CreateFileResponse added in v0.0.7

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 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 FileInfoResponse added in v0.0.7

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"`
	DerivationType string                 `json:"derivation_type"`
	OwnerID        string                 `json:"owner_id"`
	OwnerType      string                 `json:"owner_type"`
	TenantID       string                 `json:"tenant_id"`
}

FileInfoResponse represents file information including URLs

type FilesHandler added in v0.0.7

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

FilesHandler handles file upload and management API endpoints

func NewFilesHandler added in v0.0.7

func NewFilesHandler(contentService *service.ContentService, objectService *service.ObjectService) *FilesHandler

NewFilesHandler creates a new files handler

func (*FilesHandler) CompleteUpload added in v0.0.7

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

CompleteUpload marks a client-side upload as complete

func (*FilesHandler) CreateFile added in v0.0.7

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

CreateFile creates a new content and returns upload URL

func (*FilesHandler) GetFileInfo added in v0.0.7

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

GetFileInfo returns file information including preview and download URLs

func (*FilesHandler) GetFilesByContentIDs added in v0.0.8

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

GetBulkFiles retrieves multiple files by their IDs

func (*FilesHandler) Routes added in v0.0.7

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

Routes returns the router for files endpoints

func (*FilesHandler) UpdateMetadata added in v0.0.7

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

UpdateMetadata updates file metadata

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

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 UpdateMetadataRequest added in v0.0.7

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

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