Dekanat.ScheduleSdk 1.0.1

dotnet add package Dekanat.ScheduleSdk --version 1.0.1
                    
NuGet\Install-Package Dekanat.ScheduleSdk -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dekanat.ScheduleSdk" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dekanat.ScheduleSdk" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Dekanat.ScheduleSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dekanat.ScheduleSdk --version 1.0.1
                    
#r "nuget: Dekanat.ScheduleSdk, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dekanat.ScheduleSdk@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dekanat.ScheduleSdk&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Dekanat.ScheduleSdk&version=1.0.1
                    
Install as a Cake Tool

Dekanat.ScheduleSdk

.NET 10 SDK для роботи з JSON API експорту розкладу ПС-Розклад Національного університету нафти і газу.

Офіційна сторінка параметрів: timetable_export.cgi.

Можливості

  • Типізовані моделі відповіді з System.Text.Json та [JsonPropertyName]
  • HTTP-клієнт IPsRozkladClient для всіх req_type у JSON
  • Кодування відповіді: UTF-8 за замовчуванням, опційно Windows-1251
  • Обробка кодів помилки API (PsRozkladApiException)
  • Реєстрація через Microsoft.Extensions.DependencyInjection

Встановлення

dotnet add package Dekanat.ScheduleSdk

Або додайте посилання на проєкт у monorepo:

<ProjectReference Include="..\src\Dekanat.ScheduleSdk\Dekanat.ScheduleSdk.csproj" />

Швидкий старт

Без DI

using Dekanat.ScheduleSdk;
using Dekanat.ScheduleSdk.Enums;
using Dekanat.ScheduleSdk.Requests;

HttpClient httpClient = new() { BaseAddress = new Uri(PsRozkladClientOptions.DefaultBaseUrl) };
IPsRozkladClient client = PsRozkladClient.Create(httpClient);

// Перелік груп з ID
PsRozkladExport groups = await client.GetObjectListAsync(new ObjectListRequest
{
    Mode = RequestMode.Group,
    IncludeIds = true,
});

// Розклад групи (окремі стовпчики)
PsRozkladExport schedule = await client.GetScheduleAsync(new ScheduleRequest
{
    Mode = RequestMode.Group,
    ObjectId = "-1664",
    BeginDate = new DateOnly(2026, 2, 1),
    EndDate = new DateOnly(2026, 2, 28),
    TextFormat = ScheduleTextFormat.Separated,
});

foreach (ScheduleItem item in schedule.ScheduleItems ?? [])
{
    Console.WriteLine($"{item.GetDate():dd.MM.yyyy} #{item.LessonNumber} {item.Title} — {item.Teacher}");
}

ASP.NET Core

builder.Services.AddPsRozkladClient(options =>
{
    options.Encoding = TextEncodingMode.Utf8;
    options.RequestTimeout = TimeSpan.FromSeconds(60);
});

Кодування

Режим Параметр API Опис
TextEncodingMode.Utf8 (за замовч.) coding_mode=UTF8 Рекомендовано для JSON
TextEncodingMode.Windows1251 coding_mode=WINDOWS-1251 Legacy

Глобально — у PsRozkladClientOptions.Encoding. Для одного запиту — властивість Encoding у ObjectListRequest, ScheduleRequest тощо.

Методи клієнта

Метод req_type Опис
GetObjectListAsync obj_list Групи / викладачі / аудиторії
GetScheduleAsync rozklad Розклад за ID, назвою або dep_name
GetFreeRoomsAsync free_rooms_list Вільні аудиторії
GetRoomTypesAsync room_type_list Типи аудиторій
SendAsync довільний Низькорівневий доступ

Моделі

Коренева відповідь: PsRozkladResponsePsRozkladExport.

JSON Модель C#
departments Department
blocks Building
roz_items ScheduleItem
objects (room types) RoomType
free_rooms FreeRoomsEntry
error ApiErrorDetails

Поле code та errorcode десеріалізуються як int навіть якщо сервер повертає рядок.

Помилки API

Якщо ThrowOnApiError = true (за замовчуванням), при code != 0 кидається PsRozkladApiException з ErrorCode та ErrorMessage.

Коди з документації відображені в ApiResultCode (наприклад -90 — об'єкт не знайдено).

Тести

dotnet test                              # 76 тестів (52 unit + 24 integration)
dotnet test --filter Category=Unit       # без мережі
dotnet test --filter Category=Integration

set SKIP_PSROZKLAD_INTEGRATION_TESTS=1   # інтеграція одразу виходить
dotnet test
Проєкт Покриття
Dekanat.ScheduleSdk.Tests JSON-моделі, валідація, query (mock HTTP), ApiQueryBuilder
Dekanat.ScheduleSdk.IntegrationTests obj_list, rozklad, free_rooms_list, room_type_list, SendAsync

Структура репозиторію

src/Dekanat.ScheduleSdk/
tests/Dekanat.ScheduleSdk.Tests/
tests/Dekanat.ScheduleSdk.IntegrationTests/

Ліцензія

Уточніть ліцензію для вашої організації.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 94 5/26/2026
1.0.0 87 5/26/2026