Remove pending contact state from the database.

This commit is contained in:
akwizgran
2019-05-22 11:25:05 +01:00
parent da5d442c91
commit 01ef367864
25 changed files with 286 additions and 171 deletions

View File

@@ -107,11 +107,27 @@ Until it is completed, a pending contact is returned as JSON:
{
"pendingContactId": "jsTgWcsEQ2g9rnomeK1g/hmO8M1Ix6ZIGWAjgBtlS9U=",
"alias": "ztatsaajzeegraqcizbbfftofdekclatyht",
"state": "adding_contact",
"timestamp": 1557838312175
}
```
It is possible to get a list of all pending contacts:
`GET /v1/contacts/add/pending`
This will return a JSON array of pending contacts and their states:
```json
{
"pendingContact": {
"pendingContactId": "jsTgWcsEQ2g9rnomeK1g/hmO8M1Ix6ZIGWAjgBtlS9U=",
"alias": "ztatsaajzeegraqcizbbfftofdekclatyht",
"timestamp": 1557838312175
},
"state": "adding_contact"
}
```
The state can be one of these values:
* `waiting_for_connection`
@@ -119,21 +135,16 @@ The state can be one of these values:
* `adding_contact`
* `failed`
If you want to get informed about state changes,
If you want to be informed about state changes,
you can use the Websocket API (below) to listen for events.
The following events are relevant here:
* `PendingContactAddedEvent`
* `PendingContactStateChangedEvent`
* `PendingContactRemovedEvent`
* `ContactAddedRemotelyEvent` (when the pending contact becomes an actual contact)
It is possible to get a list of all pending contacts:
`GET /v1/contacts/add/pending`
This will return a JSON array of pending contacts formatted as shown above.
To remove a pending contact and abort the process of adding it:
`DELETE /v1/contacts/add/pending`
@@ -302,6 +313,22 @@ it will send a JSON object representing the new contact to connected websocket c
}
```
### A pending contact was added
```json
{
"data": {
"pendingContact": {
"pendingContactId": "jsTgWcsEQ2g9rnomeK1g/hmO8M1Ix6ZIGWAjgBtlS9U=",
"alias": "ztatsaajzeegraqcizbbfftofdekclatyht",
"timestamp": 1557838312175
}
},
"name": "PendingContactAddedEvent",
"type": "event"
}
```
### A pending contact changed its state
```json