mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
can add pages
This commit is contained in:
@@ -30,7 +30,7 @@ public class CanvasCoursePageService(
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> Create(
|
||||
public async Task<ulong> Create(
|
||||
ulong canvasCourseId,
|
||||
LocalCoursePage localCourse
|
||||
)
|
||||
|
||||
@@ -123,4 +123,30 @@ public class CanvasService(
|
||||
if (newItem == null)
|
||||
throw new Exception("something went wrong updating module item");
|
||||
}
|
||||
public async Task CreateModuleItem(
|
||||
ulong canvasCourseId,
|
||||
ulong canvasModuleId,
|
||||
string title,
|
||||
string type,
|
||||
string contentId
|
||||
)
|
||||
{
|
||||
logger.Log($"creating new module item {title}");
|
||||
var url = $"courses/{canvasCourseId}/modules/{canvasModuleId}/items";
|
||||
var body = new
|
||||
{
|
||||
module_item = new
|
||||
{
|
||||
title,
|
||||
type = type.ToString(),
|
||||
content_id = contentId,
|
||||
}
|
||||
};
|
||||
var request = new RestRequest(url);
|
||||
request.AddBody(body);
|
||||
|
||||
var (newItem, _response) = await webRequestor.PostAsync<CanvasModuleItem>(request);
|
||||
if (newItem == null)
|
||||
throw new Exception("something went wrong updating module item with string content id");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user