snips

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileTypeBinary   = "binary"
	FileTypeMarkdown = "markdown"
)
View Source
const (
	// NameMaxLength is the maximum length of a file's name.
	NameMaxLength = 40
)

Variables

View Source
var (
	ErrInvalidName = fmt.Errorf("names must be 1-%d alphanumeric characters (hyphen, dot, or underscore separators allowed)", NameMaxLength)
)

Functions

func IsZSTDCompressed added in v0.10.0

func IsZSTDCompressed(data []byte) bool

IsZSTDCompressed checks if the data starts with the zstd magic number. https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#zstandard-frames

func NormalizeName added in v0.12.0

func NormalizeName(name string) (string, error)

Types

type File

type File struct {
	ID         string
	CreatedAt  time.Time
	UpdatedAt  time.Time
	Size       uint64
	RawContent []byte
	Private    bool
	Type       string
	UserID     string
	Name       string
}

func (*File) DisplayName added in v0.12.0

func (f *File) DisplayName() string

func (*File) GetContent added in v0.3.0

func (f *File) GetContent() ([]byte, error)

func (*File) GetSignedURL

func (f *File) GetSignedURL(cfg *config.Config, ttl time.Duration) (url.URL, time.Time)

func (*File) IsBinary

func (f *File) IsBinary() bool

func (*File) IsMarkdown

func (f *File) IsMarkdown() bool

func (*File) SetContent added in v0.3.0

func (f *File) SetContent(in []byte, compress bool) error

func (*File) Visibility

func (f *File) Visibility() string

type PublicKey

type PublicKey struct {
	ID          string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Fingerprint string
	Type        string
	UserID      string
}

type Revision added in v0.10.0

type Revision struct {
	ID        string
	Sequence  int64
	FileID    string
	CreatedAt time.Time
	RawDiff   []byte // may be zstd-compressed
	Size      uint64 // file size after this revision
	Type      string // file type after this revision
}

func (*Revision) GetDiff added in v0.10.0

func (r *Revision) GetDiff() ([]byte, error)

func (*Revision) SetDiff added in v0.10.0

func (r *Revision) SetDiff(in []byte, compress bool) error

type User

type User struct {
	ID         string
	CreatedAt  time.Time
	UpdatedAt  time.Time
	ThemeColor string // named theme option from styles.ThemeOptions (e.g. "blue"); empty = use default palette
}

Jump to

Keyboard shortcuts

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