[API] Partially revert "Include device object in each request."

This commit is contained in:
Kuba Szczodrzyński 2020-01-20 21:34:22 +01:00
parent 3ba30ede92
commit 97e0d04842
8 changed files with 32 additions and 37 deletions

View File

@ -57,7 +57,7 @@ class SzkolnyApi(val app: App) {
private fun getDevice() = run {
val config = app.config
val device = ApiRequest.Device(
val device = Device(
osType = "Android",
osVersion = Build.VERSION.RELEASE,
hardware = "${Build.MANUFACTURER} ${Build.MODEL}",

View File

@ -1,21 +0,0 @@
/*
* Copyright (c) Kuba Szczodrzyński 2020-1-20.
*/
package pl.szczodrzynski.edziennik.data.api.szkolny.request
open class ApiRequest(
open val deviceId: String,
open val device: Device? = null
) {
data class Device(
val osType: String,
val osVersion: String,
val hardware: String,
val pushToken: String?,
val appVersion: String,
val appType: String,
val appVersionCode: Int,
val syncInterval: Int
)
}

View File

@ -5,9 +5,9 @@
package pl.szczodrzynski.edziennik.data.api.szkolny.request
data class AppUserRequest(
override val deviceId: String,
override val device: Device? = null,
val deviceId: String,
val device: Device? = null,
val action: String = "unregister",
val userCode: String
) : ApiRequest(deviceId, device)
)

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) Kuba Szczodrzyński 2020-1-20.
*/
package pl.szczodrzynski.edziennik.data.api.szkolny.request
data class Device(
val osType: String,
val osVersion: String,
val hardware: String,
val pushToken: String?,
val appVersion: String,
val appType: String,
val appVersionCode: Int,
val syncInterval: Int
)

View File

@ -5,12 +5,12 @@
package pl.szczodrzynski.edziennik.data.api.szkolny.request
data class ErrorReportRequest(
override val deviceId: String,
override val device: Device? = null,
val deviceId: String,
val device: Device? = null,
val appVersion: String,
val errors: List<Error>
) : ApiRequest(deviceId, device) {
) {
data class Error(
val id: Long,
val tag: String,

View File

@ -7,8 +7,8 @@ package pl.szczodrzynski.edziennik.data.api.szkolny.request
import pl.szczodrzynski.edziennik.data.db.full.EventFull
data class EventShareRequest (
override val deviceId: String,
override val device: Device? = null,
val deviceId: String,
val device: Device? = null,
val action: String = "event",
@ -19,4 +19,4 @@ data class EventShareRequest (
val eventId: Long? = null,
val event: EventFull? = null
) : ApiRequest(deviceId, device)
)

View File

@ -5,14 +5,14 @@
package pl.szczodrzynski.edziennik.data.api.szkolny.request
data class ServerSyncRequest(
override val deviceId: String,
override val device: Device? = null,
val deviceId: String,
val device: Device? = null,
val userCodes: List<String>,
val users: List<User>? = null,
val notifications: List<Notification>? = null
) : ApiRequest(deviceId, device) {
) {
data class User(
val userCode: String,
val studentName: String,

View File

@ -5,11 +5,11 @@
package pl.szczodrzynski.edziennik.data.api.szkolny.request
data class WebPushRequest(
override val deviceId: String,
override val device: Device? = null,
val deviceId: String,
val device: Device? = null,
val action: String,
val browserId: String? = null,
val pairToken: String? = null
) : ApiRequest(deviceId, device)
)