From 0cca5034c648461868c2d8692261cf3ffac38a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 9 May 2024 20:48:50 +0200 Subject: [PATCH] Add missing eduOne endpoint mapping --- build.gradle | 2 +- .../wulkanowy/sdk/scrapper/ApiEndpoints.kt | 99 +++++++++++++++++++ .../io/github/wulkanowy/sdk/scrapper/Utils.kt | 9 +- .../scrapper/repository/RegisterRepository.kt | 6 +- .../repository/StudentPlusRepository.kt | 37 ++++--- .../sdk/scrapper/service/MessagesService.kt | 7 +- .../scrapper/service/StudentPlusService.kt | 88 +++++++++++------ 7 files changed, 193 insertions(+), 55 deletions(-) diff --git a/build.gradle b/build.gradle index aef7f28e..88a3ee3d 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ ext { moshi = "1.13.0" } -version = "2.6.1" +version = "2.6.2-SNAPSHOT" group = "io.github.wulkanowy" nexusPublishing { diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/ApiEndpoints.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/ApiEndpoints.kt index 183d523c..f9e0cc66 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/ApiEndpoints.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/ApiEndpoints.kt @@ -53,6 +53,29 @@ internal object ApiEndpoints : IApiEndpoints { override val ZebraniaObecnosc get() = endpoints.ZebraniaObecnosc override val ZgloszoneNieobecnosci get() = endpoints.ZgloszoneNieobecnosci + // uczenplus + override val PlusContext get() = endpoints.PlusContext + override val PlusAutoryzacjaPesel get() = endpoints.PlusAutoryzacjaPesel + override val PlusFrekwencja get() = endpoints.PlusFrekwencja + override val PlusUsprawiedliwienia get() = endpoints.PlusUsprawiedliwienia + override val PlusFrekwencjaStatystyki get() = endpoints.PlusFrekwencjaStatystyki + override val PlusZarejestrowaneUrzadzenia get() = endpoints.PlusZarejestrowaneUrzadzenia + override val PlusRejestracjaUrzadzeniaToken get() = endpoints.PlusRejestracjaUrzadzeniaToken + override val PlusZebrania get() = endpoints.PlusZebrania + override val PlusRealizacjaZajec get() = endpoints.PlusRealizacjaZajec + override val PlusSprawdzianyZadaniaDomowe get() = endpoints.PlusSprawdzianyZadaniaDomowe + override val PlusSprawdzianSzczegoly get() = endpoints.PlusSprawdzianSzczegoly + override val PlusZadanieDomoweSzczegoly get() = endpoints.PlusZadanieDomoweSzczegoly + override val PlusPlanZajec get() = endpoints.PlusPlanZajec + override val PlusDniWolne get() = endpoints.PlusDniWolne + override val PlusUwagi get() = endpoints.PlusUwagi + override val PlusNauczyciele get() = endpoints.PlusNauczyciele + override val PlusInformacje get() = endpoints.PlusInformacje + override val PlusDaneUcznia get() = endpoints.PlusDaneUcznia + override val PlusUczenZdjecie get() = endpoints.PlusUczenZdjecie + override val PlusOkresyKlasyfikacyjne get() = endpoints.PlusOkresyKlasyfikacyjne + override val PlusOceny get() = endpoints.PlusOceny + // wiadomosciplus override val Skrzynki get() = endpoints.Skrzynki override val Odebrane get() = endpoints.Odebrane @@ -62,7 +85,9 @@ internal object ApiEndpoints : IApiEndpoints { override val Usuniete get() = endpoints.Usuniete override val UsunieteSkrzynka get() = endpoints.UsunieteSkrzynka override val WiadomoscOdpowiedzPrzekaz get() = endpoints.WiadomoscOdpowiedzPrzekaz + override val WiadomoscNowa get() = endpoints.WiadomoscNowa override val MoveTrash get() = endpoints.MoveTrash + override val Delete get() = endpoints.Delete override val RestoreTrash get() = endpoints.RestoreTrash } @@ -110,6 +135,28 @@ internal interface IApiEndpoints { val ZebraniaObecnosc: String val ZgloszoneNieobecnosci: String + val PlusContext: String + val PlusAutoryzacjaPesel: String + val PlusFrekwencja: String + val PlusUsprawiedliwienia: String + val PlusFrekwencjaStatystyki: String + val PlusZarejestrowaneUrzadzenia: String + val PlusRejestracjaUrzadzeniaToken: String + val PlusZebrania: String + val PlusRealizacjaZajec: String + val PlusSprawdzianyZadaniaDomowe: String + val PlusSprawdzianSzczegoly: String + val PlusZadanieDomoweSzczegoly: String + val PlusPlanZajec: String + val PlusDniWolne: String + val PlusUwagi: String + val PlusNauczyciele: String + val PlusInformacje: String + val PlusDaneUcznia: String + val PlusUczenZdjecie: String + val PlusOkresyKlasyfikacyjne: String + val PlusOceny: String + // wiadomosciplus val Skrzynki: String val Odebrane: String @@ -119,7 +166,9 @@ internal interface IApiEndpoints { val Usuniete: String val UsunieteSkrzynka: String val WiadomoscOdpowiedzPrzekaz: String + val WiadomoscNowa: String val MoveTrash: String + val Delete: String val RestoreTrash: String } @@ -167,6 +216,29 @@ internal object ApiEndpoints_24_4_1_58566 : IApiEndpoints { override val ZebraniaObecnosc = "ZebraniaObecnosc" override val ZgloszoneNieobecnosci = "ZgloszoneNieobecnosci" + // uczenplus + override val PlusContext = "Context" + override val PlusAutoryzacjaPesel = "AutoryzacjaPesel" + override val PlusFrekwencja = "Frekwencja" + override val PlusUsprawiedliwienia = "PlusUsprawiedliwienia" + override val PlusFrekwencjaStatystyki = "PlusFrekwencjaStatystyki" + override val PlusZarejestrowaneUrzadzenia = "PlusZarejestrowaneUrzadzenia" + override val PlusRejestracjaUrzadzeniaToken = "PlusRejestracjaUrzadzeniaToken" + override val PlusZebrania = "PlusZebrania" + override val PlusRealizacjaZajec = "PlusRealizacjaZajec" + override val PlusSprawdzianyZadaniaDomowe = "PlusSprawdzianyZadaniaDomowe" + override val PlusSprawdzianSzczegoly = "PlusSprawdzianSzczegoly" + override val PlusZadanieDomoweSzczegoly = "PlusZadanieDomoweSzczegoly" + override val PlusPlanZajec = "PlusPlanZajec" + override val PlusDniWolne = "PlusDniWolne" + override val PlusUwagi = "PlusUwagi" + override val PlusNauczyciele = "PlusNauczyciele" + override val PlusInformacje = "PlusInformacje" + override val PlusDaneUcznia = "PlusDaneUcznia" + override val PlusUczenZdjecie = "PlusUczenZdjecie" + override val PlusOkresyKlasyfikacyjne = "OkresyKlasyfikacyjne" + override val PlusOceny = "Oceny" + // wiadomosciplus override val Skrzynki = "Skrzynki" override val Odebrane = "Odebrane" @@ -176,7 +248,9 @@ internal object ApiEndpoints_24_4_1_58566 : IApiEndpoints { override val Usuniete = "Usuniete" override val UsunieteSkrzynka = "UsunieteSkrzynka" override val WiadomoscOdpowiedzPrzekaz = "WiadomoscOdpowiedzPrzekaz" + override val WiadomoscNowa = "WiadomoscNowa" override val MoveTrash = "MoveTrash" + override val Delete = "Delete" override val RestoreTrash = "RestoreTrash" } @@ -224,6 +298,29 @@ internal object ApiEndpoints_24_4_2_58666 : IApiEndpoints { override val ZebraniaObecnosc = "6ef8e1de-1234-4f39-9cd4-f68dabb8a440" override val ZgloszoneNieobecnosci = "80fe9dc2-8c36-41ea-8009-82503ff3c810" + // uczenplus + override val PlusContext = "7fbcc3fc-1021-444e-86ec-506683e02337" + override val PlusAutoryzacjaPesel = "PlusAutoryzacjaPesel" + override val PlusFrekwencja = "c1fc4853-7216-4fd1-9957-4426278bb0bc" + override val PlusUsprawiedliwienia = "e3ae5a25-40ba-46f6-8e3f-fa325c68a300" + override val PlusFrekwencjaStatystyki = "85ec4b45-092b-49ff-a280-89c8439d2e09" + override val PlusZarejestrowaneUrzadzenia = "eca2a314-4aa1-4242-a032-82915863b00e" + override val PlusRejestracjaUrzadzeniaToken = "PlusRejestracjaUrzadzeniaToken" + override val PlusZebrania = "358477c6-2917-4a11-9208-8abdcde4d05c" + override val PlusRealizacjaZajec = "25c2155a-ee89-4f0b-b1e2-000f7eebbf06" + override val PlusSprawdzianyZadaniaDomowe = "65b13621-cafd-4e86-b7a2-093acc60f618" + override val PlusSprawdzianSzczegoly = "81ee73f9-9b4f-415f-aa6a-2cb7edaae3cd" + override val PlusZadanieDomoweSzczegoly = "fd6a4f90-5cb2-44f1-991b-fc4fbba8acbe" + override val PlusPlanZajec = "b08b6215-ebac-481d-81b9-14807a098731" + override val PlusDniWolne = "457deb32-212c-4564-8c2b-7941a1f091c9" + override val PlusUwagi = "f0dcdc6d-cccf-42b9-86e3-02e7e9c5bb8d" + override val PlusNauczyciele = "4e68fe23-18d2-42ef-94c4-27acbd4ab16c" + override val PlusInformacje = "dcae87e5-17a7-40d5-b362-f6caa9162715" + override val PlusDaneUcznia = "d7ff4abc-3a93-45d3-b28d-f4fb82fcd565" + override val PlusUczenZdjecie = "86e7b08f-de0c-4cc7-8042-e3a3796f7090" + override val PlusOkresyKlasyfikacyjne = "0669f1fd-e6f0-4007-ba4a-1d99c9107bb4" + override val PlusOceny = "587b18fa-0cdd-4db9-9bc8-e2d67094b385" + // wiadomosciplus override val Skrzynki = "787817a4-bfa8-472c-b1ce-bbe324b308cf" override val Odebrane = "fa8d0cb9-742e-4f9f-b3e2-65b7d5cd7aa6" @@ -233,6 +330,8 @@ internal object ApiEndpoints_24_4_2_58666 : IApiEndpoints { override val Usuniete = "94c2e642-b8e3-41f7-8428-27c3f213cb5d" override val UsunieteSkrzynka = "bae7f54c-f18e-4553-92d6-9a5f93392b39" override val WiadomoscOdpowiedzPrzekaz = "44444524-ba04-4259-8853-88343cf294be" + override val WiadomoscNowa = "4f02e91e-b9ad-4da1-b4d9-84f258ad1d12" override val MoveTrash = "b2131c71-8d76-4d93-9274-1d5b4f30c915" + override val Delete = "cd379bae-9700-48b4-a0d0-9eca08ee908f" override val RestoreTrash = "e6de58f9-4db1-4cd2-afdf-ac9fcca37e43" } diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/Utils.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/Utils.kt index ff47972b..26b22a80 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/Utils.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/Utils.kt @@ -19,6 +19,7 @@ import java.util.Date import kotlin.io.encoding.Base64 import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.math.roundToInt +import kotlin.random.Random private val logger = LoggerFactory.getLogger("Utils") @@ -165,10 +166,10 @@ internal fun getDecodedKey(key: String): StudentKey { } return StudentKey( - studentId = parts[0] ?: -1, - diaryId = parts[1] ?: -2, - unknown = parts[2] ?: -3, - unitId = parts[3] ?: -4, + studentId = parts.getOrNull(0) ?: Random.nextInt(), + diaryId = parts.getOrNull(1) ?: Random.nextInt(), + unknown = parts.getOrNull(2) ?: Random.nextInt(), + unitId = parts.getOrNull(3) ?: Random.nextInt(), ) } diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/RegisterRepository.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/RegisterRepository.kt index 5ac4224f..7c58b7df 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/RegisterRepository.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/RegisterRepository.kt @@ -324,13 +324,13 @@ internal class RegisterRepository( private suspend fun getEduOneDiaries(baseStudentPlus: String): List { return studentPlus - .getContext(url = baseStudentPlus + "api/Context").students + .getContextByUrl(url = baseStudentPlus + "api/${ApiEndpoints.PlusContext}").students .map { contextStudent -> val semesters = runCatching { when { contextStudent.isAuthorizationRequired -> emptyList() - else -> studentPlus.getSemesters( - url = baseStudentPlus + "api/OkresyKlasyfikacyjne", + else -> studentPlus.getSemestersByUrl( + url = baseStudentPlus + "api/${ApiEndpoints.PlusOkresyKlasyfikacyjne}", key = contextStudent.key, diaryId = contextStudent.registerId, ) diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/StudentPlusRepository.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/StudentPlusRepository.kt index 1377c107..1e27a2bf 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/StudentPlusRepository.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/StudentPlusRepository.kt @@ -63,7 +63,7 @@ internal class StudentPlusRepository( suspend fun authorizePermission(pesel: String, studentId: Int, diaryId: Int, unitId: Int): Boolean { runCatching { api.authorize( - AuthorizePermissionPlusRequest( + body = AuthorizePermissionPlusRequest( key = getEncodedKey(studentId, diaryId, unitId), pesel = pesel, ), @@ -119,8 +119,10 @@ internal class StudentPlusRepository( key.studentId == studentId } ?: throw NoSuchElementException() - return api.getSemesters(student.key, student.registerId) - .mapToSemester(student) + return api.getSemesters( + key = student.key, + diaryId = student.registerId, + ).mapToSemester(student) } suspend fun getAttendance(startDate: LocalDate, endDate: LocalDate?, studentId: Int, diaryId: Int, unitId: Int): List { @@ -142,7 +144,7 @@ internal class StudentPlusRepository( } suspend fun getAttendanceSummary(studentId: Int, diaryId: Int, unitId: Int): List { - val summaries = api.getAttendanceSummary(getEncodedKey(studentId, diaryId, unitId)) + val summaries = api.getAttendanceSummary(key = getEncodedKey(studentId, diaryId, unitId)) val stats = summaries.items.associate { it.id to it.months } val getMonthValue = fun(type: Int, month: Int): Int { @@ -221,13 +223,13 @@ internal class StudentPlusRepository( suspend fun getRegisteredDevices(studentId: Int, diaryId: Int, unitId: Int): List { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getRegisteredDevices(key) + return api.getRegisteredDevices(key = key) } suspend fun getToken(studentId: Int, diaryId: Int, unitId: Int): TokenResponse { val key = getEncodedKey(studentId, diaryId, unitId) - api.createDeviceRegistrationToken(mapOf("key" to key)) - val res = api.getDeviceRegistrationToken(key) + api.createDeviceRegistrationToken(body = mapOf("key" to key)) + val res = api.getDeviceRegistrationToken(key = key) return res.copy( qrCodeImage = Jsoup.parse(res.qrCodeImage) .select("img") @@ -238,7 +240,10 @@ internal class StudentPlusRepository( suspend fun getGrades(semesterId: Int, studentId: Int, diaryId: Int, unitId: Int): Grades { val key = getEncodedKey(studentId, diaryId, unitId) - val res = api.getGrades(key, semesterId) + val res = api.getGrades( + key = key, + semesterId = semesterId, + ) return Grades( details = res.mapGradesList(), @@ -260,7 +265,7 @@ internal class StudentPlusRepository( ) return examsHomeworkRes.filter { it.type != 4 }.map { exam -> - val examDetailsRes = api.getExamDetails(key, exam.id) + val examDetailsRes = api.getExamDetails(key = key, id = exam.id) Exam( entryDate = exam.date, subject = exam.subject, @@ -288,7 +293,7 @@ internal class StudentPlusRepository( ) return examsHomeworkRes.filter { it.type == 4 }.map { homework -> - val homeworkDetailsRes = api.getHomeworkDetails(key, homework.id) + val homeworkDetailsRes = api.getHomeworkDetails(key = key, id = homework.id) Homework( homeworkId = homework.id, subject = homework.subject, @@ -406,7 +411,7 @@ internal class StudentPlusRepository( suspend fun getNotes(studentId: Int, diaryId: Int, unitId: Int): List { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getNotes(key) + return api.getNotes(key = key) .map { it.copy( category = it.category.orEmpty(), @@ -420,12 +425,12 @@ internal class StudentPlusRepository( suspend fun getConferences(studentId: Int, diaryId: Int, unitId: Int): List { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getConferences(key) + return api.getConferences(key = key) } suspend fun getTeachers(studentId: Int, diaryId: Int, unitId: Int): List { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getTeachers(key).teachers.map { + return api.getTeachers(key = key).teachers.map { Teacher( name = "${it.firstName} ${it.lastName}".trim(), subject = it.subject, @@ -435,7 +440,7 @@ internal class StudentPlusRepository( suspend fun getSchool(studentId: Int, diaryId: Int, unitId: Int): School { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getSchool(key).let { + return api.getSchool(key = key).let { val streetNumber = it.buildingNumber + it.apartmentNumber.takeIf(String::isNotEmpty)?.let { "/$it" }.orEmpty() val name = buildString { append(it.name) @@ -461,7 +466,7 @@ internal class StudentPlusRepository( suspend fun getStudentInfo(studentId: Int, diaryId: Int, unitId: Int): StudentInfo { val key = getEncodedKey(studentId, diaryId, unitId) - val studentInfo = api.getStudentInfo(key) + val studentInfo = api.getStudentInfo(key = key) return studentInfo.copy( birthDate = studentInfo.birthDateEduOne?.atStartOfDay(), guardianFirst = studentInfo.guardianFirst?.let { @@ -474,6 +479,6 @@ internal class StudentPlusRepository( suspend fun getStudentPhoto(studentId: Int, diaryId: Int, unitId: Int): StudentPhoto { val key = getEncodedKey(studentId, diaryId, unitId) - return api.getStudentPhoto(key) ?: StudentPhoto(photoBase64 = null) + return api.getStudentPhoto(key = key) ?: StudentPhoto(photoBase64 = null) } } diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt index 3bca43d7..1b831395 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt @@ -94,8 +94,11 @@ internal interface MessagesService { @Query("apiGlobalKey") globalKey: String, ): MessageReplayDetails - @POST("api/WiadomoscNowa") - suspend fun sendMessage(@Body body: SendMessageRequest) + @POST("api/{path}") + suspend fun sendMessage( + @Path("path") path: String = ApiEndpoints.WiadomoscNowa, + @Body body: SendMessageRequest, + ) @POST("api/{path}") suspend fun moveMessageToTrash( diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/StudentPlusService.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/StudentPlusService.kt index 53d9ac24..dadd2d2e 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/StudentPlusService.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/StudentPlusService.kt @@ -1,5 +1,6 @@ package io.github.wulkanowy.sdk.scrapper.service +import io.github.wulkanowy.sdk.scrapper.ApiEndpoints import io.github.wulkanowy.sdk.scrapper.attendance.Attendance import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceExcusePlusRequest import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceExcusesPlusResponse @@ -26,6 +27,7 @@ import retrofit2.Response import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.POST +import retrofit2.http.Path import retrofit2.http.Query import retrofit2.http.Url @@ -34,10 +36,10 @@ internal interface StudentPlusService { // for register @GET - suspend fun getContext(@Url url: String): ContextResponse + suspend fun getContextByUrl(@Url url: String): ContextResponse @GET - suspend fun getSemesters( + suspend fun getSemestersByUrl( @Url url: String, @Query("key") key: String, @Query("idDziennik") diaryId: Int, @@ -45,128 +47,156 @@ internal interface StudentPlusService { // - @GET("api/Context") - suspend fun getContext(): ContextResponse + @GET("api/{path}") + suspend fun getContext(@Path("path") path: String = ApiEndpoints.PlusContext): ContextResponse - @GET("api/OkresyKlasyfikacyjne") + @GET("api/{path}") suspend fun getSemesters( + @Path("path") path: String = ApiEndpoints.PlusOkresyKlasyfikacyjne, @Query("key") key: String, @Query("idDziennik") diaryId: Int, ): List - @POST("api/AutoryzacjaPesel") - suspend fun authorize(@Body body: AuthorizePermissionPlusRequest): Response + @POST("api/{path}") + suspend fun authorize( + @Path("path") path: String = ApiEndpoints.PlusAutoryzacjaPesel, + @Body body: AuthorizePermissionPlusRequest, + ): Response - @GET("api/Frekwencja") + @GET("api/{path}") suspend fun getAttendance( + @Path("path") path: String = ApiEndpoints.PlusFrekwencja, @Query("key") key: String, @Query("dataOd") from: String, @Query("dataDo") to: String, ): List - @GET("api/Usprawiedliwienia") + @GET("api/{path}") suspend fun getExcuses( + @Path("path") path: String = ApiEndpoints.PlusUsprawiedliwienia, @Query("key") key: String, @Query("dataOd") from: String, @Query("dataDo") to: String, ): AttendanceExcusesPlusResponse - @POST("api/Usprawiedliwienia") - suspend fun excuseForAbsence(@Body body: AttendanceExcusePlusRequest): Response + @POST("api/{path}") + suspend fun excuseForAbsence( + @Path("path") path: String = ApiEndpoints.PlusUsprawiedliwienia, + @Body body: AttendanceExcusePlusRequest, + ): Response - @GET("api/FrekwencjaStatystyki") + @GET("api/{path}") suspend fun getAttendanceSummary( + @Path("path") path: String = ApiEndpoints.PlusFrekwencjaStatystyki, @Query("key") key: String, ): AttendanceSummaryResponse - @GET("api/ZarejestrowaneUrzadzenia") + @GET("api/{path}") suspend fun getRegisteredDevices( + @Path("path") path: String = ApiEndpoints.PlusZarejestrowaneUrzadzenia, @Query("key") key: String, ): List - @POST("api/RejestracjaUrzadzeniaToken") + @POST("api/{path}") suspend fun createDeviceRegistrationToken( + @Path("path") path: String = ApiEndpoints.PlusRejestracjaUrzadzeniaToken, @Body body: Map, ) - @GET("api/RejestracjaUrzadzeniaToken") + @GET("api/{path}") suspend fun getDeviceRegistrationToken( + @Path("path") path: String = ApiEndpoints.PlusRejestracjaUrzadzeniaToken, @Query("key") key: String, ): TokenResponse - @GET("api/Zebrania") + @GET("api/{path}") suspend fun getConferences( + @Path("path") path: String = ApiEndpoints.PlusZebrania, @Query("key") key: String, ): List - @GET("api/RealizacjaZajec") + @GET("api/{path}") suspend fun getCompletedLessons( + @Path("path") path: String = ApiEndpoints.PlusRealizacjaZajec, @Query("key") key: String, @Query("status") status: Int, @Query("dataOd") from: String, @Query("dataDo") to: String, ): List - @GET("api/Oceny") + @GET("api/{path}") suspend fun getGrades( + @Path("path") path: String = ApiEndpoints.PlusOceny, @Query("key") key: String, @Query("idOkresKlasyfikacyjny") semesterId: Int, ): GradesResponse - @GET("api/SprawdzianyZadaniaDomowe") + @GET("api/{path}") suspend fun getExamsAndHomework( + @Path("path") path: String = ApiEndpoints.PlusSprawdzianyZadaniaDomowe, @Query("key") key: String, @Query("dataOd") from: String, @Query("dataDo") to: String?, ): List - @GET("api/SprawdzianSzczegoly") + @GET("api/{path}") suspend fun getExamDetails( + @Path("path") path: String = ApiEndpoints.PlusSprawdzianSzczegoly, @Query("key") key: String, @Query("id") id: Int, ): ExamDetailsPlus - @GET("api/ZadanieDomoweSzczegoly") + @GET("api/{path}") suspend fun getHomeworkDetails( + @Path("path") path: String = ApiEndpoints.PlusZadanieDomoweSzczegoly, @Query("key") key: String, @Query("id") id: Int, ): HomeworkDetailsPlus - @GET("api/PlanZajec") + @GET("api/{path}") suspend fun getTimetable( + @Path("path") path: String = ApiEndpoints.PlusPlanZajec, @Query("key") key: String, @Query("dataOd") from: String, @Query("dataDo") to: String?, @Query("zakresDanych") data: Int = 2, ): List - @GET("api/DniWolne") + @GET("api/{path}") suspend fun getTimetableFreeDays( + @Path("path") path: String = ApiEndpoints.PlusDniWolne, @Query("key") key: String, @Query("dataOd") from: String, @Query("dataDo") to: String?, ): List - @GET("api/Uwagi") - suspend fun getNotes(@Query("key") key: String): List + @GET("api/{path}") + suspend fun getNotes( + @Path("path") path: String = ApiEndpoints.PlusUwagi, + @Query("key") key: String, + ): List - @GET("api/Nauczyciele") + @GET("api/{path}") suspend fun getTeachers( + @Path("path") path: String = ApiEndpoints.PlusNauczyciele, @Query("key") key: String, ): TeacherPlusResponse - @GET("api/Informacje") + @GET("api/{path}") suspend fun getSchool( + @Path("path") path: String = ApiEndpoints.PlusInformacje, @Query("key") key: String, ): SchoolPlus - @GET("api/DaneUcznia") + @GET("api/{path}") suspend fun getStudentInfo( + @Path("path") path: String = ApiEndpoints.PlusDaneUcznia, @Query("key") key: String, ): StudentInfo - @GET("api/UczenZdjecie") + @GET("api/{path}") suspend fun getStudentPhoto( + @Path("path") path: String = ApiEndpoints.PlusUczenZdjecie, @Query("key") key: String, ): StudentPhoto? }