Documentation ¶
Index ¶
- Constants
- func ParseMultiple[g Group](data []byte) (g, error)
- func ParseSingle[s Single](data []byte) (s, error)
- type Attachment
- type AttachmentDetailed
- type AttachmentParams
- type Book
- type BookDetailed
- type BookParams
- type Bookstack
- func (b *Bookstack) CreateAttachment(ctx context.Context, params AttachmentParams) (Attachment, error)
- func (b *Bookstack) CreateBook(ctx context.Context, params BookParams) (Book, error)
- func (b *Bookstack) CreateChapter(ctx context.Context, params ChapterParams) (Chapter, error)
- func (b *Bookstack) CreatePage(ctx context.Context, params PageParams) (Page, error)
- func (b *Bookstack) CreateShelf(ctx context.Context, params ShelfParams) (Shelf, error)
- func (b *Bookstack) CreateUser(ctx context.Context, params UserParams) (User, error)
- func (b *Bookstack) DeleteAttachment(ctx context.Context, id int) (bool, error)
- func (b *Bookstack) DeleteBook(ctx context.Context, id int) (bool, error)
- func (b *Bookstack) DeleteChapter(ctx context.Context, id int) (bool, error)
- func (b *Bookstack) DeletePage(ctx context.Context, id int) (bool, error)
- func (b *Bookstack) DeleteRecycleBinItem(ctx context.Context, id int) (int, error)
- func (b *Bookstack) DeleteShelf(ctx context.Context, id int) (bool, error)
- func (b *Bookstack) DeleteUser(ctx context.Context, id int, params *UserDeleteParams) (bool, error)
- func (b *Bookstack) ExportBookHTML(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportBookMarkdown(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportBookPDF(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportBookPlaintext(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportChapterHTML(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportChapterMarkdown(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportChapterPDF(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportChapterPlaintext(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportPageHTML(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportPageMarkdown(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportPagePDF(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) ExportPagePlaintext(ctx context.Context, id int) (io.Reader, error)
- func (b *Bookstack) GetAttachment(ctx context.Context, id int) (AttachmentDetailed, error)
- func (b *Bookstack) GetBook(ctx context.Context, id int) (BookDetailed, error)
- func (b *Bookstack) GetChapter(ctx context.Context, id int) (ChapterDetailed, error)
- func (b *Bookstack) GetPage(ctx context.Context, id int) (PageDetailed, error)
- func (b *Bookstack) GetShelf(ctx context.Context, id int) (ShelfDetailed, error)
- func (b *Bookstack) GetUser(ctx context.Context, id int) (User, error)
- func (b *Bookstack) ListAttachments(ctx context.Context, params *QueryParams) ([]Attachment, error)
- func (b *Bookstack) ListBooks(ctx context.Context, params *QueryParams) ([]Book, error)
- func (b *Bookstack) ListChapters(ctx context.Context, params *QueryParams) ([]Chapter, error)
- func (b *Bookstack) ListPages(ctx context.Context, params *QueryParams) ([]Page, error)
- func (b *Bookstack) ListRecycleBinItems(ctx context.Context) ([]RecycleBinItem, error)
- func (b *Bookstack) ListShelves(ctx context.Context, params *QueryParams) ([]Shelf, error)
- func (b *Bookstack) ListUsers(ctx context.Context, params *QueryParams) ([]User, error)
- func (b *Bookstack) RestoreRecyleBinItem(ctx context.Context, id int) (int, error)
- func (b *Bookstack) Search(ctx context.Context, query SearchParams) ([]Search, error)
- func (b *Bookstack) UpdateAttachment(ctx context.Context, id int, params AttachmentParams) (Attachment, error)
- func (b *Bookstack) UpdateBook(ctx context.Context, id int, params BookParams) (Book, error)
- func (b *Bookstack) UpdateChapter(ctx context.Context, id int, params ChapterParams) (Chapter, error)
- func (b *Bookstack) UpdatePage(ctx context.Context, id int, params PageParams) (Page, error)
- func (b *Bookstack) UpdateShelf(ctx context.Context, id int, params ShelfParams) (Shelf, error)
- func (b *Bookstack) UpdateUser(ctx context.Context, id int, params UserParams) (User, error)
- type Chapter
- type ChapterDetailed
- type ChapterPage
- type ChapterParams
- type ContentType
- type Cover
- type CreatedBy
- type Form
- type Group
- type Links
- type Option
- type OwnedBy
- type Page
- type PageDetailed
- type PageParams
- type Parent
- type PreviewHTML
- type QueryParams
- type RecycleBinItem
- type RecycledBook
- type RecycledChapter
- type RecycledPage
- type Response
- type Search
- type SearchParams
- type Shelf
- type ShelfDetailed
- type ShelfParams
- type Single
- type Tag
- type TagParams
- type UpdatedBy
- type User
- type UserDeleteParams
- type UserParams
Constants ¶
const SearchDateFormat = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func ParseMultiple ¶
func ParseSingle ¶
Types ¶
type Attachment ¶
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 ¶
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 ¶
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 Bookstack ¶
type Bookstack struct {
// contains filtered or unexported fields
}
func (*Bookstack) CreateAttachment ¶
func (b *Bookstack) CreateAttachment(ctx context.Context, params AttachmentParams) (Attachment, error)
CreateAttachment will create a attachment according to the given params.
func (*Bookstack) CreateBook ¶
CreateBook will create a book according to the given params.
func (*Bookstack) CreateChapter ¶
CreateChapter will create a chapter according to the given params.
func (*Bookstack) CreatePage ¶
CreatePage will create a page according to the given params.
func (*Bookstack) CreateShelf ¶
CreateShelf will create a shelf according to the given params.
func (*Bookstack) CreateUser ¶
CreateUser will create a user from the given params.
func (*Bookstack) DeleteAttachment ¶
DeleteAttachment will delete a attachment with the given id.
func (*Bookstack) DeleteBook ¶
DeleteBook will delete a book with the given id.
func (*Bookstack) DeleteChapter ¶
DeleteChapter will delete a chapter with the given id.
func (*Bookstack) DeletePage ¶
DeletePage will delete a page with the given id.
func (*Bookstack) DeleteRecycleBinItem ¶
DeleteRecycleBinItem will delete an item from the recycle bin.
func (*Bookstack) DeleteShelf ¶
DeleteShelf will delete a shelf with the given id.
func (*Bookstack) DeleteUser ¶
Delete user will delete a user.
func (*Bookstack) ExportBookHTML ¶
ExportBookHTML will return a book in HTML format.
func (*Bookstack) ExportBookMarkdown ¶
ExportBookMarkdown will return a book in Markdown format.
func (*Bookstack) ExportBookPDF ¶
ExportBookPDF will return a book in PDF format.
func (*Bookstack) ExportBookPlaintext ¶
ExportBookPlaintext will return a book in Plaintext format.
func (*Bookstack) ExportChapterHTML ¶
ExportChapterHTML will return a chapter in HTML format.
func (*Bookstack) ExportChapterMarkdown ¶
ExportChapterMarkdown will return a chapter in Markdown format.
func (*Bookstack) ExportChapterPDF ¶
ExportChapterPDF will return a chapter in PDF format.
func (*Bookstack) ExportChapterPlaintext ¶
ExportChapterPlaintext will return a chapter in Plaintext format.
func (*Bookstack) ExportPageHTML ¶
ExportPageHTML will return a page in HTML format.
func (*Bookstack) ExportPageMarkdown ¶
ExportPageMarkdown will return a page in Markdown format.
func (*Bookstack) ExportPagePDF ¶
ExportPagePDF will return a page in PDF format.
func (*Bookstack) ExportPagePlaintext ¶
ExportPagePlaintext will return a page in Plaintext format.
func (*Bookstack) GetAttachment ¶
GetAttachment will return a single attachment that matches id.
func (*Bookstack) GetChapter ¶
GetChapter will return a single chapter that matches id.
func (*Bookstack) ListAttachments ¶
func (b *Bookstack) ListAttachments(ctx context.Context, params *QueryParams) ([]Attachment, error)
ListAttachments will return the attachments that match the given params.
func (*Bookstack) ListChapters ¶
ListChapters will return the chapters that match the given params.
func (*Bookstack) ListRecycleBinItems ¶
func (b *Bookstack) ListRecycleBinItems(ctx context.Context) ([]RecycleBinItem, error)
ListRecycleBinItems will list the items in the recycle bin.
func (*Bookstack) ListShelves ¶
ListShelves will return the shelves that match the given params.
func (*Bookstack) RestoreRecyleBinItem ¶
RestoreRecycleBinItem will restore an item from the recycle bin.
func (*Bookstack) UpdateAttachment ¶
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 ¶
UpdateBook will update a book with the given params.
func (*Bookstack) UpdateChapter ¶
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 ¶
UpdatePage will update a page with the given params.
func (*Bookstack) UpdateShelf ¶
UpdateShelf will update a shelf with the given params.
func (*Bookstack) UpdateUser ¶
UpdateUser will update the a user with the given params.
type Chapter ¶
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 ¶
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 ¶
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 ¶
type ContentType ¶
type ContentType string
const ( ContentBook ContentType = "book" ContentChapter ContentType = "chapter" ContentShelf ContentType = "bookshelf" ContentAttachment ContentType = "attachment" ContentPage ContentType = "page" )
type Cover ¶
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 Group ¶
type Group interface { []User | []Book | []Chapter | []Page | []Shelf | []RecycleBinItem | []Attachment | []Search }
type Page ¶
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 ¶
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 ¶
type Parent ¶
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 ¶
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 ¶
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 ¶
func (i RecycleBinItem) Book() (*RecycledBook, bool)
func (RecycleBinItem) Chapter ¶
func (i RecycleBinItem) Chapter() (*RecycledChapter, bool)
func (RecycleBinItem) Page ¶
func (i RecycleBinItem) Page() (*RecycledPage, bool)
func (RecycleBinItem) Shelf ¶
func (i RecycleBinItem) Shelf() (*Shelf, bool)
type RecycledBook ¶
type RecycledChapter ¶
type RecycledPage ¶
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"` }
type Search ¶
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 ¶
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 ¶
func (s SearchParams) String(q string) string
type Shelf ¶
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 ¶
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 ¶
type Single ¶
type Single interface { User | Book | BookDetailed | Chapter | ChapterDetailed | Page | PageDetailed | Shelf | ShelfDetailed | RecycledBook | RecycledPage | RecycledChapter | Attachment | AttachmentDetailed }
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"`
}
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"` }