Use interceptor-based url mapping for uonetplus-uczen
This commit is contained in:
parent
8ddca83b53
commit
35d0a5a327
4 changed files with 253 additions and 78 deletions
|
@ -6,7 +6,7 @@ internal object ApiEndpoints : IApiEndpoints {
|
|||
|
||||
private val endpoints
|
||||
get() = when (currentVersion) {
|
||||
58698 -> ApiEndpoints_24_04_0003_58698
|
||||
58698 -> ApiEndpoints_24_4_3_58698
|
||||
in 58666..58697 -> ApiEndpoints_24_4_2_58666
|
||||
else -> ApiEndpoints_24_4_1_58566
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ internal object ApiEndpoints_24_4_2_58666 : IApiEndpoints {
|
|||
override val RestoreTrash = "e6de58f9-4db1-4cd2-afdf-ac9fcca37e43"
|
||||
}
|
||||
|
||||
internal object ApiEndpoints_24_04_0003_58698 : IApiEndpoints {
|
||||
internal object ApiEndpoints_24_4_3_58698 : IApiEndpoints {
|
||||
override val Autoryzacja = "b82c987d-8e94-4ed3-b46e-2d1818f2e0f8"
|
||||
override val DostepOffice = "9d9b5874-68f4-4f1e-bef5-372f1cb11d29"
|
||||
override val EgzaminySemestralne = "99b62670-2adc-4c17-9abc-6e3d42eec773"
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package io.github.wulkanowy.sdk.scrapper
|
||||
|
||||
internal val ApiEndpointsMap = mapOf(
|
||||
"24.04.0002.58666" to mapOf(
|
||||
"uonetplus-uczen" to mapOf(
|
||||
"Autoryzacja" to "00b61915-f3ec-421d-b7af-07aa8c4c162f",
|
||||
"DostepOffice" to "efa4a7ac-27bf-49af-90ff-ae0852339dd3",
|
||||
"EgzaminySemestralne" to "32915d4e-e542-4756-8c4b-c600f674f488",
|
||||
"EgzaminyZewnetrzne" to "9b48403a-cc4f-46a5-a51b-f04fea8753ee",
|
||||
"EwidencjaObecnosci" to "4ae4c4f5-209e-40e0-80db-3d77c484d528",
|
||||
"FormularzeSzablony" to "e36648d3-83fa-491b-8e91-5bea927120f1",
|
||||
"FormularzeSzablonyDownload" to "e1a812dd-9399-4354-aa5e-77304e042602",
|
||||
"FormularzeWysylanie" to "aa2d4eca-517c-4b53-ac44-8d5ea315bb7f",
|
||||
"Frekwencja" to "cc65835b-721d-4f4b-a316-799aed29c56f",
|
||||
"FrekwencjaStatystyki" to "a3ebd829-ee89-41c5-81c3-35a812c98640",
|
||||
"FrekwencjaStatystykiPrzedmioty" to "4c4133e2-cac7-444e-ab26-83501e5ddce5",
|
||||
"Homework" to "1dfb0cc9-584c-46c9-8f8b-bad061f9ebee",
|
||||
"Jadlospis" to "0c746ff5-f4cb-4537-b269-e3a4ac215eea",
|
||||
"LekcjeZaplanowane" to "3e8440cc-c832-45d9-abb4-3046977adb14",
|
||||
"LekcjeZrealizowane" to "9155e959-b2e7-4e05-9f2b-4773916b6dc2",
|
||||
"Oceny" to "42fd0eae-afaa-4772-ab73-66cdc1577649",
|
||||
"Ogloszenia" to "7e92f621-b90d-462e-ba6c-8b0110eb6494",
|
||||
"Oplaty" to "590bff89-a3ed-4bae-b0df-a18bdb1614e3",
|
||||
"PlanZajec" to "f6495353-4047-4752-91b6-ca202990e9e0",
|
||||
"Platnosc" to "4ba184c1-4419-4423-8864-8a6d7d1261c3",
|
||||
"PlatnoscMetadata" to "65c91912-8925-4bf2-b150-504324d781b8",
|
||||
"PodrecznikiLataSzkolne" to "862000c9-06a1-4505-b730-7fc3ed194007",
|
||||
"PodrecznikiUcznia" to "f65af6b8-1d86-4a47-9324-2c941eeb0140",
|
||||
"Pomoc" to "3380c914-a20d-44cd-9480-b2a64a3b5cf7",
|
||||
"RejestracjaUrzadzeniaToken" to "f51b7f8e-27fc-4522-aa87-fa881ee3afb8",
|
||||
"RejestracjaUrzadzeniaTokenCertyfikat" to "9fd15a23-2ec0-48be-8596-c46b7c30daac",
|
||||
"RozpoczeciePlatnosci" to "cd025374-b202-4efe-996c-18e074083775",
|
||||
"ScalanieKont" to "e4ac68c9-cf32-4ff6-be19-677cb5e5c255",
|
||||
"Sprawdziany" to "9bf0410c-aae5-447c-947e-49c815edbcb3",
|
||||
"Statystyki" to "dfa2d512-6682-414b-908b-6e208dfa0c6e",
|
||||
"SzkolaINauczyciele" to "b59d07c6-1146-4a50-ba6b-763ee8b151a3",
|
||||
"Uczen" to "a465bde1-9509-4706-bad2-658578482e04",
|
||||
"UczenCache" to "f18ddca0-400e-47cc-89a1-4bbe6685810b",
|
||||
"UczenDziennik" to "bef3daf1-07cd-4de6-b059-ee5909a7beb9",
|
||||
"UczenZdjecie" to "c1ba3b01-d53c-4577-98ab-4f1a620a3a35",
|
||||
"Usprawiedliwienia" to "863af74c-79aa-48f4-a0e6-aad168720dfd",
|
||||
"UwagiIOsiagniecia" to "6d869250-f637-4da0-a44b-c981299a55ce",
|
||||
"ZarejestrowaneUrzadzenia" to "bc9c2af4-fb13-4f9b-86e4-59ee12bfff85",
|
||||
"Zebrania" to "13fc67ca-19fc-4128-b8f0-41eed7f29838",
|
||||
"ZebraniaObecnosc" to "6ef8e1de-1234-4f39-9cd4-f68dabb8a440",
|
||||
"ZgloszoneNieobecnosci" to "80fe9dc2-8c36-41ea-8009-82503ff3c810",
|
||||
),
|
||||
"uonetplus-uczenplus" to mapOf(
|
||||
"Context" to "7fbcc3fc-1021-444e-86ec-506683e02337",
|
||||
"AutoryzacjaPesel" to "AutoryzacjaPesel",
|
||||
"Frekwencja" to "c1fc4853-7216-4fd1-9957-4426278bb0bc",
|
||||
"Usprawiedliwienia" to "e3ae5a25-40ba-46f6-8e3f-fa325c68a300",
|
||||
"FrekwencjaStatystyki" to "85ec4b45-092b-49ff-a280-89c8439d2e09",
|
||||
"ZarejestrowaneUrzadzenia" to "eca2a314-4aa1-4242-a032-82915863b00e",
|
||||
"RejestracjaUrzadzeniaToken" to "RejestracjaUrzadzeniaToken",
|
||||
"Zebrania" to "358477c6-2917-4a11-9208-8abdcde4d05c",
|
||||
"RealizacjaZajec" to "25c2155a-ee89-4f0b-b1e2-000f7eebbf06",
|
||||
"SprawdzianyZadaniaDomowe" to "65b13621-cafd-4e86-b7a2-093acc60f618",
|
||||
"SprawdzianSzczegoly" to "81ee73f9-9b4f-415f-aa6a-2cb7edaae3cd",
|
||||
"ZadanieDomoweSzczegoly" to "fd6a4f90-5cb2-44f1-991b-fc4fbba8acbe",
|
||||
"PlanZajec" to "b08b6215-ebac-481d-81b9-14807a098731",
|
||||
"DniWolne" to "457deb32-212c-4564-8c2b-7941a1f091c9",
|
||||
"Uwagi" to "f0dcdc6d-cccf-42b9-86e3-02e7e9c5bb8d",
|
||||
"Nauczyciele" to "4e68fe23-18d2-42ef-94c4-27acbd4ab16c",
|
||||
"Informacje" to "dcae87e5-17a7-40d5-b362-f6caa9162715",
|
||||
"DaneUcznia" to "d7ff4abc-3a93-45d3-b28d-f4fb82fcd565",
|
||||
"UczenZdjecie" to "86e7b08f-de0c-4cc7-8042-e3a3796f7090",
|
||||
"OkresyKlasyfikacyjne" to "0669f1fd-e6f0-4007-ba4a-1d99c9107bb4",
|
||||
"Oceny" to "587b18fa-0cdd-4db9-9bc8-e2d67094b385",
|
||||
),
|
||||
"uonetplus-wiadomosciplus" to mapOf(
|
||||
"Skrzynki" to "787817a4-bfa8-472c-b1ce-bbe324b308cf",
|
||||
"Odebrane" to "fa8d0cb9-742e-4f9f-b3e2-65b7d5cd7aa6",
|
||||
"OdebraneSkrzynka" to "9545648d-6534-4282-acb7-6e9cc52ab402",
|
||||
"Wyslane" to "962f3256-b82a-42bd-8f20-f03d79723516",
|
||||
"WyslaneSkrzynka" to "a046f45d-42ae-4072-9684-e957a797a22b",
|
||||
"Usuniete" to "94c2e642-b8e3-41f7-8428-27c3f213cb5d",
|
||||
"UsunieteSkrzynka" to "bae7f54c-f18e-4553-92d6-9a5f93392b39",
|
||||
"WiadomoscOdpowiedzPrzekaz" to "44444524-ba04-4259-8853-88343cf294be",
|
||||
"WiadomoscNowa" to "4f02e91e-b9ad-4da1-b4d9-84f258ad1d12",
|
||||
"MoveTrash" to "b2131c71-8d76-4d93-9274-1d5b4f30c915",
|
||||
"Delete" to "cd379bae-9700-48b4-a0d0-9eca08ee908f",
|
||||
"RestoreTrash" to "e6de58f9-4db1-4cd2-afdf-ac9fcca37e43",
|
||||
),
|
||||
),
|
||||
"24.04.0003.58698" to mapOf(
|
||||
"uonetplus-uczen" to mapOf(
|
||||
"Autoryzacja" to "b82c987d-8e94-4ed3-b46e-2d1818f2e0f8",
|
||||
"DostepOffice" to "9d9b5874-68f4-4f1e-bef5-372f1cb11d29",
|
||||
"EgzaminySemestralne" to "99b62670-2adc-4c17-9abc-6e3d42eec773",
|
||||
"EgzaminyZewnetrzne" to "4db8f093-352a-4a00-a299-0e9b819c8c58",
|
||||
"EwidencjaObecnosci" to "02429d97-5877-42ae-a44e-5dd7531e20b4",
|
||||
"FormularzeSzablony" to "e02fac63-909e-450c-a4ab-75bfd4865189",
|
||||
"FormularzeSzablonyDownload" to "FormularzeSzablonyDownload",
|
||||
"FormularzeWysylanie" to "b97e880e-ae8d-44b6-a48d-92c9be7d22f5",
|
||||
"Frekwencja" to "80dc9527-386d-4da5-b688-3c3a9c4c49a9",
|
||||
"FrekwencjaStatystyki" to "a6d0fa58-5613-45e4-8f37-e2e5cba26dd3",
|
||||
"FrekwencjaStatystykiPrzedmioty" to "baa947c6-915b-4498-afdb-11ec6b088d36",
|
||||
"Homework" to "302944cd-7f41-4de8-8c9f-02dd00990f62",
|
||||
"Jadlospis" to "738a6eff-3bb3-4ff7-9443-70e6e96b61ab",
|
||||
"LekcjeZaplanowane" to "59874a90-98f2-4aa2-a857-f029b88a667c",
|
||||
"LekcjeZrealizowane" to "23f18c73-b0eb-4a1a-b9d3-67b9f3513a12",
|
||||
"Oceny" to "1e1ecd09-aa17-46ac-8cf4-90b1bf0c837d",
|
||||
"Ogloszenia" to "ba99b004-dca2-41b4-af6b-13969546ce65",
|
||||
"Oplaty" to "d58b34e4-0220-4363-b08f-fa307230898d",
|
||||
"PlanZajec" to "e59d0f63-92e1-47d9-a8e1-293eed48e4b4",
|
||||
"Platnosc" to "2b5d4da7-8b0f-45e0-923d-0b20d327800a",
|
||||
"PlatnoscMetadata" to "ca5a0fa1-78f1-4fad-b7ac-59fbdf6bdaf4",
|
||||
"PodrecznikiLataSzkolne" to "0c3f9d64-9561-42ab-825e-e73b4097c2d0",
|
||||
"PodrecznikiUcznia" to "2e7a1def-cdc3-4944-862c-5e94207ae891",
|
||||
"Pomoc" to "0cde801a-9290-4780-9099-96f7a130308e",
|
||||
"RejestracjaUrzadzeniaToken" to "17786f90-2725-477f-98ac-f0e1bff11d7d",
|
||||
"RejestracjaUrzadzeniaTokenCertyfikat" to "de16ca24-4638-4b11-8b2d-6ed09ec82b8a",
|
||||
"RozpoczeciePlatnosci" to "90273adc-6308-47b1-be2b-b8d2297a1530",
|
||||
"ScalanieKont" to "95661b3e-b9ac-416c-bf35-f195994f8af5",
|
||||
"Sprawdziany" to "d6404626-e7e4-4093-8477-4eb964da19db",
|
||||
"Statystyki" to "f8308032-0674-4bf7-a7d5-2642d064ef24",
|
||||
"SzkolaINauczyciele" to "a5ec0ae3-f7eb-4548-a484-f725e0164634",
|
||||
"Uczen" to "f8aa0d01-bd77-44d5-aa23-2606afbc27f5",
|
||||
"UczenCache" to "21a5186d-2aab-4123-bad7-269aa7173bb2",
|
||||
"UczenDziennik" to "a01ea13f-14f0-4c56-8b91-790e5aeecdf1",
|
||||
"UczenZdjecie" to "b4a0f9aa-2a45-4e3d-bd9a-f1513e949f83",
|
||||
"Usprawiedliwienia" to "81db3fa0-fb76-401a-ae9e-0fdffc86d2ff",
|
||||
"UwagiIOsiagniecia" to "f63b7ca7-cfe2-4b0b-80cf-1ef1baed597d",
|
||||
"ZarejestrowaneUrzadzenia" to "5a98cd83-f542-4bd2-a1eb-c53d75360aa7",
|
||||
"Zebrania" to "fb20a581-5ad7-49ab-b640-ccdd3f74b0ea",
|
||||
"ZebraniaObecnosc" to "a057e980-c662-4573-b485-01072dab2c14",
|
||||
"ZgloszoneNieobecnosci" to "5c63a985-2149-4e7b-a30f-3692b16b69e3",
|
||||
),
|
||||
"uonetplus-uczenplus" to mapOf(
|
||||
"Context" to "Context",
|
||||
"AutoryzacjaPesel" to "AutoryzacjaPesel",
|
||||
"Frekwencja" to "Frekwencja",
|
||||
"Usprawiedliwienia" to "Usprawiedliwienia",
|
||||
"FrekwencjaStatystyki" to "FrekwencjaStatystyki",
|
||||
"ZarejestrowaneUrzadzenia" to "ZarejestrowaneUrzadzenia",
|
||||
"RejestracjaUrzadzeniaToken" to "RejestracjaUrzadzeniaToken",
|
||||
"Zebrania" to "Zebrania",
|
||||
"RealizacjaZajec" to "RealizacjaZajec",
|
||||
"SprawdzianyZadaniaDomowe" to "SprawdzianyZadaniaDomowe",
|
||||
"SprawdzianSzczegoly" to "SprawdzianSzczegoly",
|
||||
"ZadanieDomoweSzczegoly" to "ZadanieDomoweSzczegoly",
|
||||
"PlanZajec" to "PlanZajec",
|
||||
"DniWolne" to "DniWolne",
|
||||
"Uwagi" to "Uwagi",
|
||||
"Nauczyciele" to "Nauczyciele",
|
||||
"Informacje" to "Informacje",
|
||||
"DaneUcznia" to "DaneUcznia",
|
||||
"UczenZdjecie" to "UczenZdjecie",
|
||||
"OkresyKlasyfikacyjne" to "OkresyKlasyfikacyjne",
|
||||
"Oceny" to "Oceny",
|
||||
),
|
||||
"uonetplus-wiadomosciplus" to mapOf(
|
||||
"Skrzynki" to "a04c1b46-48f5-4856-9eae-1efe9fface1a",
|
||||
"Odebrane" to "be2f38a5-f090-4d38-b78a-1e776d304b20",
|
||||
"OdebraneSkrzynka" to "4e096df8-70e9-4a7c-b72d-486d6d05d87d",
|
||||
"Wyslane" to "dee02521-890a-4701-9699-de9b1080f30a",
|
||||
"WyslaneSkrzynka" to "1aab4b35-fdeb-422d-9e62-b8337c2f1a31",
|
||||
"Usuniete" to "9a1d2b04-763e-4e5a-8835-e356f52ed9b4",
|
||||
"UsunieteSkrzynka" to "a3e8cd92-f3bd-4bf3-9a1b-63f20b475982",
|
||||
"WiadomoscOdpowiedzPrzekaz" to "WiadomoscOdpowiedzPrzekaz",
|
||||
"WiadomoscNowa" to "03051ddd-22dd-45a6-a214-211c8dab0f7d",
|
||||
"MoveTrash" to "724f1218-447a-4110-a9ce-8c9bc52547f5",
|
||||
"Delete" to "Delete",
|
||||
"RestoreTrash" to "caf5eacb-a2ab-44d7-82c1-bcbd0b7612ed",
|
||||
),
|
||||
),
|
||||
)
|
|
@ -1,6 +1,7 @@
|
|||
package io.github.wulkanowy.sdk.scrapper.interceptor
|
||||
|
||||
import io.github.wulkanowy.sdk.scrapper.ApiEndpoints
|
||||
import io.github.wulkanowy.sdk.scrapper.ApiEndpointsMap
|
||||
import io.github.wulkanowy.sdk.scrapper.ApiResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.CookieJarCabinet
|
||||
import io.github.wulkanowy.sdk.scrapper.Scrapper.LoginType
|
||||
|
@ -43,6 +44,10 @@ import java.util.concurrent.locks.ReentrantLock
|
|||
|
||||
private val lock = ReentrantLock(true)
|
||||
|
||||
private const val MessagesModuleHost = "uonetplus-wiadomosciplus"
|
||||
private const val StudentPlusModuleHost = "uonetplus-uczenplus"
|
||||
private const val StudentModuleHost = "uonetplus-uczen"
|
||||
|
||||
private var studentModuleHeaders: ModuleHeaders? = null
|
||||
private var studentPlusModuleHeaders: ModuleHeaders? = null
|
||||
private var messagesModuleHeaders: ModuleHeaders? = null
|
||||
|
@ -100,17 +105,17 @@ internal class AutoLoginInterceptor(
|
|||
}
|
||||
|
||||
when {
|
||||
"wiadomosciplus" in uri.host -> messages.getOrThrow()
|
||||
"uczenplus" in uri.host -> student.getOrThrow()
|
||||
"uczen" in uri.host -> student.getOrThrow()
|
||||
MessagesModuleHost in uri.host -> messages.getOrThrow()
|
||||
StudentPlusModuleHost in uri.host -> student.getOrThrow()
|
||||
StudentModuleHost in uri.host -> student.getOrThrow()
|
||||
else -> logger.info("Resource don't need further login anyway")
|
||||
}
|
||||
chain.proceed(chain.request().attachModuleHeaders())
|
||||
} catch (e: IOException) {
|
||||
logger.debug("Error occurred on login")
|
||||
logger.debug("IO Error occurred on login")
|
||||
throw e
|
||||
} catch (e: HttpException) {
|
||||
logger.debug("Error occurred on login")
|
||||
logger.debug("HTTP Error occurred on login")
|
||||
e.toOkHttpResponse(chain.request())
|
||||
} catch (e: Throwable) {
|
||||
throw IOException("Unknown exception on login", e)
|
||||
|
@ -163,7 +168,7 @@ internal class AutoLoginInterceptor(
|
|||
}
|
||||
|
||||
when {
|
||||
"uonetplus-wiadomosciplus" in url.host -> {
|
||||
MessagesModuleHost in url.host -> {
|
||||
messagesModuleHeaders = moduleHeaders
|
||||
|
||||
with(VTokenMapping) {
|
||||
|
@ -172,20 +177,34 @@ internal class AutoLoginInterceptor(
|
|||
appVersion = moduleHeaders.appVersion
|
||||
}
|
||||
}
|
||||
"uonetplus-uczenplus" in url.host -> studentPlusModuleHeaders = moduleHeaders
|
||||
"uonetplus-uczen" in url.host -> studentModuleHeaders = moduleHeaders
|
||||
|
||||
StudentPlusModuleHost in url.host -> studentPlusModuleHeaders = moduleHeaders
|
||||
StudentModuleHost in url.host -> studentModuleHeaders = moduleHeaders
|
||||
}
|
||||
}
|
||||
|
||||
private fun Request.attachModuleHeaders(): Request {
|
||||
val headers = when {
|
||||
"uonetplus-wiadomosciplus" in url.host -> messagesModuleHeaders
|
||||
"uonetplus-uczenplus" in url.host -> studentPlusModuleHeaders
|
||||
"uonetplus-uczen" in url.host -> studentModuleHeaders
|
||||
MessagesModuleHost in url.host -> messagesModuleHeaders
|
||||
StudentPlusModuleHost in url.host -> studentPlusModuleHeaders
|
||||
StudentModuleHost in url.host -> studentModuleHeaders
|
||||
else -> return this
|
||||
}
|
||||
logger.info("X-V-AppVersion: ${headers?.appVersion}")
|
||||
|
||||
val mappedUrl = url.newBuilder()
|
||||
.let {
|
||||
when {
|
||||
MessagesModuleHost in url.host -> it.mapMessagesModuleUrls()
|
||||
StudentPlusModuleHost in url.host -> it.mapStudentPlusModuleUrls()
|
||||
StudentModuleHost in url.host -> it.mapStudentModuleUrls(url, headers)
|
||||
else -> it
|
||||
}
|
||||
}
|
||||
.build()
|
||||
|
||||
return newBuilder()
|
||||
.url(mappedUrl)
|
||||
.apply {
|
||||
headers?.let {
|
||||
addHeader("X-V-RequestVerificationToken", it.token)
|
||||
|
@ -244,9 +263,30 @@ internal class AutoLoginInterceptor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun HttpUrl.Builder.mapStudentModuleUrls(url: HttpUrl, headers: ModuleHeaders?): HttpUrl.Builder {
|
||||
val pathKey = url.pathSegments.getOrNull(2)?.substringBefore(".mvc")
|
||||
val mappedPath = ApiEndpointsMap[headers?.appVersion]
|
||||
?.get(StudentModuleHost)
|
||||
?.get(pathKey)
|
||||
|
||||
if (mappedPath != null) {
|
||||
setPathSegment(2, "$mappedPath.mvc")
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
private fun HttpUrl.Builder.mapStudentPlusModuleUrls(): HttpUrl.Builder {
|
||||
return this
|
||||
}
|
||||
|
||||
private fun HttpUrl.Builder.mapMessagesModuleUrls(): HttpUrl.Builder {
|
||||
return this
|
||||
}
|
||||
|
||||
private fun checkHttpErrorResponse(error: VulcanClientError, url: String) {
|
||||
val isCodeMatch = error.httpCode == HttpURLConnection.HTTP_CONFLICT
|
||||
val isSubdomainMatch = "uonetplus-wiadomosciplus" in url || "uonetplus-uczenplus" in url
|
||||
val isSubdomainMatch = MessagesModuleHost in url || StudentPlusModuleHost in url
|
||||
if (isCodeMatch && isSubdomainMatch) {
|
||||
throw NotLoggedInException(error.message.orEmpty())
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.github.wulkanowy.sdk.scrapper.service
|
||||
|
||||
import io.github.wulkanowy.sdk.scrapper.ApiEndpoints
|
||||
import io.github.wulkanowy.sdk.scrapper.ApiResponse
|
||||
import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceExcuseRequest
|
||||
import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceRecordDay
|
||||
|
@ -44,7 +43,6 @@ import retrofit2.http.FormUrlEncoded
|
|||
import retrofit2.http.GET
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.Url
|
||||
|
||||
internal interface StudentService {
|
||||
|
@ -72,164 +70,133 @@ internal interface StudentService {
|
|||
@Body body: Any = Any(),
|
||||
): ApiResponse<CacheResponse>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("UczenCache.mvc/Get")
|
||||
suspend fun getUserCache(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UczenCache,
|
||||
): ApiResponse<CacheResponse>
|
||||
|
||||
@POST("{path}.mvc/Post")
|
||||
@POST("Autoryzacja.mvc/Post")
|
||||
suspend fun authorizePermission(
|
||||
@Body body: AuthorizePermissionRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Autoryzacja,
|
||||
): ApiResponse<AuthorizePermissionResponse>
|
||||
|
||||
@POST
|
||||
suspend fun getSchoolInfo(@Url url: String, @Body body: Any = Any()): ApiResponse<List<Diary>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("UczenDziennik.mvc/Get")
|
||||
suspend fun getDiaries(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UczenDziennik,
|
||||
): ApiResponse<List<Diary>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("Oceny.mvc/Get")
|
||||
suspend fun getGrades(
|
||||
@Body gradeRequest: GradeRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Oceny,
|
||||
): ApiResponse<GradesResponse>
|
||||
|
||||
@POST("{path}.mvc/GetOcenyCzastkowe")
|
||||
@POST("Statystyki.mvc/GetOcenyCzastkowe")
|
||||
suspend fun getGradesPartialStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<List<GradesStatisticsPartial>>
|
||||
|
||||
@POST("{path}.mvc/GetPunkty")
|
||||
@POST("Statystyki.mvc/GetPunkty")
|
||||
suspend fun getGradesPointsStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<GradePointsSummaryResponse>
|
||||
|
||||
@POST("{path}.mvc/GetOcenyRoczne")
|
||||
@POST("Statystyki.mvc/GetOcenyRoczne")
|
||||
suspend fun getGradesAnnualStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<List<GradesStatisticsSemester>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("Frekwencja.mvc/Get")
|
||||
suspend fun getAttendance(
|
||||
@Body attendanceRequest: AttendanceRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Frekwencja,
|
||||
): ApiResponse<AttendanceResponse>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("FrekwencjaStatystyki.mvc/Get")
|
||||
suspend fun getAttendanceStatistics(
|
||||
@Body attendanceSummaryRequest: AttendanceSummaryRequest,
|
||||
@Path("path") path: String = ApiEndpoints.FrekwencjaStatystyki,
|
||||
): ApiResponse<AttendanceSummaryResponse>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("FrekwencjaStatystykiPrzedmioty.mvc/Get")
|
||||
suspend fun getAttendanceSubjects(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.FrekwencjaStatystykiPrzedmioty,
|
||||
): ApiResponse<List<Subject>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("EwidencjaObecnosci.mvc/Get")
|
||||
suspend fun getAttendanceRecords(
|
||||
@Body attendanceRecordsRequest: AttendanceRecordsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.EwidencjaObecnosci,
|
||||
): ApiResponse<List<AttendanceRecordDay>>
|
||||
|
||||
@POST("{path}.mvc/Post")
|
||||
@POST("Usprawiedliwienia.mvc/Post")
|
||||
suspend fun excuseForAbsence(
|
||||
@Body attendanceExcuseRequest: AttendanceExcuseRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Usprawiedliwienia,
|
||||
): ApiResponse<ApiResponse<String?>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getExternalExaminations(
|
||||
@Path("path") path: String = ApiEndpoints.EgzaminyZewnetrzne,
|
||||
)
|
||||
@POST("EgzaminyZewnetrzne.mvc/Get")
|
||||
suspend fun getExternalExaminations()
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("Sprawdziany.mvc/Get")
|
||||
suspend fun getExams(
|
||||
@Body examRequest: ExamRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Sprawdziany,
|
||||
): ApiResponse<List<ExamResponse>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("Homework.mvc/Get")
|
||||
suspend fun getHomework(
|
||||
@Body homeworkRequest: HomeworkRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Homework,
|
||||
): ApiResponse<List<HomeworkDay>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("PlanZajec.mvc/Get")
|
||||
suspend fun getTimetable(
|
||||
@Body timetableRequest: TimetableRequest,
|
||||
@Path("path") path: String = ApiEndpoints.PlanZajec,
|
||||
): ApiResponse<TimetableResponse>
|
||||
|
||||
@POST("{path}.mvc/GetPrzedmioty")
|
||||
@POST("LekcjeZrealizowane.mvc/GetPrzedmioty")
|
||||
suspend fun getRealizedSubjects(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.LekcjeZrealizowane,
|
||||
)
|
||||
|
||||
@POST("{path}.mvc/GetZrealizowane")
|
||||
@POST("LekcjeZrealizowane.mvc/GetZrealizowane")
|
||||
suspend fun getCompletedLessons(
|
||||
@Body completedLessonsRequest: CompletedLessonsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.LekcjeZrealizowane,
|
||||
): ApiResponse<Map<String, List<CompletedLesson>>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("UwagiIOsiagniecia.mvc/Get")
|
||||
suspend fun getNotes(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UwagiIOsiagniecia,
|
||||
): ApiResponse<NotesResponse>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getConferences(
|
||||
@Path("path") path: String = ApiEndpoints.Zebrania,
|
||||
): ApiResponse<List<Conference>>
|
||||
@POST("Zebrania.mvc/Get")
|
||||
suspend fun getConferences(): ApiResponse<List<Conference>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("Jadlospis.mvc/Get")
|
||||
suspend fun getMenu(
|
||||
@Body menuRequest: MenuRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Jadlospis,
|
||||
): ApiResponse<List<Menu>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("ZarejestrowaneUrzadzenia.mvc/Get")
|
||||
suspend fun getRegisteredDevices(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<List<Device>>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("ZarejestrowaneUrzadzenia.mvc/Get")
|
||||
suspend fun getToken(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<TokenResponse>
|
||||
|
||||
@POST("{path}.mvc/Delete")
|
||||
@POST("ZarejestrowaneUrzadzenia.mvc/Delete")
|
||||
suspend fun unregisterDevice(
|
||||
@Body unregisterDeviceRequest: UnregisterDeviceRequest,
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<Any>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
@POST("SzkolaINauczyciele.mvc/Get")
|
||||
suspend fun getSchoolAndTeachers(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.SzkolaINauczyciele,
|
||||
): ApiResponse<SchoolAndTeachersResponse>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getStudentInfo(
|
||||
@Path("path") path: String = ApiEndpoints.Uczen,
|
||||
): ApiResponse<StudentInfo>
|
||||
@POST("Uczen.mvc/Get")
|
||||
suspend fun getStudentInfo(): ApiResponse<StudentInfo>
|
||||
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getStudentPhoto(
|
||||
@Path("path") path: String = ApiEndpoints.UczenZdjecie,
|
||||
): ApiResponse<StudentPhoto>
|
||||
@POST("UczenZdjecie.mvc/Get")
|
||||
suspend fun getStudentPhoto(): ApiResponse<StudentPhoto>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue