Skip to content

Latest commit

 

History

History
132 lines (119 loc) · 2.85 KB

APIREF-JSON.md

File metadata and controls

132 lines (119 loc) · 2.85 KB

API Reference

USERSCHATSCONTACTSFILESWEBSOCKET • JSON


A collection of JSON objects from all server responses. JSON-like notation is used for better readability - field's name quotes are omitted and placeholders for data types are used instead of concrete samples like so: <UUID> or "…" for strings. All dates are strings encoded as ISO 8601: yyyy-MM-ddTHH:mm:ss:ssZ. In the real response some fields may be omitted depending on the method called.


UserInfo:

{
   id: <Int>,
   name: "…",
   username: "…",
   about: "…",
   lastAccess: "…",
   photos: [
      <MediaInfo>,
   ],
   deviceSessions: {
      <DeviceSession>
   }
}

MediaInfo:

{
   id: <UUID>,
   fileType: "…",
   fileSize: <Int>,
   previewWidth: <Int>,
   previewHeight: <Int>,
   createdAt: "…"
}

DeviceInfo:

{
   id: <UUID>,     // locally generated UUID
   name: "…",      // f.e. "My phone"
   model: "…",
   token: "…",     // Push token (APNS or Android) obtained from OS
   transport: "…"  // "apns", "fcm" etc.
}

DeviceSession:

{
   id: <UUID>,
   accessToken: "…",
   ipAddress: "…",
   createdAt: "…",
   updatedAt: "…",
   deviceInfo: <DeviceInfo>,
}

MessageInfo:

{
   id: <UUID>,
   localId: "…",
   chatId: <UUID>,
   authorId: <Int>,
   text: "…",
   createdAt: "…",
   updatedAt: "…",
   editedAt: "…",
   deletedAt: "…",
   isVisible: <Bool>,
   attachments: [
      <MediaInfo>
   ],
   readMarks: [
      {
          id: <UUID>,
          user: <UserInfo>,
          createdAt: "…"
      }
   ]
}

ChatInfo:

{
   id: <UUID>,
   title: "…",
   isPersonal: <Bool>,
   owner: <UserInfo>,
   allUsers: [
      <UserInfo>
   ],
   addedUsers: [
      <UserInfo>
   ],
   removedUsers: [
      <UserInfo>
   ],
   lastMessage: <MessageInfo>,
   images: [
      <MediaInfo>
   ],
   isMuted: <Bool>,
   isArchived: <Bool>,
   isBlocked: <Bool>
}

ContactInfo:

{
   id: <UUID>,
   name: "…",
   isFavorite: <Bool>,
   isBlocked: <Bool>,  // not used currently
   user: <UserInfo>
}