handlers

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handlers provides HTTP handlers for the CMS plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddFieldRequest added in v0.0.7

type AddFieldRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type ArchiveEntryRequest added in v0.0.7

type ArchiveEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type BulkDeleteRequest added in v0.0.7

type BulkDeleteRequest struct {
	TypeSlug string   `path:"typeSlug" validate:"required"`
	IDs      []string `json:"ids"      validate:"required"`
}

type BulkPublishRequest added in v0.0.7

type BulkPublishRequest struct {
	TypeSlug string   `path:"typeSlug" validate:"required"`
	IDs      []string `json:"ids"      validate:"required"`
}

type BulkRequest

type BulkRequest struct {
	IDs []string `json:"ids"`
}

BulkRequest represents a bulk operation request.

type BulkUnpublishRequest added in v0.0.7

type BulkUnpublishRequest struct {
	TypeSlug string   `path:"typeSlug" validate:"required"`
	IDs      []string `json:"ids"      validate:"required"`
}

type CloneContentTypeRequest added in v0.0.7

type CloneContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type CompareRevisionsRequest added in v0.0.7

type CompareRevisionsRequest struct {
	TypeSlug   string `path:"typeSlug"   validate:"required"`
	EntryID    string `path:"entryId"    validate:"required"`
	RevisionID string `path:"revisionId" validate:"required"`
	CompareID  string `query:"compareId" validate:"required"`
}

type ContentEntryHandler

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

ContentEntryHandler handles content entry HTTP requests.

func NewContentEntryHandler

func NewContentEntryHandler(
	entrySvc *service.ContentEntryService,
	ctSvc *service.ContentTypeService,
) *ContentEntryHandler

NewContentEntryHandler creates a new content entry handler.

func (*ContentEntryHandler) ArchiveEntry

func (h *ContentEntryHandler) ArchiveEntry(c forge.Context) error

ArchiveEntry archives a content entry POST /cms/:type/:id/archive.

func (*ContentEntryHandler) BulkDelete

func (h *ContentEntryHandler) BulkDelete(c forge.Context) error

BulkDelete deletes multiple entries POST /cms/:type/bulk/delete.

func (*ContentEntryHandler) BulkPublish

func (h *ContentEntryHandler) BulkPublish(c forge.Context) error

BulkPublish publishes multiple entries POST /cms/:type/bulk/publish.

func (*ContentEntryHandler) BulkUnpublish

func (h *ContentEntryHandler) BulkUnpublish(c forge.Context) error

BulkUnpublish unpublishes multiple entries POST /cms/:type/bulk/unpublish.

func (*ContentEntryHandler) CreateEntry

func (h *ContentEntryHandler) CreateEntry(c forge.Context) error

CreateEntry creates a new content entry POST /cms/:type.

func (*ContentEntryHandler) DeleteEntry

func (h *ContentEntryHandler) DeleteEntry(c forge.Context) error

DeleteEntry deletes a content entry DELETE /cms/:type/:id.

func (*ContentEntryHandler) GetEntry

func (h *ContentEntryHandler) GetEntry(c forge.Context) error

GetEntry retrieves a content entry by ID GET /cms/:type/:id.

func (*ContentEntryHandler) GetEntryStats

func (h *ContentEntryHandler) GetEntryStats(c forge.Context) error

GetEntryStats returns statistics for entries GET /cms/:type/stats.

func (*ContentEntryHandler) ListEntries

func (h *ContentEntryHandler) ListEntries(c forge.Context) error

ListEntries lists entries for a content type GET /cms/:type.

func (*ContentEntryHandler) PublishEntry

func (h *ContentEntryHandler) PublishEntry(c forge.Context) error

PublishEntry publishes a content entry POST /cms/:type/:id/publish.

func (*ContentEntryHandler) QueryEntries

func (h *ContentEntryHandler) QueryEntries(c forge.Context) error

QueryEntries performs an advanced query on entries POST /cms/:type/query.

func (*ContentEntryHandler) UnpublishEntry

func (h *ContentEntryHandler) UnpublishEntry(c forge.Context) error

UnpublishEntry unpublishes a content entry POST /cms/:type/:id/unpublish.

func (*ContentEntryHandler) UpdateEntry

func (h *ContentEntryHandler) UpdateEntry(c forge.Context) error

UpdateEntry updates a content entry PUT /cms/:type/:id.

type ContentTypeHandler

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

ContentTypeHandler handles content type HTTP requests.

func NewContentTypeHandler

func NewContentTypeHandler(
	svc *service.ContentTypeService,
	fieldSvc *service.ContentFieldService,
) *ContentTypeHandler

NewContentTypeHandler creates a new content type handler.

func (*ContentTypeHandler) AddField

func (h *ContentTypeHandler) AddField(c forge.Context) error

AddField adds a new field to a content type POST /cms/types/:slug/fields.

func (*ContentTypeHandler) CreateContentType

func (h *ContentTypeHandler) CreateContentType(c forge.Context) error

CreateContentType creates a new content type POST /cms/types.

func (*ContentTypeHandler) DeleteContentType

func (h *ContentTypeHandler) DeleteContentType(c forge.Context) error

DeleteContentType deletes a content type DELETE /cms/types/:slug.

func (*ContentTypeHandler) DeleteField

func (h *ContentTypeHandler) DeleteField(c forge.Context) error

DeleteField deletes a field DELETE /cms/types/:slug/fields/:fieldSlug.

func (*ContentTypeHandler) GetContentType

func (h *ContentTypeHandler) GetContentType(c forge.Context) error

GetContentType retrieves a content type by slug GET /cms/types/:slug.

func (*ContentTypeHandler) GetField

func (h *ContentTypeHandler) GetField(c forge.Context) error

GetField retrieves a field by slug GET /cms/types/:slug/fields/:fieldSlug.

func (*ContentTypeHandler) GetFieldTypes

func (h *ContentTypeHandler) GetFieldTypes(c forge.Context) error

GetFieldTypes returns all available field types GET /cms/field-types.

func (*ContentTypeHandler) ListContentTypes

func (h *ContentTypeHandler) ListContentTypes(c forge.Context) error

ListContentTypes lists all content types GET /cms/types.

func (*ContentTypeHandler) ListFields

func (h *ContentTypeHandler) ListFields(c forge.Context) error

ListFields lists all fields for a content type GET /cms/types/:slug/fields.

func (*ContentTypeHandler) ReorderFields

func (h *ContentTypeHandler) ReorderFields(c forge.Context) error

ReorderFields reorders fields in a content type POST /cms/types/:slug/fields/reorder.

func (*ContentTypeHandler) UpdateContentType

func (h *ContentTypeHandler) UpdateContentType(c forge.Context) error

UpdateContentType updates a content type PUT /cms/types/:slug.

func (*ContentTypeHandler) UpdateField

func (h *ContentTypeHandler) UpdateField(c forge.Context) error

UpdateField updates a field PUT /cms/types/:slug/fields/:fieldSlug.

type CreateEntryRequest added in v0.0.7

type CreateEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
}

type DeleteContentTypeRequest added in v0.0.7

type DeleteContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type DeleteEntryRequest added in v0.0.7

type DeleteEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type DeleteFieldRequest added in v0.0.7

type DeleteFieldRequest struct {
	Slug    string `path:"slug"    validate:"required"`
	FieldID string `path:"fieldId" validate:"required"`
}

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Code    string `json:"code,omitempty"`
	Details any    `json:"details,omitempty"`
}

ErrorResponse represents an error response.

type GetContentTypeRequest added in v0.0.7

type GetContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type GetEntryRequest added in v0.0.7

type GetEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type GetEntryStatsRequest added in v0.0.7

type GetEntryStatsRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
}

type GetRevisionRequest added in v0.0.7

type GetRevisionRequest struct {
	TypeSlug   string `path:"typeSlug"   validate:"required"`
	EntryID    string `path:"entryId"    validate:"required"`
	RevisionID string `path:"revisionId" validate:"required"`
}

type ListContentTypesRequest added in v0.0.7

