|
| 1 | +package httpsms |
| 2 | + |
| 3 | +import ( |
| 4 | + "time" |
| 5 | + |
| 6 | + "github.com/google/uuid" |
| 7 | +) |
| 8 | + |
| 9 | +// MessageSendParams is the request payload for sending a message |
| 10 | +type MessageSendParams struct { |
| 11 | + Content string `json:"content"` |
| 12 | + From string `json:"from"` |
| 13 | + RequestID string `json:"request_id,omitempty"` |
| 14 | + To string `json:"to"` |
| 15 | +} |
| 16 | + |
| 17 | +// MessageIndexParams is the payload fetching entities.Message sent between 2 numbers |
| 18 | +type MessageIndexParams struct { |
| 19 | + Skip int `json:"skip"` |
| 20 | + Contact string `json:"contact"` |
| 21 | + Owner string `json:"owner"` |
| 22 | + Query *string `json:"query"` |
| 23 | + Limit int `json:"limit"` |
| 24 | +} |
| 25 | + |
| 26 | +// MessageResponse is the response gotten with a message content |
| 27 | +type MessageResponse ApiResponse[Message] |
| 28 | + |
| 29 | +// MessagesResponse is the response with multiple messages |
| 30 | +type MessagesResponse ApiResponse[[]Message] |
| 31 | + |
| 32 | +// Message represents and incoming or outgoing SMS message |
| 33 | +type Message struct { |
| 34 | + ID uuid.UUID `json:"id" example:"32343a19-da5e-4b1b-a767-3298a73703cb"` |
| 35 | + RequestID *string `json:"request_id" example:"153554b5-ae44-44a0-8f4f-7bbac5657ad4"` |
| 36 | + Owner string `json:"owner" example:"+18005550199"` |
| 37 | + UserID string `json:"user_id" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"` |
| 38 | + Contact string `json:"contact" example:"+18005550100"` |
| 39 | + Content string `json:"content" example:"This is a sample text message"` |
| 40 | + Type string `json:"type" example:"mobile-terminated"` |
| 41 | + Status string `json:"status" example:"pending"` |
| 42 | + // SIM is the SIM card to use to send the message |
| 43 | + // * SMS1: use the SIM card in slot 1 |
| 44 | + // * SMS2: use the SIM card in slot 2 |
| 45 | + SIM string `json:"sim" example:"SIM1"` |
| 46 | + |
| 47 | + // SendDuration is the number of nanoseconds from when the request was received until when the mobile phone send the message |
| 48 | + SendDuration *int64 `json:"send_time" example:"133414"` |
| 49 | + |
| 50 | + RequestReceivedAt time.Time `json:"request_received_at" example:"2022-06-05T14:26:01.520828+03:00"` |
| 51 | + CreatedAt time.Time `json:"created_at" example:"2022-06-05T14:26:02.302718+03:00"` |
| 52 | + UpdatedAt time.Time `json:"updated_at" example:"2022-06-05T14:26:10.303278+03:00"` |
| 53 | + OrderTimestamp time.Time `json:"order_timestamp" gorm:"index:idx_messages_order_timestamp" example:"2022-06-05T14:26:09.527976+03:00"` |
| 54 | + LastAttemptedAt *time.Time `json:"last_attempted_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 55 | + NotificationScheduledAt *time.Time `json:"scheduled_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 56 | + SentAt *time.Time `json:"sent_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 57 | + DeliveredAt *time.Time `json:"delivered_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 58 | + ExpiredAt *time.Time `json:"expired_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 59 | + FailedAt *time.Time `json:"failed_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 60 | + CanBePolled bool `json:"can_be_polled" example:"false"` |
| 61 | + SendAttemptCount uint `json:"send_attempt_count" example:"0"` |
| 62 | + MaxSendAttempts uint `json:"max_send_attempts" example:"1"` |
| 63 | + ReceivedAt *time.Time `json:"received_at" example:"2022-06-05T14:26:09.527976+03:00"` |
| 64 | + FailureReason *string `json:"failure_reason" example:"UNKNOWN"` |
| 65 | +} |
0 commit comments