Search in sources :

Example 1 with Users

use of org.stepik.api.objects.users.Users in project intellij-plugins by StepicOrg.

the class CourseNode method getAuthors.

@SuppressWarnings("unused")
@NotNull
public List<User> getAuthors(@NotNull StepikApiClient stepikApiClient) {
    if (authors == null) {
        List<Long> authorsIds;
        Course data = getData();
        authorsIds = data != null ? data.getAuthors() : Collections.emptyList();
        if (!authorsIds.isEmpty()) {
            try {
                if (!isAuthenticated()) {
                    return Collections.emptyList();
                }
                Users users = stepikApiClient.users().get().id(authorsIds).execute();
                authors = users.getUsers();
            } catch (StepikClientException e) {
                return Collections.emptyList();
            }
        }
    }
    return authors != null ? authors : Collections.emptyList();
}
Also used : Users(org.stepik.api.objects.users.Users) Course(org.stepik.api.objects.courses.Course) StepikClientException(org.stepik.api.exceptions.StepikClientException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)1 StepikClientException (org.stepik.api.exceptions.StepikClientException)1 Course (org.stepik.api.objects.courses.Course)1 Users (org.stepik.api.objects.users.Users)1