File size: 1,895 Bytes
83a59ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.httpsms

import com.beust.klaxon.Json
import com.beust.klaxon.Klaxon

data class ResponseMessage (
    val data: Message,
    val message: String,
    val status: String
) {
    companion object {
        fun fromJson(json: String) = Klaxon().parse<ResponseMessage>(json)
    }
}
data class ResponsePhone (
    val data: Phone,
    val message: String,
    val status: String,
) {
    companion object {
        fun fromJson(json: String) = Klaxon().parse<ResponsePhone>(json)
    }
}

data class Phone (
    val id: String,

    @Json(name = "user_id")
    val userID: String,
)

data class Message (
    val contact: String,
    val content: String,
    val sim: String,

    @Json(name = "created_at")
    val createdAt: String,

    @Json(name = "failure_reason")
    val failureReason: String?,

    val id: String,

    @Json(name = "last_attempted_at")
    val lastAttemptedAt: String?,

    @Json(name = "order_timestamp")
    val orderTimestamp: String,

    val owner: String,

    @Json(name = "received_at")
    val receivedAt: String?,

    val encrypted: Boolean,

    @Json(name = "request_received_at")
    val requestReceivedAt: String,

    @Json(name = "send_time")
    val sendTime: Long?,

    @Json(name = "sent_at")
    val sentAt: String?,

    val status: String,
    val type: String,

    @Json(name = "updated_at")
    val updatedAt: String,

    val attachments: List<String>? = null
)

data class ReceivedAttachment(
    val name: String,
    @Json(name = "content_type")
    val contentType: String,
    val content: String
)

data class ReceivedMessageRequest(
    val sim: String,
    val from: String,
    val to: String,
    val content: String,
    val encrypted: Boolean,
    val timestamp: String,
    val attachments: List<ReceivedAttachment>? = null
)