Search in sources :

Example 1 with Courses

use of org.stepik.api.objects.courses.Courses in project intellij-plugins by StepicOrg.

the class CourseNode method loadData.

@Override
protected boolean loadData(@NotNull StepikApiClient stepikApiClient, long id) {
    try {
        Courses courses = stepikApiClient.courses().get().id(id).execute();
        Course data;
        if (!courses.isEmpty()) {
            data = courses.getFirst();
        } else {
            data = new Course();
            data.setId(id);
        }
        Course oldData = this.getData();
        setData(data);
        return oldData == null || !oldData.getUpdateDate().equals(data.getUpdateDate());
    } catch (StepikClientException logged) {
        logger.warn(String.format("Failed load course data id=%d", id), logged);
    }
    return true;
}
Also used : Courses(org.stepik.api.objects.courses.Courses) Course(org.stepik.api.objects.courses.Course) StepikClientException(org.stepik.api.exceptions.StepikClientException)

Aggregations

StepikClientException (org.stepik.api.exceptions.StepikClientException)1 Course (org.stepik.api.objects.courses.Course)1 Courses (org.stepik.api.objects.courses.Courses)1