Documentation
¶
Index ¶
- Constants
- Variables
- type Activity
- type ActivityCreate
- type ActivityLevel
- type ActivityMemoCreatePayload
- type ActivityResourceCreatePayload
- type ActivityServerStartPayload
- type ActivityShortcutCreatePayload
- type ActivityTagCreatePayload
- type ActivityType
- type ActivityUserAuthSignInPayload
- type ActivityUserAuthSignUpPayload
- type ActivityUserCreatePayload
- type CacheNamespace
- type CacheService
- type CustomizedProfile
- type Memo
- type MemoCreate
- type MemoDelete
- type MemoFind
- type MemoOrganizer
- type MemoOrganizerDelete
- type MemoOrganizerFind
- type MemoOrganizerUpsert
- type MemoPatch
- type MemoResource
- type MemoResourceDelete
- type MemoResourceFind
- type MemoResourceUpsert
- type Resource
- type ResourceCreate
- type ResourceDelete
- type ResourceFind
- type ResourcePatch
- type Role
- type RowStatus
- type Shortcut
- type ShortcutCreate
- type ShortcutDelete
- type ShortcutFind
- type ShortcutPatch
- type SignIn
- type SignUp
- type SystemSetting
- type SystemSettingFind
- type SystemSettingName
- type SystemSettingUpsert
- type SystemStatus
- type Tag
- type TagDelete
- type TagFind
- type TagUpsert
- type User
- type UserCreate
- type UserDelete
- type UserFind
- type UserPatch
- type UserSetting
- type UserSettingDelete
- type UserSettingFind
- type UserSettingKey
- type UserSettingUpsert
- type Visibility
Constants ¶
View Source
const UnknownID = -1
UnknownID is the ID for unknowns.
Variables ¶
View Source
var ( UserSettingLocaleValue = []string{"en", "zh", "vi", "fr", "nl", "sv", "de", "es", "uk", "ru", "it"} UserSettingAppearanceValue = []string{"system", "light", "dark"} UserSettingMemoVisibilityValue = []Visibility{Private, Protected, Public} UserSettingMemoDisplayTsOptionKeyValue = []string{"created_ts", "updated_ts"} )
View Source
var (
SystemSettingAllowSignUpValue = []bool{true, false}
)
Functions ¶
This section is empty.
Types ¶
type Activity ¶ added in v0.10.0
type Activity struct {
ID int `json:"id"`
// Standard fields
CreatorID int `json:"creatorId"`
CreatedTs int64 `json:"createdTs"`
// Domain specific fields
Type ActivityType `json:"type"`
Level ActivityLevel `json:"level"`
Payload string `json:"payload"`
}
type ActivityCreate ¶ added in v0.10.0
type ActivityCreate struct {
// Standard fields
CreatorID int
// Domain specific fields
Type ActivityType `json:"type"`
Level ActivityLevel
Payload string `json:"payload"`
}
ActivityCreate is the API message for creating an activity.
type ActivityLevel ¶ added in v0.10.0
type ActivityLevel string
ActivityLevel is the level of activities.
const ( // ActivityInfo is the INFO level of activities. ActivityInfo ActivityLevel = "INFO" // ActivityWarn is the WARN level of activities. ActivityWarn ActivityLevel = "WARN" // ActivityError is the ERROR level of activities. ActivityError ActivityLevel = "ERROR" )
type ActivityMemoCreatePayload ¶ added in v0.10.0
type ActivityResourceCreatePayload ¶ added in v0.10.0
type ActivityServerStartPayload ¶ added in v0.10.0
type ActivityShortcutCreatePayload ¶ added in v0.10.0
type ActivityTagCreatePayload ¶ added in v0.10.0
type ActivityTagCreatePayload struct {
TagName string `json:"tagName"`
}
type ActivityType ¶ added in v0.10.0
type ActivityType string
ActivityType is the type for an activity.
const ( // ActivityUserCreate is the type for creating users. ActivityUserCreate ActivityType = "user.create" // ActivityUserUpdate is the type for updating users. ActivityUserUpdate ActivityType = "user.update" // ActivityUserDelete is the type for deleting users. ActivityUserDelete ActivityType = "user.delete" // ActivityUserAuthSignIn is the type for user signin. ActivityUserAuthSignIn ActivityType = "user.auth.signin" // ActivityUserAuthSignUp is the type for user signup. ActivityUserAuthSignUp ActivityType = "user.auth.signup" // ActivityUserSettingUpdate is the type for updating user settings. ActivityUserSettingUpdate ActivityType = "user.setting.update" // ActivityMemoCreate is the type for creating memos. ActivityMemoCreate ActivityType = "memo.create" // ActivityMemoUpdate is the type for updating memos. ActivityMemoUpdate ActivityType = "memo.update" // ActivityMemoDelete is the type for deleting memos. ActivityMemoDelete ActivityType = "memo.delete" // ActivityShortcutCreate is the type for creating shortcuts. ActivityShortcutCreate ActivityType = "shortcut.create" // ActivityShortcutUpdate is the type for updating shortcuts. ActivityShortcutUpdate ActivityType = "shortcut.update" // ActivityShortcutDelete is the type for deleting shortcuts. ActivityShortcutDelete ActivityType = "shortcut.delete" // ActivityResourceCreate is the type for creating resources. ActivityResourceCreate ActivityType = "resource.create" // ActivityResourceDelete is the type for deleting resources. ActivityResourceDelete ActivityType = "resource.delete" // ActivityTagCreate is the type for creating tags. ActivityTagCreate ActivityType = "tag.create" // ActivityTagDelete is the type for deleting tags. ActivityTagDelete ActivityType = "tag.delete" // ActivityServerStart is the type for starting server. ActivityServerStart ActivityType = "server.start" )
type ActivityUserAuthSignInPayload ¶ added in v0.10.0
type ActivityUserAuthSignUpPayload ¶ added in v0.10.0
type ActivityUserCreatePayload ¶ added in v0.10.0
type CacheNamespace ¶ added in v0.4.0
type CacheNamespace string
CacheNamespace is the type of a cache.
const ( // UserCache is the cache type of users. UserCache CacheNamespace = "u" // MemoCache is the cache type of memos. MemoCache CacheNamespace = "m" // ShortcutCache is the cache type of shortcuts. ShortcutCache CacheNamespace = "s" // ResourceCache is the cache type of resources. ResourceCache CacheNamespace = "r" )
type CacheService ¶ added in v0.4.0
type CacheService interface {
FindCache(namespace CacheNamespace, id int, entry interface{}) (bool, error)
UpsertCache(namespace CacheNamespace, id int, entry interface{}) error
DeleteCache(namespace CacheNamespace, id int)
}
CacheService is the service for caches.
type CustomizedProfile ¶ added in v0.9.0
type CustomizedProfile struct {
// Name is the server name, default is `memos`
Name string `json:"name"`
// LogoURL is the url of logo image.
LogoURL string `json:"logoUrl"`
// Description is the server description.
Description string `json:"description"`
// Locale is the server default locale.
Locale string `json:"locale"`
// Appearance is the server default appearance.
Appearance string `json:"appearance"`
// ExternalURL is the external url of server. e.g. https://usermemos.com
ExternalURL string `json:"externalUrl"`
}
CustomizedProfile is the struct definition for SystemSettingCustomizedProfileName system setting item.
type Memo ¶
type Memo struct {
ID int `json:"id"`
// Standard fields
RowStatus RowStatus `json:"rowStatus"`
CreatorID int `json:"creatorId"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
// Domain specific fields
Content string `json:"content"`
Visibility Visibility `json:"visibility"`
Pinned bool `json:"pinned"`
DisplayTs int64 `json:"displayTs"`
// Related fields
Creator *User `json:"creator"`
ResourceList []*Resource `json:"resourceList"`
}
type MemoCreate ¶
type MemoCreate struct {
// Standard fields
CreatorID int `json:"-"`
// Domain specific fields
Visibility Visibility `json:"visibility"`
Content string `json:"content"`
// Related fields
ResourceIDList []int `json:"resourceIdList"`
}
type MemoDelete ¶
type MemoDelete struct {
ID int
}
type MemoOrganizer ¶
type MemoOrganizerDelete ¶ added in v0.7.2
type MemoOrganizerFind ¶
type MemoOrganizerUpsert ¶
type MemoPatch ¶
type MemoPatch struct {
ID int `json:"-"`
// Standard fields
CreatedTs *int64 `json:"createdTs"`
UpdatedTs *int64
RowStatus *RowStatus `json:"rowStatus"`
// Domain specific fields
Content *string `json:"content"`
Visibility *Visibility `json:"visibility"`
// Related fields
ResourceIDList []int `json:"resourceIdList"`
}
type MemoResource ¶ added in v0.5.0
type MemoResourceDelete ¶ added in v0.5.0
type MemoResourceFind ¶ added in v0.5.0
type MemoResourceUpsert ¶ added in v0.5.0
type Resource ¶
type Resource struct {
ID int `json:"id"`
// Standard fields
CreatorID int `json:"creatorId"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
// Domain specific fields
Filename string `json:"filename"`
Blob []byte `json:"-"`
ExternalLink string `json:"externalLink"`
Type string `json:"type"`
Size int64 `json:"size"`
// Related fields
LinkedMemoAmount int `json:"linkedMemoAmount"`
}
type ResourceCreate ¶
type ResourceDelete ¶
type ResourceDelete struct {
ID int
}
type ResourceFind ¶
type ResourcePatch ¶ added in v0.7.0
type ShortcutCreate ¶
type ShortcutDelete ¶
type ShortcutFind ¶
type ShortcutPatch ¶
type SystemSetting ¶ added in v0.7.1
type SystemSetting struct {
Name SystemSettingName
// Value is a JSON string with basic value.
Value string
Description string
}
type SystemSettingFind ¶ added in v0.7.1
type SystemSettingFind struct {
Name *SystemSettingName `json:"name"`
}
type SystemSettingName ¶ added in v0.7.1
type SystemSettingName string
const ( // SystemSettingServerID is the key type of server id. SystemSettingServerID SystemSettingName = "serverId" // SystemSettingSecretSessionName is the key type of secret session name. SystemSettingSecretSessionName SystemSettingName = "secretSessionName" // SystemSettingAllowSignUpName is the key type of allow signup setting. SystemSettingAllowSignUpName SystemSettingName = "allowSignUp" // SystemSettingAdditionalStyleName is the key type of additional style. SystemSettingAdditionalStyleName SystemSettingName = "additionalStyle" // SystemSettingAdditionalScriptName is the key type of additional script. SystemSettingAdditionalScriptName SystemSettingName = "additionalScript" // SystemSettingCustomizedProfileName is the key type of customized server profile. SystemSettingCustomizedProfileName SystemSettingName = "customizedProfile" )
func (SystemSettingName) String ¶ added in v0.7.1
func (key SystemSettingName) String() string
type SystemSettingUpsert ¶ added in v0.7.1
type SystemSettingUpsert struct {
Name SystemSettingName `json:"name"`
Value string `json:"value"`
Description string `json:"description"`
}
func (SystemSettingUpsert) Validate ¶ added in v0.7.1
func (upsert SystemSettingUpsert) Validate() error
type SystemStatus ¶
type SystemStatus struct {
Host *User `json:"host"`
Profile profile.Profile `json:"profile"`
DBSize int64 `json:"dbSize"`
// System settings
// Allow sign up.
AllowSignUp bool `json:"allowSignUp"`
// Additional style.
AdditionalStyle string `json:"additionalStyle"`
// Additional script.
AdditionalScript string `json:"additionalScript"`
// Customized server profile, including server name and external url.
CustomizedProfile CustomizedProfile `json:"customizedProfile"`
}
type User ¶
type User struct {
ID int `json:"id"`
// Standard fields
RowStatus RowStatus `json:"rowStatus"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
// Domain specific fields
Username string `json:"username"`
Role Role `json:"role"`
Email string `json:"email"`
Nickname string `json:"nickname"`
PasswordHash string `json:"-"`
OpenID string `json:"openId"`
UserSettingList []*UserSetting `json:"userSettingList"`
}
type UserCreate ¶
type UserCreate struct {
// Domain specific fields
Username string `json:"username"`
Role Role `json:"role"`
Email string `json:"email"`
Nickname string `json:"nickname"`
Password string `json:"password"`
PasswordHash string
OpenID string
}
func (UserCreate) Validate ¶ added in v0.4.1
func (create UserCreate) Validate() error
type UserDelete ¶ added in v0.3.0
type UserDelete struct {
ID int
}
type UserPatch ¶
type UserPatch struct {
ID int `json:"-"`
// Standard fields
UpdatedTs *int64
RowStatus *RowStatus `json:"rowStatus"`
// Domain specific fields
Username *string `json:"username"`
Email *string `json:"email"`
Nickname *string `json:"nickname"`
Password *string `json:"password"`
ResetOpenID *bool `json:"resetOpenId"`
PasswordHash *string
OpenID *string
}
type UserSetting ¶ added in v0.4.0
type UserSetting struct {
UserID int
Key UserSettingKey `json:"key"`
// Value is a JSON string with basic value
Value string `json:"value"`
}
type UserSettingDelete ¶ added in v0.7.2
type UserSettingDelete struct {
UserID int
}
type UserSettingFind ¶ added in v0.4.0
type UserSettingFind struct {
UserID int
Key *UserSettingKey `json:"key"`
}
type UserSettingKey ¶ added in v0.4.0
type UserSettingKey string
const ( // UserSettingLocaleKey is the key type for user locale. UserSettingLocaleKey UserSettingKey = "locale" // UserSettingAppearanceKey is the key type for user appearance. UserSettingAppearanceKey UserSettingKey = "appearance" // UserSettingMemoVisibilityKey is the key type for user preference memo default visibility. UserSettingMemoVisibilityKey UserSettingKey = "memoVisibility" // UserSettingMemoDisplayTsOptionKey is the key type for memo display ts option. UserSettingMemoDisplayTsOptionKey UserSettingKey = "memoDisplayTsOption" )
func (UserSettingKey) String ¶ added in v0.4.0
func (key UserSettingKey) String() string
String returns the string format of UserSettingKey type.
type UserSettingUpsert ¶ added in v0.4.0
type UserSettingUpsert struct {
UserID int `json:"-"`
Key UserSettingKey `json:"key"`
Value string `json:"value"`
}
func (UserSettingUpsert) Validate ¶ added in v0.4.1
func (upsert UserSettingUpsert) Validate() error
type Visibility ¶ added in v0.2.0
type Visibility string
Visibility is the type of a visibility.
const ( // Public is the PUBLIC visibility. Public Visibility = "PUBLIC" // Protected is the PROTECTED visibility. Protected Visibility = "PROTECTED" // Private is the PRIVATE visibility. Private Visibility = "PRIVATE" )
func (Visibility) String ¶ added in v0.2.0
func (e Visibility) String() string
Click to show internal directories.
Click to hide internal directories.