-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
130 lines (114 loc) · 5 KB
/
Copy pathtypes.go
File metadata and controls
130 lines (114 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package types
type CodeVideoManifest struct {
Environment string `json:"environment"`
UserID string `json:"userId"`
UUID string `json:"uuid"`
Actions []Action `json:"actions,omitempty"`
Lesson Lesson `json:"lesson,omitempty"`
CurrentLessonIndex int `json:"currentLessonIndex,omitempty"`
AudioItems []AudioItem `json:"audioItems"`
FontSizePx int `json:"fontSizePx,omitempty"`
Error string `json:"error,omitempty"`
CodeVideoIDEProps *CodeVideoIDEProps `json:"codeVideoIDEProps,omitempty"`
}
// Configuration holds all CLI configuration
type Configuration struct {
ProjectJSON string
OutputPath string
Resolution string
MaxConcurrent int
OperatingSystem string
}
type Action struct {
Name string `json:"name"`
Value string `json:"value"`
}
// IsValidAction checks if an action has valid Name and Value fields
func IsValidAction(action Action) bool {
return action.Name != "" && action.Value != ""
}
// AudioItem represents an audio item in a CodeVideo project
type AudioItem struct {
Text string `json:"text"`
Mp3Url string `json:"mp3Url"`
}
// Project is a generic interface for all project types
type Project interface {
// GetType returns the type of the project (Actions, Lesson, or Course)
GetType() string
}
// ActionsProject represents a list of actions
type ActionsProject []Action
// GetType implements the Project interface
func (a ActionsProject) GetType() string {
return "Actions"
}
// CourseSnapshot represents a distinct moment in time during a lesson
// including the entire IDE state, mouse state, and other UI elements
// Since this structure is only forwarded to Node scripts and not processed in Go,
// we use a generic map to avoid having to define every field
type CourseSnapshot map[string]interface{}
// Lesson represents a lesson project.
// Field names/tags mirror the TS ILesson (codevideo-types): it serializes
// "name" (not "title") plus "id" and optional "finalSnapshot".
type Lesson struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
InitialSnapshot CourseSnapshot `json:"initialSnapshot"`
FinalSnapshot CourseSnapshot `json:"finalSnapshot,omitempty"`
Actions []Action `json:"actions"`
}
// GetType implements the Project interface
func (l Lesson) GetType() string {
return "Lesson"
}
// Course represents a course project.
// Field names/tags mirror the TS ICourse: "name" (not "title"), plus "id"
// and "primaryLanguage".
type Course struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
PrimaryLanguage string `json:"primaryLanguage"`
Lessons []Lesson `json:"lessons"`
}
// GetType implements the Project interface
func (c Course) GetType() string {
return "Course"
}
type CodeVideoUserMetadata struct {
Tokens int `json:"tokens"`
StripeID string `json:"stripeId"`
Unlimited bool `json:"unlimited"`
SubscriptionPlan string `json:"subscriptionPlan"`
SubscriptionStatus string `json:"subscriptionStatus"`
TokensPerCycle int `json:"tokensPerCycle"`
}
type CodeVideoIDEProps struct {
Theme string `json:"theme"` // 'light' | 'dark'
Project Project `json:"project"`
Mode string `json:"mode"` // GUIMode equivalent
AllowFocusInEditor bool `json:"allowFocusInEditor"`
CurrentActionIndex int `json:"currentActionIndex"`
CurrentLessonIndex *int `json:"currentLessonIndex"`
DefaultLanguage string `json:"defaultLanguage"`
IsExternalBrowserStepUrl *string `json:"isExternalBrowserStepUrl"`
IsSoundOn bool `json:"isSoundOn"`
WithCaptions bool `json:"withCaptions"`
SpeakActionAudios []SpeakActionAudio `json:"speakActionAudios"`
FileExplorerWidth *int `json:"fileExplorerWidth,omitempty"`
TerminalHeight *int `json:"terminalHeight,omitempty"`
MouseColor *string `json:"mouseColor,omitempty"`
FontSizePx *int `json:"fontSizePx,omitempty"`
IsEmbedMode *bool `json:"isEmbedMode,omitempty"`
IsFileExplorerVisible *bool `json:"isFileExplorerVisible,omitempty"`
IsTerminalVisible *bool `json:"isTerminalVisible,omitempty"`
KeyboardTypingPauseMs *int `json:"keyboardTypingPauseMs,omitempty"`
StandardPauseMs *int `json:"standardPauseMs,omitempty"`
LongPauseMs *int `json:"longPauseMs,omitempty"`
}
type SpeakActionAudio struct {
Text string `json:"text"`
Mp3Url string `json:"mp3Url"`
}