doctype

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadOnly = errors.New("read-only document type")

Functions

func FileExtension

func FileExtension(t DocType) string

func IsDirectory

func IsDirectory(t DocType) bool

func IsReadOnly

func IsReadOnly(t DocType) bool

Types

type BitableHandler

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

func NewBitableHandler

func NewBitableHandler(exec *cli.Executor) *BitableHandler

func (*BitableHandler) Create

func (h *BitableHandler) Create(_ context.Context, _ string, _ string, _ []byte) (string, error)

func (*BitableHandler) Delete

func (h *BitableHandler) Delete(ctx context.Context, token string) error

func (*BitableHandler) Extension

func (h *BitableHandler) Extension() string

func (*BitableHandler) IsDirectory

func (h *BitableHandler) IsDirectory() bool

func (*BitableHandler) List

func (h *BitableHandler) List(ctx context.Context, token string) ([]Entry, error)

func (*BitableHandler) Read

func (h *BitableHandler) Read(ctx context.Context, token string) ([]byte, error)

func (*BitableHandler) Write

func (h *BitableHandler) Write(ctx context.Context, token string, data []byte) error

type DocType

type DocType string
const (
	TypeDocx     DocType = "docx"
	TypeDoc      DocType = "doc"
	TypeSheet    DocType = "sheet"
	TypeBitable  DocType = "bitable"
	TypeFile     DocType = "file"
	TypeFolder   DocType = "folder"
	TypeSlides   DocType = "slides"
	TypeMindnote DocType = "mindnote"
)

type DocxHandler

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

func NewDocxHandler

func NewDocxHandler(exec *cli.Executor) *DocxHandler

func (*DocxHandler) Create

func (h *DocxHandler) Create(ctx context.Context, parentToken string, name string, data []byte) (string, error)

func (*DocxHandler) Delete

func (h *DocxHandler) Delete(ctx context.Context, token string) error

func (*DocxHandler) Extension

func (h *DocxHandler) Extension() string

func (*DocxHandler) IsDirectory

func (h *DocxHandler) IsDirectory() bool

func (*DocxHandler) List

func (h *DocxHandler) List(_ context.Context, _ string) ([]Entry, error)

func (*DocxHandler) Read

func (h *DocxHandler) Read(ctx context.Context, token string) ([]byte, error)

func (*DocxHandler) Write

func (h *DocxHandler) Write(ctx context.Context, token string, data []byte) error

type Entry

type Entry struct {
	Name  string
	Token string
	Type  DocType
	Size  int64
	IsDir bool
}

type FileHandler

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

func NewFileHandler

func NewFileHandler(exec *cli.Executor, cacheDir string) *FileHandler

func (*FileHandler) Create

func (h *FileHandler) Create(ctx context.Context, parentToken string, name string, data []byte) (string, error)

func (*FileHandler) Delete

func (h *FileHandler) Delete(ctx context.Context, token string) error

func (*FileHandler) Extension

func (h *FileHandler) Extension() string

func (*FileHandler) IsDirectory

func (h *FileHandler) IsDirectory() bool

func (*FileHandler) List

func (h *FileHandler) List(_ context.Context, _ string) ([]Entry, error)

func (*FileHandler) Read

func (h *FileHandler) Read(ctx context.Context, token string) ([]byte, error)

func (*FileHandler) Write

func (h *FileHandler) Write(ctx context.Context, token string, data []byte) error

type FolderHandler

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

func NewFolderHandler

func NewFolderHandler(exec *cli.Executor) *FolderHandler

func (*FolderHandler) Create

func (h *FolderHandler) Create(ctx context.Context, parentToken string, name string, _ []byte) (string, error)

func (*FolderHandler) Delete

func (h *FolderHandler) Delete(ctx context.Context, token string) error

func (*FolderHandler) Extension

func (h *FolderHandler) Extension() string

func (*FolderHandler) IsDirectory

func (h *FolderHandler) IsDirectory() bool

func (*FolderHandler) List

func (h *FolderHandler) List(ctx context.Context, token string) ([]Entry, error)

func (*FolderHandler) Read

func (h *FolderHandler) Read(_ context.Context, _ string) ([]byte, error)

func (*FolderHandler) Write

func (h *FolderHandler) Write(_ context.Context, _ string, _ []byte) error

type ReadonlyHandler

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

func NewReadonlyHandler

func NewReadonlyHandler(exec *cli.Executor, docType DocType) *ReadonlyHandler

func (*ReadonlyHandler) Create

func (h *ReadonlyHandler) Create(_ context.Context, _ string, _ string, _ []byte) (string, error)

func (*ReadonlyHandler) Delete

func (h *ReadonlyHandler) Delete(_ context.Context, _ string) error

func (*ReadonlyHandler) Extension

func (h *ReadonlyHandler) Extension() string

func (*ReadonlyHandler) IsDirectory

func (h *ReadonlyHandler) IsDirectory() bool

func (*ReadonlyHandler) List

func (h *ReadonlyHandler) List(_ context.Context, _ string) ([]Entry, error)

func (*ReadonlyHandler) Read

func (h *ReadonlyHandler) Read(ctx context.Context, token string) ([]byte, error)

func (*ReadonlyHandler) Write

func (h *ReadonlyHandler) Write(_ context.Context, _ string, _ []byte) error

type Registry

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

func NewRegistry

func NewRegistry(exec *cli.Executor, cacheDir string) *Registry

func (*Registry) Handler

func (r *Registry) Handler(t DocType) TypeHandler

type SheetHandler

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

func NewSheetHandler

func NewSheetHandler(exec *cli.Executor) *SheetHandler

func (*SheetHandler) Create

func (h *SheetHandler) Create(ctx context.Context, _ string, name string, _ []byte) (string, error)

func (*SheetHandler) Delete

func (h *SheetHandler) Delete(ctx context.Context, token string) error

func (*SheetHandler) Extension

func (h *SheetHandler) Extension() string

func (*SheetHandler) IsDirectory

func (h *SheetHandler) IsDirectory() bool

func (*SheetHandler) List

func (h *SheetHandler) List(ctx context.Context, token string) ([]Entry, error)

func (*SheetHandler) Read

func (h *SheetHandler) Read(ctx context.Context, token string) ([]byte, error)

func (*SheetHandler) Write

func (h *SheetHandler) Write(ctx context.Context, token string, data []byte) error

type TypeHandler

type TypeHandler interface {
	IsDirectory() bool
	Extension() string
	List(ctx context.Context, token string) ([]Entry, error)
	Read(ctx context.Context, token string) ([]byte, error)
	Write(ctx context.Context, token string, data []byte) error
	Create(ctx context.Context, parentToken string, name string, data []byte) (string, error)
	Delete(ctx context.Context, token string) error
}

Jump to

Keyboard shortcuts

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