Make possible to switch between api endpoints dynamically
This commit is contained in:
parent
91736bf8a0
commit
ebb54d067b
5 changed files with 410 additions and 127 deletions
|
@ -24,3 +24,4 @@ ktlint_standard_parameter-list-wrapping=disabled
|
|||
ktlint_standard_discouraged-comment-location=disabled
|
||||
ktlint_standard_if-else-wrapping=disabled
|
||||
ktlint_standard_property-naming=disabled
|
||||
ktlint_standard_class-naming=disabled
|
||||
|
|
|
@ -1,58 +1,238 @@
|
|||
package io.github.wulkanowy.sdk.scrapper
|
||||
|
||||
internal object ApiEndpoints {
|
||||
internal object ApiEndpoints : IApiEndpoints {
|
||||
|
||||
var currentVersion = 58666
|
||||
|
||||
private val endpoints
|
||||
get() = when (currentVersion) {
|
||||
in 58666..Int.MAX_VALUE -> ApiEndpoints_24_4_2_58666
|
||||
else -> ApiEndpoints_24_4_1_58566
|
||||
}
|
||||
|
||||
// uczen
|
||||
const val Autoryzacja = "00b61915-f3ec-421d-b7af-07aa8c4c162f"
|
||||
const val DostepOffice = "efa4a7ac-27bf-49af-90ff-ae0852339dd3"
|
||||
const val EgzaminySemestralne = "32915d4e-e542-4756-8c4b-c600f674f488"
|
||||
const val EgzaminyZewnetrzne = "9b48403a-cc4f-46a5-a51b-f04fea8753ee"
|
||||
const val EwidencjaObecnosci = "4ae4c4f5-209e-40e0-80db-3d77c484d528"
|
||||
const val FormularzeSzablony = "e36648d3-83fa-491b-8e91-5bea927120f1"
|
||||
const val FormularzeSzablonyDownload = "e1a812dd-9399-4354-aa5e-77304e042602"
|
||||
const val FormularzeWysylanie = "aa2d4eca-517c-4b53-ac44-8d5ea315bb7f"
|
||||
const val Frekwencja = "cc65835b-721d-4f4b-a316-799aed29c56f"
|
||||
const val FrekwencjaStatystyki = "a3ebd829-ee89-41c5-81c3-35a812c98640"
|
||||
const val FrekwencjaStatystykiPrzedmioty = "4c4133e2-cac7-444e-ab26-83501e5ddce5"
|
||||
const val Homework = "1dfb0cc9-584c-46c9-8f8b-bad061f9ebee"
|
||||
const val Jadlospis = "0c746ff5-f4cb-4537-b269-e3a4ac215eea"
|
||||
const val LekcjeZaplanowane = "3e8440cc-c832-45d9-abb4-3046977adb14"
|
||||
const val LekcjeZrealizowane = "9155e959-b2e7-4e05-9f2b-4773916b6dc2"
|
||||
const val Oceny = "42fd0eae-afaa-4772-ab73-66cdc1577649"
|
||||
const val Ogloszenia = "7e92f621-b90d-462e-ba6c-8b0110eb6494"
|
||||
const val Oplaty = "590bff89-a3ed-4bae-b0df-a18bdb1614e3"
|
||||
const val PlanZajec = "f6495353-4047-4752-91b6-ca202990e9e0"
|
||||
const val Platnosc = "4ba184c1-4419-4423-8864-8a6d7d1261c3"
|
||||
const val PlatnoscMetadata = "65c91912-8925-4bf2-b150-504324d781b8"
|
||||
const val PodrecznikiLataSzkolne = "862000c9-06a1-4505-b730-7fc3ed194007"
|
||||
const val PodrecznikiUcznia = "f65af6b8-1d86-4a47-9324-2c941eeb0140"
|
||||
const val Pomoc = "3380c914-a20d-44cd-9480-b2a64a3b5cf7"
|
||||
const val RejestracjaUrzadzeniaToken = "f51b7f8e-27fc-4522-aa87-fa881ee3afb8"
|
||||
const val RejestracjaUrzadzeniaTokenCertyfikat = "9fd15a23-2ec0-48be-8596-c46b7c30daac"
|
||||
const val RozpoczeciePlatnosci = "cd025374-b202-4efe-996c-18e074083775"
|
||||
const val ScalanieKont = "e4ac68c9-cf32-4ff6-be19-677cb5e5c255"
|
||||
const val Sprawdziany = "9bf0410c-aae5-447c-947e-49c815edbcb3"
|
||||
const val Statystyki = "dfa2d512-6682-414b-908b-6e208dfa0c6e"
|
||||
const val SzkolaINauczyciele = "b59d07c6-1146-4a50-ba6b-763ee8b151a3"
|
||||
const val Uczen = "a465bde1-9509-4706-bad2-658578482e04"
|
||||
const val UczenCache = "f18ddca0-400e-47cc-89a1-4bbe6685810b"
|
||||
const val UczenDziennik = "bef3daf1-07cd-4de6-b059-ee5909a7beb9"
|
||||
const val UczenZdjecie = "c1ba3b01-d53c-4577-98ab-4f1a620a3a35"
|
||||
const val Usprawiedliwienia = "863af74c-79aa-48f4-a0e6-aad168720dfd"
|
||||
const val UwagiIOsiagniecia = "6d869250-f637-4da0-a44b-c981299a55ce"
|
||||
const val ZarejestrowaneUrzadzenia = "bc9c2af4-fb13-4f9b-86e4-59ee12bfff85"
|
||||
const val Zebrania = "13fc67ca-19fc-4128-b8f0-41eed7f29838"
|
||||
const val ZebraniaObecnosc = "6ef8e1de-1234-4f39-9cd4-f68dabb8a440"
|
||||
const val ZgloszoneNieobecnosci = "80fe9dc2-8c36-41ea-8009-82503ff3c810"
|
||||
override val Autoryzacja = endpoints.Autoryzacja
|
||||
override val DostepOffice = endpoints.DostepOffice
|
||||
override val EgzaminySemestralne = endpoints.EgzaminySemestralne
|
||||
override val EgzaminyZewnetrzne = endpoints.EgzaminyZewnetrzne
|
||||
override val EwidencjaObecnosci = endpoints.EwidencjaObecnosci
|
||||
override val FormularzeSzablony = endpoints.FormularzeSzablony
|
||||
override val FormularzeSzablonyDownload = endpoints.FormularzeSzablonyDownload
|
||||
override val FormularzeWysylanie = endpoints.FormularzeWysylanie
|
||||
override val Frekwencja = endpoints.Frekwencja
|
||||
override val FrekwencjaStatystyki = endpoints.FrekwencjaStatystyki
|
||||
override val FrekwencjaStatystykiPrzedmioty = endpoints.FrekwencjaStatystykiPrzedmioty
|
||||
override val Homework = endpoints.Homework
|
||||
override val Jadlospis = endpoints.Jadlospis
|
||||
override val LekcjeZaplanowane = endpoints.LekcjeZaplanowane
|
||||
override val LekcjeZrealizowane = endpoints.LekcjeZrealizowane
|
||||
override val Oceny = endpoints.Oceny
|
||||
override val Ogloszenia = endpoints.Ogloszenia
|
||||
override val Oplaty = endpoints.Oplaty
|
||||
override val PlanZajec = endpoints.PlanZajec
|
||||
override val Platnosc = endpoints.Platnosc
|
||||
override val PlatnoscMetadata = endpoints.PlatnoscMetadata
|
||||
override val PodrecznikiLataSzkolne = endpoints.PodrecznikiLataSzkolne
|
||||
override val PodrecznikiUcznia = endpoints.PodrecznikiUcznia
|
||||
override val Pomoc = endpoints.Pomoc
|
||||
override val RejestracjaUrzadzeniaToken = endpoints.RejestracjaUrzadzeniaToken
|
||||
override val RejestracjaUrzadzeniaTokenCertyfikat = endpoints.RejestracjaUrzadzeniaTokenCertyfikat
|
||||
override val RozpoczeciePlatnosci = endpoints.RozpoczeciePlatnosci
|
||||
override val ScalanieKont = endpoints.ScalanieKont
|
||||
override val Sprawdziany = endpoints.Sprawdziany
|
||||
override val Statystyki = endpoints.Statystyki
|
||||
override val SzkolaINauczyciele = endpoints.SzkolaINauczyciele
|
||||
override val Uczen = endpoints.Uczen
|
||||
override val UczenCache = endpoints.UczenCache
|
||||
override val UczenDziennik = endpoints.UczenDziennik
|
||||
override val UczenZdjecie = endpoints.UczenZdjecie
|
||||
override val Usprawiedliwienia = endpoints.Usprawiedliwienia
|
||||
override val UwagiIOsiagniecia = endpoints.UwagiIOsiagniecia
|
||||
override val ZarejestrowaneUrzadzenia = endpoints.ZarejestrowaneUrzadzenia
|
||||
override val Zebrania = endpoints.Zebrania
|
||||
override val ZebraniaObecnosc = endpoints.ZebraniaObecnosc
|
||||
override val ZgloszoneNieobecnosci = endpoints.ZgloszoneNieobecnosci
|
||||
|
||||
// wiadomosciplus
|
||||
const val Skrzynki = "787817a4-bfa8-472c-b1ce-bbe324b308cf"
|
||||
const val Odebrane = "fa8d0cb9-742e-4f9f-b3e2-65b7d5cd7aa6"
|
||||
const val OdebraneSkrzynka = "9545648d-6534-4282-acb7-6e9cc52ab402"
|
||||
const val Wyslane = "962f3256-b82a-42bd-8f20-f03d79723516"
|
||||
const val WyslaneSkrzynka = "a046f45d-42ae-4072-9684-e957a797a22b"
|
||||
const val Usuniete = "94c2e642-b8e3-41f7-8428-27c3f213cb5d"
|
||||
const val UsunieteSkrzynka = "bae7f54c-f18e-4553-92d6-9a5f93392b39"
|
||||
const val WiadomoscOdpowiedzPrzekaz = "44444524-ba04-4259-8853-88343cf294be"
|
||||
const val MoveTrash = "b2131c71-8d76-4d93-9274-1d5b4f30c915"
|
||||
const val RestoreTrash = "e6de58f9-4db1-4cd2-afdf-ac9fcca37e43"
|
||||
override val Skrzynki = endpoints.Skrzynki
|
||||
override val Odebrane = endpoints.Odebrane
|
||||
override val OdebraneSkrzynka = endpoints.OdebraneSkrzynka
|
||||
override val Wyslane = endpoints.Wyslane
|
||||
override val WyslaneSkrzynka = endpoints.WyslaneSkrzynka
|
||||
override val Usuniete = endpoints.Usuniete
|
||||
override val UsunieteSkrzynka = endpoints.UsunieteSkrzynka
|
||||
override val WiadomoscOdpowiedzPrzekaz = endpoints.WiadomoscOdpowiedzPrzekaz
|
||||
override val MoveTrash = endpoints.MoveTrash
|
||||
override val RestoreTrash = endpoints.RestoreTrash
|
||||
}
|
||||
|
||||
internal interface IApiEndpoints {
|
||||
// uczen
|
||||
val Autoryzacja: String
|
||||
val DostepOffice: String
|
||||
val EgzaminySemestralne: String
|
||||
val EgzaminyZewnetrzne: String
|
||||
val EwidencjaObecnosci: String
|
||||
val FormularzeSzablony: String
|
||||
val FormularzeSzablonyDownload: String
|
||||
val FormularzeWysylanie: String
|
||||
val Frekwencja: String
|
||||
val FrekwencjaStatystyki: String
|
||||
val FrekwencjaStatystykiPrzedmioty: String
|
||||
val Homework: String
|
||||
val Jadlospis: String
|
||||
val LekcjeZaplanowane: String
|
||||
val LekcjeZrealizowane: String
|
||||
val Oceny: String
|
||||
val Ogloszenia: String
|
||||
val Oplaty: String
|
||||
val PlanZajec: String
|
||||
val Platnosc: String
|
||||
val PlatnoscMetadata: String
|
||||
val PodrecznikiLataSzkolne: String
|
||||
val PodrecznikiUcznia: String
|
||||
val Pomoc: String
|
||||
val RejestracjaUrzadzeniaToken: String
|
||||
val RejestracjaUrzadzeniaTokenCertyfikat: String
|
||||
val RozpoczeciePlatnosci: String
|
||||
val ScalanieKont: String
|
||||
val Sprawdziany: String
|
||||
val Statystyki: String
|
||||
val SzkolaINauczyciele: String
|
||||
val Uczen: String
|
||||
val UczenCache: String
|
||||
val UczenDziennik: String
|
||||
val UczenZdjecie: String
|
||||
val Usprawiedliwienia: String
|
||||
val UwagiIOsiagniecia: String
|
||||
val ZarejestrowaneUrzadzenia: String
|
||||
val Zebrania: String
|
||||
val ZebraniaObecnosc: String
|
||||
val ZgloszoneNieobecnosci: String
|
||||
|
||||
// wiadomosciplus
|
||||
val Skrzynki: String
|
||||
val Odebrane: String
|
||||
val OdebraneSkrzynka: String
|
||||
val Wyslane: String
|
||||
val WyslaneSkrzynka: String
|
||||
val Usuniete: String
|
||||
val UsunieteSkrzynka: String
|
||||
val WiadomoscOdpowiedzPrzekaz: String
|
||||
val MoveTrash: String
|
||||
val RestoreTrash: String
|
||||
}
|
||||
|
||||
internal object ApiEndpoints_24_4_1_58566 : IApiEndpoints {
|
||||
// uczen
|
||||
override val Autoryzacja = "Autoryzacja"
|
||||
override val DostepOffice = "DostepOffice"
|
||||
override val EgzaminySemestralne = "EgzaminySemestralne"
|
||||
override val EgzaminyZewnetrzne = "EgzaminyZewnetrzne"
|
||||
override val EwidencjaObecnosci = "EwidencjaObecnosci"
|
||||
override val FormularzeSzablony = "FormularzeSzablony"
|
||||
override val FormularzeSzablonyDownload = "FormularzeSzablonyDownload"
|
||||
override val FormularzeWysylanie = "FormularzeWysylanie"
|
||||
override val Frekwencja = "Frekwencja"
|
||||
override val FrekwencjaStatystyki = "FrekwencjaStatystyki"
|
||||
override val FrekwencjaStatystykiPrzedmioty = "FrekwencjaStatystykiPrzedmioty"
|
||||
override val Homework = "Homework"
|
||||
override val Jadlospis = "Jadlospis"
|
||||
override val LekcjeZaplanowane = "LekcjeZaplanowane"
|
||||
override val LekcjeZrealizowane = "LekcjeZrealizowane"
|
||||
override val Oceny = "Oceny"
|
||||
override val Ogloszenia = "Ogloszenia"
|
||||
override val Oplaty = "Oplaty"
|
||||
override val PlanZajec = "PlanZajec"
|
||||
override val Platnosc = "Platnosc"
|
||||
override val PlatnoscMetadata = "PlatnoscMetadata"
|
||||
override val PodrecznikiLataSzkolne = "PodrecznikiLataSzkolne"
|
||||
override val PodrecznikiUcznia = "PodrecznikiUcznia"
|
||||
override val Pomoc = "Pomoc"
|
||||
override val RejestracjaUrzadzeniaToken = "RejestracjaUrzadzeniaToken"
|
||||
override val RejestracjaUrzadzeniaTokenCertyfikat = "RejestracjaUrzadzeniaTokenCertyfikat"
|
||||
override val RozpoczeciePlatnosci = "RozpoczeciePlatnosci"
|
||||
override val ScalanieKont = "ScalanieKont"
|
||||
override val Sprawdziany = "Sprawdziany"
|
||||
override val Statystyki = "Statystyki"
|
||||
override val SzkolaINauczyciele = "SzkolaINauczyciele"
|
||||
override val Uczen = "Uczen"
|
||||
override val UczenCache = "UczenCache"
|
||||
override val UczenDziennik = "UczenDziennik"
|
||||
override val UczenZdjecie = "UczenZdjecie"
|
||||
override val Usprawiedliwienia = "Usprawiedliwienia"
|
||||
override val UwagiIOsiagniecia = "UwagiIOsiagniecia"
|
||||
override val ZarejestrowaneUrzadzenia = "ZarejestrowaneUrzadzenia"
|
||||
override val Zebrania = "Zebrania"
|
||||
override val ZebraniaObecnosc = "ZebraniaObecnosc"
|
||||
override val ZgloszoneNieobecnosci = "ZgloszoneNieobecnosci"
|
||||
|
||||
// wiadomosciplus
|
||||
override val Skrzynki = "Skrzynki"
|
||||
override val Odebrane = "Odebrane"
|
||||
override val OdebraneSkrzynka = "OdebraneSkrzynka"
|
||||
override val Wyslane = "Wyslane"
|
||||
override val WyslaneSkrzynka = "WyslaneSkrzynka"
|
||||
override val Usuniete = "Usuniete"
|
||||
override val UsunieteSkrzynka = "UsunieteSkrzynka"
|
||||
override val WiadomoscOdpowiedzPrzekaz = "WiadomoscOdpowiedzPrzekaz"
|
||||
override val MoveTrash = "MoveTrash"
|
||||
override val RestoreTrash = "RestoreTrash"
|
||||
}
|
||||
|
||||
internal object ApiEndpoints_24_4_2_58666 : IApiEndpoints {
|
||||
// uczen
|
||||
override val Autoryzacja = "00b61915-f3ec-421d-b7af-07aa8c4c162f"
|
||||
override val DostepOffice = "efa4a7ac-27bf-49af-90ff-ae0852339dd3"
|
||||
override val EgzaminySemestralne = "32915d4e-e542-4756-8c4b-c600f674f488"
|
||||
override val EgzaminyZewnetrzne = "9b48403a-cc4f-46a5-a51b-f04fea8753ee"
|
||||
override val EwidencjaObecnosci = "4ae4c4f5-209e-40e0-80db-3d77c484d528"
|
||||
override val FormularzeSzablony = "e36648d3-83fa-491b-8e91-5bea927120f1"
|
||||
override val FormularzeSzablonyDownload = "e1a812dd-9399-4354-aa5e-77304e042602"
|
||||
override val FormularzeWysylanie = "aa2d4eca-517c-4b53-ac44-8d5ea315bb7f"
|
||||
override val Frekwencja = "cc65835b-721d-4f4b-a316-799aed29c56f"
|
||||
override val FrekwencjaStatystyki = "a3ebd829-ee89-41c5-81c3-35a812c98640"
|
||||
override val FrekwencjaStatystykiPrzedmioty = "4c4133e2-cac7-444e-ab26-83501e5ddce5"
|
||||
override val Homework = "1dfb0cc9-584c-46c9-8f8b-bad061f9ebee"
|
||||
override val Jadlospis = "0c746ff5-f4cb-4537-b269-e3a4ac215eea"
|
||||
override val LekcjeZaplanowane = "3e8440cc-c832-45d9-abb4-3046977adb14"
|
||||
override val LekcjeZrealizowane = "9155e959-b2e7-4e05-9f2b-4773916b6dc2"
|
||||
override val Oceny = "42fd0eae-afaa-4772-ab73-66cdc1577649"
|
||||
override val Ogloszenia = "7e92f621-b90d-462e-ba6c-8b0110eb6494"
|
||||
override val Oplaty = "590bff89-a3ed-4bae-b0df-a18bdb1614e3"
|
||||
override val PlanZajec = "f6495353-4047-4752-91b6-ca202990e9e0"
|
||||
override val Platnosc = "4ba184c1-4419-4423-8864-8a6d7d1261c3"
|
||||
override val PlatnoscMetadata = "65c91912-8925-4bf2-b150-504324d781b8"
|
||||
override val PodrecznikiLataSzkolne = "862000c9-06a1-4505-b730-7fc3ed194007"
|
||||
override val PodrecznikiUcznia = "f65af6b8-1d86-4a47-9324-2c941eeb0140"
|
||||
override val Pomoc = "3380c914-a20d-44cd-9480-b2a64a3b5cf7"
|
||||
override val RejestracjaUrzadzeniaToken = "f51b7f8e-27fc-4522-aa87-fa881ee3afb8"
|
||||
override val RejestracjaUrzadzeniaTokenCertyfikat = "9fd15a23-2ec0-48be-8596-c46b7c30daac"
|
||||
override val RozpoczeciePlatnosci = "cd025374-b202-4efe-996c-18e074083775"
|
||||
override val ScalanieKont = "e4ac68c9-cf32-4ff6-be19-677cb5e5c255"
|
||||
override val Sprawdziany = "9bf0410c-aae5-447c-947e-49c815edbcb3"
|
||||
override val Statystyki = "dfa2d512-6682-414b-908b-6e208dfa0c6e"
|
||||
override val SzkolaINauczyciele = "b59d07c6-1146-4a50-ba6b-763ee8b151a3"
|
||||
override val Uczen = "a465bde1-9509-4706-bad2-658578482e04"
|
||||
override val UczenCache = "f18ddca0-400e-47cc-89a1-4bbe6685810b"
|
||||
override val UczenDziennik = "bef3daf1-07cd-4de6-b059-ee5909a7beb9"
|
||||
override val UczenZdjecie = "c1ba3b01-d53c-4577-98ab-4f1a620a3a35"
|
||||
override val Usprawiedliwienia = "863af74c-79aa-48f4-a0e6-aad168720dfd"
|
||||
override val UwagiIOsiagniecia = "6d869250-f637-4da0-a44b-c981299a55ce"
|
||||
override val ZarejestrowaneUrzadzenia = "bc9c2af4-fb13-4f9b-86e4-59ee12bfff85"
|
||||
override val Zebrania = "13fc67ca-19fc-4128-b8f0-41eed7f29838"
|
||||
override val ZebraniaObecnosc = "6ef8e1de-1234-4f39-9cd4-f68dabb8a440"
|
||||
override val ZgloszoneNieobecnosci = "80fe9dc2-8c36-41ea-8009-82503ff3c810"
|
||||
|
||||
// wiadomosciplus
|
||||
override val Skrzynki = "787817a4-bfa8-472c-b1ce-bbe324b308cf"
|
||||
override val Odebrane = "fa8d0cb9-742e-4f9f-b3e2-65b7d5cd7aa6"
|
||||
override val OdebraneSkrzynka = "9545648d-6534-4282-acb7-6e9cc52ab402"
|
||||
override val Wyslane = "962f3256-b82a-42bd-8f20-f03d79723516"
|
||||
override val WyslaneSkrzynka = "a046f45d-42ae-4072-9684-e957a797a22b"
|
||||
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 MoveTrash = "b2131c71-8d76-4d93-9274-1d5b4f30c915"
|
||||
override val RestoreTrash = "e6de58f9-4db1-4cd2-afdf-ac9fcca37e43"
|
||||
}
|
||||
|
|
|
@ -47,8 +47,12 @@ internal class MessagesRepository(
|
|||
|
||||
suspend fun getReceivedMessages(mailboxKey: String?, lastMessageKey: Int = 0, pageSize: Int = 50): List<MessageMeta> {
|
||||
val messages = when (mailboxKey) {
|
||||
null -> api.getReceived(lastMessageKey, pageSize)
|
||||
else -> api.getReceivedMailbox(mailboxKey, lastMessageKey, pageSize)
|
||||
null -> api.getReceived(lastMessageKey = lastMessageKey, pageSize = pageSize)
|
||||
else -> api.getReceivedMailbox(
|
||||
mailboxKey = mailboxKey,
|
||||
lastMessageKey = lastMessageKey,
|
||||
pageSize = pageSize,
|
||||
)
|
||||
}
|
||||
|
||||
return messages
|
||||
|
@ -58,8 +62,8 @@ internal class MessagesRepository(
|
|||
|
||||
suspend fun getSentMessages(mailboxKey: String?, lastMessageKey: Int = 0, pageSize: Int = 50): List<MessageMeta> {
|
||||
val messages = when (mailboxKey) {
|
||||
null -> api.getSent(lastMessageKey, pageSize)
|
||||
else -> api.getSentMailbox(mailboxKey, lastMessageKey, pageSize)
|
||||
null -> api.getSent(lastMessageKey = lastMessageKey, pageSize = pageSize)
|
||||
else -> api.getSentMailbox(mailboxKey = mailboxKey, lastMessageKey = lastMessageKey, pageSize = pageSize)
|
||||
}
|
||||
return messages
|
||||
.sortedBy { it.date }
|
||||
|
@ -68,8 +72,12 @@ internal class MessagesRepository(
|
|||
|
||||
suspend fun getDeletedMessages(mailboxKey: String?, lastMessageKey: Int = 0, pageSize: Int = 50): List<MessageMeta> {
|
||||
val messages = when (mailboxKey) {
|
||||
null -> api.getDeleted(lastMessageKey, pageSize)
|
||||
else -> api.getDeletedMailbox(mailboxKey, lastMessageKey, pageSize)
|
||||
null -> api.getDeleted(lastMessageKey = lastMessageKey, pageSize = pageSize)
|
||||
else -> api.getDeletedMailbox(
|
||||
mailboxKey = mailboxKey,
|
||||
lastMessageKey = lastMessageKey,
|
||||
pageSize = pageSize,
|
||||
)
|
||||
}
|
||||
return messages
|
||||
.sortedBy { it.date }
|
||||
|
@ -77,7 +85,7 @@ internal class MessagesRepository(
|
|||
}
|
||||
|
||||
suspend fun getMessageReplayDetails(globalKey: String): MessageReplayDetails {
|
||||
return api.getMessageReplayDetails(globalKey).let {
|
||||
return api.getMessageReplayDetails(globalKey = globalKey).let {
|
||||
it.apply {
|
||||
sender = Recipient(
|
||||
mailboxGlobalKey = it.senderMailboxId,
|
||||
|
|
|
@ -14,6 +14,7 @@ import retrofit2.http.GET
|
|||
import retrofit2.http.Header
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.PUT
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.Url
|
||||
|
||||
|
@ -30,46 +31,52 @@ internal interface MessagesService {
|
|||
@FieldMap certificate: Map<String, String>,
|
||||
): String
|
||||
|
||||
@GET("api/${ApiEndpoints.Skrzynki}")
|
||||
suspend fun getMailboxes(): List<Mailbox>
|
||||
@GET("api/{path}")
|
||||
suspend fun getMailboxes(@Path("path") path: String = ApiEndpoints.Skrzynki): List<Mailbox>
|
||||
|
||||
@GET("api/Pracownicy")
|
||||
suspend fun getRecipients(@Query("globalKeySkrzynka") mailboxKey: String): List<Recipient>
|
||||
|
||||
@GET("api/${ApiEndpoints.Odebrane}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getReceived(
|
||||
@Path("path") path: String = ApiEndpoints.Odebrane,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
): List<MessageMeta>
|
||||
|
||||
@GET("api/${ApiEndpoints.OdebraneSkrzynka}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getReceivedMailbox(
|
||||
@Path("path") path: String = ApiEndpoints.OdebraneSkrzynka,
|
||||
@Query("globalKeySkrzynka") mailboxKey: String,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
): List<MessageMeta>
|
||||
|
||||
@GET("api/${ApiEndpoints.Wyslane}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getSent(
|
||||
@Path("path") path: String = ApiEndpoints.Wyslane,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
): List<MessageMeta>
|
||||
|
||||
@GET("api/${ApiEndpoints.WyslaneSkrzynka}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getSentMailbox(
|
||||
@Path("path") path: String = ApiEndpoints.WyslaneSkrzynka,
|
||||
@Query("globalKeySkrzynka") mailboxKey: String,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
): List<MessageMeta>
|
||||
|
||||
@GET("api/${ApiEndpoints.Usuniete}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getDeleted(
|
||||
@Path("path") path: String = ApiEndpoints.Usuniete,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
): List<MessageMeta>
|
||||
|
||||
@GET("api/${ApiEndpoints.UsunieteSkrzynka}")
|
||||
@GET("api/{path}")
|
||||
suspend fun getDeletedMailbox(
|
||||
@Path("path") path: String = ApiEndpoints.UsunieteSkrzynka,
|
||||
@Query("globalKeySkrzynka") mailboxKey: String,
|
||||
@Query("idLastWiadomosc") lastMessageKey: Int = 0,
|
||||
@Query("pageSize") pageSize: Int = 50,
|
||||
|
@ -81,17 +88,26 @@ internal interface MessagesService {
|
|||
@PUT("api/WiadomoscSzczegoly")
|
||||
suspend fun markMessageAsRead(@Body body: Map<String, String>)
|
||||
|
||||
@GET("api/${ApiEndpoints.WiadomoscOdpowiedzPrzekaz}")
|
||||
suspend fun getMessageReplayDetails(@Query("apiGlobalKey") globalKey: String): MessageReplayDetails
|
||||
@GET("api/{path}")
|
||||
suspend fun getMessageReplayDetails(
|
||||
@Path("path") path: String = ApiEndpoints.WiadomoscOdpowiedzPrzekaz,
|
||||
@Query("apiGlobalKey") globalKey: String,
|
||||
): MessageReplayDetails
|
||||
|
||||
@POST("api/WiadomoscNowa")
|
||||
suspend fun sendMessage(@Body body: SendMessageRequest)
|
||||
|
||||
@POST("api/${ApiEndpoints.MoveTrash}")
|
||||
suspend fun moveMessageToTrash(@Body body: List<String>)
|
||||
@POST("api/{path}")
|
||||
suspend fun moveMessageToTrash(
|
||||
@Body body: List<String>,
|
||||
@Path("path") path: String = ApiEndpoints.MoveTrash,
|
||||
)
|
||||
|
||||
@POST("api/${ApiEndpoints.RestoreTrash}")
|
||||
suspend fun restoreFromTrash(@Body body: List<String>)
|
||||
@POST("api/{path}")
|
||||
suspend fun restoreFromTrash(
|
||||
@Body body: List<String>,
|
||||
@Path("path") path: String = ApiEndpoints.RestoreTrash,
|
||||
)
|
||||
|
||||
@POST("api/Delete")
|
||||
suspend fun deleteMessage(@Body body: List<String>)
|
||||
|
|
|
@ -44,6 +44,7 @@ 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 {
|
||||
|
@ -71,87 +72,164 @@ internal interface StudentService {
|
|||
@Body body: Any = Any(),
|
||||
): ApiResponse<CacheResponse>
|
||||
|
||||
@POST("${ApiEndpoints.UczenCache}.mvc/Get")
|
||||
suspend fun getUserCache(@Body body: Any = Any()): ApiResponse<CacheResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getUserCache(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UczenCache,
|
||||
): ApiResponse<CacheResponse>
|
||||
|
||||
@POST("${ApiEndpoints.Autoryzacja}.mvc/Post")
|
||||
suspend fun authorizePermission(@Body body: AuthorizePermissionRequest): ApiResponse<AuthorizePermissionResponse>
|
||||
@POST("{path}.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("${ApiEndpoints.UczenDziennik}.mvc/Get")
|
||||
suspend fun getDiaries(@Body body: Any = Any()): ApiResponse<List<Diary>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getDiaries(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UczenDziennik,
|
||||
): ApiResponse<List<Diary>>
|
||||
|
||||
@POST("${ApiEndpoints.Oceny}.mvc/Get")
|
||||
suspend fun getGrades(@Body gradeRequest: GradeRequest): ApiResponse<GradesResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getGrades(
|
||||
@Body gradeRequest: GradeRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Oceny,
|
||||
): ApiResponse<GradesResponse>
|
||||
|
||||
@POST("${ApiEndpoints.Statystyki}.mvc/GetOcenyCzastkowe")
|
||||
suspend fun getGradesPartialStatistics(@Body gradesStatisticsRequest: GradesStatisticsRequest): ApiResponse<List<GradesStatisticsPartial>>
|
||||
@POST("{path}.mvc/GetOcenyCzastkowe")
|
||||
suspend fun getGradesPartialStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<List<GradesStatisticsPartial>>
|
||||
|
||||
@POST("${ApiEndpoints.Statystyki}.mvc/GetPunkty")
|
||||
suspend fun getGradesPointsStatistics(@Body gradesStatisticsRequest: GradesStatisticsRequest): ApiResponse<GradePointsSummaryResponse>
|
||||
@POST("{path}.mvc/GetPunkty")
|
||||
suspend fun getGradesPointsStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<GradePointsSummaryResponse>
|
||||
|
||||
@POST("${ApiEndpoints.Statystyki}.mvc/GetOcenyRoczne")
|
||||
suspend fun getGradesAnnualStatistics(@Body gradesStatisticsRequest: GradesStatisticsRequest): ApiResponse<List<GradesStatisticsSemester>>
|
||||
@POST("{path}.mvc/GetOcenyRoczne")
|
||||
suspend fun getGradesAnnualStatistics(
|
||||
@Body gradesStatisticsRequest: GradesStatisticsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Statystyki,
|
||||
): ApiResponse<List<GradesStatisticsSemester>>
|
||||
|
||||
@POST("${ApiEndpoints.Frekwencja}.mvc/Get")
|
||||
suspend fun getAttendance(@Body attendanceRequest: AttendanceRequest): ApiResponse<AttendanceResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getAttendance(
|
||||
@Body attendanceRequest: AttendanceRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Frekwencja,
|
||||
): ApiResponse<AttendanceResponse>
|
||||
|
||||
@POST("${ApiEndpoints.FrekwencjaStatystyki}.mvc/Get")
|
||||
suspend fun getAttendanceStatistics(@Body attendanceSummaryRequest: AttendanceSummaryRequest): ApiResponse<AttendanceSummaryResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getAttendanceStatistics(
|
||||
@Body attendanceSummaryRequest: AttendanceSummaryRequest,
|
||||
@Path("path") path: String = ApiEndpoints.FrekwencjaStatystyki,
|
||||
): ApiResponse<AttendanceSummaryResponse>
|
||||
|
||||
@POST("${ApiEndpoints.FrekwencjaStatystykiPrzedmioty}.mvc/Get")
|
||||
suspend fun getAttendanceSubjects(@Body body: Any = Any()): ApiResponse<List<Subject>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getAttendanceSubjects(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.FrekwencjaStatystykiPrzedmioty,
|
||||
): ApiResponse<List<Subject>>
|
||||
|
||||
@POST("${ApiEndpoints.EwidencjaObecnosci}.mvc/Get")
|
||||
suspend fun getAttendanceRecords(@Body attendanceRecordsRequest: AttendanceRecordsRequest): ApiResponse<List<AttendanceRecordDay>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getAttendanceRecords(
|
||||
@Body attendanceRecordsRequest: AttendanceRecordsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.EwidencjaObecnosci,
|
||||
): ApiResponse<List<AttendanceRecordDay>>
|
||||
|
||||
@POST("${ApiEndpoints.Usprawiedliwienia}.mvc/Post")
|
||||
suspend fun excuseForAbsence(@Body attendanceExcuseRequest: AttendanceExcuseRequest): ApiResponse<ApiResponse<String?>>
|
||||
@POST("{path}.mvc/Post")
|
||||
suspend fun excuseForAbsence(
|
||||
@Body attendanceExcuseRequest: AttendanceExcuseRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Usprawiedliwienia,
|
||||
): ApiResponse<ApiResponse<String?>>
|
||||
|
||||
@POST("${ApiEndpoints.EgzaminyZewnetrzne}.mvc/Get")
|
||||
suspend fun getExternalExaminations()
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getExternalExaminations(
|
||||
@Path("path") path: String = ApiEndpoints.EgzaminyZewnetrzne,
|
||||
)
|
||||
|
||||
@POST("${ApiEndpoints.Sprawdziany}.mvc/Get")
|
||||
suspend fun getExams(@Body examRequest: ExamRequest): ApiResponse<List<ExamResponse>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getExams(
|
||||
@Body examRequest: ExamRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Sprawdziany,
|
||||
): ApiResponse<List<ExamResponse>>
|
||||
|
||||
@POST("${ApiEndpoints.Homework}.mvc/Get")
|
||||
suspend fun getHomework(@Body homeworkRequest: HomeworkRequest): ApiResponse<List<HomeworkDay>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getHomework(
|
||||
@Body homeworkRequest: HomeworkRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Homework,
|
||||
): ApiResponse<List<HomeworkDay>>
|
||||
|
||||
@POST("${ApiEndpoints.PlanZajec}.mvc/Get")
|
||||
suspend fun getTimetable(@Body timetableRequest: TimetableRequest): ApiResponse<TimetableResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getTimetable(
|
||||
@Body timetableRequest: TimetableRequest,
|
||||
@Path("path") path: String = ApiEndpoints.PlanZajec,
|
||||
): ApiResponse<TimetableResponse>
|
||||
|
||||
@POST("${ApiEndpoints.LekcjeZrealizowane}.mvc/GetPrzedmioty")
|
||||
suspend fun getRealizedSubjects(@Body body: Any = Any())
|
||||
@POST("{path}.mvc/GetPrzedmioty")
|
||||
suspend fun getRealizedSubjects(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.LekcjeZrealizowane,
|
||||
)
|
||||
|
||||
@POST("${ApiEndpoints.LekcjeZrealizowane}.mvc/GetZrealizowane")
|
||||
suspend fun getCompletedLessons(@Body completedLessonsRequest: CompletedLessonsRequest): ApiResponse<Map<String, List<CompletedLesson>>>
|
||||
@POST("{path}.mvc/GetZrealizowane")
|
||||
suspend fun getCompletedLessons(
|
||||
@Body completedLessonsRequest: CompletedLessonsRequest,
|
||||
@Path("path") path: String = ApiEndpoints.LekcjeZrealizowane,
|
||||
): ApiResponse<Map<String, List<CompletedLesson>>>
|
||||
|
||||
@POST("${ApiEndpoints.UwagiIOsiagniecia}.mvc/Get")
|
||||
suspend fun getNotes(@Body body: Any = Any()): ApiResponse<NotesResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getNotes(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.UwagiIOsiagniecia,
|
||||
): ApiResponse<NotesResponse>
|
||||
|
||||
@POST("${ApiEndpoints.Zebrania}.mvc/Get")
|
||||
suspend fun getConferences(): ApiResponse<List<Conference>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getConferences(
|
||||
@Path("path") path: String = ApiEndpoints.Zebrania,
|
||||
): ApiResponse<List<Conference>>
|
||||
|
||||
@POST("${ApiEndpoints.Jadlospis}.mvc/Get")
|
||||
suspend fun getMenu(@Body menuRequest: MenuRequest): ApiResponse<List<Menu>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getMenu(
|
||||
@Body menuRequest: MenuRequest,
|
||||
@Path("path") path: String = ApiEndpoints.Jadlospis,
|
||||
): ApiResponse<List<Menu>>
|
||||
|
||||
@POST("${ApiEndpoints.ZarejestrowaneUrzadzenia}.mvc/Get")
|
||||
suspend fun getRegisteredDevices(@Body body: Any = Any()): ApiResponse<List<Device>>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getRegisteredDevices(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<List<Device>>
|
||||
|
||||
@POST("${ApiEndpoints.RejestracjaUrzadzeniaToken}.mvc/Get")
|
||||
suspend fun getToken(@Body body: Any = Any()): ApiResponse<TokenResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getToken(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<TokenResponse>
|
||||
|
||||
@POST("${ApiEndpoints.ZarejestrowaneUrzadzenia}.mvc/Delete")
|
||||
suspend fun unregisterDevice(@Body unregisterDeviceRequest: UnregisterDeviceRequest): ApiResponse<Any>
|
||||
@POST("{path}.mvc/Delete")
|
||||
suspend fun unregisterDevice(
|
||||
@Body unregisterDeviceRequest: UnregisterDeviceRequest,
|
||||
@Path("path") path: String = ApiEndpoints.ZarejestrowaneUrzadzenia,
|
||||
): ApiResponse<Any>
|
||||
|
||||
@POST("${ApiEndpoints.SzkolaINauczyciele}.mvc/Get")
|
||||
suspend fun getSchoolAndTeachers(@Body body: Any = Any()): ApiResponse<SchoolAndTeachersResponse>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getSchoolAndTeachers(
|
||||
@Body body: Any = Any(),
|
||||
@Path("path") path: String = ApiEndpoints.SzkolaINauczyciele,
|
||||
): ApiResponse<SchoolAndTeachersResponse>
|
||||
|
||||
@POST("${ApiEndpoints.Uczen}.mvc/Get")
|
||||
suspend fun getStudentInfo(): ApiResponse<StudentInfo>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getStudentInfo(
|
||||
@Path("path") path: String = ApiEndpoints.Uczen,
|
||||
): ApiResponse<StudentInfo>
|
||||
|
||||
@POST("${ApiEndpoints.UczenZdjecie}.mvc/Get")
|
||||
suspend fun getStudentPhoto(): ApiResponse<StudentPhoto>
|
||||
@POST("{path}.mvc/Get")
|
||||
suspend fun getStudentPhoto(
|
||||
@Path("path") path: String = ApiEndpoints.UczenZdjecie,
|
||||
): ApiResponse<StudentPhoto>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue