docs

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionName         = "docs"
	VersionsCollectionName = "doc_versions"
	PinsCollectionName     = "doc_pins"
)
View Source
const (
	AssetsCollectionName = "doc_assets"
)

Variables

View Source
var (
	ErrNotFound     = errors.New("document not found")
	ErrForbidden    = errors.New("document access denied")
	ErrConflict     = errors.New("document has a newer revision")
	ErrInvalidInput = errors.New("invalid document input")
	ErrPinLimit     = errors.New("you can pin at most 6 documents")
)

Functions

func Delete

func Delete(ctx context.Context, app core.App, actorID, id string) error

func Register

func Register(app core.App)

func SetPinned

func SetPinned(ctx context.Context, app core.App, actorID, id string, pinned bool) error

Types

type Asset added in v0.0.4

type Asset struct {
	ID        string `json:"id"`
	DocID     string `json:"docId"`
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	MediaType string `json:"mediaType"`
	Size      int64  `json:"size"`
	URL       string `json:"url"`
}

func UploadAsset added in v0.0.4

func UploadAsset(ctx context.Context, app core.App, actorID, docID string, file *filesystem.File) (Asset, error)

type CreateInput

type CreateInput struct {
	Title     string `json:"title"`
	Content   string `json:"content"`
	ProjectID string `json:"projectId"`
	Source    string `json:"-"`
}

type Document

type Document struct {
	ID           string `json:"id"`
	Title        string `json:"title"`
	Content      string `json:"content"`
	OwnerID      string `json:"ownerId"`
	ProjectID    string `json:"projectId,omitempty"`
	ProjectName  string `json:"projectName,omitempty"`
	Status       string `json:"status"`
	Revision     int    `json:"revision"`
	LastEditedBy string `json:"lastEditedBy"`
	Created      string `json:"created"`
	Updated      string `json:"updated"`
}

func Create

func Create(ctx context.Context, app core.App, actorID string, input CreateInput) (Document, error)

func Get

func Get(ctx context.Context, app core.App, actorID, id string) (Document, error)

func ListPinned

func ListPinned(ctx context.Context, app core.App, actorID string) ([]Document, error)

func MoveToProject

func MoveToProject(ctx context.Context, app core.App, actorID, id, projectID string) (Document, error)

func Replace

func Replace(ctx context.Context, app core.App, actorID, id string, input ReplaceInput) (Document, int, bool, error)

func Restore

func Restore(ctx context.Context, app core.App, actorID, id string, revision, baseRevision int) (Document, error)
func Search(ctx context.Context, app core.App, actorID string, options SearchOptions) ([]Document, error)

func SetArchived

func SetArchived(ctx context.Context, app core.App, actorID, id string, archived bool) (Document, error)

func Update

func Update(ctx context.Context, app core.App, actorID, id string, input UpdateInput) (Document, bool, error)

type ReplaceInput

type ReplaceInput struct {
	ID           string `json:"id"`
	Find         string `json:"find"`
	Replace      string `json:"replace"`
	ReplaceAll   bool   `json:"replaceAll"`
	BaseRevision int    `json:"baseRevision"`
	Source       string `json:"-"`
}

type SearchOptions

type SearchOptions struct {
	Query string
	Limit int
}

type UpdateInput

type UpdateInput struct {
	Title        string `json:"title"`
	Content      string `json:"content"`
	BaseRevision int    `json:"baseRevision"`
	Source       string `json:"-"`
}

type Version

type Version struct {
	ID        string `json:"id"`
	Revision  int    `json:"revision"`
	Title     string `json:"title"`
	Content   string `json:"content,omitempty"`
	CreatedBy string `json:"createdBy"`
	Source    string `json:"source"`
	Created   string `json:"created"`
}

func GetVersion

func GetVersion(ctx context.Context, app core.App, actorID, id string, revision int) (Version, error)

func ListVersions

func ListVersions(ctx context.Context, app core.App, actorID, id string) ([]Version, error)

Jump to

Keyboard shortcuts

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