This package contains an HTTP client for TermTime
License
—
Deps
5
Install Size
—
Vulns
✓ 0
Published
Dec 12, 2025
$ dotnet add package UvA.TermTime.ClientThis package provides an API client for TermTime.
Each academic year has its own TermTime client. To configure the API keys, use the following options pattern:
{
"TermTime": {
"url": "https://ttportaluvadev.com/v1/api/",
"apiKeys": {
"2023": "<super-secret-2023>",
"2024": "<super-secret-2024>"
}
}
}
To use the TermTime client in your software, install the package. And apply the following steps:
sectionName is the name of the section containing the options:services.AddTermTimeClient(sectionName);
ITermTimeClientFactory in your Service or Controller:public class MyService
{
private readonly ITermTimeClientFactory _factory;
public MyService(ITermTimeClientFactory factory)
{
_factory = factory;
}
public async Task DoRequest(int academicYear)
{
// Will throw an exception if there is no TermTime client registered for the given year
var client = _factory.CreateClient(academicYear);
var pong = await client.Ping();
}
}
All requests support validation using DataAnnotations. To validate a request, use the following code:
var request = new DeleteCourse("oh:course:12345");
var context = new ValidationContext(request);
Validator.Validate(request, context); // Will throw a ValidationException if invalid
If requests fail for whatever reason, a TermTimeException is thrown.