mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
compose
This commit is contained in:
@@ -8,26 +8,26 @@ public record GradeModel
|
||||
string? HtmlUrl = null,
|
||||
|
||||
[property: JsonPropertyName("current_grade")]
|
||||
string? CurrentGrade = null,
|
||||
float? CurrentGrade = null,
|
||||
|
||||
[property: JsonPropertyName("final_grade")]
|
||||
string? FinalGrade = null,
|
||||
float? FinalGrade = null,
|
||||
|
||||
[property: JsonPropertyName("current_score")]
|
||||
string? CurrentScore = null,
|
||||
float? CurrentScore = null,
|
||||
|
||||
[property: JsonPropertyName("final_score")]
|
||||
string? FinalScore = null,
|
||||
float? FinalScore = null,
|
||||
|
||||
[property: JsonPropertyName("unposted_current_grade")]
|
||||
string? UnpostedCurrentGrade = null,
|
||||
float? UnpostedCurrentGrade = null,
|
||||
|
||||
[property: JsonPropertyName("unposted_final_grade")]
|
||||
string? UnpostedFinalGrade = null,
|
||||
float? UnpostedFinalGrade = null,
|
||||
|
||||
[property: JsonPropertyName("unposted_current_score")]
|
||||
string? UnpostedCurrentScore = null,
|
||||
float? UnpostedCurrentScore = null,
|
||||
|
||||
[property: JsonPropertyName("unposted_final_score")]
|
||||
string? UnpostedFinalScore = null
|
||||
float? UnpostedFinalScore = null
|
||||
);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Security.Policy;
|
||||
|
||||
using CanvasModel;
|
||||
using CanvasModel.Assignments;
|
||||
using CanvasModel.Courses;
|
||||
using CanvasModel.Enrollments;
|
||||
using CanvasModel.EnrollmentTerms;
|
||||
using CanvasModel.Modules;
|
||||
using CanvasModel.Pages;
|
||||
@@ -23,6 +26,7 @@ public interface ICanvasService
|
||||
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, ulong contentId);
|
||||
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, string contentId);
|
||||
Task CreatePageModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, CanvasPage canvasPage);
|
||||
Task<IEnumerable<EnrollmentModel>> GetEnrolledStudents(ulong canvasCourseId);
|
||||
}
|
||||
|
||||
public class CanvasService(
|
||||
@@ -191,4 +195,19 @@ public class CanvasService(
|
||||
if (newItem == null)
|
||||
throw new Exception("something went wrong updating module item with string content id");
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EnrollmentModel>> GetEnrolledStudents(
|
||||
ulong canvasCourseId
|
||||
)
|
||||
{
|
||||
logger.Log($"getting students for corse {canvasCourseId}");
|
||||
|
||||
var url = $"courses/{canvasCourseId}/enrollments?enrollment_type=student";
|
||||
var request = new RestRequest(url);
|
||||
var (enrollments, _response) = await webRequestor.GetManyAsync<EnrollmentModel>(request);
|
||||
if (enrollments == null)
|
||||
throw new Exception($"something went wrong getting enrollments for {canvasCourseId}");
|
||||
|
||||
return enrollments;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user