bookstack

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 17 Imported by: 0

README

go-bookstack

Go Reference Go Report Card

Manage a Bookstack instance with Golang.

Requires go v1.18+

Documentation

Index

Constants

View Source
const SearchDateFormat = "2006-01-02"

Variables

This section is empty.

Functions

func ParseMultiple

func ParseMultiple[g Group](data []byte) (g, error)

func ParseSingle

func ParseSingle[s Single](data []byte) (s, error)

Types

type Attachment added in v0.0.3

type Attachment struct {
	ID         int       `json:"id,omitempty"`
	Name       string    `json:"name,omitempty"`
	Extension  string    `json:"extension,omitempty"`
	UploadedTo int       `json:"uploaded_to,omitempty"`
	External   bool      `json:"external,omitempty"`
	Order      int       `json:"order,omitempty"`
	CreatedAt  time.Time `json:"created_at,omitempty"`
	UpdatedAt  time.Time `json:"updated_at,omitempty"`
	CreatedBy  int       `json:"created_by,omitempty"`
	UpdatedBy  int       `json:"updated_by,omitempty"`
}

type AttachmentDetailed added in v0.0.3

type AttachmentDetailed struct {
	ID         int       `json:"id,omitempty"`
	Name       string    `json:"name,omitempty"`
	Extension  string    `json:"extension,omitempty"`
	UploadedTo int       `json:"uploaded_to,omitempty"`
	External   bool      `json:"external,omitempty"`
	Order      int       `json:"order,omitempty"`
	CreatedBy  CreatedBy `json:"created_by,omitempty"`
	UpdatedBy  UpdatedBy `json:"updated_by,omitempty"`
	CreatedAt  time.Time `json:"created_at,omitempty"`
	UpdatedAt  time.Time `json:"updated_at,omitempty"`
	Links      Links     `json:"links,omitempty"`
	Content    string    `json:"content,omitempty"`
}

type AttachmentParams added in v0.0.3

type AttachmentParams struct {
	Name       string `json:"name,omitempty"`
	UploadedTo int    `json:"uploaded_to,omitempty"`
	File       string `json:"file,omitempty"`
	Link       string `json:"link,omitempty"`
}

func (AttachmentParams) Form added in v0.0.3

func (a AttachmentParams) Form() (string, io.Reader, error)

type Book

type Book struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   int       `json:"created_by,omitempty"`
	UpdatedBy   int       `json:"updated_by,omitempty"`
	OwnedBy     int       `json:"owned_by,omitempty"`
}

type BookDetailed

type BookDetailed struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   CreatedBy `json:"created_by,omitempty"`
	UpdatedBy   UpdatedBy `json:"updated_by,omitempty"`
	OwnedBy     OwnedBy   `json:"owned_by,omitempty"`
	Tags        []Tag     `json:"tags,omitempty"`
	Cover       Cover     `json:"cover,omitempty"`
}

type BookParams

type BookParams struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Image       string `json:"image,omitempty"`
}

func (BookParams) Form

func (bp BookParams) Form() (string, io.Reader, error)

type Bookstack

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

func New

func New(opts ...Option) *Bookstack

func (*Bookstack) CreateAttachment added in v0.0.3

func (b *Bookstack) CreateAttachment(ctx context.Context, params AttachmentParams) (Attachment, error)

CreateAttachment will create a attachment according to the given params.

func (*Bookstack) CreateBook

func (b *Bookstack) CreateBook(ctx context.Context, params BookParams) (Book, error)

CreateBook will create a book according to the given params.

func (*Bookstack) CreateChapter added in v0.0.2

func (b *Bookstack) CreateChapter(ctx context.Context, params ChapterParams) (Chapter, error)

CreateChapter will create a chapter according to the given params.

func (*Bookstack) CreatePage added in v0.0.2

func (b *Bookstack) CreatePage(ctx context.Context, params PageParams) (Page, error)

