referencing courses directly from canvas

This commit is contained in:
2023-07-15 23:19:39 -06:00
parent 5ece8b9d36
commit ed1963c67b
27 changed files with 370 additions and 249 deletions

View File

@@ -5,21 +5,24 @@ public class WebRequestor : IWebRequestor
private const string BaseUrl = "https://snow.instructure.com/api/v1/";
private string token;
private RestClient client;
private string courseid { get; }
public WebRequestor()
{
token = Environment.GetEnvironmentVariable("CANVAS_TOKEN") ?? throw new Exception("CANVAS_TOKEN not in environment");
token =
Environment.GetEnvironmentVariable("CANVAS_TOKEN")
?? throw new Exception("CANVAS_TOKEN not in environment");
client = new RestClient(BaseUrl);
client.AddDefaultHeader("Authorization", $"Bearer {token}");
courseid = "774898";
}
public async Task<RestResponse<T[]>> GetManyAsync<T>(RestRequest request)
{
return await client.ExecuteGetAsync<T[]>(request);
}
public async Task<RestResponse<T>> GetAsync<T>(RestRequest request)
{
return await client.ExecuteGetAsync<T>(request);
}
}
}