pad

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableFonts = []string{
	"Quicksand",
	"Roboto",
	"Alegreya",
	"PlayfairDisplay",
	"Montserrat",
	"OpenDyslexic",
	"RobotoMono",
}

Functions

func AppendChatMessage added in v0.0.5

func AppendChatMessage(initStore *lib.InitStore) fiber.Handler

AppendChatMessage godoc @Summary Append a chat message @Description Creates a chat message for the pad @Tags Chat @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body AppendChatMessageRequest true "Chat message data" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/chat [post]

func AppendText added in v0.0.5

func AppendText(initStore *lib.InitStore) fiber.Handler

AppendText godoc @Summary Append text to a pad @Description Appends text to the end of a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body AppendTextRequest true "Text to append and Author ID" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/appendText [post]

func CheckToken added in v0.0.5

func CheckToken() fiber.Handler

CheckToken godoc @Summary Check API token @Description Returns ok when the current API token is valid @Tags Auth @Accept json @Produce json @Success 200 {string} string "OK" @Security BearerAuth @Router /admin/api/checkToken [get]

func CreatePad added in v0.0.5

func CreatePad(initStore *lib.InitStore) fiber.Handler

CreatePad godoc @Summary Create a new pad @Description Creates a new pad with optional initial text @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body CreatePadRequest false "Initial text and author ID" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 409 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId} [post]

func DeletePad added in v0.0.5

func DeletePad(initStore *lib.InitStore) fiber.Handler

DeletePad godoc @Summary Delete a pad @Description Deletes a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {string} string "OK" @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId} [delete]

func GetAttributePool added in v0.0.5

func GetAttributePool(initStore *lib.InitStore) fiber.Handler

GetAttributePool godoc @Summary Get attribute pool of a pad @Description Returns the attribute pool of a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} AttributePoolResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/attributePool [get]

func GetChatHead added in v0.0.5

func GetChatHead(initStore *lib.InitStore) fiber.Handler

GetChatHead godoc @Summary Get chat head @Description Returns the chat head (last number of the last chat message) of the pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} ChatHeadResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/chatHead [get]

func GetChatHistory added in v0.0.5

func GetChatHistory(initStore *lib.InitStore) fiber.Handler

GetChatHistory godoc @Summary Get chat history @Description Returns a part of or the whole chat history of this pad @Tags Chat @Accept json @Produce json @Param padId path string true "Pad ID" @Param start query int false "Start index" @Param end query int false "End index" @Success 200 {object} ChatHistoryResponse @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/chatHistory [get]

func GetHTML added in v0.0.5

func GetHTML(initStore *lib.InitStore) fiber.Handler

GetHTML godoc @Summary Get pad HTML @Description Returns the pad content as HTML @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param rev query string false "Revision number" @Success 200 {object} map[string]string @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/html [get]

func GetLastEdited added in v0.0.5

func GetLastEdited(initStore *lib.InitStore) fiber.Handler

GetLastEdited godoc @Summary Get last edited timestamp @Description Returns the timestamp of when the pad was last edited @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} map[string]int64 @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/lastEdited [get]

func GetPadID added in v0.0.5

func GetPadID(initStore *lib.InitStore) fiber.Handler

GetPadID godoc @Summary Get pad ID from read-only ID @Description Returns the pad ID based on the read-only ID @Tags Pads @Accept json @Produce json @Param roId path string true "Read-only ID" @Success 200 {object} PadIDResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/readonly/{roId} [get]

func GetPadText added in v0.0.5

func GetPadText(initStore *lib.InitStore) fiber.Handler

GetPadText godoc @Summary Get pad text @Description Returns the current text of a pad, optionally for a specific revision @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param rev query string false "Revision number" @Success 200 {object} TextResponse @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/text [get]

func GetPadUsers added in v0.0.5

func GetPadUsers(initStore *lib.InitStore) fiber.Handler

GetPadUsers godoc @Summary Get users currently in a pad @Description Returns a list of users currently editing a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} PadUsersResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/users [get]

func GetPadUsersCount added in v0.0.5

func GetPadUsersCount(initStore *lib.InitStore) fiber.Handler

GetPadUsersCount godoc @Summary Get count of users in a pad @Description Returns the number of users currently editing a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} PadUsersCountResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/usersCount [get]

func GetReadOnlyID added in v0.0.5

func GetReadOnlyID(initStore *lib.InitStore) fiber.Handler

GetReadOnlyID godoc @Summary Get read-only ID @Description Returns the read-only link ID of a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} ReadOnlyIDResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/readOnlyID [get]

func GetRevisionChangeset added in v0.0.5

func GetRevisionChangeset(initStore *lib.InitStore) fiber.Handler

GetRevisionChangeset godoc @Summary Get revision changeset @Description Returns the changeset of a specific revision of a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param rev path string true "Revision number" @Success 200 {object} string @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/{rev}/revisionChangeset [get]

func GetRevisionChangesetOptional added in v0.0.5

func GetRevisionChangesetOptional(initStore *lib.InitStore) fiber.Handler

GetRevisionChangesetOptional godoc @Summary Get revision changeset (optional rev) @Description Returns the changeset at a given revision, or last revision if rev is not provided @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param rev query string false "Revision number (optional, defaults to head)" @Success 200 {object} ChangesetResponse @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/revisionChangeset [get]

func GetRevisionsCount added in v0.0.5

func GetRevisionsCount(initStore *lib.InitStore) fiber.Handler

GetRevisionsCount godoc @Summary Get revisions count @Description Returns the number of revisions of this pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} map[string]int @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/revisionsCount [get]

func GetSavedRevisionsCount added in v0.0.5

func GetSavedRevisionsCount(initStore *lib.InitStore) fiber.Handler

GetSavedRevisionsCount godoc @Summary Get saved revisions count @Description Returns the number of saved revisions of this pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} SavedRevisionsCountResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/savedRevisionsCount [get]

func HandlePadOpen added in v0.0.5

func HandlePadOpen(c fiber.Ctx, uiAssets embed.FS, retrievedSettings *settings.Settings, hooks *hooks.Hook) error

func HandlePadQr added in v0.5.0

func HandlePadQr(c fiber.Ctx, store *lib.InitStore) error

func Init

func Init(initStore *lib.InitStore)

func ListAllPads added in v0.0.5

func ListAllPads(initStore *lib.InitStore) fiber.Handler

ListAllPads godoc @Summary List all pads @Description Returns a list of all pad IDs @Tags Pads @Accept json @Produce json @Success 200 {object} AllPadsResponse @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads [get]

func ListAuthorsOfPad added in v0.0.5

func ListAuthorsOfPad(initStore *lib.InitStore) fiber.Handler

ListAuthorsOfPad godoc @Summary List authors of a pad @Description Returns an array of author IDs who contributed to this pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} AuthorsResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/authors [get]

func ListSavedRevisions added in v0.0.5

func ListSavedRevisions(initStore *lib.InitStore) fiber.Handler

ListSavedRevisions godoc @Summary List saved revisions @Description Returns the list of saved revisions of this pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Success 200 {object} SavedRevisionsListResponse @Failure 404 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/savedRevisions [get]

func RestoreRevision added in v0.0.5

func RestoreRevision(initStore *lib.InitStore) fiber.Handler

RestoreRevision godoc @Summary Restore a revision @Description Restores a revision from the past as a new changeset @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body RestoreRevisionRequest true "Revision and Author ID" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/restoreRevision [post]

func SaveRevision added in v0.0.5

func SaveRevision(initStore *lib.InitStore) fiber.Handler

SaveRevision godoc @Summary Save a revision @Description Saves the current revision of the pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body SaveRevisionRequest false "Revision number (optional, defaults to head)" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/saveRevision [post]

func SetHTML added in v0.0.5

func SetHTML(initStore *lib.InitStore) fiber.Handler

SetHTML godoc @Summary Set pad HTML @Description Sets the text of a pad based on HTML @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body SetHTMLRequest true "HTML content and Author ID" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/html [post]

func SetPadText added in v0.0.5

func SetPadText(initStore *lib.InitStore) fiber.Handler

SetPadText godoc @Summary Set pad text @Description Updates the text of a pad @Tags Pads @Accept json @Produce json @Param padId path string true "Pad ID" @Param request body SetTextRequest true "Text and Author ID" @Success 200 {string} string "OK" @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/pads/{padId}/text [post]

Types

type AllPadsResponse added in v0.0.5

type AllPadsResponse struct {
	PadIDs []string `json:"padIDs"`
}

AllPadsResponse represents the response with all pad IDs

type AppendChatMessageRequest added in v0.0.5

type AppendChatMessageRequest struct {
	Text     string `json:"text"`
	AuthorID string `json:"authorID"`
	Time     int64  `json:"time"`
}

AppendChatMessageRequest represents the request to append a chat message

type AppendTextRequest added in v0.0.5

type AppendTextRequest struct {
	Text     string `json:"text"`
	AuthorId string `json:"authorId"`
}

AppendTextRequest represents the request to append text

type AttributePoolResponse

type AttributePoolResponse struct {
	Pool apool.APool `json:"pool"`
}

type AuthorsResponse added in v0.0.5

type AuthorsResponse struct {
	AuthorIDs []string `json:"authorIDs"`
}

AuthorsResponse represents the response with author IDs

type ChangesetResponse added in v0.0.5

type ChangesetResponse struct {
	Changeset string `json:"changeset"`
}

ChangesetResponse represents the response with a changeset

type ChatHeadResponse added in v0.0.5

type ChatHeadResponse struct {
	ChatHead int `json:"chatHead"`
}