CreatePage will create a page according to the given params.

func (*Bookstack) CreateShelf added in v0.0.2

func (b *Bookstack) CreateShelf(ctx context.Context, params ShelfParams) (Shelf, error)

CreateShelf will create a shelf according to the given params.

func (*Bookstack) CreateUser

func (b *Bookstack) CreateUser(ctx context.Context, params UserParams) (User, error)

CreateUser will create a user from the given params.

func (*Bookstack) DeleteAttachment added in v0.0.3

func (b *Bookstack) DeleteAttachment(ctx context.Context, id int) (bool, error)

DeleteAttachment will delete a attachment with the given id.

func (*Bookstack) DeleteBook

func (b *Bookstack) DeleteBook(ctx context.Context, id int) (bool, error)

DeleteBook will delete a book with the given id.

func (*Bookstack) DeleteChapter added in v0.0.2

func (b *Bookstack) DeleteChapter(ctx context.Context, id int) (bool, error)

DeleteChapter will delete a chapter with the given id.

func (*Bookstack) DeletePage added in v0.0.2

func (b *Bookstack) DeletePage(ctx context.Context, id int) (bool, error)

DeletePage will delete a page with the given id.

func (*Bookstack) DeleteRecycleBinItem added in v0.0.2

func (b *Bookstack) DeleteRecycleBinItem(ctx context.Context, id int) (int, error)

DeleteRecycleBinItem will delete an item from the recycle bin.

func (*Bookstack) DeleteShelf added in v0.0.2

func (b *Bookstack) DeleteShelf(ctx context.Context, id int) (bool, error)

DeleteShelf will delete a shelf with the given id.

func (*Bookstack) DeleteUser

func (b *Bookstack) DeleteUser(ctx context.Context, id int, params *UserDeleteParams) (bool, error)

Delete user will delete a user.

func (*Bookstack) ExportBookHTML added in v0.0.2

func (b *Bookstack) ExportBookHTML(ctx context.Context, id int) (io.Reader, error)

ExportBookHTML will return a book in HTML format.

func (*Bookstack) ExportBookMarkdown added in v0.0.2

func (b *Bookstack) ExportBookMarkdown(ctx context.Context, id int) (io.Reader, error)

ExportBookMarkdown will return a book in Markdown format.

func (*Bookstack) ExportBookPDF added in v0.0.2

func (b *Bookstack) ExportBookPDF(ctx context.Context, id int) (io.Reader, error)

ExportBookPDF will return a book in PDF format.

func (*Bookstack) ExportBookPlaintext added in v0.0.2

func (b *Bookstack) ExportBookPlaintext(ctx context.Context, id int) (io.Reader, error)

ExportBookPlaintext will return a book in Plaintext format.

func (*Bookstack) ExportChapterHTML added in v0.0.2

func (b *Bookstack) ExportChapterHTML(ctx context.Context, id int) (io.Reader, error)

ExportChapterHTML will return a chapter in HTML format.

func (*Bookstack) ExportChapterMarkdown added in v0.0.2

func (b *Bookstack) ExportChapterMarkdown(ctx context.Context, id int) (io.Reader, error)

ExportChapterMarkdown will return a chapter in Markdown format.

func (*Bookstack) ExportChapterPDF added in v0.0.2

func (b *Bookstack) ExportChapterPDF(ctx context.Context, id int) (io.Reader, error)

ExportChapterPDF will return a chapter in PDF format.

func (*Bookstack) ExportChapterPlaintext added in v0.0.2

func (b *Bookstack) ExportChapterPlaintext(ctx context.Context, id int) (io.Reader, error)

ExportChapterPlaintext will return a chapter in Plaintext format.

func (*Bookstack) ExportPageHTML added in v0.0.2

func (b *Bookstack) ExportPageHTML(ctx context.Context, id int) (io.Reader, error)

ExportPageHTML will return a page in HTML format.

