Fix sending messages
This commit is contained in:
parent
bb083546e0
commit
88111ea725
4 changed files with 36 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -71,3 +71,4 @@ gradle-app.setting
|
|||
*iml
|
||||
classes
|
||||
.DS_Store
|
||||
.idea/libraries-with-intellij-classes.xml
|
||||
|
|
|
@ -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}")
|
||||
|
||||
val incoming = SendMessageRequest.Incoming(
|
||||
recipients = recipients,
|
||||
subject = subject,
|
||||
content = content
|
||||
)
|
||||
|
||||
return api.sendMessage(
|
||||
sendMessageRequest = SendMessageRequest(
|
||||
SendMessageRequest.Incoming(
|
||||
recipients = recipients,
|
||||
subject = subject,
|
||||
content = content
|
||||
)
|
||||
),
|
||||
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