api

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserSettingLocaleValue                 = []string{"en", "zh", "vi"}
	UserSettingMemoVisibilityValue         = []Visibility{Privite, Protected, Public}
	UserSettingEditorFontStyleValue        = []string{"normal", "mono"}
	UserSettingMemoDisplayTsOptionKeyValue = []string{"created_ts", "updated_ts"}
)
View Source
var (
	SystemSettingAllowSignUpValue = []bool{true, false}
)

Functions

This section is empty.

Types

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

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

type MemoFind struct {
	ID *int `json:"id"`

	// Standard fields
	RowStatus *RowStatus `json:"rowStatus"`
	CreatorID *int       `json:"creatorId"`

	// Domain specific fields
	Pinned         *bool
	ContentSearch  *string
	VisibilityList []Visibility

	// Pagination
	Limit  int
	Offset int
}

type MemoOrganizer

type MemoOrganizer struct {
	ID int

	// Domain specific fields
	MemoID int
	UserID int
	Pinned bool
}

type MemoOrganizerDelete added in v0.7.2

type MemoOrganizerDelete struct {
	MemoID *int
	UserID *int
}

type MemoOrganizerFind

type MemoOrganizerFind struct {
	MemoID int
	UserID int
}

type MemoOrganizerUpsert

type MemoOrganizerUpsert struct {
	MemoID int
	UserID int
	Pinned bool `json:"pinned"`
}

type MemoPatch

type MemoPatch struct {
	ID int

	// 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 MemoResource struct {
	MemoID     int
	ResourceID int
	CreatedTs  int64
	UpdatedTs  int64
}

type MemoResourceDelete added in v0.5.0

type MemoResourceDelete struct {
	MemoID     *int
	ResourceID *int
}

type MemoResourceFind added in v0.5.0

type MemoResourceFind struct {
	MemoID     *int
	ResourceID *int
}

type MemoResourceUpsert added in v0.5.0

type MemoResourceUpsert struct {
	MemoID     int
	ResourceID int
	UpdatedTs  *int64
}

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:"-"`
	Type     string `json:"type"`
	Size     int64  `json:"size"`

	// Related fields
	LinkedMemoAmount int `json:"linkedMemoAmount"`
}

type ResourceCreate

type ResourceCreate struct {
	// Standard fields
	CreatorID int

	// Domain specific fields
	Filename string `json:"filename"`
	Blob     []byte `json:"blob"`
	Type     string `json:"type"`
	Size     int64  `json:"size"`
}

type ResourceDelete

type ResourceDelete struct {
	ID int
}

type ResourceFind

type ResourceFind struct {
	ID *int `json:"id"`

	// Standard fields
	CreatorID *int `json:"creatorId"`

	// Domain specific fields
	Filename *string `json:"filename"`
	MemoID   *int
}

type ResourcePatch added in v0.7.0

type ResourcePatch struct {
	ID int

	// Standard fields
	UpdatedTs *int64

	// Domain specific fields
	Filename *string `json:"filename"`
}

type Role

type Role string

Role is the type of a role.

const (
	// Host is the HOST role.
	Host Role = "HOST"
	// NormalUser is the USER role.
	NormalUser Role = "USER"
)

func (Role) String

func (e Role) String() string

type RowStatus

type RowStatus string

RowStatus is the status for a row.

const (
	// Normal is the status for a normal row.
	Normal RowStatus = "NORMAL"
	// Archived is the status for an archived row.
	Archived RowStatus = "ARCHIVED"
)

func (RowStatus) String

func (e RowStatus) String() string

type Shortcut

type Shortcut 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
	Title   string `json:"title"`
	Payload string `json:"payload"`
}

type ShortcutCreate

type ShortcutCreate struct {
	// Standard fields
	CreatorID int

	// Domain specific fields
	Title   string `json:"title"`
	Payload string `json:"payload"`
}

type ShortcutDelete

type ShortcutDelete struct {
	ID *int

	// Standard fields
	CreatorID *int
}

type ShortcutFind

type ShortcutFind struct {
	ID *int

	// Standard fields
	CreatorID *int

	// Domain specific fields
	Title *string `json:"title"`
}

type ShortcutPatch

type ShortcutPatch struct {
	ID int

	// Standard fields
	UpdatedTs *int64
	RowStatus *RowStatus `json:"rowStatus"`

	// Domain specific fields
	Title   *string `json:"title"`
	Payload *string `json:"payload"`
}

type Signin added in v0.2.0

type Signin struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Signup

type Signup struct {
	Email    string `json:"email"`
	Role     Role   `json:"role"`
	Name     string `json:"name"`
	Password string `json:"password"`
}

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 (
	// 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"
)

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

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
	Email           string         `json:"email"`
	Role            Role           `json:"role"`
	Name            string         `json:"name"`
	PasswordHash    string         `json:"-"`
	OpenID          string         `json:"openId"`
	UserSettingList []*UserSetting `json:"userSettingList"`
}

type UserCreate

type UserCreate struct {
	// Domain specific fields
	Email        string `json:"email"`
	Role         Role   `json:"role"`
	Name         string `json:"name"`
	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 UserFind

type UserFind struct {
	ID *int `json:"id"`

	// Standard fields
	RowStatus *RowStatus `json:"rowStatus"`

	// Domain specific fields
	Email  *string `json:"email"`
	Role   *Role
	Name   *string `json:"name"`
	OpenID *string
}

type UserPatch

type UserPatch struct {
	ID int

	// Standard fields
	UpdatedTs *int64
	RowStatus *RowStatus `json:"rowStatus"`

	// Domain specific fields
	Email        *string `json:"email"`
	Name         *string `json:"name"`
	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"
	// 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
	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"
	// Privite is the PRIVATE visibility.
	Privite Visibility = "PRIVATE"
)

func (Visibility) String added in v0.2.0

func (e Visibility) String() string

Jump to

Keyboard shortcuts

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