func (*Bookstack) ExportPageMarkdown added in v0.0.2

func (b *Bookstack) ExportPageMarkdown(ctx context.Context, id int) (io.Reader, error)

ExportPageMarkdown will return a page in Markdown format.

func (*Bookstack) ExportPagePDF added in v0.0.2

func (b *Bookstack) ExportPagePDF(ctx context.Context, id int) (io.Reader, error)

ExportPagePDF will return a page in PDF format.

func (*Bookstack) ExportPagePlaintext added in v0.0.2

func (b *Bookstack) ExportPagePlaintext(ctx context.Context, id int) (io.Reader, error)

ExportPagePlaintext will return a page in Plaintext format.

func (*Bookstack) GetAttachment added in v0.0.3

func (b *Bookstack) GetAttachment(ctx context.Context, id int) (AttachmentDetailed, error)

GetAttachment will return a single attachment that matches id.

func (*Bookstack) GetBook

func (b *Bookstack) GetBook(ctx context.Context, id int) (BookDetailed, error)

GetBook will return a single book that matches id.

func (*Bookstack) GetChapter added in v0.0.2

func (b *Bookstack) GetChapter(ctx context.Context, id int) (ChapterDetailed, error)

GetChapter will return a single chapter that matches id.

func (*Bookstack) GetPage added in v0.0.2

func (b *Bookstack) GetPage(ctx context.Context, id int) (PageDetailed, error)

GetPage will return a single page that matches id.

func (*Bookstack) GetShelf added in v0.0.2

func (b *Bookstack) GetShelf(ctx context.Context, id int) (ShelfDetailed, error)

GetShelf will return a single shelf that matches id.

func (*Bookstack) GetUser

func (b *Bookstack) GetUser(ctx context.Context, id int) (User, error)

GetUser will return the user assigned to the given id, or an error.

func (*Bookstack) ListAttachments added in v0.0.3

func (b *Bookstack) ListAttachments(ctx context.Context, params *QueryParams) ([]Attachment, error)

ListAttachments will return the attachments that match the given params.

func (*Bookstack) ListBooks

func (b *Bookstack) ListBooks(ctx context.Context, params *QueryParams) ([]Book, error)

ListBooks will return the books that match the given params.

func (*Bookstack) ListChapters added in v0.0.2

func (b *Bookstack) ListChapters(ctx context.Context, params *QueryParams) ([]Chapter, error)

ListChapters will return the chapters that match the given params.

func (*Bookstack) ListPages added in v0.0.2

func (b *Bookstack) ListPages(ctx context.Context, params *QueryParams) ([]Page, error)

ListPages will return the pages that match the given params.

func (*Bookstack) ListRecycleBinItems added in v0.0.2

func (b *Bookstack) ListRecycleBinItems(ctx context.Context) ([]RecycleBinItem, error)

ListRecycleBinItems will list the items in the recycle bin.

func (*Bookstack) ListShelves added in v0.0.2

func (b *Bookstack) ListShelves(ctx context.Context, params *QueryParams) ([]Shelf, error)

ListShelves will return the shelves that match the given params.

func (*Bookstack) ListUsers

func (b *Bookstack) ListUsers(ctx context.Context, params *QueryParams) ([]User, error)

ListUsers will return the users the match the given params.

func (*Bookstack) RestoreRecyleBinItem added in v0.0.2

func (b *Bookstack) RestoreRecyleBinItem(ctx context.Context, id int) (int, error)

RestoreRecycleBinItem will restore an item from the recycle bin.

func (*Bookstack) Search added in v0.0.4

func (b *Bookstack) Search(ctx context.Context, query SearchParams) ([]Search, error)

func (*Bookstack) UpdateAttachment added in v0.0.3

func (b *Bookstack) UpdateAttachment(ctx context.Context, id int, params AttachmentParams) (Attachment, error)

UpdateAttachment will update a attachment with the given params.

