OSARS Client Library
A comprehensive Rust client library for interacting with the OpenScheduleAPI. This library provides type-safe access to college, campus, group, and schedule data from educational institutions through the OpenScheduleAPI backend.
Built for OpenScheduleAPI
GitHub: thisishyum/OpenScheduleApi
Features
- Full OpenScheduleAPI Coverage: Complete access to colleges, campuses, student groups, and schedules
- Type-Safe Queries: Builder pattern for constructing complex queries against OpenScheduleAPI
- Async/Await Ready: Built on tokio and reqwest for high-performance async operations
- Comprehensive Error Handling: Detailed error types for all OpenScheduleAPI failure scenarios
- Serde Support: Full serialization/deserialization support for all OpenScheduleAPI data models
- Flexible HTTP Client: Use default client or bring your own configured client
- Logging Support: Optional tracing-based logging via feature flag
Installation
Add this to your Cargo.toml:
[]
= "0.3.0"
For logging support, enable the feature:
[]
= { = "0.3.1", = ["logging"] }
Quick Start
use Client;
async
Core Concepts
Client
The main entry point that manages OpenScheduleAPI connections and provides query builders.
// Basic client for OpenScheduleAPI
let client = new;
// Client with custom HTTP configuration for OpenScheduleAPI
let http_client = builder
.timeout
.build?;
let client = with_client;
// Client with default college for OpenScheduleAPI queries
let client = client.with_college;
Query Builders
Chain methods to build complex queries against OpenScheduleAPI:
// College queries from OpenScheduleAPI
client.colleges.name.send.await?;
// Campus queries from OpenScheduleAPI
client.with_college.campuses?.name.send.await?;
// Group queries from OpenScheduleAPI
client.groups.name.send.await?;
// Schedule queries from OpenScheduleAPI
client.schedule
.today
.send.await?;
client.schedule
.week
.weekday
.send.await?;
client.schedule
.date // Format: dd-mm-yyyy
.send.await?;
OpenScheduleAPI Data Models
All models correspond directly to the OpenScheduleAPI response formats.
College
Represents an educational institution from OpenScheduleAPI.
Campus
A physical location of a college from OpenScheduleAPI.
Group
A student group that attends classes together from OpenScheduleAPI.
Schedule
Daily schedule for a student group from OpenScheduleAPI.
Lesson
Individual class session from OpenScheduleAPI.
Call
Lesson period time slots from OpenScheduleAPI.
Advanced Usage
Error Handling for OpenScheduleAPI
use ;
match client.colleges.send.await
Custom OpenScheduleAPI Endpoints
// For different OpenScheduleAPI instances
let tyumen_client = new;
let other_client = new;
Logging with OpenScheduleAPI
Enable the logging feature and initialize tracing in your application:
use EnvFilter;
async
Testing
The library includes comprehensive tests:
# Run unit tests
# Run integration tests with mock server
# Run all tests with logging
RUST_LOG=debug
API Reference
Client Methods
new(base_url)- Create client for OpenScheduleAPIwith_client(base_url, http_client)- Create client with custom HTTP clientwith_college(college_id)- Set default college for queriescolleges()- Query all colleges from OpenScheduleAPIcollege()- Query default collegecampuses()- Query campuses for default collegecampus(campus_id)- Query specific campusgroups(campus_id)- Query groups for campusschedule(group_id)- Query schedule for grouptoday(group_id)- Query today's scheduletomorrow(group_id)- Query tomorrow's scheduleauthenticated()- Create authenticated client for private endpoints
Query Parameters
name(pattern)- Filter by name patterndate("dd-mm-yyyy")- Specific date schedule (OpenScheduleAPI format)week(Week)- Week-based schedule (Previous/Current/Next)weekday(Weekday)- Specific weekday scheduletoday()- Today's scheduletomorrow()- Tomorrow's schedule
Contributing
This client library is designed to work with the OpenScheduleAPI project. For issues related to the API itself, please refer to the main repository: thisishyum/OpenScheduleApi
License
MIT License - see LICENSE for details.
Related Projects
- OpenScheduleAPI - The main API backend
- osatui - Terminal UI client using this library
Support
For issues with this client library, open an issue in this repository. For issues with the OpenScheduleAPI backend, please refer to the main OpenScheduleAPI repository.