status-go/services/mailservers
Andrea Maria Piana fd49b0140e
Move to protobuf for Message type (#1706)
* Use a single Message type `v1/message.go` and `message.go` are the same now, and they embed `protobuf.ChatMessage`

* Use `SendChatMessage` for sending chat messages, this is basically the old `Send` but a bit more flexible so we can send different message types (stickers,commands), and not just text.

* Remove dedup from services/shhext. Because now we process in status-protocol, dedup makes less sense, as those messages are going to be processed anyway, so removing for now, we can re-evaluate if bringing it to status-go or not.

* Change the various retrieveX method to a single one:
`RetrieveAll` will be processing those messages that it can process (Currently only `Message`), and return the rest in `RawMessages` (still transit). The format for the response is:
`Chats`: -> The chats updated by receiving the message
`Messages`: -> The messages retrieved (already matched to a chat)
`Contacts`: -> The contacts updated by the messages
`RawMessages` -> Anything else that can't be parsed, eventually as we move everything to status-protocol-go this will go away.
2019-12-05 17:25:34 +01:00
..
README.md add persistency for mailserver chat requests (#1598) 2019-09-06 15:02:31 +02:00
api.go add persistency for mailserver chat requests (#1598) 2019-09-06 15:02:31 +02:00
api_test.go add persistency for mailserver chat requests (#1598) 2019-09-06 15:02:31 +02:00
database.go Move to protobuf for Message type (#1706) 2019-12-05 17:25:34 +01:00
service.go Add mailservers service (#1595) 2019-09-04 08:25:33 +02:00
tcp_ping.go return rttMs as null on error 2019-11-25 21:41:51 +01:00

README.md

Mailservers Service

Mailservers service provides read/write API for Mailserver object which stores details about user's mailservers.

To enable this service, include mailservers in APIModules:

{
  "MailserversConfig": {
    "Enabled": true
  },
  "APIModules": "mailservers"
}

API

Enabling service will expose three additional methods:

mailservers_addMailserver

Stores Mailserver in the database.

{
    "id": "1",
    "name": "my mailserver",
    "address": "enode://...",
    "password": "some-pass",
    "fleet": "beta"
}

mailservers_getMailservers

Reads all saved mailservers.

mailservers_deleteMailserver

Deletes a mailserver specified by an ID.

Mailserver requests gap service

Mailserver request gaps service provides read/write API for MailserverRequestGap object which stores details about the gaps between mailserver requests.

API

The service exposes four methods

mailserverrequestgaps_addMailserverRequestGaps

Stores MailserverRequestGap in the database. All fields are specified below:

{
  "id": "1",
  "chatId": "chat-id",
  "from": 1,
  "to": 2
}

mailservers_getMailserverRequestGaps

Reads all saved mailserver request gaps by chatID.

mailservers_deleteMailserverRequestGaps

Deletes all MailserverRequestGaps specified by IDs.

mailservers_deleteMailserverRequestGapsByChatID

Deletes all MailserverRequestGaps specified by chatID.

mailservers_addMailserverTopic

Stores MailserverTopic in the database.

{
    "topic": "topic-as-string",
    "chat-ids": ["a", "list", "of", "chatIDs"],
    "last-request": 1
}

mailservers_getMailserverTopics

Reads all saved mailserver topics.

mailservers_deleteMailserverTopic

Deletes a mailserver topic using topic as an identifier.

mailservers_addChatRequestRange

Stores ChatRequestRange in the database.

{
    "chat-id": "chat-id-001",
    "lowest-request-from": 1567693421154,
    "highest-request-to": 1567693576779 
}

mailservers_getChatRequestRanges

Reads all saved chat request ranges.

mailservers_deleteChatRequestRange

Deletes a chat request range by chat-id.