From 652a3cf0a72e6ff6a4ac2af6594cbe29b0c90720 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Fri, 17 Jul 2026 09:55:16 +0100 Subject: [PATCH 01/10] delete course --- examples/course/deleteCourse.js | 8 ++++++++ package.json | 2 +- src/lib/course.ts | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 examples/course/deleteCourse.js diff --git a/examples/course/deleteCourse.js b/examples/course/deleteCourse.js new file mode 100644 index 0000000..4862c46 --- /dev/null +++ b/examples/course/deleteCourse.js @@ -0,0 +1,8 @@ +const { codio, auth } = require('../auth.js') + +async function main() { + await auth + await codio.course.createCourse({id: "your course id", removeOutdatedStudents: false}) +} + +main() diff --git a/package.json b/package.json index 896e640..5af7c89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codio-api-js", - "version": "0.18.0", + "version": "0.19.0", "description": "JS client to Codio API", "repository": { "type": "git", diff --git a/src/lib/course.ts b/src/lib/course.ts index d77321e..4f36dc6 100644 --- a/src/lib/course.ts +++ b/src/lib/course.ts @@ -636,6 +636,26 @@ export async function createModule(courseId: string, moduleName: string): Promis } } +export type DeleteCourseRequest = { + id: string, + removeOutdatedStudents?: boolean +} + +export async function deleteCourse(data: DeleteCourseRequest): Promise { + const api = bent(getApiV1Url(), 'DELETE', 'json', 200) + try { + const paramString = data.removeOutdatedStudents ? `?removeOutdatedStudents=${data.removeOutdatedStudents}` : '' + await api(`/courses${paramString}`, data, getBearer()) + return + } catch (error: any) { + if (error.json) { + const message = JSON.stringify(await error.json()) + throw new Error(message) + } + throw error + } +} + export async function addTeacher(courseId: string, userId: string, readOnly = false): Promise { const api = bent(getApiV1Url(), 'POST', 'json', 200) try { From 7201154d6c128b059a977a55d9e8df358e0a8894 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 14:34:04 +0100 Subject: [PATCH 02/10] typo --- examples/course/deleteCourse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/course/deleteCourse.js b/examples/course/deleteCourse.js index 4862c46..3d273c0 100644 --- a/examples/course/deleteCourse.js +++ b/examples/course/deleteCourse.js @@ -2,7 +2,7 @@ const { codio, auth } = require('../auth.js') async function main() { await auth - await codio.course.createCourse({id: "your course id", removeOutdatedStudents: false}) + await codio.course.deleteCourse({id: "your course id", removeOutdatedStudents: false}) } main() From 451f27ae880b758f427d637f3bb053b16ebef661 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 15:12:23 +0100 Subject: [PATCH 03/10] wip --- src/lib/course.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/course.ts b/src/lib/course.ts index 4f36dc6..5595e8c 100644 --- a/src/lib/course.ts +++ b/src/lib/course.ts @@ -705,7 +705,8 @@ const course = { filterLearnersForMentors, createCourse, createModule, - addTeacher + addTeacher, + deleteCourse } export default course From a8ab65a621e28474341169507a394486c12ba502 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 15:13:07 +0100 Subject: [PATCH 04/10] readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b45a6ed..09b0ab1 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ API keys. - zstd ## How to build -- Run `yarn` -- Run `yarn build` +- Run `npm` +- Run `npm build` ## Authentication From 21aa22ed4adf1869cecc1465dda5143454b13163 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 15:15:14 +0100 Subject: [PATCH 05/10] wip --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09b0ab1..67cab11 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ API keys. - zstd ## How to build -- Run `npm` +- Run `npm install` - Run `npm build` From bf7d4611a7365a72af14bac5d6531d54a7319bc2 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 15:37:19 +0100 Subject: [PATCH 06/10] wip --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5af7c89..51b0b1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codio-api-js", - "version": "0.19.0", + "version": "0.19.1", "description": "JS client to Codio API", "repository": { "type": "git", From 74c5895f57f279d8ae7ed088942bb9eb75e4a7e8 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 15:56:12 +0100 Subject: [PATCH 07/10] fix --- README.md | 2 +- src/lib/course.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67cab11..0ccf83d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ API keys. ## How to build - Run `npm install` -- Run `npm build` +- Run `npm run build` ## Authentication diff --git a/src/lib/course.ts b/src/lib/course.ts index 5595e8c..b6a230b 100644 --- a/src/lib/course.ts +++ b/src/lib/course.ts @@ -645,7 +645,7 @@ export async function deleteCourse(data: DeleteCourseRequest): Promise { const api = bent(getApiV1Url(), 'DELETE', 'json', 200) try { const paramString = data.removeOutdatedStudents ? `?removeOutdatedStudents=${data.removeOutdatedStudents}` : '' - await api(`/courses${paramString}`, data, getBearer()) + await api(`/courses/${data.id}${paramString}`, data, getBearer()) return } catch (error: any) { if (error.json) { From c294f5c8f8044fc976b96040b8038b6ec5c95e3d Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 16:29:03 +0100 Subject: [PATCH 08/10] readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0ccf83d..4eb877b 100644 --- a/README.md +++ b/README.md @@ -525,6 +525,12 @@ Returns `Date` of archivation await codio.course.archive() ``` +#### Delete course + +``` +await codio.course.deleteCourse({id: "", removeOutdatedStudents: }) +``` + #### Filter Learners For Mentors Specify mentors for LTI-base course From 056eb2531a8f3abcd9dfb5605716ed9ac856f953 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Thu, 23 Jul 2026 16:48:00 +0100 Subject: [PATCH 09/10] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4eb877b..bc4ed1a 100644 --- a/README.md +++ b/README.md @@ -528,7 +528,7 @@ await codio.course.archive() #### Delete course ``` -await codio.course.deleteCourse({id: "", removeOutdatedStudents: }) +await codio.course.deleteCourse({id: , removeOutdatedStudents: }) ``` #### Filter Learners For Mentors From 3ad9c2f6a8796f7cff32a14357336462c3225a50 Mon Sep 17 00:00:00 2001 From: Sergei Bronnikov Date: Fri, 24 Jul 2026 16:34:57 +0100 Subject: [PATCH 10/10] readme --- examples/course/deleteCourse.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/course/deleteCourse.js b/examples/course/deleteCourse.js index 3d273c0..e91748f 100644 --- a/examples/course/deleteCourse.js +++ b/examples/course/deleteCourse.js @@ -1,8 +1,13 @@ const { codio, auth } = require('../auth.js') async function main() { - await auth + await auth + try { await codio.course.deleteCourse({id: "your course id", removeOutdatedStudents: false}) + console.log("Course deleted successfully.") + } catch (error) { + console.error("Error deleting course:", error) + } } main()