func (*Bookstack) UpdateBook

func (b *Bookstack) UpdateBook(ctx context.Context, id int, params BookParams) (Book, error)

UpdateBook will update a book with the given params.

func (*Bookstack) UpdateChapter added in v0.0.2

func (b *Bookstack) UpdateChapter(ctx context.Context, id int, params ChapterParams) (Chapter, error)

UpdateChapter will update a chapter with the given params.

func (*Bookstack) UpdatePage added in v0.0.2

func (b *Bookstack) UpdatePage(ctx context.Context, id int, params PageParams) (Page, error)

UpdatePage will update a page with the given params.

func (*Bookstack) UpdateShelf added in v0.0.2

func (b *Bookstack) UpdateShelf(ctx context.Context, id int, params ShelfParams) (Shelf, error)

UpdateShelf will update a shelf with the given params.

func (*Bookstack) UpdateUser

func (b *Bookstack) UpdateUser(ctx context.Context, id int, params UserParams) (User, error)

UpdateUser will update the a user with the given params.

type Chapter added in v0.0.2

type Chapter struct {
	ID          int       `json:"id,omitempty"`
	BookID      int       `json:"book_id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	Priority    int       `json:"priority,omitempty"`
	CreatedAt   string    `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   int       `json:"created_by,omitempty"`
	UpdatedBy   int       `json:"updated_by,omitempty"`
	OwnedBy     int       `json:"owned_by,omitempty"`
}

type ChapterDetailed added in v0.0.2

type ChapterDetailed struct {
	ID          int           `json:"id,omitempty"`
	BookID      int           `json:"book_id,omitempty"`
	Slug        string        `json:"slug,omitempty"`
	Name        string        `json:"name,omitempty"`
	Description string        `json:"description,omitempty"`
	Priority    int           `json:"priority,omitempty"`
	CreatedAt   time.Time     `json:"created_at,omitempty"`
	UpdatedAt   time.Time     `json:"updated_at,omitempty"`
	CreatedBy   CreatedBy     `json:"created_by,omitempty"`
	UpdatedBy   UpdatedBy     `json:"updated_by,omitempty"`
	OwnedBy     OwnedBy       `json:"owned_by,omitempty"`
	Tags        []Tag         `json:"tags,omitempty"`
	Pages       []ChapterPage `json:"pages,omitempty"`
}

type ChapterPage added in v0.0.2

