PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.2
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.2
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / MCP / Schemas / LessonSchemas.php

LessonSchemas.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.2, at inc/MCP/Schemas/LessonSchemas.php

163 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace LearnPress\MCP\Schemas;
4
5 use LearnPress\MCP\Support\Schemas;
6
7 defined( 'ABSPATH' ) || exit;
8
9 /**
10 * Input/output schemas for lesson write tools.
11 *
12 * Material attachment writes are intentionally deferred in Phase 2 and are not
13 * part of the input contract.
14 */
15 class LessonSchemas {
16
17 /**
18 * create-lesson input.
19 *
20 * @return array
21 */
22 public static function create_input(): array {
23 return Schemas::object(
24 array(
25 'course_id' => Schemas::id(),
26 'section_id' => Schemas::id(),
27 'title' => Schemas::string(),
28 'content' => Schemas::string(),
29 'excerpt' => Schemas::string(),
30 'status' => Schemas::status(),
31 'duration' => Schemas::string(),
32 'preview' => Schemas::boolean(),
33 'video_intro' => Schemas::string(),
34 'order' => Schemas::integer( 1 ),
35 ),
36 array( 'course_id', 'section_id', 'title' )
37 );
38 }
39
40 /**
41 * update-lesson input.
42 *
43 * @return array
44 */
45 public static function update_input(): array {
46 return Schemas::object(
47 array(
48 'lesson_id' => Schemas::id(),
49 'title' => Schemas::string(),
50 'content' => Schemas::string(),
51 'excerpt' => Schemas::string(),
52 'status' => Schemas::status(),
53 'duration' => Schemas::string(),
54 'preview' => Schemas::boolean(),
55 'video_intro' => Schemas::string(),
56 'section_id' => Schemas::id(),
57 'order' => Schemas::integer( 1 ),
58 ),
59 array( 'lesson_id' )
60 );
61 }
62
63 /**
64 * delete-lesson input.
65 *
66 * @return array
67 */
68 public static function delete_input(): array {
69 return Schemas::object(
70 array(
71 'lesson_id' => Schemas::id(),
72 'course_id' => Schemas::id(),
73 'section_id' => Schemas::id(),
74 ),
75 array( 'lesson_id' )
76 );
77 }
78
79 /**
80 * Write output wrapped under "lesson".
81 *
82 * @return array
83 */
84 public static function write_output(): array {
85 return Schemas::object_output( 'lesson' );
86 }
87
88 /**
89 * delete-lesson output.
90 *
91 * @return array
92 */
93 public static function delete_output(): array {
94 return Schemas::object(
95 array(
96 'trashed' => Schemas::boolean(),
97 'lesson_id' => Schemas::integer(),
98 'removed_from_curriculum' => Schemas::boolean(),
99 'recovery' => array( 'type' => 'object' ),
100 ),
101 array( 'trashed', 'lesson_id' )
102 );
103 }
104
105 /**
106 * list-lessons input (read).
107 *
108 * @return array
109 */
110 public static function list_lessons_input(): array {
111 return array(
112 'type' => 'object',
113 'additionalProperties' => false,
114 'required' => array( 'course_id' ),
115 'properties' => array(
116 'course_id' => array(
117 'type' => 'integer',
118 'minimum' => 1,
119 ),
120 'section_id' => array(
121 'type' => 'integer',
122 'minimum' => 1,
123 ),
124 'status' => array( 'type' => array( 'string', 'array', 'null' ) ),
125 'page' => array(
126 'type' => 'integer',
127 'minimum' => 1,
128 'default' => 1,
129 ),
130 'per_page' => array(
131 'type' => 'integer',
132 'minimum' => 1,
133 'maximum' => 100,
134 'default' => 10,
135 ),
136 ),
137 );
138 }
139
140 /**
141 * Lesson list-item summary schema (read).
142 *
143 * @return array
144 */
145 public static function lesson_summary(): array {
146 return array(
147 'type' => 'object',
148 'properties' => array(
149 'lesson_id' => array( 'type' => 'integer' ),
150 'course_id' => array( 'type' => 'integer' ),
151 'section_id' => array( 'type' => 'integer' ),
152 'section_name' => array( 'type' => 'string' ),
153 'title' => array( 'type' => 'string' ),
154 'excerpt' => array( 'type' => 'string' ),
155 'duration' => array( 'type' => 'string' ),
156 'preview' => array( 'type' => 'boolean' ),
157 'status' => array( 'type' => 'string' ),
158 'permalink' => array( 'type' => 'string' ),
159 ),
160 );
161 }
162 }
163