Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchPageMarkdown ¶
func FetchPageMarkdown(app *config.Application, pageID int) ([]byte, error)
FetchPageMarkdown hits the /api/pages/<pageid>/export/markdown endpoint and returns a byte slice with APP_URL replaed by a /
Types ¶
type Book ¶
type Book struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"created_by"`
UpdatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"updated_by"`
OwnedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"owned_by"`
Tags []struct {
ID int `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
Order int `json:"order"`
} `json:"tags"`
Cover struct {
ID int `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
Path string `json:"path"`
Type string `json:"type"`
UploadedTo int `json:"uploaded_to"`
} `json:"cover"`
}
Book represents the BookStack API endpoint /api/books/{id}
type Books ¶
type Books struct {
Data []struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
OwnedBy int `json:"owned_by"`
ImageID int `json:"image_id"`
} `json:"data"`
Total int `json:"total"`
}
Books represents the BookStack API endpoint /api/books
func FetchBooks ¶
func FetchBooks(app *config.Application) (Books, error)
FetchBooks returns all the books in the wiki sorted by name.
type Chapter ¶
type Chapter struct {
ID int `json:"id"`
BookID int `json:"book_id"`
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description"`
Priority int `json:"priority"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"created_by"`
UpdatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"updated_by"`
OwnedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"owned_by"`
Tags []struct {
Name string `json:"name"`
Value string `json:"value"`
Order int `json:"order"`
} `json:"tags"`
Pages []struct {
ID int `json:"id"`
BookID int `json:"book_id"`
ChapterID int `json:"chapter_id"`
Name string `json:"name"`
Slug string `json:"slug"`
Priority int `json:"priority"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
Draft bool `json:"draft"`
RevisionCount int `json:"revision_count"`
Template bool `json:"template"`
} `json:"pages"`
}
Chapter represents the BookStack API endpoint /api/chapters/{id}
type Chapters ¶
type Chapters struct {
Data []struct {
ID int `json:"id"`
BookID int `json:"book_id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
Priority int `json:"priority"`
CreatedAt string `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
OwnedBy int `json:"owned_by"`
} `json:"data"`
Total int `json:"total"`
}
Chapters represents the BookStack API endpoint /api/chapters
func FetchChapters ¶
func FetchChapters(app *config.Application, bookID int) (Chapters, error)
FetchChapters returns all the chapters of a book sorted by priority.
func FetchPages ¶
FetchPages returns pages sorted by priority. If chapterID = 0 then it returns independent (non chapter) pages of the book. If chapterID != 0 then it returns pages of the chapter.
type Page ¶
type Page struct {
ID int `json:"id"`
BookID int `json:"book_id"`
ChapterID int `json:"chapter_id"`
Name string `json:"name"`
Slug string `json:"slug"`
HTML string `json:"html"`
Priority int `json:"priority"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"created_by"`
UpdatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"updated_by"`
OwnedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"owned_by"`
Draft bool `json:"draft"`
Markdown string `json:"markdown"`
RevisionCount int `json:"revision_count"`
Template bool `json:"template"`
Tags []struct {
Name string `json:"name"`
Value string `json:"value"`
Order int `json:"order"`
} `json:"tags"`
}
Page represents the BookStack API endpoint /api/pages/{id}
type Pages ¶
type Pages struct {
Data []struct {
ID int `json:"id"`
BookID int `json:"book_id"`
ChapterID int `json:"chapter_id"`
Name string `json:"name"`
Slug string `json:"slug"`
Priority int `json:"priority"`
Draft bool `json:"draft"`
Template bool `json:"template"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
OwnedBy int `json:"owned_by"`
} `json:"data"`
Total int `json:"total"`
}
Pages represents the BookStack API endpoint /api/pages
type Shelf ¶
type Shelf struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
CreatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"created_by"`
UpdatedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"updated_by"`
OwnedBy struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"owned_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Tags []struct {
ID int `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
Order int `json:"order"`
} `json:"tags"`
Cover struct {
ID int `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
Path string `json:"path"`
Type string `json:"type"`
UploadedTo int `json:"uploaded_to"`
} `json:"cover"`
Books []struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"books"`
}
Shelf represents the BookStack API endpoint /api/shelves/{id}
type Shelves ¶
type Shelves struct {
Data []struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
OwnedBy int `json:"owned_by"`
ImageID int `json:"image_id"`
} `json:"data"`
Total int `json:"total"`
}
Shelves represents the BookStack API endpoint /api/shelves
type Wiki ¶
type Wiki struct {
Name string
Books []WikiBook
// one book can be on multiple shelves
Shelves []WikiShelf
}
Wiki is the BookStack2Site representation of a Wiki
type WikiBook ¶
type WikiBook struct {
BookID int
Name string
Slug string
// a book can have pages in chapters or independent pages
Chapters []WikiChapter
IndiePages []WikiPage
}