type ChapterPage struct {
	ID            int       `json:"id,omitempty"`
	BookID        int       `json:"book_id,omitempty"`
	ChapterID     int       `json:"chapter_id,omitempty"`
	Name          string    `json:"name,omitempty"`
	Slug          string    `json:"slug,omitempty"`
	Priority      int       `json:"priority,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	CreatedBy     int       `json:"created_by,omitempty"`
	UpdatedBy     int       `json:"updated_by,omitempty"`
	Draft         bool      `json:"draft,omitempty"`
	RevisionCount int       `json:"revision_count,omitempty"`
	Template      bool      `json:"template,omitempty"`
}

type ChapterParams added in v0.0.2

type ChapterParams struct {
	BookID      int         `json:"book_id,omitempty"`
	Name        string      `json:"name,omitempty"`
	Description string      `json:"description,omitempty"`
	Tags        []TagParams `json:"tags,omitempty"`
}

func (ChapterParams) Form added in v0.0.2

func (bp ChapterParams) Form() (string, io.Reader, error)

type ContentType added in v0.0.4

type ContentType string
const (
	ContentBook       ContentType = "book"
	ContentChapter    ContentType = "chapter"
	ContentShelf      ContentType = "bookshelf"
	ContentAttachment ContentType = "attachment"
	ContentPage       ContentType = "page"
)

type Cover added in v0.0.2

type Cover struct {
	ID         int       `json:"id,omitempty"`
	Name       string    `json:"name,omitempty"`
	URL        string    `json:"url,omitempty"`
	CreatedAt  time.Time `json:"created_at,omitempty"`
	UpdatedAt  time.Time `json:"updated_at,omitempty"`
	CreatedBy  int       `json:"created_by,omitempty"`
	UpdatedBy  int       `json:"updated_by,omitempty"`
	Path       string    `json:"path,omitempty"`
	Type       string    `json:"type,omitempty"`
	UploadedTo int       `json:"uploaded_to,omitempty"`
}

type CreatedBy added in v0.0.2

type CreatedBy struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Form

type Form interface {
	Form() (string, io.Reader, error)
}

type Group

type Group interface {
	[]User | []Book | []Chapter | []Page | []Shelf | []RecycleBinItem | []Attachment | []Search
}
type Links struct {
	HTML     string `json:"html,omitempty"`
	Markdown string `json:"markdown,omitempty"`
}

type Option

type Option func(*Bookstack)

func SetLogger

func SetLogger(l *log.Logger) Option

func SetRateLimit

func SetRateLimit(limit int) Option

func SetToken

func SetToken(id, secret string) Option

func SetURL

func SetURL(url string) Option

SetURL sets the url of the site to control.

type OwnedBy added in v0.0.2

type OwnedBy struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Page added in v0.0.2

type Page struct {
	ID            int       `json:"id,omitempty"`
	BookID        int       `json:"book_id,omitempty"`
	PageID        int       `json:"page_id,omitempty"`
	Name          string    `json:"name,omitempty"`
	Slug          string    `json:"slug,omitempty"`
	Priority      int       `json:"priority,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	CreatedBy     int       `json:"created_by,omitempty"`
	UpdatedBy     int       `json:"updated_by,omitempty"`
	Draft         bool      `json:"draft,omitempty"`
	RevisionCount int       `json:"revision_count,omitempty"`
	Template      bool      `json:"template,omitempty"`
}

type PageDetailed added in v0.0.2

