Fix compilation errors
This commit is contained in:
parent
ae322f4966
commit
8d37efb8e8
9 changed files with 141 additions and 135 deletions
|
@ -4,6 +4,9 @@
|
|||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="corretto-11" />
|
||||
<option name="modules">
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package io.github.wulkanowy.sdk.hebe
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import org.threeten.bp.LocalDateTime.now
|
||||
import org.threeten.bp.ZoneOffset.UTC
|
||||
import org.threeten.bp.format.DateTimeFormatter.ofPattern
|
||||
import kotlinx.serialization.SerialName
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneOffset.UTC
|
||||
import java.time.format.DateTimeFormatter.ofPattern
|
||||
import java.util.UUID
|
||||
|
||||
data class ApiRequest<T>(
|
||||
|
||||
@SerializedName("API")
|
||||
@SerialName("API")
|
||||
val apiVersion: Int = 1,
|
||||
|
||||
@SerializedName("AppName")
|
||||
@SerialName("AppName")
|
||||
val appName: String = "DzienniczekPlus 2.0",
|
||||
|
||||
@SerializedName("AppVersion")
|
||||
@SerialName("AppVersion")
|
||||
val appVersion: String = "1.0",
|
||||
|
||||
@SerializedName("CertificateId")
|
||||
@SerialName("CertificateId")
|
||||
val certificateId: String,
|
||||
|
||||
@SerializedName("Envelope")
|
||||
@SerialName("Envelope")
|
||||
val envelope: T,
|
||||
|
||||
@SerializedName("FirebaseToken")
|
||||
@SerialName("FirebaseToken")
|
||||
val firebaseToken: String,
|
||||
|
||||
@SerializedName("RequestId")
|
||||
@SerialName("RequestId")
|
||||
val requestId: String = UUID.randomUUID().toString(),
|
||||
|
||||
@SerializedName("Timestamp")
|
||||
val timestamp: Long = now().toEpochSecond(UTC),
|
||||
@SerialName("Timestamp")
|
||||
val timestamp: Long = LocalDateTime.now().toEpochSecond(UTC),
|
||||
|
||||
@SerializedName("TimestampFormatted")
|
||||
val timestampFormatted: String = now().format(ofPattern("yyyy-MM-dd hh:mm:ss"))
|
||||
@SerialName("TimestampFormatted")
|
||||
val timestampFormatted: String = LocalDateTime.now().format(ofPattern("yyyy-MM-dd hh:mm:ss")),
|
||||
)
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
package io.github.wulkanowy.sdk.hebe.register
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.serialization.SerialName
|
||||
import java.util.UUID
|
||||
|
||||
data class RegisterRequest(
|
||||
|
||||
@SerializedName("Certificate")
|
||||
@SerialName("Certificate")
|
||||
val certificate: String,
|
||||
|
||||
@SerializedName("CertificateThumbprint")
|
||||
@SerialName("CertificateThumbprint")
|
||||
val certificateThumbprint: String,
|
||||
|
||||
@SerializedName("CertificateType")
|
||||
@SerialName("CertificateType")
|
||||
val certificateType: String = "X509",
|
||||
|
||||
@SerializedName("DeviceModel")
|
||||
@SerialName("DeviceModel")
|
||||
val deviceModel: String,
|
||||
|
||||
@SerializedName("OS")
|
||||
@SerialName("OS")
|
||||
val os: String = "Android",
|
||||
|
||||
@SerializedName("PIN")
|
||||
@SerialName("PIN")
|
||||
val pin: String,
|
||||
|
||||
@SerializedName("SecurityToken")
|
||||
@SerialName("SecurityToken")
|
||||
val securityToken: String,
|
||||
|
||||
@SerializedName("SelfIdentifier")
|
||||
@SerialName("SelfIdentifier")
|
||||
val selfIdentifier: String = UUID.randomUUID().toString()
|
||||
)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package io.github.wulkanowy.sdk.hebe.register
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
data class RegisterResponse(
|
||||
|
||||
@SerializedName("LoginId")
|
||||
@SerialName("LoginId")
|
||||
val loginId: Int,
|
||||
|
||||
@SerializedName("RestURL")
|
||||
@SerialName("RestURL")
|
||||
val restUrl: String,
|
||||
|
||||
@SerializedName("UserLogin")
|
||||
@SerialName("UserLogin")
|
||||
val userLogin: String,
|
||||
|
||||
@SerializedName("UserName")
|
||||
val userName: String
|
||||
@SerialName("UserName")
|
||||
val userName: String,
|
||||
)
|
||||
|
|
|
@ -1,265 +1,265 @@
|
|||
package io.github.wulkanowy.sdk.hebe.register
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
class StudentInfo(
|
||||
|
||||
@SerializedName("Capabilities")
|
||||
@SerialName("Capabilities")
|
||||
val capabilities: List<String>,
|
||||
|
||||
@SerializedName("ClassDisplay")
|
||||
@SerialName("ClassDisplay")
|
||||
val classDisplay: String,
|
||||
|
||||
@SerializedName("ConstituentUnit")
|
||||
@SerialName("ConstituentUnit")
|
||||
val constituentUnit: ConstituentUnit,
|
||||
|
||||
@SerializedName("Educators")
|
||||
@SerialName("Educators")
|
||||
val educators: List<Educator>,
|
||||
|
||||
@SerializedName("FullSync")
|
||||
@SerialName("FullSync")
|
||||
val fullSync: Boolean,
|
||||
|
||||
@SerializedName("InfoDisplay")
|
||||
@SerialName("InfoDisplay")
|
||||
val infoDisplay: String,
|
||||
|
||||
@SerializedName("Journal")
|
||||
@SerialName("Journal")
|
||||
val journal: Journal,
|
||||
|
||||
@SerializedName("Login")
|
||||
@SerialName("Login")
|
||||
val login: Login,
|
||||
|
||||
@SerializedName("Partition")
|
||||
@SerialName("Partition")
|
||||
val partition: String,
|
||||
|
||||
@SerializedName("Periods")
|
||||
@SerialName("Periods")
|
||||
val periods: List<Period>,
|
||||
|
||||
@SerializedName("Pupil")
|
||||
@SerialName("Pupil")
|
||||
val pupil: Pupil,
|
||||
|
||||
@SerializedName("SenderEntry")
|
||||
@SerialName("SenderEntry")
|
||||
val senderEntry: SenderEntry,
|
||||
|
||||
@SerializedName("TopLevelPartition")
|
||||
@SerialName("TopLevelPartition")
|
||||
val topLevelPartition: String,
|
||||
|
||||
@SerializedName("Unit")
|
||||
val unit: Unit
|
||||
@SerialName("Unit")
|
||||
val unit: Unit,
|
||||
) {
|
||||
|
||||
data class ConstituentUnit(
|
||||
|
||||
@SerializedName("Address")
|
||||
@SerialName("Address")
|
||||
val address: String,
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("Name")
|
||||
@SerialName("Name")
|
||||
val name: String,
|
||||
|
||||
@SerializedName("Patron")
|
||||
@SerialName("Patron")
|
||||
val patron: String,
|
||||
|
||||
@SerializedName("SchoolTopic")
|
||||
@SerialName("SchoolTopic")
|
||||
val schoolTopic: String,
|
||||
|
||||
@SerializedName("Short")
|
||||
val short: String
|
||||
@SerialName("Short")
|
||||
val short: String,
|
||||
)
|
||||
|
||||
data class Educator(
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("Initials")
|
||||
@SerialName("Initials")
|
||||
val initials: String,
|
||||
|
||||
@SerializedName("LoginId")
|
||||
@SerialName("LoginId")
|
||||
val loginId: Int,
|
||||
|
||||
@SerializedName("Name")
|
||||
@SerialName("Name")
|
||||
val name: String,
|
||||
|
||||
@SerializedName("Surname")
|
||||
@SerialName("Surname")
|
||||
val surname: String,
|
||||
|
||||
@SerializedName("Roles")
|
||||
val roles: List<Role>
|
||||
@SerialName("Roles")
|
||||
val roles: List<Role>,
|
||||
) {
|
||||
data class Role(
|
||||
|
||||
@SerializedName("Address")
|
||||
@SerialName("Address")
|
||||
val address: String,
|
||||
|
||||
@SerializedName("AddressHash")
|
||||
@SerialName("AddressHash")
|
||||
val addressHash: String,
|
||||
|
||||
@SerializedName("ClassSymbol")
|
||||
@SerialName("ClassSymbol")
|
||||
val classSymbol: String,
|
||||
|
||||
@SerializedName("ConstituentUnitSymbol")
|
||||
@SerialName("ConstituentUnitSymbol")
|
||||
val constituentUnitSymbol: String,
|
||||
|
||||
@SerializedName("Initials")
|
||||
@SerialName("Initials")
|
||||
val initials: String,
|
||||
|
||||
@SerializedName("Name")
|
||||
@SerialName("Name")
|
||||
val name: String,
|
||||
|
||||
@SerializedName("RoleName")
|
||||
@SerialName("RoleName")
|
||||
val roleName: String,
|
||||
|
||||
@SerializedName("RoleOrder")
|
||||
@SerialName("RoleOrder")
|
||||
val roleOrder: Int,
|
||||
|
||||
@SerializedName("Surname")
|
||||
@SerialName("Surname")
|
||||
val surname: String,
|
||||
|
||||
@SerializedName("UnitSymbol")
|
||||
val unitSymbol: String?
|
||||
@SerialName("UnitSymbol")
|
||||
val unitSymbol: String?,
|
||||
)
|
||||
}
|
||||
|
||||
data class Journal(
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("YearStart")
|
||||
@SerialName("YearStart")
|
||||
val yearStart: PeriodDate,
|
||||
|
||||
@SerializedName("YearEnd")
|
||||
val yearEnd: PeriodDate
|
||||
@SerialName("YearEnd")
|
||||
val yearEnd: PeriodDate,
|
||||
)
|
||||
|
||||
data class PeriodDate(
|
||||
|
||||
@SerializedName("Date")
|
||||
@SerialName("Date")
|
||||
val date: String,
|
||||
|
||||
@SerializedName("DateDisplay")
|
||||
@SerialName("DateDisplay")
|
||||
val dateDisplay: String,
|
||||
|
||||
@SerializedName("Time")
|
||||
@SerialName("Time")
|
||||
val time: String,
|
||||
|
||||
@SerializedName("Timestamp")
|
||||
val timestamp: Long
|
||||
@SerialName("Timestamp")
|
||||
val timestamp: Long,
|
||||
)
|
||||
|
||||
data class Login(
|
||||
|
||||
@SerializedName("DisplayName")
|
||||
@SerialName("DisplayName")
|
||||
val displayName: String,
|
||||
|
||||
@SerializedName("FirstName")
|
||||
@SerialName("FirstName")
|
||||
val firstName: String,
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("LoginRole")
|
||||
@SerialName("LoginRole")
|
||||
val loginRole: String,
|
||||
|
||||
@SerializedName("SecondName")
|
||||
@SerialName("SecondName")
|
||||
val secondName: String,
|
||||
|
||||
@SerializedName("Surname")
|
||||
@SerialName("Surname")
|
||||
val surname: String,
|
||||
|
||||
@SerializedName("Value")
|
||||
val value: String
|
||||
@SerialName("Value")
|
||||
val value: String,
|
||||
)
|
||||
|
||||
data class Period(
|
||||
|
||||
@SerializedName("Current")
|
||||
@SerialName("Current")
|
||||
val current: Boolean,
|
||||
|
||||
@SerializedName("End")
|
||||
@SerialName("End")
|
||||
val end: PeriodDate,
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("Last")
|
||||
@SerialName("Last")
|
||||
val last: Boolean,
|
||||
|
||||
@SerializedName("Level")
|
||||
@SerialName("Level")
|
||||
val level: Int,
|
||||
|
||||
@SerializedName("Number")
|
||||
@SerialName("Number")
|
||||
val number: Int,
|
||||
|
||||
@SerializedName("Start")
|
||||
val start: PeriodDate
|
||||
@SerialName("Start")
|
||||
val start: PeriodDate,
|
||||
)
|
||||
|
||||
data class Pupil(
|
||||
|
||||
@SerializedName("FirstName")
|
||||
@SerialName("FirstName")
|
||||
val firstName: String,
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("LoginId")
|
||||
@SerialName("LoginId")
|
||||
val loginId: Int,
|
||||
|
||||
@SerializedName("LoginValue")
|
||||
@SerialName("LoginValue")
|
||||
val loginValue: String,
|
||||
|
||||
@SerializedName("SecondName")
|
||||
@SerialName("SecondName")
|
||||
val secondName: String,
|
||||
|
||||
@SerializedName("Sex")
|
||||
@SerialName("Sex")
|
||||
val sex: Boolean,
|
||||
|
||||
@SerializedName("Surname")
|
||||
val surname: String
|
||||
@SerialName("Surname")
|
||||
val surname: String,
|
||||
)
|
||||
|
||||
data class SenderEntry(
|
||||
|
||||
@SerializedName("Address")
|
||||
@SerialName("Address")
|
||||
val address: String,
|
||||
|
||||
@SerializedName("AddressHash")
|
||||
@SerialName("AddressHash")
|
||||
val addressHash: String,
|
||||
|
||||
@SerializedName("Initials")
|
||||
@SerialName("Initials")
|
||||
val initials: String,
|
||||
|
||||
@SerializedName("LoginId")
|
||||
val loginId: Int
|
||||
@SerialName("LoginId")
|
||||
val loginId: Int,
|
||||
)
|
||||
|
||||
data class Unit(
|
||||
|
||||
@SerializedName("Address")
|
||||
@SerialName("Address")
|
||||
val address: String,
|
||||
|
||||
@SerializedName("DisplayName")
|
||||
@SerialName("DisplayName")
|
||||
val displayName: String,
|
||||
|
||||
@SerializedName("Id")
|
||||
@SerialName("Id")
|
||||
val id: Int,
|
||||
|
||||
@SerializedName("Name")
|
||||
@SerialName("Name")
|
||||
val name: String,
|
||||
|
||||
@SerializedName("Patron")
|
||||
@SerialName("Patron")
|
||||
val patron: String,
|
||||
|
||||
@SerializedName("RestURL")
|
||||
@SerialName("RestURL")
|
||||
val restUrl: String,
|
||||
|
||||
@SerializedName("Short")
|
||||
@SerialName("Short")
|
||||
val short: String,
|
||||
|
||||
@SerializedName("Symbol")
|
||||
val symbol: String
|
||||
@SerialName("Symbol")
|
||||
val symbol: String,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,22 +3,20 @@ package io.github.wulkanowy.sdk.hebe.repository
|
|||
import io.github.wulkanowy.sdk.hebe.exception.InvalidTokenException
|
||||
import io.github.wulkanowy.sdk.hebe.exception.UnknownTokenException
|
||||
import io.github.wulkanowy.sdk.hebe.service.RoutingRulesService
|
||||
import io.reactivex.Single
|
||||
|
||||
class RoutingRulesRepository(private val api: RoutingRulesService) {
|
||||
|
||||
fun getRouteByToken(token: String): Single<String> {
|
||||
if (token.length < 4) return Single.error<String>(InvalidTokenException("Token '$token' is too short"))
|
||||
suspend fun getRouteByToken(token: String): String {
|
||||
if (token.length < 4) throw InvalidTokenException("Token '$token' is too short")
|
||||
|
||||
val tokenSymbol = token.substring(0..2)
|
||||
|
||||
if ("FK1" == tokenSymbol) return Single.just("https://api.fakelog.cf")
|
||||
if ("FK1" == tokenSymbol) return "https://api.fakelog.cf"
|
||||
|
||||
return api.getRoutingRules().map { routes ->
|
||||
routes.split("\r?\n".toRegex())
|
||||
return api.getRoutingRules()
|
||||
.split("\r?\n".toRegex())
|
||||
.singleOrNull { tokenSymbol == it.substringBefore(",") }
|
||||
?.substringAfter(",")
|
||||
?: throw UnknownTokenException("This token: '$token' is unsupported")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package io.github.wulkanowy.sdk.hebe.service
|
||||
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.GET
|
||||
|
||||
interface RoutingRulesService {
|
||||
|
||||
@GET("/UonetPlusMobile/RoutingRules.txt")
|
||||
fun getRoutingRules(): Single<String>
|
||||
suspend fun getRoutingRules(): String
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@ class Sdk {
|
|||
fun switchDiary(diaryId: Int, kindergartenDiaryId: Int, schoolYear: Int): Sdk {
|
||||
return also {
|
||||
it.diaryId = diaryId
|
||||
it.kindergartenDiaryId = kindergartenDiaryId
|
||||
it.schoolYear = schoolYear
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,12 @@ fun List<StudentInfo>.mapHebeStudents(certificateKey: String, privateKey: String
|
|||
scrapperBaseUrl = "",
|
||||
mobileBaseUrl = it.unit.restUrl,
|
||||
certificateKey = certificateKey,
|
||||
privateKey = privateKey
|
||||
privateKey = privateKey,
|
||||
// todo
|
||||
userName = "",
|
||||
userLogin = "",
|
||||
studentSurname = "",
|
||||
semesters = listOf(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue