Documentation ¶
Index ¶
- Constants
- Variables
- type AccessSource
- type AccessToken
- type AuditLogEntry
- type AuthorizationDetails
- type CommonTreeFields
- type CompilerField
- type ContentLockedAtField
- type CreatedAtField
- type DeletedAtField
- type DeletedDocsField
- type Doc
- type DocWithParent
- type DocsField
- type EditableField
- type EpochField
- type FileRef
- type FileWithParent
- type FilesField
- type Folder
- func (t *Folder) CountNodes() int
- func (t *Folder) CreateParents(path sharedTypes.DirName) (*Folder, error)
- func (t *Folder) GetDoc(needle sharedTypes.Filename) *Doc
- func (t *Folder) GetEntry(needle sharedTypes.Filename) TreeElement
- func (t *Folder) GetFile(needle sharedTypes.Filename) *FileRef
- func (t *Folder) HasEntry(needle sharedTypes.Filename) bool
- func (t *Folder) PopulateIds(b *sharedTypes.UUIDBatch)
- func (t *Folder) WalkFolders(fn func(*Folder) error) error
- type FoldersField
- type ForAuthorizationDetails
- func (p *ForAuthorizationDetails) GetPrivilegeLevel(userId sharedTypes.UUID, accessToken AccessToken) (*AuthorizationDetails, error)
- func (p *ForAuthorizationDetails) GetPrivilegeLevelAnonymous(accessToken AccessToken) (*AuthorizationDetails, error)
- func (p *ForAuthorizationDetails) GetPrivilegeLevelAuthenticated() (*AuthorizationDetails, error)
- type ForBootstrapWS
- type ForClone
- type ForCreation
- type ForProjectEntries
- type ForProjectInvite
- type ForProjectJWT
- type ForProjectList
- type ForTokenAccessDetails
- type ForTree
- type ForZip
- type IdField
- type ImageNameField
- type IsRestrictedUser
- type LastOpenedField
- type LastUpdatedAtField
- type LastUpdatedByField
- type LeafFields
- type LinkedFileData
- type LinkedFileProvider
- type List
- type ListViewPrivate
- type LoadEditorDetails
- type LoadEditorViewPrivate
- type LoadEditorViewPublic
- type Manager
- type Member
- type Name
- type NameField
- type Names
- type OwnerFeaturesField
- type OwnerField
- type OwnerIdField
- type PublicAccessLevel
- type PublicAccessLevelField
- type RootDoc
- type RootDocField
- type RootDocIdField
- type RootFolderField
- type SpellCheckLanguageField
- type TokenAccessDetails
- type Tokens
- type TokensField
- type TreeElement
- type TreeEntity
- type TreeNodeKind
- type VersionField
- type WithIdAndName
Constants ¶
View Source
const ( AccessSourceToken AccessSource = "token" AccessSourceInvite AccessSource = "invite" AccessSourceOwner AccessSource = "owner" TokenBasedAccess PublicAccessLevel = "tokenBased" PrivateAccess PublicAccessLevel = "private" )
View Source
const ( LinkedFileProviderURL = "url" LinkedFileProviderProjectFile = "project_file" LinkedFileProviderProjectOutputFile = "project_output_file" )
View Source
const (
DefaultCompiler = sharedTypes.PDFLaTeX
)
Variables ¶
View Source
var ErrDuplicateNameInFolder = &errors.InvalidStateError{
Msg: "folder already has entry with given name",
}
View Source
var ErrEpochIsNotStable = errors.New("epoch is not stable")
View Source
var ErrInvalidTokenFormat = &errors.ValidationError{Msg: "invalid token format"}
Functions ¶
This section is empty.
Types ¶
type AccessSource ¶
type AccessSource string
func (AccessSource) Enum ¶
func (a AccessSource) Enum() int8
type AccessToken ¶
type AccessToken string
func (AccessToken) EqualsTimingSafe ¶
func (t AccessToken) EqualsTimingSafe(other AccessToken) bool
func (AccessToken) ValidateReadAndWrite ¶
func (t AccessToken) ValidateReadAndWrite() error
func (AccessToken) ValidateReadOnly ¶
func (t AccessToken) ValidateReadOnly() error
type AuditLogEntry ¶
type AuditLogEntry struct { CreatedAt time.Time Info interface{} InitiatorId sharedTypes.UUID Operation string }
type AuthorizationDetails ¶
type AuthorizationDetails struct { Epoch int64 `json:"e"` PrivilegeLevel sharedTypes.PrivilegeLevel `json:"l"` AccessSource AccessSource `json:"s"` }
func (*AuthorizationDetails) IsRestrictedUser ¶
func (a *AuthorizationDetails) IsRestrictedUser() IsRestrictedUser
func (*AuthorizationDetails) IsTokenMember ¶
func (a *AuthorizationDetails) IsTokenMember() bool
type CommonTreeFields ¶
type CommonTreeFields struct { Id sharedTypes.UUID `json:"_id"` Name sharedTypes.Filename `json:"name"` CreatedAt time.Time `json:"created"` }
func (CommonTreeFields) GetId ¶
func (c CommonTreeFields) GetId() sharedTypes.UUID
type CompilerField ¶
type CompilerField struct {
Compiler sharedTypes.Compiler `json:"compiler"`
}
type ContentLockedAtField ¶
type CreatedAtField ¶
type DeletedAtField ¶
type DeletedDocsField ¶
type DeletedDocsField struct {
DeletedDocs []CommonTreeFields `json:"deletedDocs"`
}
type Doc ¶
type Doc struct { LeafFields Snapshot string `json:"snapshot"` Version sharedTypes.Version `json:"version"` }
func NewDoc ¶
func NewDoc(name sharedTypes.Filename) Doc
type DocWithParent ¶
type EditableField ¶
type EditableField struct {
Editable bool `json:"editable"`
}
type EpochField ¶
type EpochField struct {
Epoch int64
}
type FileRef ¶
type FileRef struct { LeafFields LinkedFileData *LinkedFileData `json:"linkedFileData,omitempty"` Hash sharedTypes.Hash `json:"hash,omitempty"` Size int64 `json:"size"` }
func NewFileRef ¶
func NewFileRef(name sharedTypes.Filename, hash sharedTypes.Hash, size int64) FileRef
type FileWithParent ¶
type FileWithParent struct { FileRef ParentId sharedTypes.UUID }
type FilesField ¶
type FilesField struct {
Files []FileRef
}
type Folder ¶
type Folder struct { CommonTreeFields Path sharedTypes.DirName `json:"-"` Docs []Doc `json:"docs"` FileRefs []FileRef `json:"fileRefs"` Folders []Folder `json:"folders"` }
func NewFolder ¶
func NewFolder(name sharedTypes.Filename) Folder
func (*Folder) CountNodes ¶
func (*Folder) CreateParents ¶
func (t *Folder) CreateParents(path sharedTypes.DirName) (*Folder, error)
func (*Folder) GetEntry ¶
func (t *Folder) GetEntry(needle sharedTypes.Filename) TreeElement
func (*Folder) PopulateIds ¶
func (t *Folder) PopulateIds(b *sharedTypes.UUIDBatch)
type FoldersField ¶
type FoldersField struct {
Folders []Folder `json:"-"`
}
type ForAuthorizationDetails ¶
type ForAuthorizationDetails struct { Member EpochField PublicAccessLevelField TokensField }
func (*ForAuthorizationDetails) GetPrivilegeLevel ¶
func (p *ForAuthorizationDetails) GetPrivilegeLevel(userId sharedTypes.UUID, accessToken AccessToken) (*AuthorizationDetails, error)
func (*ForAuthorizationDetails) GetPrivilegeLevelAnonymous ¶
func (p *ForAuthorizationDetails) GetPrivilegeLevelAnonymous(accessToken AccessToken) (*AuthorizationDetails, error)
func (*ForAuthorizationDetails) GetPrivilegeLevelAuthenticated ¶
func (p *ForAuthorizationDetails) GetPrivilegeLevelAuthenticated() (*AuthorizationDetails, error)
type ForBootstrapWS ¶
type ForBootstrapWS struct { ForTree `json:"-"` CompilerField ContentLockedAtField EditableField DeletedDocsField IdField ImageNameField NameField OwnerField PublicAccessLevelField RootDocIdField SpellCheckLanguageField VersionField }
type ForClone ¶
type ForClone struct { ForAuthorizationDetails CompilerField ImageNameField RootDocField SpellCheckLanguageField ForTree }
func (*ForClone) BuildTreeElements ¶
func (p *ForClone) BuildTreeElements() (sharedTypes.PathName, []TreeElement, []sharedTypes.DirName)
type ForCreation ¶
type ForCreation struct { CreatedAtField CompilerField DeletedAtField IdField ImageNameField NameField OwnerIdField RootDocField SpellCheckLanguageField RootFolderField }
func NewProject ¶
func NewProject() ForCreation
type ForProjectEntries ¶
type ForProjectEntries struct { DocsField FilesField }
type ForProjectInvite ¶
type ForProjectInvite struct { NameField ForAuthorizationDetails Sender user.WithPublicInfo User user.WithPublicInfo }
type ForProjectJWT ¶
type ForProjectJWT struct { ForAuthorizationDetails EditableField OwnerFeaturesField }
type ForProjectList ¶
type ForProjectList struct { User user.ProjectListViewCaller Tags []tag.Full Notifications notification.Notifications Projects List }
type ForTokenAccessDetails ¶
type ForTokenAccessDetails struct { IdField NameField ForAuthorizationDetails }
type ForTree ¶
type ForTree struct { RootFolderField // contains filtered or unexported fields }
func (*ForTree) GetRootFolder ¶
type IdField ¶
type IdField struct {
Id sharedTypes.UUID `json:"_id"`
}
type ImageNameField ¶
type ImageNameField struct {
ImageName sharedTypes.ImageName `json:"imageName"`
}
type IsRestrictedUser ¶
type IsRestrictedUser bool
type LastOpenedField ¶
type LastUpdatedAtField ¶
type LastUpdatedByField ¶
type LastUpdatedByField struct {
LastUpdatedBy sharedTypes.UUID
}
type LeafFields ¶
type LeafFields struct { CommonTreeFields Path sharedTypes.PathName `json:"-"` }
type LinkedFileData ¶
type LinkedFileData struct { Provider LinkedFileProvider `json:"provider"` SourceProjectId sharedTypes.UUID `json:"source_project_id,omitempty"` SourceEntityPath sharedTypes.PathName `json:"source_entity_path,omitempty"` SourceOutputFilePath sharedTypes.PathName `json:"source_output_file_path,omitempty"` URL string `json:"url,omitempty"` }
type LinkedFileProvider ¶
type LinkedFileProvider string
func (LinkedFileProvider) Validate ¶
func (p LinkedFileProvider) Validate() error
type List ¶
type List []ListViewPrivate
type ListViewPrivate ¶
type ListViewPrivate struct { ContentLockedAtField ForAuthorizationDetails IdField LastUpdatedAtField LastUpdatedByField NameField OwnerIdField LastUpdater user.WithPublicInfoAndNonStandardId Owner user.WithPublicInfoAndNonStandardId TagIds sharedTypes.UUIDs }
type LoadEditorDetails ¶
type LoadEditorDetails struct { Project LoadEditorViewPrivate User user.WithLoadEditorInfo }
type LoadEditorViewPrivate ¶
type LoadEditorViewPrivate struct { LoadEditorViewPublic ForAuthorizationDetails EditableField RootDocField }
type LoadEditorViewPublic ¶
type LoadEditorViewPublic struct { CompilerField IdField ImageNameField NameField OwnerFeaturesField RootDocIdField VersionField }
type Manager ¶
type Manager interface { PrepareProjectCreation(ctx context.Context, p *ForCreation) error FinalizeProjectCreation(ctx context.Context, p *ForCreation) error SoftDelete(ctx context.Context, projectIds sharedTypes.UUIDs, userId sharedTypes.UUID, ipAddress string) error HardDelete(ctx context.Context, projectId sharedTypes.UUID) error ProcessSoftDeleted(ctx context.Context, cutOff time.Time, fn func(projectId sharedTypes.UUID) bool) error GetDeletedProjectsName(ctx context.Context, projectId, userId sharedTypes.UUID) (Name, error) Restore(ctx context.Context, projectId, userId sharedTypes.UUID, name Name) error AddFolder(ctx context.Context, projectId, userId, parent sharedTypes.UUID, f *Folder) (sharedTypes.Version, error) DeleteDoc(ctx context.Context, projectId, userId, docId sharedTypes.UUID) (sharedTypes.Version, error) DeleteFile(ctx context.Context, projectId, userId, fileId sharedTypes.UUID) (sharedTypes.Version, error) DeleteFolder(ctx context.Context, projectId, userId, folderId sharedTypes.UUID) (sharedTypes.Version, error) RestoreDoc(ctx context.Context, projectId, userId, docId sharedTypes.UUID, name sharedTypes.Filename) (sharedTypes.Version, sharedTypes.UUID, error) MoveDoc(ctx context.Context, projectId, userId, folderId, docId sharedTypes.UUID) (sharedTypes.Version, sharedTypes.PathName, error) MoveFile(ctx context.Context, projectId, userId, folderId, fileId sharedTypes.UUID) (sharedTypes.Version, sharedTypes.PathName, error) MoveFolder(ctx context.Context, projectId, userId, targetFolderId, folderId sharedTypes.UUID) (sharedTypes.Version, []Doc, []FileRef, error) RenameDoc(ctx context.Context, projectId, userId sharedTypes.UUID, d *Doc) (sharedTypes.Version, sharedTypes.PathName, error) RenameFile(ctx context.Context, projectId, userId sharedTypes.UUID, f *FileRef) (sharedTypes.Version, sharedTypes.PathName, error) RenameFolder(ctx context.Context, projectId, userId sharedTypes.UUID, f *Folder) (sharedTypes.Version, []Doc, []FileRef, error) GetAuthorizationDetails(ctx context.Context, projectId, userId sharedTypes.UUID, accessToken AccessToken) (*AuthorizationDetails, error) GetForClone(ctx context.Context, projectId, userId sharedTypes.UUID) (*ForClone, error) GetForProjectInvite(ctx context.Context, projectId, actorId sharedTypes.UUID, email sharedTypes.Email) (*ForProjectInvite, error) GetForProjectJWT(ctx context.Context, projectId, userId sharedTypes.UUID, accessToken AccessToken) (*ForProjectJWT, int64, error) GetForZip(ctx context.Context, projectId sharedTypes.UUID, userId sharedTypes.UUID, accessToken AccessToken) (*ForZip, error) ValidateProjectJWTEpochs(ctx context.Context, projectId, userId sharedTypes.UUID, projectEpoch, userEpoch int64) error BumpLastOpened(ctx context.Context, projectId sharedTypes.UUID) error GetDoc(ctx context.Context, projectId, docId sharedTypes.UUID) (*time.Time, *Doc, error) GetFile(ctx context.Context, projectId, userId sharedTypes.UUID, accessToken AccessToken, fileId sharedTypes.UUID) (*FileWithParent, error) GetElementByPath(ctx context.Context, projectId, userId sharedTypes.UUID, path sharedTypes.PathName) (sharedTypes.UUID, bool, error) GetBootstrapWSDetails(ctx context.Context, projectId, userId sharedTypes.UUID, projectEpoch, userEpoch int64, source AccessSource, p *ForBootstrapWS, u *user.WithPublicInfo) error GetBootstrapWSUser(ctx context.Context, projectId, userId sharedTypes.UUID, projectEpoch, userEpoch int64, u *user.WithPublicInfo, treeVersion *sharedTypes.Version) error GetLastUpdatedAt(ctx context.Context, projectId sharedTypes.UUID) (time.Time, error) GetLoadEditorDetails(ctx context.Context, projectId, userId sharedTypes.UUID, accessToken AccessToken) (*LoadEditorDetails, error) GetProjectWithContent(ctx context.Context, projectId sharedTypes.UUID) ([]Doc, []FileRef, error) GetTokenAccessDetails(ctx context.Context, userId sharedTypes.UUID, privilegeLevel sharedTypes.PrivilegeLevel, accessToken AccessToken) (*ForTokenAccessDetails, *AuthorizationDetails, error) GetTreeEntities(ctx context.Context, projectId, userId sharedTypes.UUID) ([]TreeEntity, error) GetProjectMembers(ctx context.Context, projectId sharedTypes.UUID) ([]user.AsProjectMember, error) GrantTokenAccess(ctx context.Context, projectId, userId sharedTypes.UUID, accessToken AccessToken, privilegeLevel sharedTypes.PrivilegeLevel) error GrantMemberAccess(ctx context.Context, projectId, ownerId, userId sharedTypes.UUID, privilegeLevel sharedTypes.PrivilegeLevel) error GetAccessTokens(ctx context.Context, projectId, userId sharedTypes.UUID, tokens *Tokens) error PopulateTokens(ctx context.Context, projectId, userId sharedTypes.UUID) (*Tokens, error) GetProjectNames(ctx context.Context, userId sharedTypes.UUID) (Names, error) SetCompiler(ctx context.Context, projectId, userId sharedTypes.UUID, compiler sharedTypes.Compiler) error SetImageName(ctx context.Context, projectId, userId sharedTypes.UUID, imageName sharedTypes.ImageName) error SetSpellCheckLanguage(ctx context.Context, projectId, userId sharedTypes.UUID, spellCheckLanguage spellingTypes.SpellCheckLanguage) error SetRootDoc(ctx context.Context, projectId, userId, rooDocId sharedTypes.UUID) error SetPublicAccessLevel(ctx context.Context, projectId, userId sharedTypes.UUID, level PublicAccessLevel) error ArchiveForUser(ctx context.Context, projectId, userId sharedTypes.UUID) error UnArchiveForUser(ctx context.Context, projectId, userId sharedTypes.UUID) error TrashForUser(ctx context.Context, projectId, userId sharedTypes.UUID) error UnTrashForUser(ctx context.Context, projectId, userId sharedTypes.UUID) error Rename(ctx context.Context, projectId, userId sharedTypes.UUID, name Name) error RemoveMember(ctx context.Context, projectId sharedTypes.UUID, actor, userId sharedTypes.UUID) error TransferOwnership(ctx context.Context, projectId, previousOwnerId, newOwnerId sharedTypes.UUID) (*user.WithPublicInfo, *user.WithPublicInfo, Name, error) CreateDoc(ctx context.Context, projectId, userId, folderId sharedTypes.UUID, d *Doc) (sharedTypes.Version, error) EnsureIsDoc(ctx context.Context, projectId, userId, folderId sharedTypes.UUID, d *Doc) (sharedTypes.UUID, bool, sharedTypes.Version, error) PrepareFileCreation(ctx context.Context, projectId, userId, folderId sharedTypes.UUID, f *FileRef) error FinalizeFileCreation(ctx context.Context, projectId, userId sharedTypes.UUID, f *FileRef) (sharedTypes.UUID, bool, sharedTypes.Version, error) ProcessStaleFileUploads(ctx context.Context, cutOff time.Time, fn func(projectId, fileId sharedTypes.UUID) bool) error PurgeStaleFileUpload(ctx context.Context, projectId, fileId sharedTypes.UUID) error ListProjectsWithName(ctx context.Context, userId sharedTypes.UUID) ([]WithIdAndName, error) GetOwnedProjects(ctx context.Context, userId sharedTypes.UUID) ([]sharedTypes.UUID, error) GetProjectListDetails(ctx context.Context, userId sharedTypes.UUID, r *ForProjectList) error SetContentLockedAt(ctx context.Context, projectId, userId sharedTypes.UUID, contentLocked *time.Time) (bool, error) }
type Member ¶
type Member struct { AccessSource AccessSource PrivilegeLevel sharedTypes.PrivilegeLevel Archived bool Trashed bool }
type OwnerFeaturesField ¶
type OwnerField ¶
type OwnerField struct {
Owner user.WithPublicInfo `json:"owner"`
}
type OwnerIdField ¶
type OwnerIdField struct {
OwnerId sharedTypes.UUID `json:"owner_ref"`
}
type PublicAccessLevel ¶
type PublicAccessLevel string
func (PublicAccessLevel) Validate ¶
func (l PublicAccessLevel) Validate() error
type PublicAccessLevelField ¶
type PublicAccessLevelField struct {
PublicAccessLevel PublicAccessLevel `json:"publicAccessLevel"`
}
type RootDocField ¶
type RootDocField struct {
RootDoc RootDoc `json:"root_doc"`
}
type RootDocIdField ¶
type RootDocIdField struct {
RootDocId sharedTypes.UUID `json:"rootDoc_id"`
}
type RootFolderField ¶
type RootFolderField struct {
RootFolder Folder
}
type SpellCheckLanguageField ¶
type SpellCheckLanguageField struct {
SpellCheckLanguage spellingTypes.SpellCheckLanguage `json:"spellCheckLanguage"`
}
type TokenAccessDetails ¶
type TokenAccessDetails struct { ProjectId sharedTypes.UUID Fresh *AuthorizationDetails Existing *AuthorizationDetails }
func (*TokenAccessDetails) ShouldGrantHigherAccess ¶
func (r *TokenAccessDetails) ShouldGrantHigherAccess() bool
type Tokens ¶
type Tokens struct { ReadOnly AccessToken `json:"readOnly"` ReadAndWrite AccessToken `json:"readAndWrite"` ReadAndWritePrefix string `json:"-"` }
type TokensField ¶
type TokensField struct {
Tokens Tokens `json:"tokens"`
}
type TreeElement ¶
type TreeElement interface {
GetId() sharedTypes.UUID
}
type TreeEntity ¶
type TreeNodeKind ¶
type TreeNodeKind string
const ( TreeNodeKindDoc TreeNodeKind = "doc" TreeNodeKindFile TreeNodeKind = "file" TreeNodeKindFolder TreeNodeKind = "folder" )
type VersionField ¶
type VersionField struct {
Version sharedTypes.Version `json:"version"`
}
type WithIdAndName ¶
Click to show internal directories.
Click to hide internal directories.