Add binary compatibility valiator

This commit is contained in:
Mikołaj Pich 2023-04-15 23:38:35 +02:00
parent 07d68f5425
commit 8c1af1192d
102 changed files with 3204 additions and 190 deletions

View file

@ -30,6 +30,10 @@ jobs:
run: |
./gradlew test --stacktrace
./gradlew jacocoTestReport --stacktrace
- name: API changes check
run: |
./gradlew :sdk:apiCheck --stacktrace
./gradlew :sdk-scrapper:apiCheck --stacktrace
- uses: codecov/codecov-action@v1
lint:

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
alias(libs.plugins.validator)
}
dependencies {

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ApiResponse<out T>(
internal data class ApiResponse<out T>(
val success: Boolean,
val data: T?,
val feedback: Feedback? = null,
@ -12,7 +12,7 @@ data class ApiResponse<out T>(
)
@Serializable
data class Feedback(
internal data class Feedback(
@SerialName("Handled")
val handled: Boolean?,

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.scrapper
import okhttp3.OkHttpClient
class OkHttpClientBuilderFactory {
internal class OkHttpClientBuilderFactory {
private val okHttpClient by lazy { OkHttpClient() }

View file

@ -6,7 +6,7 @@ import kotlin.reflect.KProperty
/**
* see https://stackoverflow.com/a/35757638/6695449
*/
class ResettableLazyManager {
internal class ResettableLazyManager {
// we synchronize to make sure the timing of a reset() call and new inits do not collide
val managedDelegates = LinkedList<Resettable>()
@ -24,11 +24,11 @@ class ResettableLazyManager {
}
}
interface Resettable {
internal interface Resettable {
fun reset()
}
class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: () -> PROPTYPE) : Resettable {
internal class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: () -> PROPTYPE) : Resettable {
@Volatile
var lazyHolder = makeInitBlock()
@ -48,8 +48,8 @@ class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: ()
}
}
fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): ResettableLazy<PROPTYPE> {
internal fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): ResettableLazy<PROPTYPE> {
return ResettableLazy(manager, init)
}
fun resettableManager(): ResettableLazyManager = ResettableLazyManager()
internal fun resettableManager(): ResettableLazyManager = ResettableLazyManager()

View file

@ -6,7 +6,7 @@ import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
class TLSSocketFactory : SSLSocketFactory() {
internal class TLSSocketFactory : SSLSocketFactory() {
private val factory: SSLSocketFactory

View file

@ -6,36 +6,27 @@ import io.github.wulkanowy.sdk.scrapper.messages.RecipientType
import org.jsoup.Jsoup.parse
import java.text.Normalizer
import java.text.SimpleDateFormat
import java.time.DayOfWeek.MONDAY
import java.time.Instant.ofEpochMilli
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.ZoneId.systemDefault
import java.time.format.DateTimeFormatter.ofPattern
import java.time.temporal.TemporalAdjusters.previousOrSame
import java.util.Date
import kotlin.math.roundToInt
fun String.toDate(format: String): Date = SimpleDateFormat(format).parse(this)
internal fun String.toDate(format: String): Date = SimpleDateFormat(format).parse(this)
fun String.toLocalDate(format: String): LocalDate = LocalDate.parse(this, ofPattern(format))
internal fun String.toLocalDate(format: String): LocalDate = LocalDate.parse(this, ofPattern(format))
fun String.toLocalTime(): LocalTime = LocalTime.parse(this)
internal fun Date.toLocalDate(): LocalDate = ofEpochMilli(time).atZone(systemDefault()).toLocalDate()
fun Date.toLocalDate(): LocalDate = ofEpochMilli(time).atZone(systemDefault()).toLocalDate()
internal fun LocalDate.toFormat(format: String): String = format(ofPattern(format))
fun LocalDate.toDate(): Date = Date.from(atStartOfDay(systemDefault()).toInstant())
internal fun LocalDateTime.toFormat(format: String): String = format(ofPattern(format))
fun LocalDate.toFormat(format: String): String = format(ofPattern(format))
internal fun LocalDate.getSchoolYear(): Int = if (month.value > 8) year else year - 1
fun LocalDateTime.toFormat(format: String): String = format(ofPattern(format))
fun LocalDate.getLastMonday(): LocalDate = with(previousOrSame(MONDAY))
fun LocalDate.getSchoolYear(): Int = if (month.value > 8) year else year - 1
fun getGradeShortValue(value: String?): String {
internal fun getGradeShortValue(value: String?): String {
return when (value?.trim()) {
"celujący" -> "6"
"bardzo dobry" -> "5"
@ -47,25 +38,25 @@ fun getGradeShortValue(value: String?): String {
}
}
fun String.getEmptyIfDash(): String {
internal fun String.getEmptyIfDash(): String {
return if (this == "-") ""
else this
}
fun String.getGradePointPercent(): String {
internal fun String.getGradePointPercent(): String {
return split("/").let { (student, max) ->
if (max == "0") return this
"${(student.toDouble() / max.toDouble() * 100).roundToInt()}%"
}
}
fun getScriptParam(name: String, content: String, fallback: String = ""): String {
internal fun getScriptParam(name: String, content: String, fallback: String = ""): String {
return "$name: '(.)*'".toRegex().find(content).let { result ->
if (null !== result) parse(result.groupValues[0].substringAfter("'").substringBefore("'")).text() else fallback
}
}
fun String.getNormalizedSymbol(): String = this
internal fun String.getNormalizedSymbol(): String = this
.trim().lowercase()
.replace("default", "")
.run {
@ -77,9 +68,9 @@ fun String.getNormalizedSymbol(): String = this
.replace("[^a-z0-9]".toRegex(), "")
.ifBlank { "Default" }
fun List<Recipient>.normalizeRecipients() = map { it.parseName() }
internal fun List<Recipient>.normalizeRecipients() = map { it.parseName() }
fun Recipient.parseName(): Recipient {
internal fun Recipient.parseName(): Recipient {
val typeSeparatorPosition = fullName.indexOfAny(RecipientType.values().map { " - ${it.letter} - " })
if (typeSeparatorPosition == -1) return copy(userName = fullName)
@ -96,7 +87,7 @@ fun Recipient.parseName(): Recipient {
)
}
fun Mailbox.toRecipient() = Recipient(
internal fun Mailbox.toRecipient() = Recipient(
mailboxGlobalKey = globalKey,
type = type,
fullName = fullName,
@ -105,7 +96,7 @@ fun Mailbox.toRecipient() = Recipient(
schoolNameShort = schoolNameShort,
)
fun Recipient.toMailbox() = Mailbox(
internal fun Recipient.toMailbox() = Mailbox(
globalKey = mailboxGlobalKey,
userType = -1,
type = type,
@ -115,4 +106,4 @@ fun Recipient.toMailbox() = Mailbox(
schoolNameShort = schoolNameShort,
)
fun String.capitalise() = replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
internal fun String.capitalise() = replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }

View file

@ -10,7 +10,7 @@ import java.time.format.DateTimeFormatter
@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = LocalDateTime::class)
object CustomDateAdapter : KSerializer<LocalDateTime> {
internal object CustomDateAdapter : KSerializer<LocalDateTime> {
private const val DATE_FORMAT_1 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
private const val DATE_FORMAT_2 = "yyyy-MM-dd'T'HH:mm:ss.SSXXX"

View file

@ -10,7 +10,7 @@ import java.time.format.DateTimeFormatter
@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = LocalDate::class)
object GradeDateDeserializer : KSerializer<LocalDate> {
internal object GradeDateDeserializer : KSerializer<LocalDate> {
private const val SERVER_FORMAT = "dd.MM.yyyy"
private const val SERVER_FORMAT_2 = "dd.M.yyyy"

View file

@ -9,7 +9,7 @@ import kotlinx.serialization.encoding.Encoder
@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = Object::class)
object ObjectSerializer : KSerializer<Any> {
internal object ObjectSerializer : KSerializer<Any> {
override fun deserialize(decoder: Decoder): Any = Any()

View file

@ -33,5 +33,5 @@ data class Attendance(
var excusable: Boolean = false
@Transient
var excuseStatus: SentExcuse.Status? = null
var excuseStatus: SentExcuseStatus? = null
}

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class AttendanceExcuseRequest(
internal data class AttendanceExcuseRequest(
@SerialName("usprawiedliwienie")
val excuse: Excuse,

View file

@ -9,7 +9,7 @@ import kotlinx.serialization.json.Json
import java.time.LocalDate
import java.time.Month
fun AttendanceResponse.mapAttendanceList(start: LocalDate, end: LocalDate?, times: List<Time>): List<Attendance> {
internal fun AttendanceResponse.mapAttendanceList(start: LocalDate, end: LocalDate?, times: List<Time>): List<Attendance> {
val endDate = end ?: start.plusDays(4)
return lessons.map {
val sentExcuse = sentExcuses.firstOrNull { excuse -> excuse.date == it.date && excuse.timeId == it.timeId }
@ -17,14 +17,14 @@ fun AttendanceResponse.mapAttendanceList(start: LocalDate, end: LocalDate?, time
number = times.single { time -> time.id == it.timeId }.number
category = AttendanceCategory.getCategoryById(categoryId)
excusable = excuseActive && (category == ABSENCE_UNEXCUSED || category == UNEXCUSED_LATENESS) && sentExcuse == null
if (sentExcuse != null) excuseStatus = SentExcuse.Status.getByValue(sentExcuse.status)
if (sentExcuse != null) excuseStatus = SentExcuseStatus.getByValue(sentExcuse.status)
}
}.filter {
it.date.toLocalDate() >= start && it.date.toLocalDate() <= endDate
}.sortedWith(compareBy({ it.date }, { it.number }))
}
fun AttendanceSummaryResponse.mapAttendanceSummaryList(): List<AttendanceSummary> {
internal fun AttendanceSummaryResponse.mapAttendanceSummaryList(): List<AttendanceSummary> {
val jsonObject = Json {
isLenient = true
}

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class AttendanceRecordDay(
internal data class AttendanceRecordDay(
@SerialName("Data")
val date: String,

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
data class AttendanceRequest(
internal data class AttendanceRequest(
@SerialName("data")
@Serializable(with = CustomDateAdapter::class)
@ -17,7 +17,7 @@ data class AttendanceRequest(
)
@Serializable
data class AttendanceRecordsRequest(
internal data class AttendanceRecordsRequest(
@SerialName("miesiac")
val month: Int,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class AttendanceResponse(
internal data class AttendanceResponse(
@SerialName("UsprawiedliwieniaAktywne")
val excuseActive: Boolean,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class AttendanceSummaryRequest(
internal data class AttendanceSummaryRequest(
@SerialName("idPrzedmiot")
val id: Int?,
)

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
class AttendanceSummaryResponse {
internal class AttendanceSummaryResponse {
@SerialName("Statystyki")
var items: List<Summary> = emptyList()

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
class SentExcuse {
internal class SentExcuse {
@SerialName("Status")
var status: Int = 0
@ -17,15 +17,15 @@ class SentExcuse {
@SerialName("IdPoraLekcji")
var timeId: Int? = null
}
enum class Status(val id: Int) {
WAITING(0),
ACCEPTED(1),
DENIED(2),
;
enum class SentExcuseStatus(val id: Int) {
WAITING(0),
ACCEPTED(1),
DENIED(2),
;
companion object {
fun getByValue(value: Int) = values().firstOrNull { it.id == value }
}
companion object {
fun getByValue(value: Int) = values().firstOrNull { it.id == value }
}
}

View file

@ -5,7 +5,7 @@ import java.time.format.DateTimeFormatter
private val dateFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")
fun List<Conference>.mapConferences() = map {
internal fun List<Conference>.mapConferences(): List<Conference> = map {
val dateString = it.title.split(",")[1].trim().replace(" godzina", "")
it.copy(
title = it.title.substringAfter(", ").substringAfter(", "),

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
data class ExamRequest(
internal data class ExamRequest(
@SerialName("data")
@Serializable(with = CustomDateAdapter::class)

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
class ExamResponse {
internal class ExamResponse {
@SerialName("SprawdzianyGroupedByDayList")
var weeks: List<ExamDay> = emptyList()

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.scrapper.exams
import java.time.LocalDate
fun List<ExamResponse>.mapExamsList(startDate: LocalDate, endDate: LocalDate?): List<Exam> {
internal fun List<ExamResponse>.mapExamsList(startDate: LocalDate, endDate: LocalDate?): List<Exam> {
val end = endDate ?: startDate.plusDays(4)
return asSequence().map { weeks ->
weeks.weeks.map { day ->

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GradePointsSummaryResponse(
internal data class GradePointsSummaryResponse(
@SerialName("Items")
val items: List<GradePointsSummary>,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GradeRequest(
internal data class GradeRequest(
@SerialName("okres")
val semesterId: Int?,

View file

@ -8,7 +8,7 @@ private val pointGradeRegex = "\\d+\\.?\\d+/\\d+".toRegex()
private fun String.isEntryContainsCommentWithGrade() = isGradeValid(removeSurrounding("(", ")"))
fun GradesResponse.mapGradesList() = gradesWithSubjects.map { gradesSubject ->
internal fun GradesResponse.mapGradesList() = gradesWithSubjects.map { gradesSubject ->
gradesSubject.grades.map { grade ->
val (gradeValue, gradeModifier) = getGradeValueWithModifier(grade.entry)
val gradeEntryWithoutComment = grade.entry.substringBefore(" (")
@ -45,7 +45,7 @@ fun GradesResponse.mapGradesList() = gradesWithSubjects.map { gradesSubject ->
}
}.flatten().sortedByDescending { it.date }
fun GradesResponse.mapGradesSummary() = gradesWithSubjects.map { subject ->
internal fun GradesResponse.mapGradesSummary() = gradesWithSubjects.map { subject ->
GradeSummary(
visibleSubject = subject.visibleSubject,
order = subject.order,
@ -59,7 +59,7 @@ fun GradesResponse.mapGradesSummary() = gradesWithSubjects.map { subject ->
)
}.sortedBy { it.name }.toList()
fun List<GradesStatisticsSemester>.mapGradesStatisticsSemester() = map {
internal fun List<GradesStatisticsSemester>.mapGradesStatisticsSemester() = map {
it.copy(
items = it.items.orEmpty().reversed().mapIndexed { index, item ->
item.copy().apply {
@ -70,7 +70,7 @@ fun List<GradesStatisticsSemester>.mapGradesStatisticsSemester() = map {
)
}
fun List<GradesStatisticsPartial>.mapGradesStatisticsPartial() = map {
internal fun List<GradesStatisticsPartial>.mapGradesStatisticsPartial() = map {
it.copy(
classSeries = it.classSeries.addGradeValue(),
studentSeries = it.studentSeries.addGradeValue(),

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GradesResponse(
internal data class GradesResponse(
@SerialName("IsSrednia")
val isAverage: Boolean,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GradesStatisticsRequest(
internal data class GradesStatisticsRequest(
@SerialName("idOkres")
val semesterId: Int,

View file

@ -3,6 +3,16 @@ package io.github.wulkanowy.sdk.scrapper.home
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GovernmentUnit(
@SerialName("UnitName")
val unitName: String,
@SerialName("People")
val people: List<GovernmentMember>,
)
@Serializable
data class GovernmentMember(

View file

@ -1,14 +0,0 @@
package io.github.wulkanowy.sdk.scrapper.home
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GovernmentUnit(
@SerialName("UnitName")
val unitName: String,
@SerialName("People")
val people: List<GovernmentMember>,
)

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class HomepageTileResponse(
internal data class HomepageTileResponse(
@SerialName("IkonkaNazwa")
val iconName: String?,

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
data class HomeworkDay(
internal data class HomeworkDay(
@SerialName("Date")
@Serializable(with = CustomDateAdapter::class)

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.scrapper.homework
import org.jsoup.parser.Parser
import java.time.LocalDate
fun List<HomeworkDay>.mapHomework(startDate: LocalDate, endDate: LocalDate?): List<Homework> {
internal fun List<HomeworkDay>.mapHomework(startDate: LocalDate, endDate: LocalDate?): List<Homework> {
val end = endDate ?: startDate
return asSequence().map { day ->
day.items.map { homework ->

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
data class HomeworkRequest(
internal data class HomeworkRequest(
@SerialName("date")
@Serializable(with = CustomDateAdapter::class)

View file

@ -33,7 +33,7 @@ import java.net.HttpURLConnection
import java.util.concurrent.locks.Lock
import java.util.concurrent.locks.ReentrantLock
class AutoLoginInterceptor(
internal class AutoLoginInterceptor(
private val loginType: LoginType,
private val jar: CookieManager,
private val emptyCookieJarIntercept: Boolean,

View file

@ -7,7 +7,7 @@ import io.github.wulkanowy.sdk.scrapper.exception.InvalidPathException
import io.github.wulkanowy.sdk.scrapper.exception.VulcanException
import io.github.wulkanowy.sdk.scrapper.login.AccountPermissionException
fun <T> ApiResponse<T>.handleErrors(): ApiResponse<T> {
internal fun <T> ApiResponse<T>.handleErrors(): ApiResponse<T> {
return if (!success && feedback != null) throw feedback.run {
when {
message.contains("niespójność danych") -> ScrapperException(message)

View file

@ -17,7 +17,7 @@ import org.jsoup.nodes.Document
import org.slf4j.LoggerFactory
import java.net.CookieManager
class ErrorInterceptor(
internal class ErrorInterceptor(
private val cookies: CookieManager,
) : Interceptor {

View file

@ -7,7 +7,7 @@ import io.github.wulkanowy.sdk.scrapper.login.NotLoggedInException
import okhttp3.Interceptor
import okhttp3.Response
class HttpErrorInterceptor : Interceptor {
internal class HttpErrorInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val response = chain.proceed(chain.request())

View file

@ -6,7 +6,7 @@ import java.net.CookieManager
import java.net.HttpCookie
import java.net.URI
class StudentCookieInterceptor(
internal class StudentCookieInterceptor(
private val cookies: CookieManager,
private val schema: String,
private val host: String,

View file

@ -7,7 +7,7 @@ import okhttp3.Response
* @see <a href="https://github.com/jhy/jsoup/blob/220b77140bce70dcf9c767f8f04758b09097db14/src/main/java/org/jsoup/helper/HttpConnection.java#L59">JSoup default user agent</a>
* @see <a href="https://developer.chrome.com/multidevice/user-agent#chrome_for_android_user_agent">User Agent Strings - Google Chrome</a>
*/
class UserAgentInterceptor(
internal class UserAgentInterceptor(
private val androidVersion: String,
private val buildTag: String,
private val userAgentTemplate: String,

View file

@ -20,7 +20,7 @@ import java.time.LocalDateTime.now
import java.time.ZoneId
import java.time.format.DateTimeFormatter
class LoginHelper(
internal class LoginHelper(
var loginType: Scrapper.LoginType,
private val schema: String,
private val host: String,

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.scrapper.login
import java.net.URL
class UrlGenerator(
internal class UrlGenerator(
private val schema: String,
private val host: String,
var symbol: String,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class SendMessageRequest(
internal data class SendMessageRequest(
@SerialName("globalKey")
val globalKey: String,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class UnregisterDeviceRequest(
internal data class UnregisterDeviceRequest(
@SerialName("id")
val id: Int,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class NotesResponse(
internal data class NotesResponse(
@SerialName("Uwagi")
val notes: List<Note> = emptyList(),

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
data class Diary(
internal data class Diary(
@SerialName("Id")
val id: Int,

View file

@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory
private val logger = LoggerFactory.getLogger(RegisterRepository::class.java)
fun List<Diary>.toSemesters(studentId: Int, classId: Int, unitId: Int): List<Semester> = this
internal fun List<Diary>.toSemesters(studentId: Int, classId: Int, unitId: Int): List<Semester> = this
.filter { it.studentId == studentId }
.filter { (it.semesters?.firstOrNull()?.classId ?: 0) == classId }
.flatMap { diary ->

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.scrapper.register
import org.jsoup.nodes.Element
import pl.droidsonroids.jspoon.annotation.Selector
class HomePageResponse {
internal class HomePageResponse {
@Selector(".panel.linkownia.pracownik.klient a[href*=\"uonetplus-uczen\"]")
var studentSchools: List<Element> = emptyList()

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.scrapper.register
import org.jsoup.nodes.Element
import pl.droidsonroids.jspoon.annotation.Selector
class LoginForm {
internal class LoginForm {
@Selector("html")
lateinit var page: Element

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class Permissions(
internal data class Permissions(
@SerialName("AuthInfos")
val authInfos: List<AuthInfo>,
@ -14,7 +14,7 @@ data class Permissions(
)
@Serializable
data class AuthInfo(
internal data class AuthInfo(
@SerialName("JednostkaSprawozdawczaId")
val unitId: Int,
@ -41,7 +41,7 @@ data class AuthInfo(
)
@Serializable
data class PermissionUnit(
internal data class PermissionUnit(
@SerialName("Id")
val id: Int,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.scrapper.register
import org.jsoup.nodes.Element
import pl.droidsonroids.jspoon.annotation.Selector
class SentUnlockAccountResponse {
internal class SentUnlockAccountResponse {
@Selector("html")
lateinit var html: Element

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.scrapper.register
import pl.droidsonroids.jspoon.annotation.Selector
class UnlockAccountResponse {
internal class UnlockAccountResponse {
@Selector(".g-recaptcha", attr = "data-sitekey")
lateinit var recaptchaSiteKey: String

View file

@ -17,7 +17,7 @@ import io.github.wulkanowy.sdk.scrapper.login.UrlGenerator
import io.github.wulkanowy.sdk.scrapper.service.AccountService
import java.net.URL
class AccountRepository(private val account: AccountService) {
internal class AccountRepository(private val account: AccountService) {
companion object {
const val SELECTOR_STANDARD = ".loginButton, .LogOnBoard input[type=submit]" // remove second selector?

View file

@ -9,7 +9,7 @@ import io.github.wulkanowy.sdk.scrapper.service.HomepageService
import io.github.wulkanowy.sdk.scrapper.toDate
import io.github.wulkanowy.sdk.scrapper.toLocalDate
class HomepageRepository(private val api: HomepageService) {
internal class HomepageRepository(private val api: HomepageService) {
private lateinit var token: String

View file

@ -15,7 +15,7 @@ import io.github.wulkanowy.sdk.scrapper.toRecipient
import org.slf4j.LoggerFactory
import java.util.UUID
class MessagesRepository(private val api: MessagesService) {
internal class MessagesRepository(private val api: MessagesService) {
companion object {
@JvmStatic

View file

@ -37,7 +37,7 @@ import org.jsoup.select.Elements
import org.slf4j.LoggerFactory
import java.nio.charset.StandardCharsets
class RegisterRepository(
internal class RegisterRepository(
private val startSymbol: String,
private val email: String,
private val password: String,
@ -204,7 +204,7 @@ class RegisterRepository(
}
private suspend fun getCert(symbolLoginType: Scrapper.LoginType): CertificateResponse {
logger.debug("Register login type: $symbolLoginType")
logger.debug("Register login type: {}", symbolLoginType)
return loginHelper
.apply { loginType = symbolLoginType }
.sendCredentials(email, password)
@ -222,7 +222,7 @@ class RegisterRepository(
private fun Elements.toNormalizedSymbols(): List<String> = this
.map { it.text().trim() }
.apply { logger.debug("$this") }
.apply { logger.debug("{}", this) }
.filter { it.matches("[a-zA-Z0-9]*".toRegex()) } // early filter invalid symbols
.filter { it != "Default" }

View file

@ -55,7 +55,7 @@ import io.github.wulkanowy.sdk.scrapper.toFormat
import org.jsoup.Jsoup
import java.time.LocalDate
class StudentRepository(private val api: StudentService) {
internal class StudentRepository(private val api: StudentService) {
private fun LocalDate.toISOFormat(): String = toFormat("yyyy-MM-dd'T00:00:00'")

View file

@ -6,7 +6,7 @@ import io.github.wulkanowy.sdk.scrapper.register.toSemesters
import io.github.wulkanowy.sdk.scrapper.service.StudentService
import org.slf4j.LoggerFactory
class StudentStartRepository(
internal class StudentStartRepository(
private val studentId: Int,
private val classId: Int,
private val unitId: Int,

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
class SchoolAndTeachersResponse {
internal class SchoolAndTeachersResponse {
@SerialName("Nauczyciele")
var teachers: List<Teacher> = emptyList()

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.scrapper.school
import io.github.wulkanowy.sdk.scrapper.getEmptyIfDash
fun SchoolAndTeachersResponse.mapToSchool() = school.copy(
internal fun SchoolAndTeachersResponse.mapToSchool() = school.copy(
name = school.name.trim('-'),
address = school.address.trim('-'),
contact = school.contact.trim('-'),
@ -10,7 +10,7 @@ fun SchoolAndTeachersResponse.mapToSchool() = school.copy(
pedagogue = school.pedagogue.trim('-'),
)
fun SchoolAndTeachersResponse.mapToTeachers() = teachers.map { item ->
internal fun SchoolAndTeachersResponse.mapToTeachers() = teachers.map { item ->
item.name.split(",").map { namePart ->
item.copy(
name = namePart.substringBefore(" [").getEmptyIfDash().trim(),

View file

@ -10,7 +10,7 @@ import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Url
interface AccountService {
internal interface AccountService {
@GET
suspend fun getFormType(@Url url: String): LoginForm

View file

@ -8,7 +8,7 @@ import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
interface HomepageService {
internal interface HomepageService {
@GET("Start.mvc/Index")
suspend fun getStart(): String

View file

@ -10,7 +10,7 @@ import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Url
interface LoginService {
internal interface LoginService {
@POST("Account/LogOn")
@FormUrlEncoded

View file

@ -14,7 +14,7 @@ import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Query
interface MessagesService {
internal interface MessagesService {
@GET(".")
suspend fun getStart(): String

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.scrapper.register.LoginForm
import retrofit2.http.GET
import retrofit2.http.Url
interface RegisterService {
internal interface RegisterService {
@GET
suspend fun getFormType(@Url url: String): LoginForm

View file

@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit.SECONDS
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
class ServiceManager(
internal class ServiceManager(
private val okHttpClientBuilderFactory: OkHttpClientBuilderFactory,
logLevel: HttpLoggingInterceptor.Level,
private val loginType: Scrapper.LoginType,

View file

@ -39,7 +39,7 @@ import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Url
interface StudentService {
internal interface StudentService {
@GET
suspend fun getStart(@Url url: String): String

View file

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import java.time.LocalDateTime
@Serializable
class CacheResponse {
internal class CacheResponse {
@SerialName("isParentUser")
var isParent: Boolean = false

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
class CompletedLessonsRequest(
internal class CompletedLessonsRequest(
@SerialName("poczatek")
val startDate: String,

View file

@ -13,7 +13,7 @@ private val parser = TimetableParser()
private val formatter1 = DateTimeFormatter.ofPattern("dd.MM.yyyy")
private val formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
fun TimetableResponse.mapTimetableList(startDate: LocalDate, endDate: LocalDate?): List<Lesson> = rows.flatMap { lessons ->
internal fun TimetableResponse.mapTimetableList(startDate: LocalDate, endDate: LocalDate?): List<Lesson> = rows.flatMap { lessons ->
lessons.drop(1).mapIndexed { i, it ->
val times = lessons[0].split("<br />")
val header = headers.drop(1)[i].date.split("<br />")
@ -30,7 +30,7 @@ fun TimetableResponse.mapTimetableList(startDate: LocalDate, endDate: LocalDate?
it.date >= startDate && it.date <= (endDate ?: startDate.plusDays(4))
}.sortedWith(compareBy({ it.date }, { it.number })).toList()
fun TimetableResponse.mapTimetableHeaders() = headers.drop(1).map {
internal fun TimetableResponse.mapTimetableHeaders(): List<TimetableDayHeader> = headers.drop(1).map {
val header = it.date.split("<br />")
TimetableDayHeader(
date = header[1].toDate("dd.MM.yyyy").toLocalDate(),
@ -38,7 +38,7 @@ fun TimetableResponse.mapTimetableHeaders() = headers.drop(1).map {
)
}
fun TimetableResponse.mapTimetableAdditional() = additional.flatMap { day ->
internal fun TimetableResponse.mapTimetableAdditional(): List<LessonAdditional> = additional.flatMap { day ->
val date = LocalDate.parse(day.header.substringAfter(", "), formatter1)
day.descriptions.map { lesson ->
val description = Jsoup.parse(lesson.description).text()
@ -53,7 +53,7 @@ fun TimetableResponse.mapTimetableAdditional() = additional.flatMap { day ->
}
}
fun ApiResponse<Map<String, List<CompletedLesson>>>.mapCompletedLessonsList(start: LocalDate, endDate: LocalDate?): List<CompletedLesson> {
internal fun ApiResponse<Map<String, List<CompletedLesson>>>.mapCompletedLessonsList(start: LocalDate, endDate: LocalDate?): List<CompletedLesson> {
return data.orEmpty()
.flatMap { it.value }
.map {

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.scrapper.capitalise
import org.jsoup.nodes.Element
import org.jsoup.select.Elements
class TimetableParser {
internal class TimetableParser {
private companion object {
const val CLASS_PLANNED = "x-treelabel-ppl"

View file

@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class TimetableRequest(
internal data class TimetableRequest(
@SerialName("data")
val date: String,

View file

@ -7,7 +7,7 @@ import java.time.LocalDate
import java.time.LocalDateTime
@Serializable
data class TimetableResponse(
internal data class TimetableResponse(
@SerialName("Headers")
val headers: List<TimetableHeader> = emptyList(),
@ -20,14 +20,14 @@ data class TimetableResponse(
)
@Serializable
data class TimetableHeader(
internal data class TimetableHeader(
@SerialName("Text")
val date: String,
)
@Serializable
data class TimetableAdditionalDay(
internal data class TimetableAdditionalDay(
@SerialName("Header")
val header: String,
@ -37,13 +37,13 @@ data class TimetableAdditionalDay(
)
@Serializable
data class TimetableAdditionalLesson(
internal data class TimetableAdditionalLesson(
@SerialName("Description")
val description: String,
)
data class TimetableCell(
internal data class TimetableCell(
val number: Int = 0,
val start: LocalDateTime,
val end: LocalDateTime,

View file

@ -37,11 +37,16 @@ abstract class BaseLocalTest : BaseTest() {
server.shutdown()
}
fun getStudentRepo(testClass: Class<*>, fixture: String, loginType: Scrapper.LoginType = Scrapper.LoginType.STANDARD, autoLogin: Boolean = false): StudentRepository {
internal fun getStudentRepo(
testClass: Class<*>,
fixture: String,
loginType: Scrapper.LoginType = Scrapper.LoginType.STANDARD,
autoLogin: Boolean = false,
): StudentRepository {
return getStudentRepo(loginType, autoLogin) { it.enqueue(fixture, testClass) }
}
fun getStudentRepo(loginType: Scrapper.LoginType = Scrapper.LoginType.STANDARD, autoLogin: Boolean = false, responses: (MockWebServer) -> Unit): StudentRepository {
internal fun getStudentRepo(loginType: Scrapper.LoginType = Scrapper.LoginType.STANDARD, autoLogin: Boolean = false, responses: (MockWebServer) -> Unit): StudentRepository {
responses(server)
val okHttp = getOkHttp(errorInterceptor = true, autoLoginInterceptorOn = true, loginType = loginType, autoLogin = autoLogin)
return StudentRepository(getService(StudentService::class.java, server.url("/").toString(), false, okHttp))
@ -75,7 +80,7 @@ abstract class BaseLocalTest : BaseTest() {
.build()
.create(service)
fun getOkHttp(
internal fun getOkHttp(
errorInterceptor: Boolean = true,
autoLoginInterceptorOn: Boolean = true,
loginType: Scrapper.LoginType = Scrapper.LoginType.STANDARD,

View file

@ -37,7 +37,7 @@ class AttendanceTest : BaseLocalTest() {
assertEquals(getDate(2018, 10, 2), date)
assertEquals("Zajęcia artystyczne", subject)
assertEquals(AttendanceCategory.PRESENCE, category)
assertEquals(SentExcuse.Status.WAITING, excuseStatus)
assertEquals(SentExcuseStatus.WAITING, excuseStatus)
assertFalse(excusable)
}
}
@ -51,7 +51,7 @@ class AttendanceTest : BaseLocalTest() {
assertEquals(getDate(2018, 10, 2), date)
assertEquals("Informatyka", subject)
assertEquals(AttendanceCategory.ABSENCE_UNEXCUSED, category)
assertEquals(SentExcuse.Status.ACCEPTED, excuseStatus)
assertEquals(SentExcuseStatus.ACCEPTED, excuseStatus)
assertFalse(excusable)
}
}
@ -65,7 +65,7 @@ class AttendanceTest : BaseLocalTest() {
assertEquals(getDate(2018, 10, 3), date)
assertEquals("Matematyka", subject)
assertEquals(AttendanceCategory.ABSENCE_EXCUSED, category)
assertEquals(SentExcuse.Status.DENIED, excuseStatus)
assertEquals(SentExcuseStatus.DENIED, excuseStatus)
assertFalse(excusable)
}
}

View file

@ -19,9 +19,9 @@ import java.net.CookieManager
class AutoLoginInterceptorTest : BaseLocalTest() {
lateinit var loginService: LoginService
private lateinit var loginService: LoginService
lateinit var loginHelper: LoginHelper
private lateinit var loginHelper: LoginHelper
@Test
fun oneLoginAtTime() = runBlocking {

1165
sdk/api/sdk.api Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
alias(libs.plugins.validator)
}
dependencies {

View file

@ -14,7 +14,7 @@ import io.github.wulkanowy.sdk.scrapper.attendance.Absent as ScrapperAbsent
import io.github.wulkanowy.sdk.scrapper.attendance.Attendance as ScrapperAttendance
import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceSummary as ScrapperAttendanceSummary
fun List<ScrapperAttendance>.mapAttendance() = map {
internal fun List<ScrapperAttendance>.mapAttendance() = map {
Attendance(
number = it.number,
name = it.category.name,
@ -33,7 +33,7 @@ fun List<ScrapperAttendance>.mapAttendance() = map {
)
}
fun List<ScrapperAttendanceSummary>.mapAttendanceSummary() = map {
internal fun List<ScrapperAttendanceSummary>.mapAttendanceSummary() = map {
AttendanceSummary(
month = it.month,
presence = it.presence,
@ -46,7 +46,7 @@ fun List<ScrapperAttendanceSummary>.mapAttendanceSummary() = map {
)
}
fun List<Absent>.mapToScrapperAbsent() = map {
internal fun List<Absent>.mapToScrapperAbsent() = map {
ScrapperAbsent(
date = it.date,
timeId = it.timeId,

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.pojo.Conference
import java.time.ZoneId
import io.github.wulkanowy.sdk.scrapper.conferences.Conference as ScrapperConference
fun List<ScrapperConference>.mapConferences(zoneId: ZoneId) = map {
internal fun List<ScrapperConference>.mapConferences(zoneId: ZoneId) = map {
Conference(
title = it.title,
subject = it.subject,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.Exam
import io.github.wulkanowy.sdk.scrapper.exams.Exam as ScrapperExam
fun List<ScrapperExam>.mapExams() = map {
internal fun List<ScrapperExam>.mapExams() = map {
Exam(
date = it.date.toLocalDate(),
entryDate = it.entryDate.toLocalDate(),

View file

@ -5,14 +5,14 @@ import io.github.wulkanowy.sdk.pojo.GovernmentUnit
import io.github.wulkanowy.sdk.scrapper.home.GovernmentMember as ScrapperGovernmentMember
import io.github.wulkanowy.sdk.scrapper.home.GovernmentUnit as ScrapperGovernmentUnit
fun List<ScrapperGovernmentUnit>.mapToUnits() = map {
internal fun List<ScrapperGovernmentUnit>.mapToUnits() = map {
GovernmentUnit(
unitName = it.unitName,
people = it.people.mapToMembers(),
)
}
fun List<ScrapperGovernmentMember>.mapToMembers() = map {
internal fun List<ScrapperGovernmentMember>.mapToMembers() = map {
GovernmentMember(
name = it.name,
division = it.division,

View file

@ -7,7 +7,7 @@ import io.github.wulkanowy.sdk.scrapper.grades.Grade as ScrapperGrade
import io.github.wulkanowy.sdk.scrapper.grades.GradeSummary as ScrapperGradeSummary
import io.github.wulkanowy.sdk.scrapper.grades.Grades as ScrapperGrades
fun List<ScrapperGrade>.mapGradesDetails() = map {
internal fun List<ScrapperGrade>.mapGradesDetails() = map {
Grade(
subject = it.subject,
description = it.description.orEmpty(),
@ -24,7 +24,7 @@ fun List<ScrapperGrade>.mapGradesDetails() = map {
)
}
fun List<ScrapperGradeSummary>.mapGradesSummary() = map {
internal fun List<ScrapperGradeSummary>.mapGradesSummary() = map {
GradeSummary(
name = it.name,
finalPoints = it.finalPoints,
@ -36,7 +36,7 @@ fun List<ScrapperGradeSummary>.mapGradesSummary() = map {
)
}
fun ScrapperGrades.mapGrades() = Grades(
internal fun ScrapperGrades.mapGrades() = Grades(
details = details.mapGradesDetails(),
summary = summary.mapGradesSummary(),
isAverage = isAverage,

View file

@ -9,7 +9,7 @@ import io.github.wulkanowy.sdk.scrapper.grades.GradePointsSummary
import io.github.wulkanowy.sdk.scrapper.grades.GradesStatisticsPartial
import io.github.wulkanowy.sdk.scrapper.grades.GradesStatisticsSemester
fun List<GradesStatisticsSemester>.mapGradesSemesterStatistics() = map {
internal fun List<GradesStatisticsSemester>.mapGradesSemesterStatistics() = map {
GradeStatisticsSemester(
subject = it.subject,
items = it.items.orEmpty().map { item ->
@ -22,7 +22,7 @@ fun List<GradesStatisticsSemester>.mapGradesSemesterStatistics() = map {
)
}
fun List<GradesStatisticsPartial>.mapGradeStatistics() = map { partial ->
internal fun List<GradesStatisticsPartial>.mapGradeStatistics() = map { partial ->
GradeStatisticsSubject(
subject = partial.subject,
classAverage = partial.classSeries.average.takeIf { !partial.classSeries.isEmpty }.orEmpty(),
@ -44,7 +44,7 @@ fun List<GradesStatisticsPartial>.mapGradeStatistics() = map { partial ->
)
}
fun List<GradePointsSummary>.mapGradePointsStatistics() = map {
internal fun List<GradePointsSummary>.mapGradePointsStatistics() = map {
GradePointsStatistics(
subject = it.subject,
student = it.student,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.DirectorInformation
import io.github.wulkanowy.sdk.scrapper.home.DirectorInformation as ScrapperDirectorInformation
fun List<ScrapperDirectorInformation>.mapDirectorInformation() = map {
internal fun List<ScrapperDirectorInformation>.mapDirectorInformation() = map {
DirectorInformation(
date = it.date,
subject = it.subject,

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.pojo.Homework
import io.github.wulkanowy.sdk.pojo.HomeworkAttachment
import io.github.wulkanowy.sdk.scrapper.homework.Homework as ScrapperHomework
fun List<ScrapperHomework>.mapHomework() = map {
internal fun List<ScrapperHomework>.mapHomework() = map {
Homework(
date = it.date.toLocalDate(),
teacher = it.teacher,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.LuckyNumber
import io.github.wulkanowy.sdk.scrapper.home.LuckyNumber as ScrapperLuckyNumber
fun List<ScrapperLuckyNumber>.mapLuckyNumbers() = map {
internal fun List<ScrapperLuckyNumber>.mapLuckyNumbers() = map {
LuckyNumber(
unitName = it.unitName,
school = it.school,

View file

@ -5,7 +5,7 @@ import io.github.wulkanowy.sdk.pojo.MailboxType
import io.github.wulkanowy.sdk.pojo.Mailbox as SdkMailbox
import io.github.wulkanowy.sdk.scrapper.messages.Mailbox as ScrapperMailbox
fun List<ScrapperMailbox>.mapMailboxes(): List<Mailbox> {
internal fun List<ScrapperMailbox>.mapMailboxes(): List<Mailbox> {
return map {
SdkMailbox(
globalKey = it.globalKey,

View file

@ -10,7 +10,7 @@ import io.github.wulkanowy.sdk.scrapper.messages.MessageDetails as ScrapperDetai
import io.github.wulkanowy.sdk.scrapper.messages.MessageMeta as ScrapperMessageMeta
import io.github.wulkanowy.sdk.scrapper.messages.MessageReplayDetails as ScrapperReplayDetailsMessage
fun List<ScrapperMessageMeta>.mapMessages(zoneId: ZoneId, folderId: Folder) = map {
internal fun List<ScrapperMessageMeta>.mapMessages(zoneId: ZoneId, folderId: Folder) = map {
Message(
globalKey = it.apiGlobalKey,
id = it.id,
@ -28,7 +28,7 @@ fun List<ScrapperMessageMeta>.mapMessages(zoneId: ZoneId, folderId: Folder) = ma
)
}
fun ScrapperDetailsMessage.mapScrapperMessage() = MessageDetails(
internal fun ScrapperDetailsMessage.mapScrapperMessage() = MessageDetails(
content = content,
apiGlobalKey = apiGlobalKey,
date = date,
@ -44,7 +44,7 @@ fun ScrapperDetailsMessage.mapScrapperMessage() = MessageDetails(
},
)
fun ScrapperReplayDetailsMessage.mapScrapperMessage() = MessageReplayDetails(
internal fun ScrapperReplayDetailsMessage.mapScrapperMessage() = MessageReplayDetails(
content = content,
apiGlobalKey = apiGlobalKey,
date = date,

View file

@ -7,14 +7,14 @@ import java.time.LocalDateTime
import java.time.ZoneId
import io.github.wulkanowy.sdk.scrapper.mobile.Device as ScrapperDevice
fun TokenResponse.mapToken() = Token(
internal fun TokenResponse.mapToken() = Token(
token = token,
symbol = symbol,
pin = pin,
qrCodeImage = qrCodeImage,
)
fun List<ScrapperDevice>.mapDevices(zoneId: ZoneId) = map {
internal fun List<ScrapperDevice>.mapDevices(zoneId: ZoneId): List<Device> = map {
Device(
id = it.id,
deviceId = it.deviceId.orEmpty(),

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.pojo.Note
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory
import io.github.wulkanowy.sdk.scrapper.notes.Note as ScrapperNote
fun List<ScrapperNote>.mapNotes() = map {
internal fun List<ScrapperNote>.mapNotes() = map {
Note(
date = it.date.toLocalDate(),
teacher = it.teacher,

View file

@ -4,11 +4,11 @@ import io.github.wulkanowy.sdk.pojo.MailboxType
import io.github.wulkanowy.sdk.pojo.Recipient
import io.github.wulkanowy.sdk.scrapper.messages.Recipient as ScrapperRecipient
fun List<ScrapperRecipient>.mapRecipients() = map {
internal fun List<ScrapperRecipient>.mapRecipients() = map {
it.mapToRecipient()
}
fun ScrapperRecipient.mapToRecipient() = Recipient(
internal fun ScrapperRecipient.mapToRecipient() = Recipient(
mailboxGlobalKey = mailboxGlobalKey,
fullName = fullName,
userName = userName,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.School
import io.github.wulkanowy.sdk.scrapper.school.School as ScrapperSchool
fun ScrapperSchool.mapSchool() = School(
internal fun ScrapperSchool.mapSchool() = School(
name = name,
address = address,
contact = contact,

View file

@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.pojo.Semester
import io.github.wulkanowy.sdk.scrapper.register.Semester as ScrapperSemester
@JvmName("mapScrapperSemesters")
fun List<ScrapperSemester>.mapSemesters() = map {
internal fun List<ScrapperSemester>.mapSemesters() = map {
Semester(
diaryId = it.diaryId,
kindergartenDiaryId = it.kindergartenDiaryId,

View file

@ -8,7 +8,7 @@ import io.github.wulkanowy.sdk.scrapper.student.StudentGuardian as ScrapperStude
import io.github.wulkanowy.sdk.scrapper.student.StudentInfo as ScrapperStudentInfo
import io.github.wulkanowy.sdk.scrapper.student.StudentPhoto as ScrapperStudentPhoto
fun ScrapperStudentInfo.mapStudent() = StudentInfo(
internal fun ScrapperStudentInfo.mapStudent() = StudentInfo(
fullName = fullName,
address = address,
birthDate = birthDate.toLocalDate(),
@ -29,7 +29,7 @@ fun ScrapperStudentInfo.mapStudent() = StudentInfo(
guardianSecond = guardianSecond?.toFamilyMember(),
)
fun ScrapperStudentPhoto.mapPhoto() = StudentPhoto(photoBase64 = photoBase64.orEmpty())
internal fun ScrapperStudentPhoto.mapPhoto() = StudentPhoto(photoBase64 = photoBase64.orEmpty())
private fun ScrapperStudentGuardian.toFamilyMember() = StudentGuardian(
fullName = fullName,

View file

@ -13,7 +13,7 @@ import io.github.wulkanowy.sdk.scrapper.register.RegisterSymbol as SdkRegisterSy
import io.github.wulkanowy.sdk.scrapper.register.RegisterUnit as ScrapperRegisterUnit
import io.github.wulkanowy.sdk.scrapper.register.RegisterUser as ScrapperRegisterUser
fun ScrapperRegisterUser.mapUser(): RegisterUser = RegisterUser(
internal fun ScrapperRegisterUser.mapUser(): RegisterUser = RegisterUser(
email = email,
login = login,
baseUrl = baseUrl,
@ -21,14 +21,14 @@ fun ScrapperRegisterUser.mapUser(): RegisterUser = RegisterUser(
symbols = symbols.map { it.mapSymbol() },
)
fun SdkRegisterSymbol.mapSymbol(): RegisterSymbol = RegisterSymbol(
internal fun SdkRegisterSymbol.mapSymbol(): RegisterSymbol = RegisterSymbol(
symbol = symbol,
userName = userName,
error = error,
schools = schools.map { it.mapUnit() },
)
fun ScrapperRegisterUnit.mapUnit(): RegisterUnit = RegisterUnit(
internal fun ScrapperRegisterUnit.mapUnit(): RegisterUnit = RegisterUnit(
userLoginId = userLoginId,
schoolId = schoolId,
schoolName = schoolName,
@ -40,19 +40,19 @@ fun ScrapperRegisterUnit.mapUnit(): RegisterUnit = RegisterUnit(
subjects = subjects.map { it.mapSubject() },
)
fun ScrapperRegisterSubject.mapSubject(): RegisterSubject {
internal fun ScrapperRegisterSubject.mapSubject(): RegisterSubject {
return when (this) {
is ScrapperRegisterStudent -> mapStudent()
is ScrapperRegisterEmploye -> mapEmployee()
}
}
fun ScrapperRegisterEmploye.mapEmployee(): RegisterEmployee = RegisterEmployee(
internal fun ScrapperRegisterEmploye.mapEmployee(): RegisterEmployee = RegisterEmployee(
employeeId = employeeId,
employeeName = employeeName,
)
fun ScrapperRegisterStudent.mapStudent(): RegisterStudent = RegisterStudent(
internal fun ScrapperRegisterStudent.mapStudent(): RegisterStudent = RegisterStudent(
studentId = studentId,
studentName = studentName,
studentSecondName = studentSecondName,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.Subject
import io.github.wulkanowy.sdk.scrapper.attendance.Subject as ScrapperSubject
fun List<ScrapperSubject>.mapSubjects() = map {
internal fun List<ScrapperSubject>.mapSubjects(): List<Subject> = map {
Subject(
id = it.value,
name = it.name,

View file

@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.mapper
import io.github.wulkanowy.sdk.pojo.Teacher
import io.github.wulkanowy.sdk.scrapper.school.Teacher as ScrapperTeacher
fun List<ScrapperTeacher>.mapTeachers() = map {
internal fun List<ScrapperTeacher>.mapTeachers() = map {
Teacher(
name = it.name,
short = it.short,

View file

@ -12,13 +12,13 @@ import io.github.wulkanowy.sdk.scrapper.timetable.LessonAdditional as ScrapperTi
import io.github.wulkanowy.sdk.scrapper.timetable.Timetable as ScrapperTimetableFull
import io.github.wulkanowy.sdk.scrapper.timetable.TimetableDayHeader as ScrapperTimetableDayHeader
fun ScrapperTimetableFull.mapTimetableFull(zoneId: ZoneId) = Timetable(
internal fun ScrapperTimetableFull.mapTimetableFull(zoneId: ZoneId) = Timetable(
headers = headers.mapTimetableDayHeaders(),
lessons = lessons.mapTimetable(zoneId),
additional = additional.mapTimetableAdditional(zoneId),
)
fun List<ScrapperTimetable>.mapTimetable(zoneId: ZoneId) = map {
internal fun List<ScrapperTimetable>.mapTimetable(zoneId: ZoneId) = map {
Lesson(
canceled = it.canceled,
changes = it.changes,
@ -38,14 +38,14 @@ fun List<ScrapperTimetable>.mapTimetable(zoneId: ZoneId) = map {
)
}
fun List<ScrapperTimetableDayHeader>.mapTimetableDayHeaders() = map {
internal fun List<ScrapperTimetableDayHeader>.mapTimetableDayHeaders() = map {
TimetableDayHeader(
date = it.date,
content = it.content,
)
}
fun List<ScrapperTimetableAdditional>.mapTimetableAdditional(zoneId: ZoneId) = map {
internal fun List<ScrapperTimetableAdditional>.mapTimetableAdditional(zoneId: ZoneId) = map {
LessonAdditional(
subject = it.subject,
date = it.date,
@ -54,7 +54,7 @@ fun List<ScrapperTimetableAdditional>.mapTimetableAdditional(zoneId: ZoneId) = m
)
}
fun List<ScrapperCompletedLesson>.mapCompletedLessons() = map {
internal fun List<ScrapperCompletedLesson>.mapCompletedLessons() = map {
CompletedLesson(
date = it.date.toLocalDate(),
number = it.number,

Some files were not shown because too many files have changed in this diff Show more