kibela

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID          `json:"id"`
	Content     string `json:"content"`
	Author      User   `json:"author"`
	PublishedAt Time   `json:"publishedAt"`
	Summary     string `json:"summary"`
}

Comment represents comment of Kibela

type Folder

type Folder struct {
	ID       `json:"id"`
	FullName string `json:"fullName"`
	Group    Group  `json:group`
}

Folder represents folder of Kibela

type Folders added in v0.1.5

type Folders struct {
	Nodes []*Folder `json:"nodes"`
}

type Group

type Group struct {
	ID   `json:"id"`
	Name string `json:"name"`
}

Group represents groups of Kibela

type ID

type ID string

ID represents kibela ID

func (ID) Empty

func (i ID) Empty() bool

Empty returns the if the id is empty

func (ID) Number

func (i ID) Number() (int, error)

Number returns the number

func (ID) Raw

func (i ID) Raw() string

Raw returns raw id string

func (ID) String

func (i ID) String() string

func (ID) Type

func (i ID) Type() string

Type returns the type

type Kibela

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

Kibela is a client for Kibela API

func New

func New(ver string) (*Kibela, error)

New returns new Kibela client

func (*Kibela) GetComment

func (ki *Kibela) GetComment(ctx context.Context, num int) (*Comment, error)

GetComment gets kibela comment

func (*Kibela) GetNote

func (ki *Kibela) GetNote(ctx context.Context, num int) (*Note, error)

GetNote gets kibela note

func (*Kibela) PublishMD

func (ki *Kibela) PublishMD(ctx context.Context, m *MD, save bool) error

PublishMD publishes new MD to Kibela

func (*Kibela) PullFullNotes

func (ki *Kibela) PullFullNotes(ctx context.Context, dir, folder string, limit int) error

PullFullNotes pull full notes from Kibela

func (*Kibela) PullNote

func (ki *Kibela) PullNote(ctx context.Context, dir, arg string) error

PullNote pulls a single note

func (*Kibela) PullNotes

func (ki *Kibela) PullNotes(ctx context.Context, dir, folder string, limit int) error

PullNotes pulls notes from Kibela

func (*Kibela) PushMD

func (ki *Kibela) PushMD(ctx context.Context, m *MD) error

PushMD pushes MD to Kibela

type MD

type MD struct {
	ID          ID
	FrontMatter *Meta
	Content     string
	UpdatedAt   time.Time
	// contains filtered or unexported fields
}

MD represents local Markdown file

func LoadMD

func LoadMD(fpath string) (*MD, error)

LoadMD loads MD from file

func NewMD

func NewMD(fpath string, r io.Reader, title string, coEdit bool, dir string) (*MD, error)

NewMD returns new MD

type Meta

type Meta struct {
	Title   string   `yaml:"title"`
	Author  string   `yaml:"author,omitempty"`
	Groups  []string `yaml:"groups,flow"`
	Folders Folders  `yaml:"folders,omitempty"`
}

Meta is a meta information of entry rendered as FrontMatter

type Note

type Note struct {
	ID          `json:"id"`
	Title       string   `json:"title"`
	Content     string   `json:"content"`
	CoEditing   bool     `json:"coediting"`
	Folders     Folders  `json:"folders"`
	Groups      []*Group `json:"groups"`
	Author      User     `json:"author"`
	UpdatedAt   Time     `json:"updatedAt"`
	PublishedAt Time     `json:"publishedAt"`
	Summary     string   `json:"summary"`
}

Note represents note of Kibela

type Time

type Time struct {
	time.Time
}

Time (un)marshals time for kibela

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

MarshalJSON for encoding/json

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON for encoding/json

type User

type User struct {
	ID      `json:"id"`
	Account string `json:"account"`
}

User represents user of Kibela

Jump to

Keyboard shortcuts

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