92 lines
2.6 KiB
Go
92 lines
2.6 KiB
Go
package model
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
NodeTypeFolder = "folder"
|
|
NodeTypeFile = "file"
|
|
NodeTypeGoogleSheet = "google_sheet"
|
|
NodeTypeOfficeDocument = "office_document"
|
|
|
|
AccessView = "view"
|
|
AccessEdit = "edit"
|
|
)
|
|
|
|
var ErrInvalidMove = errors.New("invalid move")
|
|
|
|
type Node struct {
|
|
ID string `json:"id"`
|
|
ParentID *string `json:"parent_id,omitempty"`
|
|
NodeType string `json:"node_type"`
|
|
Title string `json:"title"`
|
|
OwnerUserID string `json:"owner_user_id"`
|
|
OwnerDepartmentID *string `json:"owner_department_id,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
UpdatedBy *string `json:"updated_by,omitempty"`
|
|
StorageKey *string `json:"storage_key,omitempty"`
|
|
OriginalFilename *string `json:"original_filename,omitempty"`
|
|
MimeType *string `json:"mime_type,omitempty"`
|
|
Extension *string `json:"extension,omitempty"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
OfficeFormat *string `json:"office_format,omitempty"`
|
|
ExternalURL *string `json:"external_url,omitempty"`
|
|
Version int `json:"version"`
|
|
EffectiveAccess string `json:"effective_access"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
TrashedAt *time.Time `json:"trashed_at,omitempty"`
|
|
PurgeAfter *time.Time `json:"purge_after,omitempty"`
|
|
DeletedAt *time.Time `json:"deleted_at,omitempty"`
|
|
}
|
|
|
|
type Access struct {
|
|
UserID string `json:"user_id"`
|
|
AccessLevel string `json:"access_level"`
|
|
GrantedBy string `json:"granted_by,omitempty"`
|
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
|
}
|
|
|
|
type CreateFolderRequest struct {
|
|
ParentID *string `json:"parent_id"`
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
type CreateOfficeDocumentRequest struct {
|
|
ParentID *string `json:"parent_id"`
|
|
Title string `json:"title"`
|
|
OfficeID string `json:"office_id"`
|
|
OfficeFormat string `json:"office_format"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
}
|
|
|
|
type UpdateNodeRequest struct {
|
|
ParentID *string `json:"parent_id"`
|
|
Title *string `json:"title"`
|
|
}
|
|
|
|
type MoveNodeRequest struct {
|
|
ParentID *string `json:"parent_id"`
|
|
}
|
|
|
|
type PublicNodeResponse struct {
|
|
Node *Node `json:"node"`
|
|
Children []Node `json:"children,omitempty"`
|
|
}
|
|
|
|
type ReplaceAccessRequest struct {
|
|
Access []Access `json:"access"`
|
|
}
|
|
|
|
type PublicLinkRequest struct {
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
}
|
|
|
|
type PublicLinkResponse struct {
|
|
ID string `json:"id"`
|
|
URL string `json:"url"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
}
|