Git Product home page Git Product logo

classcharts-api's Introduction

ClassCharts API


About The Project

ClassCharts is an online behavior and homework management system used by schools.

This java project is an unofficial ClassCharts API wrapper that can be used to:

  • Login and access ClassCharts
  • View homeworks as parsed objects
  • Mark homeworks as seen
  • Tick homeworks off as "completed"

How To Use

First, you should create a StudentCredentials object so that you can create a Student object and login to ClassCharts.

This can be achieved by first calling the static factory method ClassChartsDate#from(String) or ClassChartsDate#from(Date) to get a ClassChartsDate object then use that when calling the static factory method StudentCredential#from(String, ClassChartsDate).

//The date of birth should be in the format "dd/MM/yyyy"
ClassChartsDate date = ClassChartsDate.from("DATE_OF_BIRTH")
StudentCredentials studentCredentials = StudentCredentials.from("CODE", date);

Next, you can create a new Student object using the constructor Student(StudentCredentials).

When the Student object is created, the student is logged in automatically and data that will be necessary for other methods is retrieved from ClassCharts.

Student student = new Student(studentCredentials);

The Student instance can now be used to get the homework associated with that user.

Homework can be retrieved using the methods getHomework(), getHomework(ClassChartsDate, ClassChartsDate) and getHomework(DisplayDate, ClassChartsDate, ClassChartsDate) in the Student class. A student's timetable can also be accessed by the method getTimetable() which returns the current day's timetable lessons and the method getTimetable(ClassChartsDate) which returns the timetable lessons of the given date.

Examples of how to use these methods are demonstrated below:

//The dates be in the format "dd/MM/yyyy"
ClassChartsDate startDate = ClassChartsDate.from("01/01/2020");
ClassChartsDate endDate = ClassChartsDate.from("01/12/2020");

List<Homework> homework = student.getHomework();
List<Homework> homework2 = student.getHomework(startDate, endDate);
List<Homework> homework3 = student.getHomework(DisplayDate.DUE, startDate, endDate);
List<Homework> homework3 = student.getHomework(DisplayDate.ISSUE, startDate, endDate);

//Get today's lessons
List<TimetableLesson> lessons = student.getTimetable();
//Get tomorrow's lessons
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
List<TimetableLesson> lessonsTomorrow = student.getTimetable(calendar.getTime());

Using the list of homeworks retrieved, you can do many things such as the following example: (which prints out the title of every homework in the default timeframe which hasn't been done)

homework.stream().filter(hwk -> !(hwk.getStatus().isCompleted() || hwk.getStatus().isTicked())).map(Homework::getTitle).forEach(System.out::println);

Finally, the Student class contains methods to interact with homeworks.

You can tick a homework with the method Student#tickHomework(Homework). This method effectively toggles the tick status of the homework therefore if it is already ticked then it will un-tick and vice versa.

Homeworks can also be marked as seen which happens normally when you just click on a homework on the ClassCharts web app. This is done with the method Student#markHomeworkAsSeen(Homework).

When a student session expires, you should reauthenticate a student object using Student#reauthenticate().

classcharts-api's People

Contributors

ben-d-anderson avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.