Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0247d6

Browse files
committed
add webhook dependencies to config
Signed-off-by: shmck <[email protected]>
1 parent 93d6938 commit a0247d6

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

src/schema/skeleton.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@ export default {
5353
examples: ['coderoad']
5454
}
5555
},
56+
webhooks: {
57+
type: 'object',
58+
description: 'Optional configuration for setting up webhook events',
59+
properties: {
60+
endpoint: {
61+
type: 'string',
62+
description:
63+
'Webhook endpoint to hit on events. Uses HTTP POST requests',
64+
examples: ['https://api.com/v1/coderoad']
65+
},
66+
headers: {
67+
type: 'object',
68+
description: 'Headers for the webhook request in JSON format',
69+
examples: ['{ x-token: "$CODEROAD_WEBHOOK_TOKEN" }'],
70+
additionalProperties: true
71+
},
72+
events: {
73+
type: 'object',
74+
description:
75+
'A configuration of possible events toggled on or off',
76+
properties: {
77+
init: {
78+
type: 'boolean',
79+
description: 'Trigger webhook when user starts a tutorial'
80+
},
81+
reset: {
82+
type: 'boolean',
83+
description:
84+
'Trigger webhook when user resets a CodeRoad tutorial'
85+
},
86+
step_complete: {
87+
type: 'boolean',
88+
description: 'Trigger webhook when user completes a step'
89+
},
90+
level_complete: {
91+
type: 'boolean',
92+
description: 'Trigger webhook when user completes a level'
93+
},
94+
tutorial_complete: {
95+
type: 'boolean',
96+
description:
97+
'Trigger webhook when user completes a tutorial'
98+
}
99+
},
100+
additionalProperties: false
101+
}
102+
}
103+
},
56104
required: ['command', 'args']
57105
},
58106
setup: {

src/schema/tutorial.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,52 @@ export default {
159159
}
160160
}
161161
},
162+
webhooks: {
163+
type: 'object',
164+
description: 'Optional configuration for setting up webhook events',
165+
properties: {
166+
endpoint: {
167+
type: 'string',
168+
description:
169+
'Webhook endpoint to hit on events. Uses HTTP POST requests',
170+
examples: ['https://api.com/v1/coderoad']
171+
},
172+
headers: {
173+
type: 'object',
174+
description: 'Headers for the webhook request in JSON format',
175+
examples: ['{ x-token: "$CODEROAD_WEBHOOK_TOKEN" }'],
176+
additionalProperties: true
177+
},
178+
events: {
179+
type: 'object',
180+
description: 'A configuration of possible events toggled on or off',
181+
properties: {
182+
init: {
183+
type: 'boolean',
184+
description: 'Trigger webhook when user starts a tutorial'
185+
},
186+
reset: {
187+
type: 'boolean',
188+
description:
189+
'Trigger webhook when user resets a CodeRoad tutorial'
190+
},
191+
step_complete: {
192+
type: 'boolean',
193+
description: 'Trigger webhook when user completes a step'
194+
},
195+
level_complete: {
196+
type: 'boolean',
197+
description: 'Trigger webhook when user completes a level'
198+
},
199+
tutorial_complete: {
200+
type: 'boolean',
201+
description: 'Trigger webhook when user completes a tutorial'
202+
}
203+
},
204+
additionalProperties: false
205+
}
206+
}
207+
},
162208
additionalProperties: false,
163209
required: ['testRunner', 'repo']
164210
},

0 commit comments

Comments
 (0)