type PageDetailed struct {
	ID            int       `json:"id,omitempty"`
	BookID        int       `json:"book_id,omitempty"`
	ChapterID     int       `json:"chapter_id,omitempty"`
	Name          string    `json:"name,omitempty"`
	Slug          string    `json:"slug,omitempty"`
	HTML          string    `json:"html,omitempty"`
	Priority      int       `json:"priority,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	CreatedBy     CreatedBy `json:"created_by,omitempty"`
	UpdatedBy     UpdatedBy `json:"updated_by,omitempty"`
	OwnedBy       OwnedBy   `json:"owned_by,omitempty"`
	Draft         bool      `json:"draft,omitempty"`
	Markdown      string    `json:"markdown,omitempty"`
	RevisionCount int       `json:"revision_count,omitempty"`
	Template      bool      `json:"template,omitempty"`
	Tags          []Tag     `json:"tags,omitempty"`
}

type PageParams added in v0.0.2

type PageParams struct {
	BookID    int         `json:"book_id,omitempty"`
	ChapterID int         `json:"chapterID,omitempty"`
	Name      string      `json:"name,omitempty"`
	HTML      string      `json:"html,omitempty"`
	Markdown  string      `json:"markdown,omitempty"`
	Tags      []TagParams `json:"tags,omitempty"`
}

func (PageParams) Form added in v0.0.2

func (bp PageParams) Form() (string, io.Reader, error)

type Parent added in v0.0.3

type Parent struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   int       `json:"created_by,omitempty"`
	UpdatedBy   int       `json:"updated_by,omitempty"`
	OwnedBy     int       `json:"owned_by,omitempty"`
	Type        string    `json:"type,omitempty"`
}

type PreviewHTML added in v0.0.4

type PreviewHTML struct {
	Name    string `json:"name,omitempty"`
	Content string `json:"content,omitempty"`
}

type QueryParams

type QueryParams struct {
	Count          int
	Offset         int
	SortField      string
	SortDescending bool
	FilterField    string
	FilterValue    string
}

func (*QueryParams) String

func (q *QueryParams) String(l string) string

type RecycleBinItem added in v0.0.2

type RecycleBinItem struct {
	ID            int             `json:"id,omitempty"`
	DeletedBy     int             `json:"deleted_by,omitempty"`
	CreatedAt     time.Time       `json:"created_at,omitempty"`
	UpdatedAt     time.Time       `json:"updated_at,omitempty"`
	DeletableType ContentType     `json:"deletable_type,omitempty"`
	DeletableID   int             `json:"deletable_id,omitempty"`
	Deletable     json.RawMessage `json:"deletable,omitempty"`
}

func (RecycleBinItem) Book added in v0.0.2

func (i RecycleBinItem) Book() (*RecycledBook, bool)

func (RecycleBinItem) Chapter added in v0.0.2

func (i RecycleBinItem) Chapter() (*RecycledChapter, bool)

func (RecycleBinItem) Page added in v0.0.2

func (i RecycleBinItem) Page() (*RecycledPage, bool)

func (RecycleBinItem) Shelf added in v0.0.2

func (i RecycleBinItem) Shelf() (*Shelf, bool)

type RecycledBook added in v0.0.3

type RecycledBook struct {
	Book
	PagesCount    int `json:"pages_count,omitempty"`
	ChaptersCount int `json:"chapters_count,omitempty"`
}

type RecycledChapter added in v0.0.3

type RecycledChapter struct {
	Chapter
	BookSlug   string `json:"book_slug,omitempty"`
	PagesCount int    `json:"pages_count,omitempty"`
	Parent     Parent `json:"parent,omitempty"`
}

type RecycledPage added in v0.0.3

type RecycledPage struct {
	ID            int       `json:"id,omitempty"`
	BookID        int       `json:"book_id,omitempty"`
	ChapterID     int       `json:"chapter_id,omitempty"`
	Name          string    `json:"name,omitempty"`
	Slug          string    `json:"slug,omitempty"`
	Priority      int       `json:"priority,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	CreatedBy     int       `json:"created_by,omitempty"`
	UpdatedBy     int       `json:"updated_by,omitempty"`
	Draft         bool      `json:"draft,omitempty"`
	RevisionCount int       `json:"revision_count,omitempty"`
	Template      bool      `json:"template,omitempty"`
	OwnedBy       int       `json:"owned_by,omitempty"`
	Editor        string    `json:"editor,omitempty"`
	BookSlug      string    `json:"book_slug,omitempty"`
	Parent        Parent    `json:"parent,omitempty"`
}

type Response

type Response struct {
	Data  json.RawMessage `json:"data,omitempty"`
	Total int             `json:"total,omitempty"`
	Err   struct {
		Code    int    `json:"code,omitempty"`
		Message string `json:"message,omitempty"`
	} `json:"error,omitempty"`
}

func (Response) Error

func (r Response) Error() error
type Search struct {
	ID          int         `json:"id,omitempty"`
	BookID      int         `json:"book_id,omitempty"`
	Slug        string      `json:"slug,omitempty"`
	Name        string      `json:"name,omitempty"`
	CreatedAt   time.Time   `json:"created_at,omitempty"`
	UpdatedAt   time.Time   `json:"updated_at,omitempty"`
	Type        ContentType `json:"type,omitempty"`
	URL         string      `json:"url,omitempty"`
	PreviewHTML PreviewHTML `json:"preview_html,omitempty"`
	Tags        []Tag       `json:"tags,omitempty"`
	ChapterID   int         `json:"chapter_id,omitempty"`
	Draft       bool        `json:"draft,omitempty"`
	Template    bool        `json:"template,omitempty"`
}

type SearchParams added in v0.0.4

