Add some missing API
This commit is contained in:
parent
430e388b7d
commit
32d6505e4b
26 changed files with 503 additions and 122 deletions
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
|
@ -33,6 +33,7 @@ jobs:
|
|||
- name: API changes check
|
||||
run: |
|
||||
./gradlew :sdk:apiCheck --stacktrace
|
||||
./gradlew :sdk-hebe:apiCheck --stacktrace
|
||||
./gradlew :sdk-scrapper:apiCheck --stacktrace
|
||||
- uses: codecov/codecov-action@v1
|
||||
|
||||
|
|
273
sdk-hebe/api/sdk-hebe.api
Normal file
273
sdk-hebe/api/sdk-hebe.api
Normal file
|
@ -0,0 +1,273 @@
|
|||
public final class io/github/wulkanowy/sdk/hebe/Hebe {
|
||||
public fun <init> ()V
|
||||
public final fun getBaseUrl ()Ljava/lang/String;
|
||||
public final fun getDeviceModel ()Ljava/lang/String;
|
||||
public final fun getLogLevel ()Lokhttp3/logging/HttpLoggingInterceptor$Level;
|
||||
public final fun getPrivateKey ()Ljava/lang/String;
|
||||
public final fun getSchoolSymbol ()Ljava/lang/String;
|
||||
public final fun getStudents (Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun register (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun setBaseUrl (Ljava/lang/String;)V
|
||||
public final fun setDeviceModel (Ljava/lang/String;)V
|
||||
public final fun setLogLevel (Lokhttp3/logging/HttpLoggingInterceptor$Level;)V
|
||||
public final fun setPrivateKey (Ljava/lang/String;)V
|
||||
public final fun setSchoolSymbol (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/exception/InvalidTokenException : java/io/IOException {
|
||||
public fun <init> (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/exception/UnknownTokenException : java/io/IOException {
|
||||
public fun <init> (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/RegisterResponse {
|
||||
public fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||
public final fun component1 ()I
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun copy (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/RegisterResponse;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/RegisterResponse;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/RegisterResponse;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getLoginId ()I
|
||||
public final fun getRestUrl ()Ljava/lang/String;
|
||||
public final fun getUserLogin ()Ljava/lang/String;
|
||||
public final fun getUserName ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo {
|
||||
public fun <init> (Ljava/util/List;Ljava/lang/String;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit;Ljava/util/List;ZLjava/lang/String;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Login;Ljava/lang/String;Ljava/util/List;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry;Ljava/lang/String;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit;)V
|
||||
public final fun getCapabilities ()Ljava/util/List;
|
||||
public final fun getClassDisplay ()Ljava/lang/String;
|
||||
public final fun getConstituentUnit ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit;
|
||||
public final fun getEducators ()Ljava/util/List;
|
||||
public final fun getFullSync ()Z
|
||||
public final fun getInfoDisplay ()Ljava/lang/String;
|
||||
public final fun getJournal ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal;
|
||||
public final fun getLogin ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Login;
|
||||
public final fun getPartition ()Ljava/lang/String;
|
||||
public final fun getPeriods ()Ljava/util/List;
|
||||
public final fun getPupil ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil;
|
||||
public final fun getSenderEntry ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry;
|
||||
public final fun getTopLevelPartition ()Ljava/lang/String;
|
||||
public final fun getUnit ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit {
|
||||
public fun <init> (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()I
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/lang/String;
|
||||
public final fun copy (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$ConstituentUnit;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getAddress ()Ljava/lang/String;
|
||||
public final fun getId ()I
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getPatron ()Ljava/lang/String;
|
||||
public final fun getSchoolTopic ()Ljava/lang/String;
|
||||
public final fun getShort ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator {
|
||||
public fun <init> (ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/util/List;)V
|
||||
public final fun component1 ()I
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()I
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/util/List;
|
||||
public final fun copy (ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/util/List;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator;ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getId ()I
|
||||
public final fun getInitials ()Ljava/lang/String;
|
||||
public final fun getLoginId ()I
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getRoles ()Ljava/util/List;
|
||||
public final fun getSurname ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator$Role {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component10 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/lang/String;
|
||||
public final fun component7 ()Ljava/lang/String;
|
||||
public final fun component8 ()I
|
||||
public final fun component9 ()Ljava/lang/String;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator$Role;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator$Role;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Educator$Role;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getAddress ()Ljava/lang/String;
|
||||
public final fun getAddressHash ()Ljava/lang/String;
|
||||
public final fun getClassSymbol ()Ljava/lang/String;
|
||||
public final fun getConstituentUnitSymbol ()Ljava/lang/String;
|
||||
public final fun getInitials ()Ljava/lang/String;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getRoleName ()Ljava/lang/String;
|
||||
public final fun getRoleOrder ()I
|
||||
public final fun getSurname ()Ljava/lang/String;
|
||||
public final fun getUnitSymbol ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal {
|
||||
public fun <init> (ILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;)V
|
||||
public final fun component1 ()I
|
||||
public final fun component2 ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun component3 ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun copy (ILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal;ILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Journal;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getId ()I
|
||||
public final fun getYearEnd ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun getYearStart ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Login {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()I
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/lang/String;
|
||||
public final fun component7 ()Ljava/lang/String;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Login;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Login;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Login;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getDisplayName ()Ljava/lang/String;
|
||||
public final fun getFirstName ()Ljava/lang/String;
|
||||
public final fun getId ()I
|
||||
public final fun getLoginRole ()Ljava/lang/String;
|
||||
public final fun getSecondName ()Ljava/lang/String;
|
||||
public final fun getSurname ()Ljava/lang/String;
|
||||
public final fun getValue ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Period {
|
||||
public fun <init> (ZLio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;IZIILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;)V
|
||||
public final fun component1 ()Z
|
||||
public final fun component2 ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun component3 ()I
|
||||
public final fun component4 ()Z
|
||||
public final fun component5 ()I
|
||||
public final fun component6 ()I
|
||||
public final fun component7 ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun copy (ZLio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;IZIILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Period;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Period;ZLio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;IZIILio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Period;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getCurrent ()Z
|
||||
public final fun getEnd ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public final fun getId ()I
|
||||
public final fun getLast ()Z
|
||||
public final fun getLevel ()I
|
||||
public final fun getNumber ()I
|
||||
public final fun getStart ()Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()J
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$PeriodDate;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getDate ()Ljava/lang/String;
|
||||
public final fun getDateDisplay ()Ljava/lang/String;
|
||||
public final fun getTime ()Ljava/lang/String;
|
||||
public final fun getTimestamp ()J
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil {
|
||||
public fun <init> (Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()I
|
||||
public final fun component3 ()I
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Z
|
||||
public final fun component7 ()Ljava/lang/String;
|
||||
public final fun copy (Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil;Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Pupil;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getFirstName ()Ljava/lang/String;
|
||||
public final fun getId ()I
|
||||
public final fun getLoginId ()I
|
||||
public final fun getLoginValue ()Ljava/lang/String;
|
||||
public final fun getSecondName ()Ljava/lang/String;
|
||||
public final fun getSex ()Z
|
||||
public final fun getSurname ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()I
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$SenderEntry;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getAddress ()Ljava/lang/String;
|
||||
public final fun getAddressHash ()Ljava/lang/String;
|
||||
public final fun getInitials ()Ljava/lang/String;
|
||||
public final fun getLoginId ()I
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()I
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/lang/String;
|
||||
public final fun component7 ()Ljava/lang/String;
|
||||
public final fun component8 ()Ljava/lang/String;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/hebe/register/StudentInfo$Unit;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getAddress ()Ljava/lang/String;
|
||||
public final fun getDisplayName ()Ljava/lang/String;
|
||||
public final fun getId ()I
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public final fun getPatron ()Ljava/lang/String;
|
||||
public final fun getRestUrl ()Ljava/lang/String;
|
||||
public final fun getShort ()Ljava/lang/String;
|
||||
public final fun getSymbol ()Ljava/lang/String;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
alias(libs.plugins.validator)
|
||||
id 'jacoco'
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.time.ZoneOffset.UTC
|
|||
import java.time.format.DateTimeFormatter.ofPattern
|
||||
import java.util.UUID
|
||||
|
||||
data class ApiRequest<T>(
|
||||
internal data class ApiRequest<T>(
|
||||
|
||||
@SerialName("API")
|
||||
val apiVersion: Int = 1,
|
||||
|
|
|
@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
|
|||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
class ApiResponse<T> {
|
||||
internal class ApiResponse<T> {
|
||||
|
||||
@SerialName("Envelope")
|
||||
var envelope: T? = null
|
||||
|
|
|
@ -46,10 +46,17 @@ class Hebe {
|
|||
|
||||
private val routes by resettableLazy(resettableManager) { serviceManager.getRoutesRepository() }
|
||||
|
||||
suspend fun register(privateKey: String, certificateId: String, token: String, pin: String, symbol: String): ApiResponse<RegisterResponse> {
|
||||
suspend fun register(privateKey: String, certificateId: String, firebaseToken: String, token: String, pin: String, symbol: String): RegisterResponse {
|
||||
return serviceManager
|
||||
.getRegisterRepository(routes.getRouteByToken(token), symbol)
|
||||
.registerDevice(privateKey, certificateId, deviceModel, pin, token)
|
||||
.registerDevice(
|
||||
privateKey = privateKey,
|
||||
certificateId = certificateId,
|
||||
deviceModel = deviceModel,
|
||||
firebaseToken = firebaseToken,
|
||||
pin = pin,
|
||||
token = token,
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getStudents(url: String, symbol: String): List<StudentInfo> {
|
||||
|
|
|
@ -6,7 +6,7 @@ import kotlin.reflect.KProperty
|
|||
/**
|
||||
* see https://stackoverflow.com/a/35757638/6695449
|
||||
*/
|
||||
class ResettableLazyManager {
|
||||
internal class ResettableLazyManager {
|
||||
// we synchronize to make sure the timing of a reset() call and new inits do not collide
|
||||
val managedDelegates = LinkedList<Resettable>()
|
||||
|
||||
|
@ -24,11 +24,11 @@ class ResettableLazyManager {
|
|||
}
|
||||
}
|
||||
|
||||
interface Resettable {
|
||||
internal interface Resettable {
|
||||
fun reset()
|
||||
}
|
||||
|
||||
class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: () -> PROPTYPE) : Resettable {
|
||||
internal class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: () -> PROPTYPE) : Resettable {
|
||||
@Volatile
|
||||
var lazyHolder = makeInitBlock()
|
||||
|
||||
|
@ -48,8 +48,8 @@ class ResettableLazy<PROPTYPE>(val manager: ResettableLazyManager, val init: ()
|
|||
}
|
||||
}
|
||||
|
||||
fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): ResettableLazy<PROPTYPE> {
|
||||
internal fun <PROPTYPE> resettableLazy(manager: ResettableLazyManager, init: () -> PROPTYPE): ResettableLazy<PROPTYPE> {
|
||||
return ResettableLazy(manager, init)
|
||||
}
|
||||
|
||||
fun resettableManager(): ResettableLazyManager = ResettableLazyManager()
|
||||
internal fun resettableManager(): ResettableLazyManager = ResettableLazyManager()
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.hebe.interceptor
|
|||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
|
||||
class ErrorInterceptor : Interceptor {
|
||||
internal class ErrorInterceptor : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
return chain.proceed(chain.request())
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.hebe.interceptor
|
|||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
|
||||
class SignInterceptor(private val privateKey: String) : Interceptor {
|
||||
internal class SignInterceptor(private val privateKey: String) : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
return chain.proceed(chain.request())
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.github.wulkanowy.sdk.hebe.register
|
|||
import kotlinx.serialization.SerialName
|
||||
import java.util.UUID
|
||||
|
||||
data class RegisterRequest(
|
||||
internal data class RegisterRequest(
|
||||
|
||||
@SerialName("Certificate")
|
||||
val certificate: String,
|
||||
|
@ -27,5 +27,5 @@ data class RegisterRequest(
|
|||
val securityToken: String,
|
||||
|
||||
@SerialName("SelfIdentifier")
|
||||
val selfIdentifier: String = UUID.randomUUID().toString()
|
||||
val selfIdentifier: String = UUID.randomUUID().toString(),
|
||||
)
|
||||
|
|
|
@ -7,23 +7,28 @@ import io.github.wulkanowy.sdk.hebe.register.RegisterResponse
|
|||
import io.github.wulkanowy.sdk.hebe.register.StudentInfo
|
||||
import io.github.wulkanowy.sdk.hebe.service.RegisterService
|
||||
|
||||
class RegisterRepository(private val service: RegisterService) {
|
||||
internal class RegisterRepository(private val service: RegisterService) {
|
||||
|
||||
suspend fun registerDevice(privateKey: String, certificateId: String, deviceModel: String, pin: String, token: String): ApiResponse<RegisterResponse> {
|
||||
return service.registerDevice(
|
||||
ApiRequest(
|
||||
certificateId = certificateId,
|
||||
firebaseToken = "",
|
||||
envelope = RegisterRequest(
|
||||
certificate = privateKey,
|
||||
certificateThumbprint = certificateId,
|
||||
deviceModel = deviceModel,
|
||||
pin = pin,
|
||||
securityToken = token,
|
||||
),
|
||||
suspend fun registerDevice(
|
||||
privateKey: String,
|
||||
certificateId: String,
|
||||
deviceModel: String,
|
||||
firebaseToken: String,
|
||||
pin: String,
|
||||
token: String,
|
||||
): RegisterResponse = service.registerDevice(
|
||||
ApiRequest(
|
||||
certificateId = certificateId,
|
||||
firebaseToken = firebaseToken,
|
||||
envelope = RegisterRequest(
|
||||
certificate = privateKey,
|
||||
certificateThumbprint = certificateId,
|
||||
deviceModel = deviceModel,
|
||||
pin = pin,
|
||||
securityToken = token,
|
||||
),
|
||||
)
|
||||
}
|
||||
),
|
||||
).envelope!!
|
||||
|
||||
suspend fun getStudentInfo(): List<StudentInfo> {
|
||||
return service.getStudentsInfo().envelope!!
|
||||
|
|
|
@ -13,7 +13,7 @@ import retrofit2.Retrofit
|
|||
import retrofit2.converter.scalars.ScalarsConverterFactory
|
||||
import retrofit2.create
|
||||
|
||||
class RepositoryManager(
|
||||
internal class RepositoryManager(
|
||||
private val logLevel: HttpLoggingInterceptor.Level,
|
||||
private val privateKey: String,
|
||||
private val interceptors: MutableList<Pair<Interceptor, Boolean>>,
|
||||
|
@ -32,14 +32,24 @@ class RepositoryManager(
|
|||
}
|
||||
|
||||
fun getRoutesRepository(): RoutingRulesRepository {
|
||||
return RoutingRulesRepository(getRetrofitBuilder(interceptors).baseUrl("http://komponenty.vulcan.net.pl").build().create())
|
||||
return RoutingRulesRepository(
|
||||
getRetrofitBuilder(interceptors)
|
||||
.baseUrl("http://komponenty.vulcan.net.pl")
|
||||
.build()
|
||||
.create(),
|
||||
)
|
||||
}
|
||||
|
||||
fun getRegisterRepository(baseUrl: String, symbol: String) = getRegisterRepository("${baseUrl.removeSuffix("/")}/$symbol")
|
||||
internal fun getRegisterRepository(baseUrl: String, symbol: String): RegisterRepository = getRegisterRepository(
|
||||
"${baseUrl.removeSuffix("/")}/$symbol",
|
||||
)
|
||||
|
||||
fun getRegisterRepository(baseUrl: String): RegisterRepository {
|
||||
return RegisterRepository(getRetrofitBuilder(interceptors).baseUrl("${baseUrl.removeSuffix("/")}/api/mobile/register/").build().create())
|
||||
}
|
||||
private fun getRegisterRepository(baseUrl: String): RegisterRepository = RegisterRepository(
|
||||
getRetrofitBuilder(interceptors)
|
||||
.baseUrl("${baseUrl.removeSuffix("/")}/api/mobile/register/")
|
||||
.build()
|
||||
.create(),
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private fun getRetrofitBuilder(interceptors: MutableList<Pair<Interceptor, Boolean>>): Retrofit.Builder {
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.github.wulkanowy.sdk.hebe.exception.InvalidTokenException
|
|||
import io.github.wulkanowy.sdk.hebe.exception.UnknownTokenException
|
||||
import io.github.wulkanowy.sdk.hebe.service.RoutingRulesService
|
||||
|
||||
class RoutingRulesRepository(private val api: RoutingRulesService) {
|
||||
internal class RoutingRulesRepository(private val api: RoutingRulesService) {
|
||||
|
||||
suspend fun getRouteByToken(token: String): String {
|
||||
if (token.length < 4) throw InvalidTokenException("Token '$token' is too short")
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.sdk.hebe.register.StudentInfo
|
|||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface RegisterService {
|
||||
internal interface RegisterService {
|
||||
|
||||
@POST("new")
|
||||
suspend fun registerDevice(request: ApiRequest<RegisterRequest>): ApiResponse<RegisterResponse>
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.hebe.service
|
|||
|
||||
import retrofit2.http.GET
|
||||
|
||||
interface RoutingRulesService {
|
||||
internal interface RoutingRulesService {
|
||||
|
||||
@GET("/UonetPlusMobile/RoutingRules.txt")
|
||||
suspend fun getRoutingRules(): String
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class io/github/wulkanowy/sdk/scrapper/Scrapper {
|
|||
public final fun getRecipients (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getRegisteredDevices (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getSchool (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getSchoolSymbol ()Ljava/lang/String;
|
||||
public final fun getSchoolId ()Ljava/lang/String;
|
||||
public final fun getSchoolYear ()I
|
||||
public final fun getSelfGovernments (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getSemesters (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
|
@ -89,7 +89,7 @@ public final class io/github/wulkanowy/sdk/scrapper/Scrapper {
|
|||
public final fun setLogLevel (Lokhttp3/logging/HttpLoggingInterceptor$Level;)V
|
||||
public final fun setLoginType (Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;)V
|
||||
public final fun setPassword (Ljava/lang/String;)V
|
||||
public final fun setSchoolSymbol (Ljava/lang/String;)V
|
||||
public final fun setSchoolId (Ljava/lang/String;)V
|
||||
public final fun setSchoolYear (I)V
|
||||
public final fun setSsl (Z)V
|
||||
public final fun setStudentId (I)V
|
||||
|
@ -111,6 +111,10 @@ public final class io/github/wulkanowy/sdk/scrapper/Scrapper$LoginType : java/la
|
|||
public static fun values ()[Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/scrapper/UtilsKt {
|
||||
public static final fun getNormalizedSymbol (Ljava/lang/String;)Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/scrapper/attendance/Absent {
|
||||
public fun <init> (Ljava/time/LocalDateTime;Ljava/lang/Integer;)V
|
||||
public final fun component1 ()Ljava/time/LocalDateTime;
|
||||
|
|
|
@ -109,7 +109,7 @@ class Scrapper {
|
|||
field = value
|
||||
}
|
||||
|
||||
var schoolSymbol: String = ""
|
||||
var schoolId: String = ""
|
||||
set(value) {
|
||||
if (field != value) changeManager.reset()
|
||||
field = value
|
||||
|
@ -197,7 +197,7 @@ class Scrapper {
|
|||
symbol = normalizedSymbol,
|
||||
email = email,
|
||||
password = password,
|
||||
schoolSymbol = schoolSymbol,
|
||||
schoolId = schoolId,
|
||||
studentId = studentId,
|
||||
diaryId = diaryId,
|
||||
kindergartenDiaryId = kindergartenDiaryId,
|
||||
|
|
|
@ -43,7 +43,7 @@ internal class ServiceManager(
|
|||
private val symbol: String,
|
||||
private val email: String,
|
||||
private val password: String,
|
||||
private val schoolSymbol: String,
|
||||
private val schoolId: String,
|
||||
private val studentId: Int,
|
||||
private val diaryId: Int,
|
||||
private val kindergartenDiaryId: Int,
|
||||
|
@ -65,7 +65,7 @@ internal class ServiceManager(
|
|||
}
|
||||
|
||||
val urlGenerator by lazy {
|
||||
UrlGenerator(schema, host, symbol, schoolSymbol)
|
||||
UrlGenerator(schema, host, symbol, schoolId)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
|
@ -141,7 +141,7 @@ internal class ServiceManager(
|
|||
}
|
||||
|
||||
private fun prepareStudentService(withLogin: Boolean, studentInterceptor: Boolean): OkHttpClient.Builder {
|
||||
if (withLogin && schoolSymbol.isBlank()) throw ScrapperException("School id is not set")
|
||||
if (withLogin && schoolId.isBlank()) throw ScrapperException("School id is not set")
|
||||
|
||||
val client = getClientBuilder(loginIntercept = withLogin)
|
||||
if (studentInterceptor) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class ScrapperRemoteTest : BaseTest() {
|
|||
symbol = "powiatwulkanowy"
|
||||
email = "jan@fakelog.cf"
|
||||
password = "jan123"
|
||||
schoolSymbol = "123456"
|
||||
schoolId = "123456"
|
||||
studentId = 1
|
||||
diaryId = 101
|
||||
kindergartenDiaryId = 1
|
||||
|
|
|
@ -20,7 +20,7 @@ class ScrapperTest : BaseLocalTest() {
|
|||
symbol = "Default"
|
||||
email = "jan@fakelog.cf"
|
||||
password = "jan123"
|
||||
schoolSymbol = "123456"
|
||||
schoolId = "123456"
|
||||
studentId = 1
|
||||
diaryId = 101
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class StudentStartRepositoryTest : BaseLocalTest() {
|
|||
symbol = "Default"
|
||||
email = "jan@fakelog.cf"
|
||||
password = "jan123"
|
||||
schoolSymbol = "123456"
|
||||
schoolId = "123456"
|
||||
diaryId = 101
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class ServiceManagerTest : BaseLocalTest() {
|
|||
symbol = "default",
|
||||
email = "email",
|
||||
password = "password",
|
||||
schoolSymbol = "schoolSymbol",
|
||||
schoolId = "schoolSymbol",
|
||||
studentId = 123,
|
||||
diaryId = 101,
|
||||
kindergartenDiaryId = 0,
|
||||
|
@ -61,7 +61,7 @@ class ServiceManagerTest : BaseLocalTest() {
|
|||
symbol = "default",
|
||||
email = "email",
|
||||
password = "password",
|
||||
schoolSymbol = "schoolSymbol",
|
||||
schoolId = "schoolSymbol",
|
||||
studentId = 123,
|
||||
diaryId = 101,
|
||||
kindergartenDiaryId = 0,
|
||||
|
@ -131,7 +131,7 @@ class ServiceManagerTest : BaseLocalTest() {
|
|||
symbol = "default",
|
||||
email = "email",
|
||||
password = "password",
|
||||
schoolSymbol = "schoolSymbol",
|
||||
schoolId = "schoolSymbol",
|
||||
studentId = 123,
|
||||
diaryId = 101,
|
||||
kindergartenDiaryId = 0,
|
||||
|
|
|
@ -12,6 +12,7 @@ public final class io/github/wulkanowy/sdk/Sdk {
|
|||
public final fun getAttendanceSummary (Ljava/lang/Integer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun getAttendanceSummary$default (Lio/github/wulkanowy/sdk/Sdk;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public final fun getBuildTag ()Ljava/lang/String;
|
||||
public final fun getCertKey ()Ljava/lang/String;
|
||||
public final fun getClassId ()I
|
||||
public final fun getCompletedLessons (Ljava/time/LocalDate;Ljava/time/LocalDate;ILkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun getCompletedLessons$default (Lio/github/wulkanowy/sdk/Sdk;Ljava/time/LocalDate;Ljava/time/LocalDate;ILkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
|
@ -46,10 +47,12 @@ public final class io/github/wulkanowy/sdk/Sdk {
|
|||
public final fun getMessageReplayDetails (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getMessages (Lio/github/wulkanowy/sdk/pojo/Folder;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun getMessages$default (Lio/github/wulkanowy/sdk/Sdk;Lio/github/wulkanowy/sdk/pojo/Folder;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public final fun getMobileBaseUrl ()Ljava/lang/String;
|
||||
public final fun getMode ()Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public final fun getNotes (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getPassword ()Ljava/lang/String;
|
||||
public final fun getPasswordResetCaptchaCode (Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getPrivateKey ()Ljava/lang/String;
|
||||
public final fun getReceivedMessages (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun getReceivedMessages$default (Lio/github/wulkanowy/sdk/Sdk;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public final fun getRecipients (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
|
@ -66,6 +69,9 @@ public final class io/github/wulkanowy/sdk/Sdk {
|
|||
public final fun getStudentInfo (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getStudentPhoto (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getStudentThreats (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getStudentsFromHebe (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getStudentsHybrid (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun getStudentsHybrid$default (Lio/github/wulkanowy/sdk/Sdk;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public final fun getStudentsTrips (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getSubjects (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun getSymbol ()Ljava/lang/String;
|
||||
|
@ -79,6 +85,7 @@ public final class io/github/wulkanowy/sdk/Sdk {
|
|||
public final fun sendPasswordResetRequest (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public final fun setAndroidVersion (Ljava/lang/String;)V
|
||||
public final fun setBuildTag (Ljava/lang/String;)V
|
||||
public final fun setCertKey (Ljava/lang/String;)V
|
||||
public final fun setClassId (I)V
|
||||
public final fun setDiaryId (I)V
|
||||
public final fun setEmail (Ljava/lang/String;)V
|
||||
|
@ -86,8 +93,10 @@ public final class io/github/wulkanowy/sdk/Sdk {
|
|||
public final fun setKindergartenDiaryId (I)V
|
||||
public final fun setLogLevel (Lokhttp3/logging/HttpLoggingInterceptor$Level;)V
|
||||
public final fun setLoginType (Lio/github/wulkanowy/sdk/Sdk$ScrapperLoginType;)V
|
||||
public final fun setMobileBaseUrl (Ljava/lang/String;)V
|
||||
public final fun setMode (Lio/github/wulkanowy/sdk/Sdk$Mode;)V
|
||||
public final fun setPassword (Ljava/lang/String;)V
|
||||
public final fun setPrivateKey (Ljava/lang/String;)V
|
||||
public final fun setSchoolSymbol (Ljava/lang/String;)V
|
||||
public final fun setSchoolYear (I)V
|
||||
public final fun setScrapperBaseUrl (Ljava/lang/String;)V
|
||||
|
@ -103,6 +112,7 @@ public final class io/github/wulkanowy/sdk/Sdk$Companion {
|
|||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/Sdk$Mode : java/lang/Enum {
|
||||
public static final field HEBE Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public static final field HYBRID Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public static final field SCRAPPER Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public static fun valueOf (Ljava/lang/String;)Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
|
@ -134,6 +144,10 @@ public final class io/github/wulkanowy/sdk/exception/FeatureNotAvailableExceptio
|
|||
public final class io/github/wulkanowy/sdk/exception/VulcanException : java/io/IOException {
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/mapper/StudentsMapperKt {
|
||||
public static final fun mapHebeUser (Ljava/util/List;Lio/github/wulkanowy/sdk/hebe/register/RegisterResponse;Ljava/lang/String;Ljava/lang/String;)Lio/github/wulkanowy/sdk/pojo/RegisterUser;
|
||||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/pojo/Absent {
|
||||
public fun <init> (Ljava/time/LocalDateTime;Ljava/lang/Integer;)V
|
||||
public final fun component1 ()Ljava/time/LocalDateTime;
|
||||
|
@ -898,19 +912,27 @@ public final class io/github/wulkanowy/sdk/pojo/RegisterUnit {
|
|||
}
|
||||
|
||||
public final class io/github/wulkanowy/sdk/pojo/RegisterUser {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Ljava/util/List;)V
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Lio/github/wulkanowy/sdk/Sdk$Mode;Ljava/util/List;)V
|
||||
public final fun component1 ()Ljava/lang/String;
|
||||
public final fun component2 ()Ljava/lang/String;
|
||||
public final fun component3 ()Ljava/lang/String;
|
||||
public final fun component4 ()Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;
|
||||
public final fun component5 ()Ljava/util/List;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Ljava/util/List;)Lio/github/wulkanowy/sdk/pojo/RegisterUser;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/pojo/RegisterUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Ljava/util/List;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/pojo/RegisterUser;
|
||||
public final fun component4 ()Ljava/lang/String;
|
||||
public final fun component5 ()Ljava/lang/String;
|
||||
public final fun component6 ()Ljava/lang/String;
|
||||
public final fun component7 ()Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;
|
||||
public final fun component8 ()Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public final fun component9 ()Ljava/util/List;
|
||||
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Lio/github/wulkanowy/sdk/Sdk$Mode;Ljava/util/List;)Lio/github/wulkanowy/sdk/pojo/RegisterUser;
|
||||
public static synthetic fun copy$default (Lio/github/wulkanowy/sdk/pojo/RegisterUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;Lio/github/wulkanowy/sdk/Sdk$Mode;Ljava/util/List;ILjava/lang/Object;)Lio/github/wulkanowy/sdk/pojo/RegisterUser;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getBaseUrl ()Ljava/lang/String;
|
||||
public final fun getCertificateKey ()Ljava/lang/String;
|
||||
public final fun getEmail ()Ljava/lang/String;
|
||||
public final fun getHebeBaseUrl ()Ljava/lang/String;
|
||||
public final fun getLogin ()Ljava/lang/String;
|
||||
public final fun getLoginMode ()Lio/github/wulkanowy/sdk/Sdk$Mode;
|
||||
public final fun getLoginType ()Lio/github/wulkanowy/sdk/scrapper/Scrapper$LoginType;
|
||||
public final fun getPrivateKey ()Ljava/lang/String;
|
||||
public final fun getScrapperBaseUrl ()Ljava/lang/String;
|
||||
public final fun getSymbols ()Ljava/util/List;
|
||||
public fun hashCode ()I
|
||||
public fun toString ()Ljava/lang/String;
|
||||
|
|
|
@ -12,7 +12,7 @@ import io.github.wulkanowy.sdk.mapper.mapGradePointsStatistics
|
|||
import io.github.wulkanowy.sdk.mapper.mapGradeStatistics
|
||||
import io.github.wulkanowy.sdk.mapper.mapGrades
|
||||
import io.github.wulkanowy.sdk.mapper.mapGradesSemesterStatistics
|
||||
import io.github.wulkanowy.sdk.mapper.mapHebeStudents
|
||||
import io.github.wulkanowy.sdk.mapper.mapHebeUser
|
||||
import io.github.wulkanowy.sdk.mapper.mapHomework
|
||||
import io.github.wulkanowy.sdk.mapper.mapLuckyNumbers
|
||||
import io.github.wulkanowy.sdk.mapper.mapMailboxes
|
||||
|
@ -53,6 +53,7 @@ import io.github.wulkanowy.sdk.pojo.MessageDetails
|
|||
import io.github.wulkanowy.sdk.pojo.MessageReplayDetails
|
||||
import io.github.wulkanowy.sdk.pojo.Note
|
||||
import io.github.wulkanowy.sdk.pojo.Recipient
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterStudent
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterUser
|
||||
import io.github.wulkanowy.sdk.pojo.School
|
||||
import io.github.wulkanowy.sdk.pojo.Semester
|
||||
|
@ -136,7 +137,7 @@ class Sdk {
|
|||
var schoolSymbol = ""
|
||||
set(value) {
|
||||
field = value
|
||||
scrapper.schoolSymbol = value
|
||||
scrapper.schoolId = value
|
||||
hebe.schoolSymbol = value
|
||||
}
|
||||
|
||||
|
@ -266,13 +267,21 @@ class Sdk {
|
|||
}
|
||||
}
|
||||
|
||||
suspend fun getStudentsFromHebe(token: String, pin: String, symbol: String): List<Student> {
|
||||
suspend fun getStudentsFromHebe(token: String, pin: String, symbol: String, firebaseToken: String): RegisterUser {
|
||||
val privateKey = "" // TODO
|
||||
val certificateId = "" // TODO
|
||||
|
||||
val students = hebe.register(privateKey, certificateId, token, pin, symbol)
|
||||
return hebe.getStudents(students.envelope!!.restUrl, symbol)
|
||||
.mapHebeStudents(certificateId, privateKey)
|
||||
val registerResponse = hebe.register(
|
||||
privateKey = privateKey,
|
||||
certificateId = certificateId,
|
||||
firebaseToken = firebaseToken,
|
||||
token = token,
|
||||
pin = pin,
|
||||
symbol = symbol,
|
||||
)
|
||||
return hebe
|
||||
.getStudents(registerResponse.restUrl, symbol)
|
||||
.mapHebeUser(registerResponse, certificateId, privateKey)
|
||||
}
|
||||
|
||||
suspend fun getStudentsHybrid(
|
||||
|
@ -282,36 +291,35 @@ class Sdk {
|
|||
firebaseToken: String,
|
||||
startSymbol: String = "Default",
|
||||
) = withContext(Dispatchers.IO) {
|
||||
getStudentsFromScrapper(email, password, scrapperBaseUrl, startSymbol)
|
||||
.distinctBy { it.symbol }
|
||||
.map { scrapperStudent ->
|
||||
scrapper.let {
|
||||
it.symbol = scrapperStudent.symbol
|
||||
it.schoolSymbol = scrapperStudent.schoolSymbol
|
||||
it.studentId = scrapperStudent.studentId
|
||||
val scrapperUser = getUserSubjectsFromScrapper(email, password, scrapperBaseUrl, startSymbol)
|
||||
scrapperUser.symbols
|
||||
.mapNotNull { symbol ->
|
||||
val school = symbol.schools
|
||||
.firstOrNull() ?: return@mapNotNull null
|
||||
val student = school.subjects
|
||||
.firstOrNull() as? RegisterStudent ?: return@mapNotNull null
|
||||
scrapper.also {
|
||||
it.symbol = symbol.symbol
|
||||
it.schoolId = school.schoolId
|
||||
it.studentId = student.studentId
|
||||
it.diaryId = -1
|
||||
it.classId = scrapperStudent.classId
|
||||
it.loginType = Scrapper.LoginType.valueOf(scrapperStudent.loginType.name)
|
||||
it.classId = student.classId
|
||||
it.loginType = Scrapper.LoginType.valueOf(scrapperUser.loginType!!.name)
|
||||
}
|
||||
val token = scrapper.getToken()
|
||||
getStudentsFromHebe(token.token, token.pin, token.symbol).map { student ->
|
||||
student.copy(
|
||||
loginMode = Mode.HYBRID,
|
||||
loginType = scrapperStudent.loginType,
|
||||
scrapperBaseUrl = scrapperStudent.scrapperBaseUrl,
|
||||
)
|
||||
}
|
||||
}.toList().flatten()
|
||||
}
|
||||
|
||||
suspend fun getUserSubjectsFromScrapper(email: String, password: String, scrapperBaseUrl: String, symbol: String = "Default"): RegisterUser = withContext(Dispatchers.IO) {
|
||||
scrapper.let {
|
||||
it.baseUrl = scrapperBaseUrl
|
||||
it.email = email
|
||||
it.password = password
|
||||
it.symbol = symbol
|
||||
it.getUserSubjects()
|
||||
}
|
||||
val hebeUser = getStudentsFromHebe(
|
||||
token = token.token,
|
||||
pin = token.pin,
|
||||
symbol = token.symbol,
|
||||
firebaseToken = firebaseToken,
|
||||
)
|
||||
hebeUser.copy(
|
||||
loginMode = Mode.HYBRID,
|
||||
loginType = scrapperUser.loginType,
|
||||
scrapperBaseUrl = scrapperUser.scrapperBaseUrl,
|
||||
hebeBaseUrl = hebeUser.hebeBaseUrl,
|
||||
)
|
||||
}.toList()
|
||||
}
|
||||
|
||||
suspend fun getSemesters(): List<Semester> = withContext(Dispatchers.IO) {
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
package io.github.wulkanowy.sdk.mapper
|
||||
|
||||
import io.github.wulkanowy.sdk.Sdk
|
||||
import io.github.wulkanowy.sdk.hebe.register.RegisterResponse
|
||||
import io.github.wulkanowy.sdk.hebe.register.StudentInfo
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterEmployee
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterStudent
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterSubject
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterSymbol
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterUnit
|
||||
import io.github.wulkanowy.sdk.pojo.RegisterUser
|
||||
import io.github.wulkanowy.sdk.pojo.Semester
|
||||
import io.github.wulkanowy.sdk.toLocalDate
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterEmployee as ScrapperRegisterEmploye
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterStudent as ScrapperRegisterStudent
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterSubject as ScrapperRegisterSubject
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterSymbol as SdkRegisterSymbol
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterUnit as ScrapperRegisterUnit
|
||||
import io.github.wulkanowy.sdk.scrapper.register.RegisterUser as ScrapperRegisterUser
|
||||
import io.github.wulkanowy.sdk.Sdk
|
||||
import io.github.wulkanowy.sdk.hebe.register.StudentInfo
|
||||
import io.github.wulkanowy.sdk.pojo.Student
|
||||
import io.github.wulkanowy.sdk.scrapper.register.Student as ScrapperStudent
|
||||
|
||||
internal fun ScrapperRegisterUser.mapUser(): RegisterUser = RegisterUser(
|
||||
email = email,
|
||||
login = login,
|
||||
baseUrl = baseUrl,
|
||||
scrapperBaseUrl = baseUrl,
|
||||
hebeBaseUrl = null,
|
||||
certificateKey = null,
|
||||
privateKey = null,
|
||||
loginType = loginType,
|
||||
loginMode = Sdk.Mode.SCRAPPER,
|
||||
symbols = symbols.map { it.mapSymbol() },
|
||||
)
|
||||
|
||||
internal fun SdkRegisterSymbol.mapSymbol(): RegisterSymbol = RegisterSymbol(
|
||||
symbol = symbol,
|
||||
userName = userName,
|
||||
|
@ -66,31 +72,70 @@ internal fun ScrapperRegisterStudent.mapStudent(): RegisterStudent = RegisterStu
|
|||
semesters = semesters.mapSemesters(),
|
||||
)
|
||||
|
||||
fun List<StudentInfo>.mapHebeStudents(certificateKey: String, privateKey: String): List<Student> {
|
||||
return map {
|
||||
Student(
|
||||
email = it.pupil.loginValue,
|
||||
isParent = it.login.loginRole != "Uczen",
|
||||
className = it.classDisplay,
|
||||
classId = -1,
|
||||
studentId = it.pupil.id,
|
||||
userLoginId = it.pupil.loginId,
|
||||
symbol = it.topLevelPartition,
|
||||
loginType = Sdk.ScrapperLoginType.STANDARD,
|
||||
schoolName = it.constituentUnit.name,
|
||||
schoolShortName = it.constituentUnit.short,
|
||||
schoolSymbol = it.unit.symbol,
|
||||
studentName = it.pupil.let { pupil -> "${pupil.firstName} ${pupil.surname}" },
|
||||
loginMode = Sdk.Mode.HEBE,
|
||||
scrapperBaseUrl = "",
|
||||
mobileBaseUrl = it.unit.restUrl,
|
||||
certificateKey = certificateKey,
|
||||
privateKey = privateKey,
|
||||
// todo
|
||||
userName = "",
|
||||
userLogin = "",
|
||||
studentSurname = "",
|
||||
semesters = listOf(),
|
||||
)
|
||||
}
|
||||
fun List<StudentInfo>.mapHebeUser(
|
||||
registerResponse: RegisterResponse,
|
||||
certificateKey: String,
|
||||
privateKey: String,
|
||||
): RegisterUser = RegisterUser(
|
||||
email = registerResponse.userName,
|
||||
login = registerResponse.userLogin,
|
||||
scrapperBaseUrl = null,
|
||||
loginType = null,
|
||||
loginMode = Sdk.Mode.HEBE,
|
||||
hebeBaseUrl = registerResponse.restUrl,
|
||||
certificateKey = certificateKey,
|
||||
privateKey = privateKey,
|
||||
symbols = this
|
||||
.groupBy { it.topLevelPartition }
|
||||
.mapNotNull { (symbol, students) ->
|
||||
RegisterSymbol(
|
||||
symbol = symbol,
|
||||
error = null,
|
||||
userName = students.firstOrNull()?.login?.displayName ?: return@mapNotNull null,
|
||||
schools = students.mapUnit(),
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
private fun List<StudentInfo>.mapUnit(): List<RegisterUnit> {
|
||||
return this
|
||||
.groupBy { it.unit.symbol }
|
||||
.mapNotNull { (schoolId, students) ->
|
||||
val firstStudent = students.firstOrNull() ?: return@mapNotNull null
|
||||
RegisterUnit(
|
||||
userLoginId = firstStudent.login.id,
|
||||
schoolId = schoolId,
|
||||
schoolName = firstStudent.constituentUnit.name,
|
||||
schoolShortName = firstStudent.constituentUnit.short,
|
||||
parentIds = listOf(),
|
||||
studentIds = listOf(),
|
||||
employeeIds = listOf(),
|
||||
error = null,
|
||||
subjects = students.map { student ->
|
||||
RegisterStudent(
|
||||
studentId = student.pupil.id,
|
||||
studentName = student.pupil.let { pupil -> "${pupil.firstName} ${pupil.surname}" },
|
||||
studentSecondName = student.pupil.secondName,
|
||||
studentSurname = student.pupil.surname,
|
||||
className = student.classDisplay,
|
||||
classId = -1, // todo
|
||||
isParent = student.login.loginRole != "Uczen",
|
||||
semesters = student.periods.map { period ->
|
||||
Semester(
|
||||
diaryId = student.journal.id,
|
||||
kindergartenDiaryId = 0,
|
||||
diaryName = student.classDisplay,
|
||||
schoolYear = period.start.timestamp.toLocalDate().year,
|
||||
semesterId = period.id,
|
||||
semesterNumber = period.number,
|
||||
start = period.start.timestamp.toLocalDate(),
|
||||
end = period.end.timestamp.toLocalDate(),
|
||||
classId = -1, // todo
|
||||
unitId = student.unit.id, // todo: is needed?
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package io.github.wulkanowy.sdk.pojo
|
||||
|
||||
import io.github.wulkanowy.sdk.Sdk
|
||||
import io.github.wulkanowy.sdk.scrapper.Scrapper
|
||||
|
||||
data class RegisterUser(
|
||||
val email: String,
|
||||
val login: String, // may be the same as email
|
||||
val baseUrl: String,
|
||||
val scrapperBaseUrl: String?,
|
||||
val hebeBaseUrl: String?,
|
||||
val certificateKey: String?,
|
||||
val privateKey: String?,
|
||||
val loginType: Scrapper.LoginType?,
|
||||
val loginMode: Sdk.Mode,
|
||||
val symbols: List<RegisterSymbol>,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue