Documentation ¶
Overview ¶
Package api contains common definitions used for client and server.
Index ¶
- Constants
- type Aggregate
- type Command
- type EncodingEnum
- type MetaRights
- type URLBuilder
- func (ub *URLBuilder) AppendKVQuery(key, value string) *URLBuilder
- func (ub *URLBuilder) AppendPath(p string) *URLBuilder
- func (ub *URLBuilder) AppendQuery(value string) *URLBuilder
- func (ub *URLBuilder) ClearQuery() *URLBuilder
- func (ub *URLBuilder) Clone() *URLBuilder
- func (ub *URLBuilder) SetFragment(s string) *URLBuilder
- func (ub *URLBuilder) SetRawLocal(rawLocal string) *URLBuilder
- func (ub *URLBuilder) SetZid(zid ZettelID) *URLBuilder
- func (ub *URLBuilder) String() string
- type ZettelData
- type ZettelID
- type ZettelMeta
- type ZettelRights
- type ZidMetaRights
Constants ¶
const ( // System zettel ZidVersion = ZettelID("00000000000001") ZidHost = ZettelID("00000000000002") ZidOperatingSystem = ZettelID("00000000000003") ZidLicense = ZettelID("00000000000004") ZidAuthors = ZettelID("00000000000005") ZidDependencies = ZettelID("00000000000006") ZidLog = ZettelID("00000000000007") ZidMemory = ZettelID("00000000000008") ZidBoxManager = ZettelID("00000000000020") ZidMetadataKey = ZettelID("00000000000090") ZidParser = ZettelID("00000000000092") ZidStartupConfiguration = ZettelID("00000000000096") ZidConfiguration = ZettelID("00000000000100") // WebUI HTML templates are in the range 10000..19999 ZidBaseTemplate = ZettelID("00000000010100") ZidLoginTemplate = ZettelID("00000000010200") ZidListTemplate = ZettelID("00000000010300") ZidZettelTemplate = ZettelID("00000000010401") ZidInfoTemplate = ZettelID("00000000010402") ZidFormTemplate = ZettelID("00000000010403") ZidRenameTemplate = ZettelID("00000000010404") ZidDeleteTemplate = ZettelID("00000000010405") ZidErrorTemplate = ZettelID("00000000010700") // WebUI sxn code zettel are in the range 19000..19999 ZidSxnStart = ZettelID("00000000019000") ZidSxnBase = ZettelID("00000000019990") // CSS-related zettel are in the range 20000..29999 ZidBaseCSS = ZettelID("00000000020001") ZidUserCSS = ZettelID("00000000025001") // WebUI image zettel are in the range 40000..49999 ZidEmoji = ZettelID("00000000040001") // Other sxn code zettel are in the range 50000..59999 ZidSxnPrelude = ZettelID("00000000059900") // Predefined Zettelmarkup zettel are in the range 60000..69999 ZidRoleZettelZettel = ZettelID("00000000060010") ZidRoleConfigurationZettel = ZettelID("00000000060020") ZidRoleRoleZettel = ZettelID("00000000060030") ZidRoleTagZettel = ZettelID("00000000060040") // Range 90000...99999 is reserved for zettel templates ZidTOCNewTemplate = ZettelID("00000000090000") ZidTemplateNewZettel = ZettelID("00000000090001") ZidTemplateNewRole = ZettelID("00000000090004") ZidTemplateNewTag = ZettelID("00000000090003") ZidTemplateNewUser = ZettelID("00000000090002") ZidDefaultHome = ZettelID("00010000000000") )
Predefined Zettel Identifier
const ( MetaCredential = "Credential" MetaEmpty = "EString" MetaID = "Identifier" MetaIDSet = "IdentifierSet" MetaNumber = "Number" MetaString = "String" MetaTagSet = "TagSet" MetaTimestamp = "Timestamp" MetaURL = "URL" MetaWord = "Word" MetaZettelmarkup = "Zettelmarkup" )
Values of the metadata key/value type.
const ( KeyID = "id" KeyTitle = "title" KeyRole = "role" KeyTags = "tags" KeySyntax = "syntax" KeyAuthor = "author" KeyBack = "back" KeyBackward = "backward" KeyBoxNumber = "box-number" KeyCopyright = "copyright" KeyCreated = "created" KeyCredential = "credential" KeyDead = "dead" KeyExpire = "expire" KeyFolge = "folge" KeyFolgeRole = "folge-role" KeyForward = "forward" KeyLang = "lang" KeyLicense = "license" KeyModified = "modified" KeyPrecursor = "precursor" KeyPredecessor = "predecessor" KeyPublished = "published" KeyQuery = "query" KeyReadOnly = "read-only" KeySubordinates = "subordinates" KeySuccessors = "successors" KeySuperior = "superior" KeySummary = "summary" KeyURL = "url" KeyUselessFiles = "useless-files" KeyUserID = "user-id" KeyUserRole = "user-role" KeyVisibility = "visibility" )
Predefined general Metadata keys
const ( ValueFalse = "false" ValueTrue = "true" ValueLangEN = "en" ValueRoleConfiguration = "configuration" ValueRoleTag = "tag" ValueRoleRole = "role" ValueRoleZettel = "zettel" ValueSyntaxCSS = "css" ValueSyntaxDraw = "draw" ValueSyntaxGif = "gif" ValueSyntaxHTML = "html" ValueSyntaxMarkdown = "markdown" ValueSyntaxMD = "md" ValueSyntaxNone = "none" ValueSyntaxSVG = "svg" ValueSyntaxSxn = "sxn" ValueSyntaxText = "text" ValueSyntaxZmk = "zmk" ValueUserRoleCreator = "creator" ValueUserRoleOwner = "owner" ValueUserRoleReader = "reader" ValueUserRoleWriter = "writer" ValueVisibilityCreator = "creator" ValueVisibilityExpert = "expert" ValueVisibilityLogin = "login" ValueVisibilityOwner = "owner" ValueVisibilityPublic = "public" )
Predefined Metadata values
const ( MethodMove = "MOVE" // HTTP method for renaming a zettel HeaderAccept = "Accept" HeaderContentType = "Content-Type" HeaderDestination = "Destination" HeaderLocation = "Location" )
Additional HTTP constants.
const ( QueryKeyCommand = "cmd" QueryKeyEncoding = "enc" QueryKeyParseOnly = "parseonly" QueryKeyPart = "part" QueryKeyPhrase = "phrase" QueryKeyQuery = "q" QueryKeyRole = "role" QueryKeySeed = "_seed" QueryKeyTag = "tag" )
Values for HTTP query parameter.
const ( EncodingHTML = "html" EncodingMD = "md" EncodingSHTML = "shtml" EncodingSz = "sz" EncodingText = "text" EncodingZMK = "zmk" EncodingPlain = "plain" EncodingData = "data" )
Supported encoding values.
const ( PartMeta = "meta" PartContent = "content" PartZettel = "zettel" )
Supported part values.
const ( CommandAuthenticated = Command("authenticated") CommandRefresh = Command("refresh") )
Supported command values
const ( BackwardDirective = "BACKWARD" ContextDirective = "CONTEXT" CostDirective = "COST" ForwardDirective = "FORWARD" FullDirective = "FULL" IdentDirective = "IDENT" ItemsDirective = "ITEMS" MaxDirective = "MAX" LimitDirective = "LIMIT" OffsetDirective = "OFFSET" OrDirective = "OR" OrderDirective = "ORDER" PhraseDirective = "PHRASE" PickDirective = "PICK" RandomDirective = "RANDOM" ReverseDirective = "REVERSE" UnlinkedDirective = "UNLINKED" ActionSeparator = "|" AtomAction = "ATOM" KeysAction = "KEYS" MinAction = "MIN" MaxAction = "MAX" NumberedAction = "NUMBERED" RedirectAction = "REDIRECT" ReIndexAction = "REINDEX" RSSAction = "RSS" TitleAction = "TITLE" ExistOperator = "?" ExistNotOperator = "!?" SearchOperatorNot = "!" SearchOperatorEqual = "=" SearchOperatorNotEqual = "!=" SearchOperatorHas = ":" SearchOperatorHasNot = "!:" SearchOperatorPrefix = "[" SearchOperatorNoPrefix = "![" SearchOperatorSuffix = "]" SearchOperatorNoSuffix = "!]" SearchOperatorMatch = "~" SearchOperatorNoMatch = "!~" SearchOperatorLess = "<" SearchOperatorNotLess = "!<" SearchOperatorGreater = ">" SearchOperatorNotGreater = "!>" )
Supported search operator representations
const InvalidZID = ""
InvalidZID is an invalif zettel identifier
const LengthZid = len(ZidDefaultHome)
LengthZid factors the constant length of a zettel identifier
const QueryPrefix = "query:"
QueryPrefix is the prefix that denotes a query expression within a reference.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
Aggregate maps metadata keys to list of zettel identifier.
type EncodingEnum ¶
type EncodingEnum uint8
EncodingEnum lists all valid encoder keys.
const ( EncoderUnknown EncodingEnum = iota EncoderHTML EncoderMD EncoderSHTML EncoderSz EncoderText EncoderZmk EncoderPlain EncoderData )
Values for EncoderEnum
func Encoder ¶
func Encoder(encoding string) EncodingEnum
Encoder returns the internal encoder code for the given encoding string.
func (EncodingEnum) String ¶
func (e EncodingEnum) String() string
String representation of an encoder key.
type MetaRights ¶
type MetaRights struct { Meta ZettelMeta Rights ZettelRights }
MetaRights contains the metadata of a zettel, and its rights.
type URLBuilder ¶
type URLBuilder struct {
// contains filtered or unexported fields
}
URLBuilder should be used to create zettelstore URLs.
func NewURLBuilder ¶
func NewURLBuilder(prefix string, key byte) *URLBuilder
NewURLBuilder creates a new URL builder with the given prefix and key.
func (*URLBuilder) AppendKVQuery ¶
func (ub *URLBuilder) AppendKVQuery(key, value string) *URLBuilder
AppendKVQuery adds a new key/value query parameter
func (*URLBuilder) AppendPath ¶
func (ub *URLBuilder) AppendPath(p string) *URLBuilder
AppendPath adds a new path element
func (*URLBuilder) AppendQuery ¶
func (ub *URLBuilder) AppendQuery(value string) *URLBuilder
AppendQuery adds a new query
func (*URLBuilder) ClearQuery ¶
func (ub *URLBuilder) ClearQuery() *URLBuilder
ClearQuery removes all query parameters.
func (*URLBuilder) SetFragment ¶
func (ub *URLBuilder) SetFragment(s string) *URLBuilder
SetFragment stores the fragment
func (*URLBuilder) SetRawLocal ¶
func (ub *URLBuilder) SetRawLocal(rawLocal string) *URLBuilder
SetRawLocal sets everything that follows the prefix / key.
func (*URLBuilder) SetZid ¶
func (ub *URLBuilder) SetZid(zid ZettelID) *URLBuilder
SetZid sets the zettel identifier.
type ZettelData ¶
type ZettelData struct { Meta ZettelMeta Rights ZettelRights Encoding string Content string }
ZettelData contains all data for a zettel.
type ZettelID ¶
type ZettelID string
ZettelID contains the identifier of a zettel. It is a string with 14 digits.
type ZettelMeta ¶
ZettelMeta is a map containg the metadata of a zettel.
type ZettelRights ¶
type ZettelRights uint8
ZettelRights is an integer that encode access rights for a zettel.
const ( ZettelCanNone ZettelRights = 1 << iota ZettelCanCreate // Current user is allowed to create a new zettel ZettelCanRead // Requesting user is allowed to read the zettel ZettelCanWrite // Requesting user is allowed to update the zettel ZettelCanRename // Requesting user is allowed to provide the zettel with a new identifier ZettelCanDelete // Requesting user is allowed to delete the zettel ZettelMaxRight // Sentinel value )
Values for ZettelRights, can be or-ed
type ZidMetaRights ¶
type ZidMetaRights struct { ID ZettelID Meta ZettelMeta Rights ZettelRights }
ZidMetaRights contains the identifier, the metadata of a zettel, and its rights.