type SearchParams struct {
	// Time Filters
	UpdatedAfter  *time.Time `json:"updated_after,omitempty"`
	UpdatedBefore *time.Time `json:"updated_before,omitempty"`
	CreatedAfter  *time.Time `json:"created_after,omitempty"`
	CreatedBefore *time.Time `json:"created_before,omitempty"`

	// User Filters
	UpdatedBy *string `json:"updated_by,omitempty"`
	CreatedBy *string `json:"created_by,omitempty"`
	OwnedBy   *string `json:"owned_by,omitempty"`

	// Content Filters
	InName *string `json:"in_name,omitempty"`
	InBody *string `json:"in_body,omitempty"`

	// Option Filters
	IsRestricted  bool          `json:"is_restricted,omitempty"`
	ViewedByMe    bool          `json:"viewed_by_me,omitempty"`
	NotViewedByMe bool          `json:"not_viewed_by_me,omitempty"`
	Type          []ContentType `json:"type,omitempty"`

	// Query
	Query string
	Page  *int
	Count *int
}

func (SearchParams) String added in v0.0.4

func (s SearchParams) String(q string) string

type Shelf added in v0.0.2

type Shelf struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   int       `json:"created_by,omitempty"`
	UpdatedBy   int       `json:"updated_by,omitempty"`
	OwnedBy     int       `json:"owned_by,omitempty"`
}

type ShelfDetailed added in v0.0.2

type ShelfDetailed struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Slug        string    `json:"slug,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedBy   CreatedBy `json:"created_by,omitempty"`
	UpdatedBy   UpdatedBy `json:"updated_by,omitempty"`
	OwnedBy     OwnedBy   `json:"owned_by,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	Tags        []Tag     `json:"tags,omitempty"`
	Cover       Cover     `json:"cover,omitempty"`
	Books       []Book    `json:"books,omitempty"`
}

type ShelfParams added in v0.0.2

type ShelfParams struct {
	Name        string      `json:"name,omitempty"`
	Description string      `json:"description,omitempty"`
	Books       []int       `json:"books,omitempty"`
	Tags        []TagParams `json:"tags,omitempty"`
	Image       string      `json:"image,omitempty"`
}

func (ShelfParams) Form added in v0.0.2

func (bp ShelfParams) Form() (string, io.Reader, error)

type Tag

type Tag struct {
	ID    string `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
	Order int    `json:"order,omitempty"`
}

type TagParams added in v0.0.2

type TagParams struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type UpdatedBy added in v0.0.2

type UpdatedBy struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type User

type User struct {
	Name           string    `json:"name"`
	Email          string    `json:"email"`
	ExternalAuthID string    `json:"external_auth_id"`
	Slug           string    `json:"slug"`
	UpdatedAt      time.Time `json:"updated_at"`
	CreatedAt      time.Time `json:"created_at"`
	ID             int       `json:"id"`
	ProfileURL     string    `json:"profile_url"`
	EditURL        string    `json:"edit_url"`
	AvatarURL      string    `json:"avatar_url"`
	Roles          []struct {
		ID          int    `json:"id"`
		DisplayName string `json:"display_name"`
	} `json:"roles"`
}

type UserDeleteParams

type UserDeleteParams struct {
	MigrateOwnershipID int `json:"migrate_ownership_id,omitempty"`
}

func (UserDeleteParams) Form added in v0.0.2

func (ud UserDeleteParams) Form() (string, io.Reader, error)

type UserParams

type UserParams struct {
	Name           string `json:"name,omitempty"`
	Email          string `json:"email,omitempty"`
	ExternalAuthID string `json:"external_auth_id,omitempty"`
	Password       string `json:"password,omitempty"`
	Language       string `json:"language,omitempty"`
	Roles          []int  `json:"roles,omitempty"`
	SendInvite     bool   `json:"send_invite,omitempty"`
}

func (UserParams) Form added in v0.0.2

func (u UserParams) Form() (string, io.Reader, error)

Jump to

Keyboard shortcuts

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