parent
c918ba39f4
commit
7a16f07bc8
3 changed files with 35 additions and 8 deletions
|
@ -6,8 +6,11 @@ import com.squareup.moshi.JsonClass
|
|||
@JsonClass(generateAdapter = true)
|
||||
data class SendMessageRequest(
|
||||
|
||||
@Json(name = "incoming")
|
||||
val incoming: Incoming,
|
||||
|
||||
@Json(name = "incomming")
|
||||
val incoming: Incoming
|
||||
val incomming: Incoming, // for compatibility sake
|
||||
|
||||
) {
|
||||
|
||||
|
|
|
@ -91,14 +91,15 @@ class MessagesRepository(private val api: MessagesService) {
|
|||
logger.debug("Subject length: ${subject.length}, content length: ${content.length}, recipients number: ${recipients.size}")
|
||||
val res = api.getStart()
|
||||
logger.debug("Start page length: ${res.length}")
|
||||
return api.sendMessage(
|
||||
sendMessageRequest = SendMessageRequest(
|
||||
SendMessageRequest.Incoming(
|
||||
|
||||
val incoming = SendMessageRequest.Incoming(
|
||||
recipients = recipients,
|
||||
subject = subject,
|
||||
content = content
|
||||
)
|
||||
),
|
||||
|
||||
return api.sendMessage(
|
||||
sendMessageRequest = SendMessageRequest(incoming, incoming),
|
||||
token = getScriptParam("antiForgeryToken", res).ifBlank { throw ScrapperException("Can't find antiForgeryToken property!") },
|
||||
appGuid = getScriptParam("appGuid", res),
|
||||
appVersion = getScriptParam("version", res)
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
{
|
||||
"incoming": {
|
||||
"Adresaci": [
|
||||
{
|
||||
"Id": "0",
|
||||
"Name": "Kowalski Jan",
|
||||
"IdLogin": 0,
|
||||
"UnitId": 0,
|
||||
"Role": 2,
|
||||
"Hash": "hash"
|
||||
}
|
||||
],
|
||||
"Id": 0,
|
||||
"Nadawca": {
|
||||
"Id": null,
|
||||
"Name": null,
|
||||
"IdLogin": null,
|
||||
"UnitId": null,
|
||||
"Role": null,
|
||||
"Hash": null
|
||||
},
|
||||
"Temat": "Temat wiadomości",
|
||||
"Tresc": "Tak wygląda zawartość wiadomości.\nZazwyczaj ma wiele linijek.\n\nZ poważaniem,\nNazwisko Imię"
|
||||
},
|
||||
"incomming": {
|
||||
"Adresaci": [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue