bookstack

package module
v0.0.0-...-89126e9 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 17 Imported by: 0

README

Bookstack API Experomental Client

Manage a Bookstack instance with Golang.

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

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 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

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"`
	DescriptionHtml string `json:"description_html,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

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

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

CreateChapter will create a chapter according to the given params.

func (*Bookstack) CreatePage

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

CreatePage will create a page according to the given params.

func (*Bookstack) CreateShelf

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

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

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

DeleteChapter will delete a chapter with the given id.

func (*Bookstack) DeletePage

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

DeletePage will delete a page with the given id.

func (*Bookstack) DeleteRecycleBinItem

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

DeleteRecycleBinItem will delete an item from the recycle bin.

func (*Bookstack) DeleteShelf

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

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

ExportBookHTML will return a book in HTML format.

func (*Bookstack) ExportBookMarkdown

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

ExportBookMarkdown will return a book in Markdown format.

func (*Bookstack) ExportBookPDF

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

ExportBookPDF will return a book in PDF format.

func (*Bookstack) ExportBookPlaintext

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

ExportBookPlaintext will return a book in Plaintext format.

func (*Bookstack) ExportChapterHTML

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

ExportChapterHTML will return a chapter in HTML format.

func (*Bookstack) ExportChapterMarkdown

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

ExportChapterMarkdown will return a chapter in Markdown format.

func (*Bookstack) ExportChapterPDF

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

ExportChapterPDF will return a chapter in PDF format.

func (*Bookstack) ExportChapterPlaintext

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

ExportChapterPlaintext will return a chapter in Plaintext format.

func (*Bookstack) ExportPageHTML

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

ExportPageHTML will return a page in HTML format.

func (*Bookstack) ExportPageMarkdown

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

ExportPageMarkdown will return a page in Markdown format.

func (*Bookstack) ExportPagePDF

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

ExportPagePDF will return a page in PDF format.

func (*Bookstack) ExportPagePlaintext

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

ExportPagePlaintext will return a page in Plaintext format.

func (*Bookstack) GetAttachment

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

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

GetChapter will return a single chapter that matches id.

func (*Bookstack) GetPage

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

GetPage will return a single page that matches id.

func (*Bookstack) GetShelf

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

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

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

ListChapters will return the chapters that match the given params.

func (*Bookstack) ListPages

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

ListPages will return the pages 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

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

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

RestoreRecycleBinItem will restore an item from the recycle bin.

func (*Bookstack) Search

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

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

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

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

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

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

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 ChapterParams struct {
	BookID          int         `json:"book_id,omitempty"`
	Name            string      `json:"name,omitempty"`
	Description     string      `json:"description,omitempty"`
	DescriptionHtml string      `json:"description_html,omitempty"`
	Tags            []TagParams `json:"tags,omitempty"`
}

func (ChapterParams) Form

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

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 CreatedBy

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

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

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 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

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

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 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

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 RecycledBook struct {
	Book
	PagesCount    int `json:"pages_count,omitempty"`
	ChaptersCount int `json:"chapters_count,omitempty"`
}

type RecycledChapter

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

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"`
}

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

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 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

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

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

type UpdatedBy

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

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

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