Documentation
¶
Index ¶
- Constants
- type BackgroundLayer
- type Event
- type OpenPreviewRequest
- type OpenPreviewResponse
- type OpenPreviewViewportHint
- type PreviewItem
- type PutLayoutRequest
- type PutWidgetStateRequest
- type RevisionConflictError
- type Service
- func (s *Service) AppendTerminalSession(ctx context.Context, widgetID string, sessionID string) (WidgetState, error)
- func (s *Service) Close() error
- func (s *Service) OpenPreview(ctx context.Context, req OpenPreviewRequest) (OpenPreviewResponse, error)
- func (s *Service) PruneTerminalSessions(ctx context.Context, liveSessionIDs []string) ([]WidgetState, error)
- func (s *Service) PutWidgetState(ctx context.Context, widgetID string, req PutWidgetStateRequest) (WidgetState, error)
- func (s *Service) RemoveTerminalSession(ctx context.Context, widgetID string, sessionID string) (WidgetState, error)
- func (s *Service) RemoveTerminalSessionFromAllWidgets(ctx context.Context, sessionID string) ([]WidgetState, error)
- func (s *Service) Replace(ctx context.Context, req PutLayoutRequest) (Snapshot, error)
- func (s *Service) Snapshot(ctx context.Context) (Snapshot, error)
- func (s *Service) Subscribe(ctx context.Context, afterSeq int64) ([]Event, <-chan Event, error)
- type Snapshot
- type StickyNote
- type Store
- type TextAnnotation
- type ValidationError
- type WidgetLayout
- type WidgetNotFoundError
- type WidgetState
- type WidgetStateData
- type WidgetStateRevisionConflictError
- type WidgetTypeMismatchError
Constants ¶
View Source
const ( EventTypeLayoutReplaced = "layout.replaced" EventTypeWidgetStateUpserted = "widget_state.upserted" WidgetTypeFiles = "redeven.files" WidgetTypeTerminal = "redeven.terminal" WidgetTypePreview = "redeven.preview" WidgetStateKindFiles = "files" WidgetStateKindTerminal = "terminal" WidgetStateKindPreview = "preview" OpenPreviewStrategySameFileOrCreate = "same_file_or_create" OpenPreviewStrategyFocusLatestOrCreate = "focus_latest_or_create" OpenPreviewStrategyCreateNew = "create_new" DefaultPreviewWidgetWidth = 900 DefaultPreviewWidgetHeight = 620 TerminalMinFontSize = 10 TerminalMaxFontSize = 20 StickyNoteKind = "sticky_note" TextAnnotationKind = "text" DefaultStickyNoteBody = "Untitled note" DefaultStickyNoteColor = "amber" DefaultAnnotationText = "Text" DefaultAnnotationFontFamily = `ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif` DefaultAnnotationFontWeight = 800 DefaultAnnotationFontSize = 45 DefaultAnnotationColor = "#6b7280" DefaultAnnotationAlign = "left" DefaultBackgroundLayerName = "Canvas region" DefaultBackgroundLayerFill = "#9da8a1" DefaultBackgroundLayerOpacity = 0.72 DefaultBackgroundLayerMaterial = "dotted" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundLayer ¶
type BackgroundLayer struct {
ID string `json:"id"`
Name string `json:"name"`
Fill string `json:"fill"`
Opacity float64 `json:"opacity"`
Material string `json:"material"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
ZIndex int `json:"z_index"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
}
type Event ¶
type Event struct {
Seq int64 `json:"seq"`
Type string `json:"type"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
Payload json.RawMessage `json:"payload"`
}
type OpenPreviewRequest ¶ added in v0.6.4
type OpenPreviewRequest struct {
RequestID string `json:"request_id,omitempty"`
Item PreviewItem `json:"item"`
OpenStrategy string `json:"open_strategy,omitempty"`
Viewport OpenPreviewViewportHint `json:"viewport,omitempty"`
}
type OpenPreviewResponse ¶ added in v0.6.4
type OpenPreviewResponse struct {
RequestID string `json:"request_id,omitempty"`
WidgetID string `json:"widget_id"`
Created bool `json:"created"`
Snapshot Snapshot `json:"snapshot"`
WidgetState WidgetState `json:"widget_state"`
}
type OpenPreviewViewportHint ¶ added in v0.6.4
type PreviewItem ¶
type PutLayoutRequest ¶
type PutLayoutRequest struct {
BaseRevision int64 `json:"base_revision"`
Widgets []WidgetLayout `json:"widgets"`
StickyNotes []StickyNote `json:"sticky_notes"`
Annotations []TextAnnotation `json:"annotations"`
BackgroundLayers []BackgroundLayer `json:"background_layers"`
}
type PutWidgetStateRequest ¶
type PutWidgetStateRequest struct {
BaseRevision int64 `json:"base_revision"`
WidgetType string `json:"widget_type"`
State WidgetStateData `json:"state"`
}
type RevisionConflictError ¶
type RevisionConflictError struct {
CurrentRevision int64
}
func (*RevisionConflictError) Error ¶
func (e *RevisionConflictError) Error() string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AppendTerminalSession ¶
func (*Service) OpenPreview ¶ added in v0.6.4
func (s *Service) OpenPreview(ctx context.Context, req OpenPreviewRequest) (OpenPreviewResponse, error)
func (*Service) PruneTerminalSessions ¶
func (*Service) PutWidgetState ¶
func (s *Service) PutWidgetState(ctx context.Context, widgetID string, req PutWidgetStateRequest) (WidgetState, error)
func (*Service) RemoveTerminalSession ¶
func (*Service) RemoveTerminalSessionFromAllWidgets ¶
type Snapshot ¶
type Snapshot struct {
Seq int64 `json:"seq"`
Revision int64 `json:"revision"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
Widgets []WidgetLayout `json:"widgets"`
StickyNotes []StickyNote `json:"sticky_notes"`
Annotations []TextAnnotation `json:"annotations"`
BackgroundLayers []BackgroundLayer `json:"background_layers"`
WidgetStates []WidgetState `json:"widget_states"`
}
type StickyNote ¶
type StickyNote struct {
ID string `json:"id"`
Kind string `json:"kind"`
Body string `json:"body"`
Color string `json:"color"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
ZIndex int `json:"z_index"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
}
type TextAnnotation ¶
type TextAnnotation struct {
ID string `json:"id"`
Kind string `json:"kind"`
Text string `json:"text"`
FontFamily string `json:"font_family"`
FontSize int `json:"font_size"`
FontWeight int `json:"font_weight"`
Color string `json:"color"`
Align string `json:"align"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
ZIndex int `json:"z_index"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
}
type ValidationError ¶
type ValidationError struct {
Message string
}
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type WidgetLayout ¶
type WidgetNotFoundError ¶
type WidgetNotFoundError struct {
WidgetID string
}
func (*WidgetNotFoundError) Error ¶
func (e *WidgetNotFoundError) Error() string
type WidgetState ¶
type WidgetState struct {
WidgetID string `json:"widget_id"`
WidgetType string `json:"widget_type"`
Revision int64 `json:"revision"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
State WidgetStateData `json:"state"`
}
type WidgetStateData ¶
type WidgetStateRevisionConflictError ¶
func (*WidgetStateRevisionConflictError) Error ¶
func (e *WidgetStateRevisionConflictError) Error() string
type WidgetTypeMismatchError ¶
func (*WidgetTypeMismatchError) Error ¶
func (e *WidgetTypeMismatchError) Error() string
Click to show internal directories.
Click to hide internal directories.