type ListContentTypesRequest struct {
	Search    string `query:"search,omitempty"`
	SortBy    string `query:"sortBy,omitempty"`
	SortOrder string `query:"sortOrder,omitempty"`
	Page      int    `query:"page,omitempty"`
	PageSize  int    `query:"pageSize,omitempty"`
}

ListContentTypesRequest is the request DTO for listing content types.

type ListEntriesRequest added in v0.0.7

type ListEntriesRequest struct {
	TypeSlug  string `path:"typeSlug"             validate:"required"`
	Search    string `query:"search,omitempty"`
	Status    string `query:"status,omitempty"`
	SortBy    string `query:"sortBy,omitempty"`
	SortOrder string `query:"sortOrder,omitempty"`
	Page      int    `query:"page,omitempty"`
	PageSize  int    `query:"pageSize,omitempty"`
}

ListEntriesRequest is the request DTO for listing entries.

type ListRevisionsRequest added in v0.0.7

type ListRevisionsRequest struct {
	TypeSlug string `path:"typeSlug"            validate:"required"`
	EntryID  string `path:"entryId"             validate:"required"`
	Page     int    `query:"page,omitempty"`
	PageSize int    `query:"pageSize,omitempty"`
}

ListRevisionsRequest is the request DTO for listing revisions.

type PublishContentTypeRequest added in v0.0.7

type PublishContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type PublishEntryRequest added in v0.0.7

type PublishEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type QueryEntriesRequest added in v0.0.7

type QueryEntriesRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
}

type ReorderFieldsRequest added in v0.0.7

type ReorderFieldsRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type RestoreEntryRequest added in v0.0.7

type RestoreEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type RestoreRevisionRequest added in v0.0.7

type RestoreRevisionRequest struct {
	TypeSlug   string `path:"typeSlug"   validate:"required"`
	EntryID    string `path:"entryId"    validate:"required"`
	RevisionID string `path:"revisionId" validate:"required"`
}

type RevisionHandler

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

RevisionHandler handles content revision HTTP requests.

func NewRevisionHandler

func NewRevisionHandler(
	revSvc *service.RevisionService,
	entrySvc *service.ContentEntryService,
	ctSvc *service.ContentTypeService,
) *RevisionHandler

NewRevisionHandler creates a new revision handler.

func (*RevisionHandler) CompareRevisions

func (h *RevisionHandler) CompareRevisions(c forge.Context) error

CompareRevisions compares two revisions GET /cms/:type/:id/revisions/compare?from=:v1&to=:v2.

func (*RevisionHandler) GetRevision

func (h *RevisionHandler) GetRevision(c forge.Context) error

GetRevision retrieves a specific revision GET /cms/:type/:id/revisions/:version.

func (*RevisionHandler) ListRevisions

func (h *RevisionHandler) ListRevisions(c forge.Context) error

ListRevisions lists revisions for an entry GET /cms/:type/:id/revisions.

func (*RevisionHandler) RestoreRevision

func (h *RevisionHandler) RestoreRevision(c forge.Context) error

RestoreRevision restores an entry to a specific revision POST /cms/:type/:id/revisions/:version/restore.

type SuccessResponse

type SuccessResponse struct {
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

SuccessResponse represents a success response.

type UnpublishContentTypeRequest added in v0.0.7

type UnpublishContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type UnpublishEntryRequest added in v0.0.7

type UnpublishEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type UpdateContentTypeRequest added in v0.0.7

type UpdateContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

type UpdateEntryRequest added in v0.0.7

type UpdateEntryRequest struct {
	TypeSlug string `path:"typeSlug" validate:"required"`
	EntryID  string `path:"entryId"  validate:"required"`
}

type UpdateFieldRequest added in v0.0.7

type UpdateFieldRequest struct {
	Slug    string `path:"slug"    validate:"required"`
	FieldID string `path:"fieldId" validate:"required"`
}

type ValidateContentTypeRequest added in v0.0.7

type ValidateContentTypeRequest struct {
	Slug string `path:"slug" validate:"required"`
}

Jump to

Keyboard shortcuts

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