6.7 KiB
API для разработчиков: связи пользователей
Документ описывает операции чтения и записи пользовательских связей.
Текущие операции:
GetFriendsListsListContactsGetUserConnectionsGraphAddCloseFriend
1. GetFriendsLists
Запрос
{
"op": "GetFriendsLists",
"requestId": "friends-001",
"payload": {
"login": "alice"
}
}
Успешный ответ
{
"op": "GetFriendsLists",
"requestId": "friends-001",
"status": 200,
"ok": true,
"payload": {
"login": "Alice",
"out_friends": ["Bob"],
"in_friends": ["Kate"]
}
}
2. ListContacts
ListContacts использует текущую авторизованную сессию. В payload нет дополнительных полей.
Запрос
{
"op": "ListContacts",
"requestId": "contacts-001",
"payload": {
}
}
Успешный ответ
{
"op": "ListContacts",
"requestId": "contacts-001",
"status": 200,
"ok": true,
"payload": {
"login": "Alice",
"dialogs": [
{
"peerLogin": "Bob",
"relationFlag": "close_friend",
"lastMessageBlobB64": "U0hpTkVfRE0B...",
"lastMessageTimeMs": 1774700000123,
"unreadCount": 2,
"hasDialog": true
},
{
"peerLogin": "Kate",
"relationFlag": "contact",
"lastMessageBlobB64": "",
"lastMessageTimeMs": 0,
"unreadCount": 0,
"hasDialog": false
},
{
"peerLogin": "Mira",
"relationFlag": "none",
"lastMessageBlobB64": "U0hpTkVfRE0B...",
"lastMessageTimeMs": 1774700000555,
"unreadCount": 1,
"hasDialog": true
}
]
}
}
Примечание
dialogsэто серверный inbox-проекционный список диалогов;relationFlagвозвращается какclose_friend,contactилиnone;- если один и тот же человек есть и в
contact, и вclose_friend, вdialogsон приходит какclose_friend. lastMessageBlobB64содержит полный signed DM block последнего контентного сообщения в base64;- для чатов без сообщений поле
lastMessageBlobB64пустое.
3. GetUserConnectionsGraph
Запрос
{
"op": "GetUserConnectionsGraph",
"requestId": "graph-001",
"payload": {
"login": "alice"
}
}
Успешный ответ
{
"op": "GetUserConnectionsGraph",
"requestId": "graph-001",
"status": 200,
"ok": true,
"payload": {
"login": "Alice",
"outFriends": ["Bob"],
"inFriends": ["Kate"],
"outContacts": [],
"inContacts": [],
"outFollows": [],
"inFollows": [],
"outSpouses": [],
"inSpouses": [],
"outParents": [],
"inParents": [],
"outChildren": [],
"inChildren": [],
"outSiblings": [],
"inSiblings": [],
"outKnownPersons": [],
"inKnownPersons": [],
"outShineConfirmed": [],
"inShineConfirmed": [],
"outShineSeen": [],
"inShineSeen": [],
"parents": [],
"children": [],
"siblings": [],
"spouses": [],
"allUsers": [
{
"login": "Bob",
"official": false,
"shine": true,
"officialLabel": "",
"shineLabel": "shine",
"avatar": { "ar": "..." }
}
]
}
}
Примечание
Поля known_person, shine_confirmed, shine_seen в UI считаются недопроверенной зоной проекта; при изменениях этой логики нужна ручная end-to-end проверка.
4. AddCloseFriend
AddCloseFriend использует текущую авторизованную сессию как источник login.
Запрос
{
"op": "AddCloseFriend",
"requestId": "close-friend-001",
"payload": {
"toLogin": "bob"
}
}
Успешный ответ
{
"op": "AddCloseFriend",
"requestId": "close-friend-001",
"status": 200,
"ok": true,
"payload": {
"login": "Alice",
"toLogin": "Bob",
"relation": "close_friend"
}
}
5. Profile relation lists (v18)
ListUserProfileRelations
Lightweight paged lists used by clickable counters in a user profile. Supported listType values:
friendsclose_friendsprimary_receivedprimary_givenshine_receivedshine_given
Request:
{
"op": "ListUserProfileRelations",
"requestId": "profile-rel-1",
"payload": { "login": "Alice", "listType": "friends", "limit": 100, "offset": 0 }
}
Each item contains a ready-to-render user card: login, firstName, lastName, avatarAr, accountRole, shineStatus, effective relationType, primaryConfirmed, shineConfirmed, plus received primary/shine confirmation counters.
Effective relation priority is close_friend > friend > contact > none. Effective 70/80 confirmations are filtered by current voting/status rules; raw blockchain connections are not deleted when temporarily ineffective.
Voting rules
- New
80requires two distinct Primary accounts (canonical signed HEADER V3,accountType=1on both sides). - New
70requires distinct logins, a Primary actor withshine=shining(legacyshine=yesis normalized), and a target withshine=shining, regardless of target account type. Turning shine off on either side temporarily removes the confirmation from effective counts; turning it back on restores qualification if the other conditions hold. - Alternative, V1/V2 and missing HEADER do not qualify. Self-confirmation does not qualify, regardless of letter case.
- Withdrawal (
81/71) may remove historical declarations; it is not a new confirmation. Ordinary friendship/contact and reactions remain available to everyone. - Archive import/replay preserves signed history without checking the current voting rights at import time. Effective graph lists, profile lists and counts all use
shine_can_confirm_primary(actor,target)/shine_can_confirm_shine(actor,target). Historical ineligible declarations remain in raw history but do not count. A change of the canonical projection or shine status may affect effective confirmations. - The declared previous accounts do not change anyone's rights or counts. No personhood analyzer is implemented yet.
ListContacts additions (v18)
Every dialog item now also carries firstName, lastName, avatarAr, accountRole, and shineStatus. relationFlag priority is now close_friend > friend > contact > none.