Skip to content

Repository files navigation

Nure.NET

Note

This library is unofficial and not supported by cist.nure.ua administration. It is developed and maintained by students and the Mindenit Team.

A .NET library for interacting with NURE's schedule (cist.nure.ua). The library provides a convenient API for accessing information about schedules, teachers, groups, and university auditoriums.

NugetLicense: GPL v3

📋 Table of Contents

📥 Installation

The library is available via NuGet. You can install it using one of the following methods:

Using .NET CLI:

dotnet add package Nure.NET

Using Package Manager Console:

Install-Package Nure.NET

🚀 Key Features

  • Retrieve list of all university groups
  • Retrieve list of teachers
  • Retrieve list of auditoriums
  • Get schedules for groups, teachers, and auditoriums
  • Support for schedule filtering by time period
  • Automatic CIST server availability detection
  • Handling of incorrect JSON responses from API

💻 Usage

Getting Groups List

usingNure.NET;usingNure.NET.Types;// Get all groupsList<Group>?groups=Cist.GetGroups();foreach(vargroupingroups){Console.WriteLine($"ID: {group.Id}, Name: {group.Name}");}// Get data in CIST formatstringcistJson=Cist.GetGroups(true);

Getting Teachers List

usingNure.NET;usingNure.NET.Types;// Get all teachersList<Teacher>?teachers=Cist.GetTeachers();foreach(varteacherinteachers){Console.WriteLine($"ID: {teacher.Id}");Console.WriteLine($"Full Name: {teacher.FullName}");Console.WriteLine($"Short Name: {teacher.ShortName}");}

Getting Auditoriums List

usingNure.NET;usingNure.NET.Types;// Get all auditoriumsList<Auditory>?auditories=Cist.GetAuditories();foreach(varauditoryinauditories){Console.WriteLine($"ID: {auditory.Id}, Name: {auditory.Name}");}

Working with Schedule

usingNure.NET;usingNure.NET.Types;// Get group scheduleList<Event>?groupSchedule=Cist.GetEvents(type:EventType.Group,id:10304333// Group ID);// Get schedule for specific periodList<Event>?periodSchedule=Cist.GetEvents(type:EventType.Group,id:10304333,startTime:1693170000,// Unix timestamp start periodendTime:1694811599// Unix timestamp end period);// Get teacher scheduleList<Event>?teacherSchedule=Cist.GetEvents(type:EventType.Teacher,id:teacherId);// Get auditory scheduleList<Event>?auditorySchedule=Cist.GetEvents(type:EventType.Auditory,id:auditoryId);// Processing the retrieved scheduleforeach(vareventingroupSchedule){Console.WriteLine($"Class #{event.NumberPair}");Console.WriteLine($"Subject: {event.Subject?.Title}");Console.WriteLine($"Type: {event.Type}");Console.WriteLine($"Auditory: {event.Auditory}");Console.WriteLine($"Start: {DateTimeOffset.FromUnixTimeSeconds((long)event.StartTime)}");Console.WriteLine($"End: {DateTimeOffset.FromUnixTimeSeconds((long)event.EndTime)}");// Teachersforeach(varteacherinevent.Teachers){Console.WriteLine($"Teacher: {teacher.FullName}");}// Groupsforeach(vargroupinevent.Groups){Console.WriteLine($"Group: {group.Name}");}}

📊 Data Types

Event

Represents one class in the schedule:

publicclassEvent{publicint?NumberPair{get;set;}// Class numberpublicSubject?Subject{get;set;}// Subjectpubliclong?StartTime{get;set;}// Start time (Unix timestamp)publiclong?EndTime{get;set;}// End time (Unix timestamp)publicstring?Auditory{get;set;}// Auditorypublicstring?Type{get;set;}// Class type (Lc, Pr, Lb, etc.)publicList<Teacher>?Teachers{get;set;}// List of teacherspublicList<Group>?Groups{get;set;}// List of groups}

Subject

Subject information:

publicclassSubject{publicint?Id{get;set;}// Subject IDpublicstring?Title{get;set;}// Full namepublicstring?Brief{get;set;}// Short name}

EventType

Entity types for schedule retrieval:

publicenumEventType{Group=1,// Group scheduleTeacher=2,// Teacher scheduleAuditory=3// Auditory schedule}

⚠️ Error Handling

The library uses exception mechanism for error handling. All methods can throw an Exception with detailed problem description. It's recommended to wrap method calls in try-catch blocks:

try{vargroups=Cist.GetGroups();// Process data}catch(Exceptione){Console.WriteLine($"Error while getting groups: {e.Message}");}

🔧 Additional Features

Getting Raw Data

All main methods have overloads that return data in CIST format:

// Get groups in CIST formatstringcistGroupsJson=Cist.GetGroups(true);// Get teachers in CIST formatstringcistTeachersJson=Cist.GetTeachers(true);// Get auditoriums in CIST formatstringcistAuditoriesJson=Cist.GetAuditories(true);

Automatic Server Detection

The library automatically checks the availability of CIST servers (cist.nure.ua and cist2.nure.ua) and uses the one that responds faster.

🤝 Contributing

We welcome contributions to the library! If you found a bug or have ideas for improvements, please:

  1. Fork the repository
  2. Create a branch for your changes
  3. Make the necessary changes
  4. Create a pull request with description of changes

📝 License

This project is distributed under the GNU GPL v3 license. See the LICENSE file for more details.

About

.NET library for work with cist.nure.ua

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages