diff --git a/Methods.cs b/Methods.cs index b8189f9..9f7a23a 100644 --- a/Methods.cs +++ b/Methods.cs @@ -42,9 +42,15 @@ public static class Cist } } - public static List? GetEvents(long startTime, long endTime, EventType type, long id) + public static List? GetEvents( EventType type, long id, long startTime = 0, long endTime = 0) { var json = JsonFixers.TryFix(Requests.GetEventsJson(type, id)); - return NureParser.ParseEvents(json); + if(startTime == 0 && endTime == 0) + return NureParser.ParseEvents(json); + else + { + var events = NureParser.ParseEvents(json); + return events.Where(e => e.StartTime >= startTime && e.EndTime <= endTime).ToList(); + } } } \ No newline at end of file diff --git a/Nure.NET.csproj b/Nure.NET.csproj index d3b3a2e..c28cfec 100644 --- a/Nure.NET.csproj +++ b/Nure.NET.csproj @@ -7,8 +7,8 @@ https://api.mindenit.tech GPL-3.0-or-later https://github.com/mindenit/Nure.NET - 0.8.3 - 0.8.3 + 0.8.4 + 0.8.4 diff --git a/README.md b/README.md index 797df43..88a3484 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,118 @@ # Nure.NET -.NET library for work with cist.nure.ua +.NET library for work with cist.nure.ua. That library allows you to get information about schedule, teachers, groups, and other information from the site cist.nure.ua. + +> **Note:** This library is not official and is not supported by the site cist.nure.ua. +> **But**, it is supported by students and Mindenit Team :) + +Below you will find a short guide to using this library. + --- +### Links: [NuGet](https://www.nuget.org/packages/Nure.NET/) + +--- +### Installation: +You can install this library via Nuget Package Manager, or via .NET CLI: +```bash +dotnet add package Nure.NET +``` + +### Usage: +Get teachers list: +```csharp +using Nure.NET; +using Nure.NET.Types; + +class Program +{ + static void Main() + { + var teachers = Cist.GetTeachers(); + + foreach (var teacher in teachers) + { + Console.WriteLine(teacher.FullName); + } + } +} +``` +Get groups list: +```csharp +using Nure.NET; +using Nure.NET.Types; + +class Program +{ + static void Main() + { + var groups = Cist.GetGroups(); + + foreach (var group in groups) + { + Console.WriteLine(group.Name); + } + } +} +``` +Get auditories list: +```csharp +using Nure.NET; +using Nure.NET.Types; + +class Program +{ + static void Main() + { + var auditories = Cist.GetAuditories(); + + foreach (var auditory in auditories) + { + Console.WriteLine(auditory.Name); + } + } +} +``` +Get schedule for group or other entity: +```csharp +using Nure.NET; +using Nure.NET.Types; + +class Program +{ + static void Main() + { + /* Get schedule for group "КІУКІ-22-7", for other entities use EntityType enum + * EntityType.Group - for groups + * EntityType.Teacher - for teachers + * EntityType.Auditory - for auditories + Default, if you don't specify startTime and endTime, method will return + all avilable lessons for that group. + */ + var schedule = Cist.GetEvents(10304333, EntityType.Group); + + foreach (var lesson in schedule) + { + Console.WriteLine(lesson); + } + } +} +``` +Get schedule for group with specified time: +```csharp +using Nure.NET; +using Nure.NET.Types; + +class Program +{ + static void Main() + { + var events = Cist.GetEvents(EventType.Group, 10304333, 1693170000, 1694811599); + + foreach (var item in events) + { + Console.WriteLine(item.Subject.Title); + } + } +} +``` \ No newline at end of file