ChatHeadResponse represents the response with chat head

type ChatHistoryResponse added in v0.0.5

type ChatHistoryResponse struct {
	Messages []ChatMessageResponse `json:"messages"`
}

ChatHistoryResponse represents the response with chat history

type ChatMessageResponse added in v0.0.5

type ChatMessageResponse struct {
	Text     string `json:"text"`
	AuthorID string `json:"authorID"`
	Time     int64  `json:"time"`
	UserName string `json:"userName"`
}

ChatMessageResponse represents a chat message in the response

type CopyPadRequest added in v0.0.5

type CopyPadRequest struct {
	DestinationID string `json:"destinationID"`
	Force         bool   `json:"force"`
}

CopyPadRequest represents the request to copy a pad

type CopyPadWithoutHistoryRequest added in v0.0.5

type CopyPadWithoutHistoryRequest struct {
	DestinationID string `json:"destinationID"`
	Force         bool   `json:"force"`
	AuthorId      string `json:"authorId"`
}

CopyPadWithoutHistoryRequest represents the request to copy a pad without history

type CreatePadRequest added in v0.0.5

type CreatePadRequest struct {
	Text     string `json:"text"`
	AuthorId string `json:"authorId"`
}

CreatePadRequest represents the request to create a pad

type DiffHTMLRequest added in v0.0.5

type DiffHTMLRequest struct {
	StartRev int `json:"startRev"`
	EndRev   int `json:"endRev"`
}

DiffHTMLRequest represents the request for diff HTML

type DiffHTMLResponse added in v0.0.5

type DiffHTMLResponse struct {
	HTML    string   `json:"html"`
	Authors []string `json:"authors"`
}

DiffHTMLResponse represents the response with diff HTML

type MovePadRequest added in v0.0.5

type MovePadRequest struct {
	DestinationID string `json:"destinationID"`
	Force         bool   `json:"force"`
}

MovePadRequest represents the request to move a pad

type PadIDResponse added in v0.0.5

type PadIDResponse struct {
	PadID string `json:"padID"`
}

PadIDResponse represents the response with a pad ID

type PadUser added in v0.0.5

type PadUser struct {
	ID      string `json:"id"`
	ColorID string `json:"colorId"`
	Name    string `json:"name"`
}

PadUser represents a user currently in a pad

type PadUsersCountResponse added in v0.0.5

type PadUsersCountResponse struct {
	PadUsersCount int `json:"padUsersCount"`
}

PadUsersCountResponse represents the response with pad users count

type PadUsersResponse added in v0.0.5

type PadUsersResponse struct {
	PadUsers []PadUser `json:"padUsers"`
}

PadUsersResponse represents the response with pad users

type PublicStatusRequest added in v0.0.5

type PublicStatusRequest struct {
	PublicStatus bool `json:"publicStatus"`
}

PublicStatusRequest represents the request to set public status

type PublicStatusResponse added in v0.0.5

type PublicStatusResponse struct {
	PublicStatus bool `json:"publicStatus"`
}

PublicStatusResponse represents the response with public status

type ReadOnlyIDResponse added in v0.0.5

type ReadOnlyIDResponse struct {
	ReadOnlyID string `json:"readOnlyID"`
}

ReadOnlyIDResponse represents the response with a read-only ID

type RestoreRevisionRequest added in v0.0.5

type RestoreRevisionRequest struct {
	Rev      int    `json:"rev"`
	AuthorId string `json:"authorId"`
}

RestoreRevisionRequest represents the request to restore a revision

type SaveRevisionRequest added in v0.0.5

type SaveRevisionRequest struct {
	Rev int `json:"rev"`
}

SaveRevisionRequest represents the request to save a revision

type SavedRevisionsCountResponse added in v0.0.5

type SavedRevisionsCountResponse struct {
	SavedRevisions int `json:"savedRevisions"`
}

SavedRevisionsCountResponse represents the response with saved revisions count

type SavedRevisionsListResponse added in v0.0.5

type SavedRevisionsListResponse struct {
	SavedRevisions []int `json:"savedRevisions"`
}

SavedRevisionsListResponse represents the response with saved revisions list

type SendMessageRequest added in v0.0.5

type SendMessageRequest struct {
	Msg string `json:"msg"`
}

SendMessageRequest represents the request to send a message to clients

type SetHTMLRequest added in v0.0.5

type SetHTMLRequest struct {
	HTML     string `json:"html"`
	AuthorId string `json:"authorId"`
}

SetHTMLRequest represents the request to set HTML content

type SetTextRequest added in v0.0.5

type SetTextRequest struct {
	Text     string `json:"text"`
	AuthorId string `json:"authorId"`
}

SetTextRequest represents the request to set text

type TextResponse added in v0.0.5

type TextResponse struct {
	Text string `json:"text"`
}

TextResponse represents the text response

Jump to

Keyboard shortcuts

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