├── .github └── workflows │ ├── cla.yml │ └── json-schemas.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── changes.proto ├── events.proto ├── json └── models │ ├── Account.json │ ├── Block.json │ ├── BlockMetaOnly.json │ ├── ChatMessage.json │ ├── ChatState.json │ ├── Detail.json │ ├── DeviceInfo.json │ ├── Export.json │ ├── FileEncryptionKey.json │ ├── FileInfo.json │ ├── IdentityProfile.json │ ├── Import.json │ ├── InternalFlag.json │ ├── Invite.json │ ├── InvitePayload.json │ ├── Layout.json │ ├── LinkPreview.json │ ├── ManifestInfo.json │ ├── Membership.json │ ├── MembershipTierData.json │ ├── Metadata.json │ ├── Notification.json │ ├── Object.json │ ├── ObjectType.json │ ├── ObjectView.json │ ├── ParticipantPermissionChange.json │ ├── Range.json │ ├── Relation.json │ ├── RelationLink.json │ ├── RelationOptions.json │ ├── RelationWithValue.json │ ├── Relations.json │ ├── Restrictions.json │ ├── Search.json │ ├── SmartBlockSnapshotBase.json │ └── SpaceObjectHeader.json ├── models.proto └── snapshot.proto /.github/workflows/cla.yml: -------------------------------------------------------------------------------- 1 | name: "CLA Check" 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened,closed,synchronize] 7 | 8 | permissions: 9 | actions: write 10 | contents: write 11 | pull-requests: write 12 | statuses: write 13 | 14 | jobs: 15 | cla-check: 16 | uses: anyproto/open/.github/workflows/cla.yml@main 17 | secrets: inherit 18 | -------------------------------------------------------------------------------- /.github/workflows/json-schemas.yml: -------------------------------------------------------------------------------- 1 | name: "JSON Schemas" 2 | on: 3 | push: 4 | paths: 5 | - 'models.proto' 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | jobs: 11 | json-schemas: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Clone any-block 15 | uses: actions/checkout@v3 16 | with: 17 | repository: anyproto/any-block 18 | token: ${{ secrets.ANY_CLA_TOKEN }} 19 | 20 | # install go, protoc, and https://github.com/chrusty/protoc-gen-jsonschema 21 | - name: Install go 22 | uses: actions/setup-go@v4 23 | with: 24 | go-version: '1.19' 25 | 26 | - name: Install protoc 27 | run: | 28 | sudo apt-get update && sudo apt-get install -y protobuf-compiler 29 | 30 | - name: Install protoc-gen-jsonschema 31 | run: | 32 | go install github.com/chrusty/protoc-gen-jsonschema/cmd/protoc-gen-jsonschema@latest 33 | 34 | # generate json schemas 35 | - name: Generate JSON Schemas 36 | run: | 37 | mkdir -p json 38 | mkdir -p json/models 39 | protoc --jsonschema_out=./json/models --proto_path=. models.proto 40 | 41 | # commit and push changes 42 | - name: Commit and push changes 43 | run: | 44 | git config --global user.email "association@anytype.io" 45 | git config --global user.name "Any Association" 46 | git add . 47 | git commit -m "Update JSON schemas" 48 | git push origin main 49 | 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Any Association 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 19 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Any-Block 2 | Protocol describing data structures used in Anytype software. 3 | 4 | ## Description 5 | We use [Protocol Buffers](https://en.wikipedia.org/wiki/Protocol_Buffers) to efficiently describe structured data in a binary format for network communication and storage. It offers smaller message sizes and faster serialization/deserialization than JSON or XML. 6 | 7 | Protobuf facilitates data exchange between different systems written in different languages, while also providing automatic code generation for various programming languages. 8 | 9 | - `models.proto` describes the base data structures used to represent objects and their components. 10 | - `changes.proto` outlines CRDT-changes of objects and their blocks. Changes related to block updates are linked to events from `events.proto`. 11 | - `events.proto` describes the events about the changes of objects and blocks. These events are used to notify clients and also serve as CDRT changes to be stored in an object's tree. 12 | 13 | JSON Schemas are generated automatically using [protoc-gen-jsonschema](https://github.com/chrusty/protoc-gen-jsonschema). 14 | 15 | ## Contribution 16 | Thank you for your desire to develop Anytype together! 17 | 18 | ❤️ This project and everyone involved in it is governed by the [Code of Conduct](https://github.com/anyproto/.github/blob/main/docs/CODE_OF_CONDUCT.md). 19 | 20 | 🧑‍💻 Check out our [contributing guide](https://github.com/anyproto/.github/blob/main/docs/CONTRIBUTING.md) to learn about asking questions, creating issues, or submitting pull requests. 21 | 22 | 🫢 For security findings, please email [security@anytype.io](mailto:security@anytype.io) and refer to our [security guide](https://github.com/anyproto/.github/blob/main/docs/SECURITY.md) for more information. 23 | 24 | 🤝 Follow us on [Github](https://github.com/anyproto) and join the [Contributors Community](https://github.com/orgs/anyproto/discussions). 25 | 26 | --- 27 | Made by Any — a Swiss association 🇨🇭 28 | 29 | Licensed under [MIT](./LICENSE.md). -------------------------------------------------------------------------------- /changes.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package anytype; 3 | option go_package = "pb"; 4 | 5 | import "models.proto"; 6 | import "events.proto"; 7 | import "google/protobuf/struct.proto"; 8 | 9 | // the element of change tree used to store and internal apply smartBlock history 10 | message Change { 11 | // set of actions to apply 12 | repeated Content content = 3; 13 | // snapshot - when not null, the Content will be ignored 14 | Snapshot snapshot = 4; 15 | // file keys related to changes content 16 | repeated FileKeys fileKeys = 6; 17 | // creation timestamp 18 | int64 timestamp = 7; 19 | 20 | // version of business logic 21 | uint32 version = 8; 22 | 23 | message Snapshot { 24 | // logId -> lastChangeId 25 | map logHeads = 1; 26 | // snapshot data 27 | anytype.model.SmartBlockSnapshotBase data = 2; 28 | // all file keys related to doc 29 | repeated FileKeys fileKeys = 3; 30 | } 31 | 32 | message FileKeys { 33 | string hash = 1; 34 | map keys = 2; 35 | } 36 | 37 | message Content { 38 | oneof value { 39 | BlockCreate blockCreate = 1; 40 | BlockUpdate blockUpdate = 2; 41 | BlockRemove blockRemove = 3; 42 | BlockMove blockMove = 4; 43 | BlockDuplicate blockDuplicate = 5; 44 | RelationAdd relationAdd = 50; 45 | RelationRemove relationRemove = 51; 46 | DetailsSet detailsSet = 100; 47 | DetailsUnset detailsUnset = 101; 48 | 49 | ObjectTypeAdd objectTypeAdd = 105; 50 | ObjectTypeRemove objectTypeRemove = 106; 51 | StoreKeySet storeKeySet = 107; 52 | StoreKeyUnset storeKeyUnset = 108; 53 | 54 | StoreSliceUpdate storeSliceUpdate = 109; 55 | OriginalCreatedTimestampSet originalCreatedTimestampSet = 110; 56 | SetFileInfo setFileInfo = 111; 57 | NotificationCreate notificationCreate = 112; 58 | NotificationUpdate notificationUpdate = 113; 59 | 60 | DeviceAdd deviceAdd = 114; 61 | DeviceUpdate deviceUpdate = 115; 62 | } 63 | reserved 102,103,104; // old unsupported relation changes 64 | } 65 | 66 | message BlockCreate { 67 | string targetId = 1; 68 | anytype.model.Block.Position position = 2; 69 | repeated anytype.model.Block blocks = 3; 70 | } 71 | 72 | message BlockUpdate { 73 | repeated Event.Message events = 2; 74 | } 75 | 76 | message BlockRemove { 77 | repeated string ids = 1; 78 | } 79 | 80 | message BlockMove { 81 | string targetId = 1; 82 | anytype.model.Block.Position position = 2; 83 | repeated string ids = 3; 84 | } 85 | 86 | message BlockDuplicate { 87 | string targetId = 1; 88 | anytype.model.Block.Position position = 2; 89 | repeated string ids = 3; 90 | } 91 | 92 | message DetailsSet { 93 | string key = 1; 94 | google.protobuf.Value value = 2; 95 | } 96 | 97 | message DetailsUnset { 98 | string key = 1; 99 | } 100 | 101 | message RelationAdd { 102 | repeated anytype.model.RelationLink relationLinks = 1; 103 | } 104 | 105 | message RelationRemove { 106 | repeated string relationKey = 1; 107 | } 108 | 109 | message ObjectTypeAdd { 110 | string url = 1; 111 | string key = 2; 112 | } 113 | 114 | message ObjectTypeRemove { 115 | string url = 1; 116 | string key = 2; 117 | } 118 | 119 | message StoreKeySet { 120 | repeated string path = 1; 121 | google.protobuf.Value value = 2; 122 | } 123 | 124 | message StoreKeyUnset { 125 | repeated string path = 1; 126 | } 127 | 128 | message StoreSliceUpdate { 129 | string key = 1; 130 | oneof operation { 131 | Add add = 2; 132 | Remove remove = 3; 133 | Move move = 4; 134 | } 135 | 136 | message Add { 137 | string afterId = 1; 138 | repeated string ids = 2; 139 | } 140 | 141 | message Remove { 142 | repeated string ids = 1; 143 | } 144 | 145 | message Move { 146 | string afterId = 1; 147 | repeated string ids = 2; 148 | } 149 | } 150 | 151 | message OriginalCreatedTimestampSet { 152 | int64 ts = 1; 153 | } 154 | 155 | message SetFileInfo { 156 | model.FileInfo fileInfo = 1; 157 | } 158 | 159 | message NotificationCreate { 160 | anytype.model.Notification notification = 1; 161 | } 162 | 163 | message NotificationUpdate { 164 | string id = 1; 165 | anytype.model.Notification.Status status = 2; 166 | } 167 | 168 | message DeviceAdd { 169 | anytype.model.DeviceInfo device = 1; 170 | } 171 | 172 | message DeviceUpdate { 173 | string id = 1; 174 | string name = 2; 175 | } 176 | } 177 | 178 | message ChangeNoSnapshot { 179 | // set of actions to apply 180 | repeated Change.Content content = 3; 181 | // file keys related to changes content 182 | repeated Change.FileKeys fileKeys = 6; 183 | // creation timestamp 184 | int64 timestamp = 7; 185 | // version of business logic 186 | uint32 version = 8; 187 | } 188 | 189 | message StoreChange { 190 | repeated StoreChangeContent changeSet = 1; 191 | } 192 | 193 | message StoreChangeContent { 194 | oneof change { 195 | DocumentCreate create = 1; 196 | DocumentModify modify = 2; 197 | DocumentDelete delete = 3; 198 | } 199 | } 200 | 201 | message DocumentCreate { 202 | string collection = 1; 203 | string documentId = 2; 204 | // json 205 | string value = 3; 206 | } 207 | 208 | message DocumentModify { 209 | string collection = 1; 210 | string documentId = 2; 211 | repeated KeyModify keys = 4; 212 | } 213 | 214 | message KeyModify { 215 | // key path; example: [user, email] 216 | repeated string keyPath = 1; 217 | // modify op: set, unset, inc, etc. 218 | ModifyOp modifyOp = 3; 219 | // json value; example: '"new@email.com"' 220 | string modifyValue = 4; 221 | } 222 | 223 | enum ModifyOp { 224 | Set = 0; 225 | Unset = 1; 226 | Inc = 2; 227 | AddToSet = 3; 228 | Pull = 4; 229 | } 230 | 231 | message DocumentDelete { 232 | string collection = 1; 233 | string documentId = 2; 234 | } 235 | 236 | -------------------------------------------------------------------------------- /events.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package anytype; 3 | option go_package = "pb"; 4 | 5 | import "models.proto"; 6 | import "google/protobuf/struct.proto"; 7 | 8 | /* 9 | * Event – type of message, that could be sent from a middleware to the corresponding front-end. 10 | */ 11 | message Event { 12 | repeated Message messages = 1; 13 | string contextId = 2; 14 | anytype.model.Account initiator = 3; 15 | string traceId = 4; 16 | 17 | message Message { 18 | string spaceId = 132; 19 | oneof value { 20 | Account.Show accountShow = 1; 21 | Account.Details accountDetails = 201; 22 | Account.Config.Update accountConfigUpdate = 202; 23 | Account.Update accountUpdate = 203; 24 | Account.LinkChallenge accountLinkChallenge = 204; 25 | Account.LinkChallengeHide accountLinkChallengeHide = 205; 26 | 27 | Object.Details.Set objectDetailsSet = 16; 28 | Object.Details.Amend objectDetailsAmend = 50; 29 | Object.Details.Unset objectDetailsUnset = 51; 30 | Object.Relations.Amend objectRelationsAmend = 52; 31 | Object.Relations.Remove objectRelationsRemove = 53; 32 | 33 | Object.Remove objectRemove = 54; 34 | Object.Close objectClose = 65; 35 | 36 | Object.Restrictions.Set objectRestrictionsSet = 55; 37 | 38 | Object.Subscription.Add subscriptionAdd = 60; 39 | Object.Subscription.Remove subscriptionRemove = 61; 40 | Object.Subscription.Position subscriptionPosition = 62; 41 | Object.Subscription.Counters subscriptionCounters = 63; 42 | Object.Subscription.Groups subscriptionGroups = 64; 43 | 44 | Block.Add blockAdd = 2; 45 | Block.Delete blockDelete = 3; 46 | Block.FilesUpload filesUpload = 4; 47 | Block.MarksInfo marksInfo = 5; 48 | 49 | Block.Set.Fields blockSetFields = 6; 50 | Block.Set.ChildrenIds blockSetChildrenIds = 7; 51 | Block.Set.Restrictions blockSetRestrictions = 8; 52 | Block.Set.BackgroundColor blockSetBackgroundColor = 9; 53 | 54 | Block.Set.Text blockSetText = 10; 55 | Block.Set.File blockSetFile = 11; 56 | Block.Set.Link blockSetLink = 13; 57 | Block.Set.Bookmark blockSetBookmark = 14; 58 | Block.Set.Align blockSetAlign = 15; 59 | Block.Set.Div blockSetDiv = 17; 60 | Block.Set.Relation blockSetRelation = 21; 61 | Block.Set.Latex blockSetLatex = 25; 62 | Block.Set.VerticalAlign blockSetVerticalAlign = 36; 63 | Block.Set.TableRow blockSetTableRow = 37; 64 | Block.Set.Widget blockSetWidget = 40; 65 | 66 | Block.Dataview.ViewSet blockDataviewViewSet = 19; 67 | Block.Dataview.ViewDelete blockDataviewViewDelete = 20; 68 | Block.Dataview.ViewOrder blockDataviewViewOrder = 29; 69 | Block.Dataview.SourceSet blockDataviewSourceSet = 35; // deprecated, source is no longer used 70 | Block.Dataview.GroupOrderUpdate blockDataViewGroupOrderUpdate = 38; 71 | Block.Dataview.ObjectOrderUpdate blockDataViewObjectOrderUpdate = 39; 72 | Block.Dataview.RelationDelete blockDataviewRelationDelete = 124; 73 | Block.Dataview.RelationSet blockDataviewRelationSet = 123; 74 | Block.Dataview.ViewUpdate blockDataviewViewUpdate = 125; 75 | Block.Dataview.TargetObjectIdSet blockDataviewTargetObjectIdSet = 126; 76 | Block.Dataview.IsCollectionSet blockDataviewIsCollectionSet = 127; 77 | 78 | // deprecated 79 | Block.Dataview.OldRelationDelete blockDataviewOldRelationDelete = 24; 80 | // deprecated 81 | Block.Dataview.OldRelationSet blockDataviewOldRelationSet = 23; 82 | 83 | 84 | 85 | User.Block.Join userBlockJoin = 31; 86 | User.Block.Left userBlockLeft = 32; 87 | User.Block.SelectRange userBlockSelectRange = 33; 88 | User.Block.TextRange userBlockTextRange = 34; 89 | 90 | Ping ping = 100; 91 | 92 | Process.New processNew = 101; 93 | Process.Update processUpdate = 102; 94 | Process.Done processDone = 103; 95 | 96 | Status.Thread threadStatus = 110; 97 | 98 | File.LimitReached fileLimitReached = 111; 99 | File.SpaceUsage fileSpaceUsage = 112; 100 | File.LocalUsage fileLocalUsage = 113; 101 | File.LimitUpdated fileLimitUpdated = 118; 102 | 103 | Notification.Send notificationSend = 114; 104 | Notification.Update notificationUpdate = 115; 105 | 106 | Payload.Broadcast payloadBroadcast = 116; 107 | 108 | Membership.Update membershipUpdate = 117; 109 | 110 | Space.SyncStatus.Update spaceSyncStatusUpdate = 119; 111 | Space.AutoWidgetAdded spaceAutoWidgetAdded = 122; 112 | 113 | P2PStatus.Update p2pStatusUpdate = 120; 114 | 115 | Import.Finish importFinish = 121; 116 | 117 | Chat.Add chatAdd = 128; 118 | Chat.Update chatUpdate = 129; 119 | Chat.UpdateReactions chatUpdateReactions = 130; 120 | Chat.UpdateMessageReadStatus chatUpdateMessageReadStatus = 134; // received to update per-message read status (if needed to highlight the unread messages in the UI) 121 | Chat.UpdateMentionReadStatus chatUpdateMentionReadStatus = 135; // received to update per-message mention read status (if needed to highlight the unread mentions in the UI) 122 | 123 | Chat.Delete chatDelete = 131; 124 | Chat.UpdateState chatStateUpdate = 133; // in case new unread messages received or chat state changed (e.g. message read on another device) 125 | PushEncryptionKey.Update pushEncryptionKeyUpdate = 136; 126 | } 127 | } 128 | 129 | message Chat { 130 | message Add { 131 | string id = 1; 132 | string orderId = 2; 133 | string afterOrderId = 6; 134 | model.ChatMessage message = 3; 135 | repeated string subIds = 4; 136 | repeated google.protobuf.Struct dependencies = 5; 137 | } 138 | message Delete { 139 | string id = 1; 140 | repeated string subIds = 2; 141 | } 142 | message Update { 143 | string id = 1; 144 | model.ChatMessage message = 2; 145 | repeated string subIds = 3; 146 | } 147 | message UpdateReactions { 148 | string id = 1; 149 | model.ChatMessage.Reactions reactions = 2; 150 | repeated string subIds = 3; 151 | } 152 | 153 | message UpdateMessageReadStatus { 154 | repeated string ids = 1; 155 | bool isRead = 2; 156 | repeated string subIds = 3; 157 | } 158 | message UpdateMentionReadStatus { 159 | repeated string ids = 1; 160 | bool isRead = 2; 161 | repeated string subIds = 3; 162 | } 163 | 164 | message UpdateState { 165 | model.ChatState state = 1; 166 | repeated string subIds = 2; 167 | } 168 | } 169 | 170 | message Account { 171 | /** 172 | * Message, that will be sent to the front on each account found after an AccountRecoverRequest 173 | */ 174 | message Show { 175 | int32 index = 1; // Number of an account in an all found accounts list 176 | anytype.model.Account account = 2; // An Account, that has been found for the mnemonic 177 | } 178 | 179 | message Details { 180 | string profileId = 1; 181 | google.protobuf.Struct details = 2; 182 | } 183 | 184 | message Config { 185 | message Update { 186 | anytype.model.Account.Config config = 1; 187 | anytype.model.Account.Status status = 2; 188 | } 189 | } 190 | 191 | message Update { 192 | anytype.model.Account.Config config = 1; 193 | anytype.model.Account.Status status = 2; 194 | } 195 | 196 | message LinkChallenge { 197 | message ClientInfo { 198 | string processName = 1; 199 | string processPath = 2; 200 | string name = 4; 201 | bool signatureVerified = 3; 202 | } 203 | string challenge = 1; 204 | ClientInfo clientInfo = 2; 205 | model.Account.Auth.LocalApiScope scope = 3; 206 | } 207 | 208 | message LinkChallengeHide { 209 | string challenge = 1; // verify code before hiding to protect from MITM attacks 210 | } 211 | } 212 | 213 | message Object { 214 | message Details { 215 | // Amend (i.e. add a new key-value pair or update an existing key-value pair) existing state 216 | message Amend { 217 | message KeyValue { 218 | string key = 1; 219 | google.protobuf.Value value = 2; // should not be null 220 | } 221 | string id = 1; // context objectId 222 | repeated KeyValue details = 2; // slice of changed key-values 223 | repeated string subIds = 3; 224 | } 225 | 226 | // Overwrite current state 227 | message Set { 228 | string id = 1; // context objectId 229 | google.protobuf.Struct details = 2; // can not be a partial state. Should replace client details state 230 | repeated string subIds = 3; 231 | } 232 | 233 | // Unset existing detail keys 234 | message Unset { 235 | string id = 1; // context objectId 236 | repeated string keys = 2; 237 | repeated string subIds = 3; 238 | } 239 | } 240 | 241 | message Subscription { 242 | 243 | // Adds new document to subscriptions 244 | message Add { 245 | string id = 1; // object id 246 | string afterId = 2; // id of previous doc in order, empty means first 247 | string subId = 3; // subscription id 248 | } 249 | 250 | // Removes document from subscription 251 | message Remove { 252 | string id = 1; // object id 253 | string subId = 2; // subscription id 254 | } 255 | 256 | // Indicates new position of document 257 | message Position { 258 | string id = 1; // object id 259 | string afterId = 2; // id of previous doc in order, empty means first 260 | string subId = 3; // subscription id 261 | } 262 | 263 | message Counters { 264 | // total available records 265 | int64 total = 1; 266 | // how many records available after 267 | int64 nextCount = 2; 268 | // how many records available before 269 | int64 prevCount = 3; 270 | 271 | string subId = 4; // subscription id 272 | } 273 | 274 | message Groups { 275 | string subId = 1; 276 | anytype.model.Block.Content.Dataview.Group group = 2; 277 | bool remove = 3; 278 | } 279 | } 280 | 281 | message Relations { 282 | 283 | message Amend { 284 | string id = 1; // context objectId 285 | repeated anytype.model.RelationLink relationLinks = 2; 286 | } 287 | 288 | message Remove { 289 | string id = 1; // context objectId 290 | repeated string relationKeys = 2; 291 | } 292 | } 293 | 294 | 295 | message Remove { 296 | // notifies that objects were removed 297 | repeated string ids = 1; 298 | } 299 | 300 | message Restrictions { 301 | message Set { 302 | string id = 1; 303 | anytype.model.Restrictions restrictions = 2; 304 | } 305 | } 306 | 307 | message Close { 308 | string id = 1; 309 | } 310 | } 311 | message Block { 312 | /* 313 | * Event to show internal blocks on a client. 314 | * Example Scenarios 315 | * A. Block Creation 316 | * 1. Block A have been created on a client C1 317 | * 2. Client C2 receives Event.Block.Add(Block A), Event.Block.Update(Page.children) 318 | * B. Partial block load 319 | * 1. Client C1 opens Page1, that contains, for example, 133 blocks. 320 | * 2. M -> F: ShowFullScreen(Root, blocks1-50) 321 | * 3. M -> F: Block.Add(blocks51-100) 322 | * 3. M -> F: Block.Add(blocks101-133) 323 | */ 324 | message Add { 325 | repeated anytype.model.Block blocks = 1; // id -> block 326 | } 327 | 328 | /** 329 | * Middleware to front end event message, that will be sent on one of this scenarios: 330 | * Precondition: user A opened a block 331 | * 1. User A drops a set of files/pictures/videos 332 | * 2. User A creates a MediaBlock and drops a single media, that corresponds to its type. 333 | */ 334 | message FilesUpload { 335 | string blockId = 1; // if empty => create new blocks 336 | repeated string filePath = 2; // filepaths to the files 337 | } 338 | 339 | /* 340 | * 341 | */ 342 | message Delete { 343 | repeated string blockIds = 1; 344 | } 345 | 346 | message MarksInfo { 347 | repeated anytype.model.Block.Content.Text.Mark.Type marksInRange = 1; 348 | } 349 | 350 | message Set { 351 | 352 | message Relation { 353 | string id = 1; 354 | Key key = 2; 355 | message Key { 356 | string value = 1; 357 | } 358 | } 359 | 360 | message Fields { 361 | string id = 1; 362 | google.protobuf.Struct fields = 2; 363 | } 364 | 365 | message ChildrenIds { 366 | string id = 1; 367 | repeated string childrenIds = 2; 368 | } 369 | 370 | message Restrictions { 371 | string id = 1; 372 | anytype.model.Block.Restrictions restrictions = 2; 373 | } 374 | 375 | message BackgroundColor { 376 | string id = 1; 377 | string backgroundColor = 2; 378 | } 379 | 380 | message Align { 381 | string id = 1; 382 | anytype.model.Block.Align align = 2; 383 | } 384 | 385 | message VerticalAlign { 386 | string id = 1; 387 | anytype.model.Block.VerticalAlign verticalAlign = 2; 388 | } 389 | 390 | 391 | message Text { 392 | string id = 1; 393 | Text text = 2; 394 | Style style = 3; 395 | Marks marks = 4; 396 | Checked checked = 5; 397 | Color color = 6; 398 | IconEmoji iconEmoji = 7; 399 | IconImage iconImage = 8; 400 | 401 | message Text { 402 | string value = 1; 403 | } 404 | 405 | message Style { 406 | anytype.model.Block.Content.Text.Style value = 1; 407 | } 408 | 409 | message Marks { 410 | anytype.model.Block.Content.Text.Marks value = 1; 411 | } 412 | 413 | message Checked { 414 | bool value = 1; 415 | } 416 | 417 | message Color { 418 | string value = 1; 419 | } 420 | 421 | message IconEmoji { 422 | string value = 1; 423 | } 424 | 425 | message IconImage { 426 | string value = 1; 427 | } 428 | } 429 | message Latex { 430 | string id = 1; 431 | Text text = 2; 432 | message Text { 433 | string value = 1; 434 | } 435 | Processor processor = 3; 436 | message Processor { 437 | anytype.model.Block.Content.Latex.Processor value = 1; 438 | } 439 | } 440 | 441 | message Div { 442 | string id = 1; 443 | Style style = 2; 444 | 445 | message Style { 446 | anytype.model.Block.Content.Div.Style value = 1; 447 | } 448 | } 449 | 450 | 451 | message File { 452 | string id = 1; 453 | Type type = 2; 454 | State state = 3; 455 | Mime mime = 4; 456 | Hash hash = 5; 457 | Name name = 6; 458 | Size size = 7; 459 | Style style = 8; 460 | TargetObjectId targetObjectId = 9; 461 | 462 | message Name { 463 | string value = 1; 464 | } 465 | 466 | message Width { 467 | int32 value = 1; 468 | } 469 | 470 | message State { 471 | anytype.model.Block.Content.File.State value = 1; 472 | } 473 | 474 | message Type { 475 | anytype.model.Block.Content.File.Type value = 1; 476 | } 477 | 478 | message Style { 479 | anytype.model.Block.Content.File.Style value = 1; 480 | } 481 | 482 | message Hash { 483 | string value = 1; 484 | } 485 | 486 | message Mime { 487 | string value = 1; 488 | } 489 | 490 | message Size { 491 | int64 value = 1; 492 | } 493 | 494 | message TargetObjectId { 495 | string value = 1; 496 | } 497 | } 498 | 499 | 500 | message Link { 501 | string id = 1; 502 | TargetBlockId targetBlockId = 2; 503 | Style style = 3; 504 | Fields fields = 4; 505 | IconSize iconSize = 5; 506 | CardStyle cardStyle = 6; 507 | Description description = 7; 508 | Relations relations = 8; 509 | 510 | message TargetBlockId { 511 | string value = 1; 512 | } 513 | 514 | message Style { 515 | anytype.model.Block.Content.Link.Style value = 1; 516 | } 517 | 518 | message Fields { 519 | google.protobuf.Struct value = 1; 520 | } 521 | 522 | message IconSize { 523 | anytype.model.Block.Content.Link.IconSize value = 1; 524 | } 525 | 526 | message CardStyle { 527 | anytype.model.Block.Content.Link.CardStyle value = 1; 528 | } 529 | 530 | message Description { 531 | anytype.model.Block.Content.Link.Description value = 1; 532 | } 533 | 534 | message Relations { 535 | repeated string value = 1; 536 | } 537 | } 538 | 539 | message Bookmark { 540 | string id = 1; 541 | Url url = 2; 542 | Title title = 3; 543 | Description description = 4; 544 | ImageHash imageHash = 5; 545 | FaviconHash faviconHash = 6; 546 | Type type = 7; 547 | TargetObjectId targetObjectId = 8; 548 | State state = 9; 549 | 550 | message Url { 551 | string value = 1; 552 | } 553 | 554 | message Title { 555 | string value = 1; 556 | } 557 | 558 | message Description { 559 | string value = 1; 560 | } 561 | 562 | message ImageHash { 563 | string value = 1; 564 | } 565 | 566 | message FaviconHash { 567 | string value = 1; 568 | } 569 | 570 | message Type { 571 | anytype.model.LinkPreview.Type value = 1; 572 | } 573 | 574 | message TargetObjectId { 575 | string value = 1; 576 | } 577 | 578 | message State { 579 | anytype.model.Block.Content.Bookmark.State value = 1; 580 | } 581 | } 582 | 583 | message TableRow { 584 | string id = 1; 585 | IsHeader isHeader = 2; 586 | 587 | message IsHeader { 588 | bool value = 1; 589 | } 590 | } 591 | 592 | message Widget { 593 | string id = 1; 594 | Layout layout = 2; 595 | Limit limit = 3; 596 | ViewId viewId = 4; 597 | 598 | message Layout { 599 | anytype.model.Block.Content.Widget.Layout value = 1; 600 | } 601 | 602 | message Limit { 603 | int32 value = 1; 604 | } 605 | 606 | message ViewId { 607 | string value = 1; 608 | } 609 | } 610 | } 611 | 612 | message Fill { 613 | 614 | message Details { 615 | string id = 1; 616 | google.protobuf.Struct details = 2; 617 | } 618 | 619 | message DatabaseRecords { 620 | string id = 1; 621 | repeated google.protobuf.Struct records = 2; 622 | } 623 | 624 | message Fields { 625 | string id = 1; 626 | google.protobuf.Struct fields = 2; 627 | } 628 | 629 | message ChildrenIds { 630 | string id = 1; 631 | repeated string childrenIds = 2; 632 | } 633 | 634 | message Restrictions { 635 | string id = 1; 636 | anytype.model.Block.Restrictions restrictions = 2; 637 | } 638 | 639 | message BackgroundColor { 640 | string id = 1; 641 | string backgroundColor = 2; 642 | } 643 | 644 | message Align { 645 | string id = 1; 646 | anytype.model.Block.Align align = 2; 647 | } 648 | 649 | 650 | message Text { 651 | string id = 1; 652 | Text text = 2; 653 | Style style = 3; 654 | Marks marks = 4; 655 | Checked checked = 5; 656 | Color color = 6; 657 | 658 | message Text { 659 | string value = 1; 660 | } 661 | 662 | message Style { 663 | anytype.model.Block.Content.Text.Style value = 1; 664 | } 665 | 666 | message Marks { 667 | anytype.model.Block.Content.Text.Marks value = 1; 668 | } 669 | 670 | message Checked { 671 | bool value = 1; 672 | } 673 | 674 | message Color { 675 | string value = 1; 676 | } 677 | 678 | } 679 | 680 | message Div { 681 | string id = 1; 682 | Style style = 2; 683 | 684 | message Style { 685 | anytype.model.Block.Content.Div.Style value = 1; 686 | } 687 | } 688 | 689 | 690 | message File { 691 | string id = 1; 692 | Type type = 2; 693 | State state = 3; 694 | Mime mime = 4; 695 | Hash hash = 5; 696 | Name name = 6; 697 | Size size = 7; 698 | Style style = 8; 699 | 700 | message Name { 701 | string value = 1; 702 | } 703 | 704 | message Width { 705 | int32 value = 1; 706 | } 707 | 708 | message State { 709 | anytype.model.Block.Content.File.State value = 1; 710 | } 711 | 712 | message Type { 713 | anytype.model.Block.Content.File.Type value = 1; 714 | } 715 | 716 | message Style { 717 | anytype.model.Block.Content.File.Style value = 1; 718 | } 719 | 720 | message Hash { 721 | string value = 1; 722 | } 723 | 724 | message Mime { 725 | string value = 1; 726 | } 727 | 728 | message Size { 729 | int64 value = 1; 730 | } 731 | 732 | } 733 | 734 | 735 | message Link { 736 | string id = 1; 737 | TargetBlockId targetBlockId = 2; 738 | Style style = 3; 739 | Fields fields = 4; 740 | 741 | message TargetBlockId { 742 | string value = 1; 743 | } 744 | 745 | message Style { 746 | anytype.model.Block.Content.Link.Style value = 1; 747 | } 748 | 749 | message Fields { 750 | google.protobuf.Struct value = 1; 751 | } 752 | 753 | } 754 | 755 | message Bookmark { 756 | string id = 1; 757 | Url url = 2; 758 | Title title = 3; 759 | Description description = 4; 760 | ImageHash imageHash = 5; 761 | FaviconHash faviconHash = 6; 762 | Type type = 7; 763 | TargetObjectId targetObjectId = 8; 764 | 765 | 766 | message Url { 767 | string value = 1; 768 | } 769 | 770 | message Title { 771 | string value = 1; 772 | } 773 | 774 | message Description { 775 | string value = 1; 776 | } 777 | 778 | message ImageHash { 779 | string value = 1; 780 | } 781 | 782 | message FaviconHash { 783 | string value = 1; 784 | } 785 | 786 | message Type { 787 | anytype.model.LinkPreview.Type value = 1; 788 | } 789 | 790 | message TargetObjectId { 791 | string value = 1; 792 | } 793 | } 794 | } 795 | 796 | message Dataview { 797 | // sent when the view have been changed or added 798 | message ViewSet { 799 | string id = 1; // dataview block's id 800 | string viewId = 2; // view id, client should double check this to make sure client doesn't switch the active view in the middle 801 | anytype.model.Block.Content.Dataview.View view = 3; 802 | } 803 | 804 | message ViewUpdate { 805 | string id = 1; 806 | string viewId = 2; 807 | repeated Filter filter = 3; 808 | repeated Relation relation = 4; 809 | repeated Sort sort = 5; 810 | Fields fields = 6; 811 | 812 | message Fields { 813 | anytype.model.Block.Content.Dataview.View.Type type = 1; 814 | string name = 2; 815 | string coverRelationKey = 3; // Relation used for cover in gallery 816 | bool hideIcon = 4; // Hide icon near name 817 | anytype.model.Block.Content.Dataview.View.Size cardSize = 5; // Gallery card size 818 | bool coverFit = 6; // Image fits container 819 | string groupRelationKey = 7; // Group view by this relationKey 820 | string endRelationKey = 16; 821 | bool groupBackgroundColors = 8; // Enable backgrounds in groups 822 | int32 pageLimit = 9; // Limit of objects shown in widget 823 | string defaultTemplateId = 10; // Id of template object set default for the view 824 | string defaultObjectTypeId = 15; // Default object type that is chosen for new object created within the view 825 | } 826 | 827 | message Filter { 828 | oneof operation { 829 | Add add = 1; 830 | Remove remove = 2; 831 | Update update = 3; 832 | Move move = 4; 833 | } 834 | 835 | message Add { 836 | string afterId = 1; 837 | repeated anytype.model.Block.Content.Dataview.Filter items = 2; 838 | } 839 | message Remove { 840 | repeated string ids = 1; 841 | } 842 | message Update { 843 | string id = 1; 844 | anytype.model.Block.Content.Dataview.Filter item = 2; 845 | } 846 | message Move { 847 | string afterId = 1; 848 | repeated string ids = 2; 849 | } 850 | } 851 | 852 | message Relation { 853 | oneof operation { 854 | Add add = 1; 855 | Remove remove = 2; 856 | Update update = 3; 857 | Move move = 4; 858 | } 859 | 860 | message Add { 861 | string afterId = 1; 862 | repeated anytype.model.Block.Content.Dataview.Relation items = 2; 863 | } 864 | message Remove { 865 | repeated string ids = 1; 866 | } 867 | message Update { 868 | string id = 1; 869 | anytype.model.Block.Content.Dataview.Relation item = 2; 870 | } 871 | message Move { 872 | string afterId = 1; 873 | repeated string ids = 2; 874 | } 875 | } 876 | 877 | message Sort { 878 | oneof operation { 879 | Add add = 1; 880 | Remove remove = 2; 881 | Update update = 3; 882 | Move move = 4; 883 | } 884 | 885 | message Add { 886 | string afterId = 1; 887 | repeated anytype.model.Block.Content.Dataview.Sort items = 2; 888 | } 889 | message Remove { 890 | repeated string ids = 1; 891 | } 892 | message Update { 893 | string id = 1; 894 | anytype.model.Block.Content.Dataview.Sort item = 2; 895 | } 896 | message Move { 897 | string afterId = 1; 898 | repeated string ids = 2; 899 | } 900 | } 901 | } 902 | 903 | message ViewDelete { 904 | string id = 1; // dataview block's id 905 | string viewId = 2; // view id to remove 906 | } 907 | 908 | 909 | message ViewOrder { 910 | string id = 1; // dataview block's id 911 | repeated string viewIds = 2; // view ids in new order 912 | } 913 | 914 | message SourceSet { 915 | string id = 1; // dataview block's id 916 | repeated string source = 2; 917 | } 918 | 919 | message OldRelationDelete { 920 | string id = 1; // dataview block's id 921 | string relationKey = 2; // relation key to remove 922 | } 923 | 924 | // sent when the dataview relation has been changed or added 925 | message OldRelationSet { 926 | string id = 1; // dataview block's id 927 | string relationKey = 2; // relation key to update 928 | anytype.model.Relation relation = 3; 929 | } 930 | 931 | message RelationDelete { 932 | string id = 1; // dataview block's id 933 | repeated string relationKeys = 2; // relation key to remove 934 | } 935 | 936 | // sent when the dataview relation has been changed or added 937 | message RelationSet { 938 | string id = 1; // dataview block's id 939 | repeated anytype.model.RelationLink relationLinks = 2; // relation id to update 940 | } 941 | 942 | message GroupOrderUpdate { 943 | string id = 1; // dataview block's id 944 | anytype.model.Block.Content.Dataview.GroupOrder groupOrder = 2; 945 | } 946 | 947 | message ObjectOrderUpdate { 948 | string id = 1; // dataview block's id 949 | string viewId = 2; 950 | string groupId = 3; 951 | repeated SliceChange sliceChanges = 4; 952 | } 953 | 954 | message SliceChange { 955 | SliceOperation op = 1; 956 | repeated string ids = 2; 957 | string afterId = 3; 958 | } 959 | 960 | enum SliceOperation { 961 | SliceOperationNone = 0; // not used 962 | SliceOperationAdd = 1; 963 | SliceOperationMove = 2; 964 | SliceOperationRemove = 3; 965 | SliceOperationReplace = 4; 966 | } 967 | 968 | message TargetObjectIdSet { 969 | string id = 1; // dataview block's id 970 | string targetObjectId = 2; 971 | } 972 | 973 | message IsCollectionSet { 974 | string id = 1; // dataview block's id 975 | bool value = 2; 976 | } 977 | } 978 | } 979 | 980 | message User { 981 | message Block { 982 | 983 | /** 984 | * Middleware to front end event message, that will be sent in this scenario: 985 | * Precondition: user A opened a block 986 | * 1. User B opens the same block 987 | * 2. User A receives a message about p.1 988 | */ 989 | message Join { 990 | Account account = 1; // Account of the user, that opened a block 991 | } 992 | 993 | /** 994 | * Middleware to front end event message, that will be sent in this scenario: 995 | * Precondition: user A and user B opened the same block 996 | * 1. User B closes the block 997 | * 2. User A receives a message about p.1 998 | */ 999 | message Left { 1000 | Account account = 1; // Account of the user, that left the block 1001 | } 1002 | 1003 | /** 1004 | * Middleware to front end event message, that will be sent in this scenario: 1005 | * Precondition: user A and user B opened the same block 1006 | * 1. User B sets cursor or selects a text region into a text block 1007 | * 2. User A receives a message about p.1 1008 | */ 1009 | message TextRange { 1010 | Account account = 1; // Account of the user, that selected a text 1011 | string blockId = 2; // Id of the text block, that have a selection 1012 | anytype.model.Range range = 3; // Range of the selection 1013 | } 1014 | 1015 | /** 1016 | * Middleware to front end event message, that will be sent in this scenario: 1017 | * Precondition: user A and user B opened the same block 1018 | * 1. User B selects some inner blocks 1019 | * 2. User A receives a message about p.1 1020 | */ 1021 | message SelectRange { 1022 | Account account = 1; // Account of the user, that selected blocks 1023 | repeated string blockIdsArray = 2; // Ids of selected blocks. 1024 | } 1025 | } 1026 | } 1027 | 1028 | message Ping { 1029 | int32 index = 1; 1030 | } 1031 | 1032 | message Process { 1033 | message New { 1034 | Model.Process process = 1; 1035 | } 1036 | message Update { 1037 | Model.Process process = 1; 1038 | } 1039 | message Done { 1040 | Model.Process process = 1; 1041 | } 1042 | } 1043 | 1044 | message Status { 1045 | message Thread { 1046 | Summary summary = 1; 1047 | Cafe cafe = 2; 1048 | repeated Account accounts = 3; 1049 | 1050 | message Summary { 1051 | SyncStatus status = 1; 1052 | } 1053 | 1054 | message Cafe { 1055 | SyncStatus status = 1; 1056 | int64 lastPulled = 2; 1057 | bool lastPushSucceed = 3; 1058 | PinStatus files = 4; 1059 | 1060 | message PinStatus { 1061 | int32 pinning = 1; 1062 | int32 pinned = 2; 1063 | int32 failed = 3; 1064 | int64 updated = 4; 1065 | } 1066 | } 1067 | 1068 | message Account { 1069 | string id = 1; 1070 | string name = 2; 1071 | string imageHash = 3; 1072 | bool online = 4; 1073 | int64 lastPulled = 5; 1074 | int64 lastEdited = 6; 1075 | repeated Device devices = 7; 1076 | } 1077 | 1078 | message Device { 1079 | string name = 1; 1080 | bool online = 2; 1081 | int64 lastPulled = 3; 1082 | int64 lastEdited = 4; 1083 | } 1084 | 1085 | enum SyncStatus { 1086 | Unknown = 0; 1087 | Offline = 1; 1088 | Syncing = 2; 1089 | Synced = 3; 1090 | Failed = 4; 1091 | IncompatibleVersion = 5; 1092 | NetworkNeedsUpdate = 6; 1093 | } 1094 | } 1095 | } 1096 | 1097 | message File { 1098 | message LimitReached { 1099 | string spaceId = 1; 1100 | string fileId = 2; 1101 | } 1102 | 1103 | message SpaceUsage { 1104 | uint64 bytesUsage = 1; 1105 | string spaceId = 2; 1106 | } 1107 | 1108 | message LocalUsage { 1109 | uint64 localBytesUsage = 1; 1110 | } 1111 | 1112 | message LimitUpdated { 1113 | uint64 bytesLimit = 1; 1114 | } 1115 | } 1116 | 1117 | message Membership { 1118 | message Update { 1119 | anytype.model.Membership data = 1; 1120 | } 1121 | } 1122 | 1123 | message Notification { 1124 | message Send { 1125 | anytype.model.Notification notification = 1; 1126 | } 1127 | message Update { 1128 | anytype.model.Notification notification = 1; 1129 | } 1130 | } 1131 | 1132 | message Payload { 1133 | message Broadcast { 1134 | string payload = 1; 1135 | } 1136 | } 1137 | 1138 | message Space { 1139 | message SyncStatus { 1140 | message Update { 1141 | string id = 1; 1142 | Status status = 2; 1143 | Network network = 3; 1144 | SyncError error = 4; 1145 | int64 syncingObjectsCounter = 5; 1146 | } 1147 | } 1148 | enum Status { 1149 | Synced = 0; 1150 | Syncing = 1; 1151 | Error = 2; 1152 | Offline = 3; 1153 | NetworkNeedsUpdate = 4; 1154 | } 1155 | enum Network { 1156 | Anytype = 0; 1157 | SelfHost = 1; 1158 | LocalOnly = 2; 1159 | } 1160 | enum SyncError { 1161 | Null = 0; 1162 | StorageLimitExceed = 1; 1163 | IncompatibleVersion = 2; 1164 | NetworkError = 3; 1165 | } 1166 | 1167 | message AutoWidgetAdded { 1168 | string targetId = 1; 1169 | string targetName = 2; // pluralName (if exists) for types, fallback to name. Special cases for "bin" and "favorites" 1170 | string widgetBlockId = 3; 1171 | } 1172 | } 1173 | message P2PStatus { 1174 | message Update { 1175 | string spaceId = 1; 1176 | Status status = 2; 1177 | int64 devicesCounter = 3; 1178 | } 1179 | 1180 | enum Status { 1181 | NotConnected = 0; 1182 | NotPossible = 1; 1183 | Connected = 2; 1184 | Restricted = 3; // only for ios for now, fallback to NotPossible if not implemented on client 1185 | } 1186 | } 1187 | 1188 | message Import { 1189 | message Finish { 1190 | string rootCollectionID = 1; 1191 | int64 objectsCount = 2; 1192 | model.Import.Type importType = 3; 1193 | } 1194 | } 1195 | 1196 | message PushEncryptionKey { 1197 | message Update { 1198 | string encryptionKeyId = 1; 1199 | string encryptionKey = 2; 1200 | } 1201 | } 1202 | } 1203 | 1204 | message ResponseEvent { 1205 | repeated Event.Message messages = 1; 1206 | string contextId = 2; 1207 | string traceId = 4; 1208 | } 1209 | 1210 | message Model { 1211 | message Process { 1212 | string id = 1; 1213 | State state = 3; 1214 | Progress progress = 4; 1215 | string spaceId = 5; 1216 | 1217 | oneof message { 1218 | DropFiles dropFiles = 6; 1219 | Import import= 7; 1220 | Export export= 8; 1221 | SaveFile saveFile = 9; 1222 | Migration migration = 10; 1223 | } 1224 | 1225 | string error = 11; 1226 | message DropFiles {} 1227 | message Import {} 1228 | message Export {} 1229 | message SaveFile {} 1230 | message Migration {} 1231 | 1232 | enum State { 1233 | None = 0; 1234 | Running = 1; 1235 | Done = 2; 1236 | Canceled = 3; 1237 | Error = 4; 1238 | } 1239 | 1240 | message Progress { 1241 | int64 total = 1; 1242 | int64 done = 2; 1243 | string message = 3; 1244 | } 1245 | } 1246 | } 1247 | -------------------------------------------------------------------------------- /json/models/Account.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Account", 4 | "definitions": { 5 | "Account": { 6 | "properties": { 7 | "id": { 8 | "type": "string", 9 | "description": "User's thread id" 10 | }, 11 | "config": { 12 | "$ref": "#/definitions/anytype.model.Account.Config", 13 | "additionalProperties": true 14 | }, 15 | "status": { 16 | "$ref": "#/definitions/anytype.model.Account.Status", 17 | "additionalProperties": true 18 | }, 19 | "info": { 20 | "$ref": "#/definitions/anytype.model.Account.Info", 21 | "additionalProperties": true 22 | } 23 | }, 24 | "additionalProperties": true, 25 | "type": "object", 26 | "title": "Account", 27 | "description": "* Contains basic information about a user account" 28 | }, 29 | "anytype.model.Account.Config": { 30 | "properties": { 31 | "enableDataview": { 32 | "type": "boolean" 33 | }, 34 | "enableDebug": { 35 | "type": "boolean" 36 | }, 37 | "enablePrereleaseChannel": { 38 | "type": "boolean" 39 | }, 40 | "enableSpaces": { 41 | "type": "boolean" 42 | }, 43 | "extra": { 44 | "additionalProperties": true, 45 | "type": "object" 46 | } 47 | }, 48 | "additionalProperties": true, 49 | "type": "object", 50 | "title": "Config" 51 | }, 52 | "anytype.model.Account.Info": { 53 | "properties": { 54 | "homeObjectId": { 55 | "type": "string", 56 | "description": "home dashboard block id" 57 | }, 58 | "archiveObjectId": { 59 | "type": "string", 60 | "description": "archive block id" 61 | }, 62 | "profileObjectId": { 63 | "type": "string", 64 | "description": "profile block id" 65 | }, 66 | "marketplaceWorkspaceId": { 67 | "type": "string", 68 | "description": "marketplace workspace id" 69 | }, 70 | "workspaceObjectId": { 71 | "type": "string", 72 | "description": "workspace object id. used for space-level chat" 73 | }, 74 | "deviceId": { 75 | "type": "string" 76 | }, 77 | "accountSpaceId": { 78 | "type": "string", 79 | "description": "the first created private space. It's filled only when account is created" 80 | }, 81 | "widgetsId": { 82 | "type": "string" 83 | }, 84 | "spaceViewId": { 85 | "type": "string" 86 | }, 87 | "techSpaceId": { 88 | "type": "string" 89 | }, 90 | "gatewayUrl": { 91 | "type": "string", 92 | "description": "gateway url for fetching static files" 93 | }, 94 | "localStoragePath": { 95 | "type": "string", 96 | "description": "path to local storage" 97 | }, 98 | "timeZone": { 99 | "type": "string", 100 | "description": "time zone from config" 101 | }, 102 | "analyticsId": { 103 | "type": "string" 104 | }, 105 | "networkId": { 106 | "type": "string", 107 | "description": "network id to which anytype is connected" 108 | }, 109 | "ethereumAddress": { 110 | "type": "string", 111 | "description": "we have Any PK AND Ethereum PK derived from one seed phrase" 112 | } 113 | }, 114 | "additionalProperties": true, 115 | "type": "object", 116 | "title": "Info" 117 | }, 118 | "anytype.model.Account.Status": { 119 | "properties": { 120 | "statusType": { 121 | "enum": [ 122 | "Active", 123 | 0, 124 | "PendingDeletion", 125 | 1, 126 | "StartedDeletion", 127 | 2, 128 | "Deleted", 129 | 3 130 | ], 131 | "oneOf": [ 132 | { 133 | "type": "string" 134 | }, 135 | { 136 | "type": "integer" 137 | } 138 | ], 139 | "title": "Status Type" 140 | }, 141 | "deletionDate": { 142 | "type": "string" 143 | } 144 | }, 145 | "additionalProperties": true, 146 | "type": "object", 147 | "title": "Status" 148 | } 149 | } 150 | } -------------------------------------------------------------------------------- /json/models/BlockMetaOnly.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/BlockMetaOnly", 4 | "definitions": { 5 | "BlockMetaOnly": { 6 | "properties": { 7 | "id": { 8 | "type": "string" 9 | }, 10 | "fields": { 11 | "additionalProperties": true, 12 | "type": "object" 13 | } 14 | }, 15 | "additionalProperties": true, 16 | "type": "object", 17 | "title": "Block Meta Only", 18 | "description": "Used to decode block meta only, without the content itself" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /json/models/ChatMessage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/ChatMessage", 4 | "definitions": { 5 | "ChatMessage": { 6 | "properties": { 7 | "id": { 8 | "type": "string", 9 | "description": "Unique message identifier" 10 | }, 11 | "orderId": { 12 | "type": "string", 13 | "description": "Lexicographical id for message in order of tree traversal" 14 | }, 15 | "creator": { 16 | "type": "string", 17 | "description": "Identifier for the message creator" 18 | }, 19 | "createdAt": { 20 | "type": "string" 21 | }, 22 | "modifiedAt": { 23 | "type": "string" 24 | }, 25 | "stateId": { 26 | "type": "string", 27 | "description": "stateId is ever-increasing id (BSON ObjectId) for this message. Unlike orderId, this ID is ordered by the time messages are added. For example, it's useful to prevent accidental reading of messages from the past when a ChatReadMessages request is sent: a message from the past may appear, but the client is still unaware of it" 28 | }, 29 | "replyToMessageId": { 30 | "type": "string", 31 | "description": "Identifier for the message being replied to" 32 | }, 33 | "message": { 34 | "$ref": "#/definitions/anytype.model.ChatMessage.MessageContent", 35 | "additionalProperties": true, 36 | "description": "Message content" 37 | }, 38 | "attachments": { 39 | "items": { 40 | "$ref": "#/definitions/anytype.model.ChatMessage.Attachment" 41 | }, 42 | "type": "array", 43 | "description": "Attachments slice" 44 | }, 45 | "reactions": { 46 | "$ref": "#/definitions/anytype.model.ChatMessage.Reactions", 47 | "additionalProperties": true, 48 | "description": "Reactions to the message" 49 | }, 50 | "read": { 51 | "type": "boolean", 52 | "description": "Message read status" 53 | }, 54 | "mentionRead": { 55 | "type": "boolean" 56 | } 57 | }, 58 | "additionalProperties": true, 59 | "type": "object", 60 | "title": "Chat Message" 61 | }, 62 | "anytype.model.Block.Content.Text.Mark": { 63 | "properties": { 64 | "range": { 65 | "$ref": "#/definitions/anytype.model.Range", 66 | "additionalProperties": true, 67 | "description": "range of symbols to apply this mark. From(symbol) To(symbol)" 68 | }, 69 | "type": { 70 | "enum": [ 71 | "Strikethrough", 72 | 0, 73 | "Keyboard", 74 | 1, 75 | "Italic", 76 | 2, 77 | "Bold", 78 | 3, 79 | "Underscored", 80 | 4, 81 | "Link", 82 | 5, 83 | "TextColor", 84 | 6, 85 | "BackgroundColor", 86 | 7, 87 | "Mention", 88 | 8, 89 | "Emoji", 90 | 9, 91 | "Object", 92 | 10 93 | ], 94 | "oneOf": [ 95 | { 96 | "type": "string" 97 | }, 98 | { 99 | "type": "integer" 100 | } 101 | ], 102 | "title": "Type" 103 | }, 104 | "param": { 105 | "type": "string", 106 | "description": "link, color, etc" 107 | } 108 | }, 109 | "additionalProperties": true, 110 | "type": "object", 111 | "title": "Mark" 112 | }, 113 | "anytype.model.ChatMessage.Attachment": { 114 | "properties": { 115 | "target": { 116 | "type": "string", 117 | "description": "Identifier for the attachment object" 118 | }, 119 | "type": { 120 | "enum": [ 121 | "FILE", 122 | 0, 123 | "IMAGE", 124 | 1, 125 | "LINK", 126 | 2 127 | ], 128 | "oneOf": [ 129 | { 130 | "type": "string" 131 | }, 132 | { 133 | "type": "integer" 134 | } 135 | ], 136 | "title": "Attachment Type" 137 | } 138 | }, 139 | "additionalProperties": true, 140 | "type": "object", 141 | "title": "Attachment" 142 | }, 143 | "anytype.model.ChatMessage.MessageContent": { 144 | "properties": { 145 | "text": { 146 | "type": "string", 147 | "description": "The text content of the message part" 148 | }, 149 | "style": { 150 | "enum": [ 151 | "Paragraph", 152 | 0, 153 | "Header1", 154 | 1, 155 | "Header2", 156 | 2, 157 | "Header3", 158 | 3, 159 | "Header4", 160 | 4, 161 | "Quote", 162 | 5, 163 | "Code", 164 | 6, 165 | "Title", 166 | 7, 167 | "Checkbox", 168 | 8, 169 | "Marked", 170 | 9, 171 | "Numbered", 172 | 10, 173 | "Toggle", 174 | 11, 175 | "Description", 176 | 12, 177 | "Callout", 178 | 13 179 | ], 180 | "oneOf": [ 181 | { 182 | "type": "string" 183 | }, 184 | { 185 | "type": "integer" 186 | } 187 | ], 188 | "title": "Style" 189 | }, 190 | "marks": { 191 | "items": { 192 | "$ref": "#/definitions/anytype.model.Block.Content.Text.Mark" 193 | }, 194 | "type": "array", 195 | "description": "List of marks applied to the text" 196 | } 197 | }, 198 | "additionalProperties": true, 199 | "type": "object", 200 | "title": "Message Content" 201 | }, 202 | "anytype.model.ChatMessage.Reactions": { 203 | "properties": { 204 | "reactions": { 205 | "additionalProperties": { 206 | "$ref": "#/definitions/anytype.model.ChatMessage.Reactions.IdentityList", 207 | "additionalProperties": true 208 | }, 209 | "type": "object", 210 | "description": "Map of emoji to list of user IDs" 211 | } 212 | }, 213 | "additionalProperties": true, 214 | "type": "object", 215 | "title": "Reactions" 216 | }, 217 | "anytype.model.ChatMessage.Reactions.IdentityList": { 218 | "properties": { 219 | "ids": { 220 | "items": { 221 | "type": "string" 222 | }, 223 | "type": "array", 224 | "description": "List of user IDs" 225 | } 226 | }, 227 | "additionalProperties": true, 228 | "type": "object", 229 | "title": "Identity List" 230 | }, 231 | "anytype.model.Range": { 232 | "properties": { 233 | "from": { 234 | "type": "integer" 235 | }, 236 | "to": { 237 | "type": "integer" 238 | } 239 | }, 240 | "additionalProperties": true, 241 | "type": "object", 242 | "title": "Range", 243 | "description": "General purpose structure, uses in Mark." 244 | } 245 | } 246 | } -------------------------------------------------------------------------------- /json/models/ChatState.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/ChatState", 4 | "definitions": { 5 | "ChatState": { 6 | "properties": { 7 | "messages": { 8 | "$ref": "#/definitions/anytype.model.ChatState.UnreadState", 9 | "additionalProperties": true, 10 | "description": "unread messages" 11 | }, 12 | "mentions": { 13 | "$ref": "#/definitions/anytype.model.ChatState.UnreadState", 14 | "additionalProperties": true, 15 | "description": "unread mentions" 16 | }, 17 | "lastStateId": { 18 | "type": "string", 19 | "description": "reflects the state of the chat db at the moment of sending response/event that includes this state" 20 | } 21 | }, 22 | "additionalProperties": true, 23 | "type": "object", 24 | "title": "Chat State" 25 | }, 26 | "anytype.model.ChatState.UnreadState": { 27 | "properties": { 28 | "oldestOrderId": { 29 | "type": "string", 30 | "description": "oldest(in the lex sorting) unread message order id. Client should ALWAYS scroll through unread messages from the oldest to the newest" 31 | }, 32 | "counter": { 33 | "type": "integer", 34 | "description": "total number of unread messages" 35 | } 36 | }, 37 | "additionalProperties": true, 38 | "type": "object", 39 | "title": "Unread State" 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /json/models/Detail.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Detail", 4 | "definitions": { 5 | "Detail": { 6 | "properties": { 7 | "key": { 8 | "type": "string" 9 | }, 10 | "value": { 11 | "oneOf": [ 12 | { 13 | "type": "array" 14 | }, 15 | { 16 | "type": "boolean" 17 | }, 18 | { 19 | "type": "number" 20 | }, 21 | { 22 | "type": "object" 23 | }, 24 | { 25 | "type": "string" 26 | } 27 | ], 28 | "title": "Value", 29 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 30 | } 31 | }, 32 | "additionalProperties": true, 33 | "type": "object", 34 | "title": "Detail" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /json/models/DeviceInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/DeviceInfo", 4 | "definitions": { 5 | "DeviceInfo": { 6 | "properties": { 7 | "id": { 8 | "type": "string" 9 | }, 10 | "name": { 11 | "type": "string" 12 | }, 13 | "addDate": { 14 | "type": "string" 15 | }, 16 | "archived": { 17 | "type": "boolean" 18 | }, 19 | "isConnected": { 20 | "type": "boolean" 21 | } 22 | }, 23 | "additionalProperties": true, 24 | "type": "object", 25 | "title": "Device Info" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /json/models/Export.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Export", 4 | "definitions": { 5 | "Export": { 6 | "additionalProperties": true, 7 | "type": "object", 8 | "title": "Export" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /json/models/FileEncryptionKey.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/FileEncryptionKey", 4 | "definitions": { 5 | "FileEncryptionKey": { 6 | "properties": { 7 | "path": { 8 | "type": "string" 9 | }, 10 | "key": { 11 | "type": "string" 12 | } 13 | }, 14 | "additionalProperties": true, 15 | "type": "object", 16 | "title": "File Encryption Key" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /json/models/FileInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/FileInfo", 4 | "definitions": { 5 | "FileInfo": { 6 | "properties": { 7 | "fileId": { 8 | "type": "string" 9 | }, 10 | "encryptionKeys": { 11 | "items": { 12 | "$ref": "#/definitions/anytype.model.FileEncryptionKey" 13 | }, 14 | "type": "array" 15 | } 16 | }, 17 | "additionalProperties": true, 18 | "type": "object", 19 | "title": "File Info" 20 | }, 21 | "anytype.model.FileEncryptionKey": { 22 | "properties": { 23 | "path": { 24 | "type": "string" 25 | }, 26 | "key": { 27 | "type": "string" 28 | } 29 | }, 30 | "additionalProperties": true, 31 | "type": "object", 32 | "title": "File Encryption Key" 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /json/models/IdentityProfile.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/IdentityProfile", 4 | "definitions": { 5 | "IdentityProfile": { 6 | "properties": { 7 | "identity": { 8 | "type": "string" 9 | }, 10 | "name": { 11 | "type": "string" 12 | }, 13 | "iconCid": { 14 | "type": "string" 15 | }, 16 | "iconEncryptionKeys": { 17 | "items": { 18 | "$ref": "#/definitions/anytype.model.FileEncryptionKey" 19 | }, 20 | "type": "array" 21 | }, 22 | "description": { 23 | "type": "string" 24 | }, 25 | "globalName": { 26 | "type": "string" 27 | } 28 | }, 29 | "additionalProperties": true, 30 | "type": "object", 31 | "title": "Identity Profile" 32 | }, 33 | "anytype.model.FileEncryptionKey": { 34 | "properties": { 35 | "path": { 36 | "type": "string" 37 | }, 38 | "key": { 39 | "type": "string" 40 | } 41 | }, 42 | "additionalProperties": true, 43 | "type": "object", 44 | "title": "File Encryption Key" 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /json/models/Import.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Import", 4 | "definitions": { 5 | "Import": { 6 | "additionalProperties": true, 7 | "type": "object", 8 | "title": "Import" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /json/models/InternalFlag.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/InternalFlag", 4 | "definitions": { 5 | "InternalFlag": { 6 | "properties": { 7 | "value": { 8 | "enum": [ 9 | "editorDeleteEmpty", 10 | 0, 11 | "editorSelectType", 12 | 1, 13 | "editorSelectTemplate", 14 | 2, 15 | "collectionDontIndexLinks", 16 | 3 17 | ], 18 | "oneOf": [ 19 | { 20 | "type": "string" 21 | }, 22 | { 23 | "type": "integer" 24 | } 25 | ], 26 | "title": "Value", 27 | "description": "Use such a weird construction due to the issue with imported repeated enum type Look https://github.com/golang/protobuf/issues/1135 for more information." 28 | } 29 | }, 30 | "additionalProperties": true, 31 | "type": "object", 32 | "title": "Internal Flag" 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /json/models/Invite.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Invite", 4 | "definitions": { 5 | "Invite": { 6 | "properties": { 7 | "payload": { 8 | "type": "string", 9 | "format": "binary", 10 | "binaryEncoding": "base64" 11 | }, 12 | "signature": { 13 | "type": "string", 14 | "format": "binary", 15 | "binaryEncoding": "base64" 16 | } 17 | }, 18 | "additionalProperties": true, 19 | "type": "object", 20 | "title": "Invite" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /json/models/InvitePayload.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/InvitePayload", 4 | "definitions": { 5 | "InvitePayload": { 6 | "properties": { 7 | "creatorIdentity": { 8 | "type": "string" 9 | }, 10 | "creatorName": { 11 | "type": "string" 12 | }, 13 | "aclKey": { 14 | "type": "string", 15 | "format": "binary", 16 | "binaryEncoding": "base64" 17 | }, 18 | "spaceId": { 19 | "type": "string" 20 | }, 21 | "spaceName": { 22 | "type": "string" 23 | }, 24 | "spaceIconCid": { 25 | "type": "string" 26 | }, 27 | "spaceIconEncryptionKeys": { 28 | "items": { 29 | "$ref": "#/definitions/anytype.model.FileEncryptionKey" 30 | }, 31 | "type": "array" 32 | }, 33 | "inviteType": { 34 | "enum": [ 35 | "Member", 36 | 0, 37 | "Guest", 38 | 1, 39 | "WithoutApprove", 40 | 2 41 | ], 42 | "oneOf": [ 43 | { 44 | "type": "string" 45 | }, 46 | { 47 | "type": "integer" 48 | } 49 | ], 50 | "title": "Invite Type" 51 | }, 52 | "guestKey": { 53 | "type": "string", 54 | "format": "binary", 55 | "binaryEncoding": "base64" 56 | } 57 | }, 58 | "additionalProperties": true, 59 | "type": "object", 60 | "title": "Invite Payload" 61 | }, 62 | "anytype.model.FileEncryptionKey": { 63 | "properties": { 64 | "path": { 65 | "type": "string" 66 | }, 67 | "key": { 68 | "type": "string" 69 | } 70 | }, 71 | "additionalProperties": true, 72 | "type": "object", 73 | "title": "File Encryption Key" 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /json/models/Layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Layout", 4 | "definitions": { 5 | "Layout": { 6 | "properties": { 7 | "id": { 8 | "enum": [ 9 | "basic", 10 | 0, 11 | "profile", 12 | 1, 13 | "todo", 14 | 2, 15 | "set", 16 | 3, 17 | "objectType", 18 | 4, 19 | "relation", 20 | 5, 21 | "file", 22 | 6, 23 | "dashboard", 24 | 7, 25 | "image", 26 | 8, 27 | "note", 28 | 9, 29 | "space", 30 | 10, 31 | "bookmark", 32 | 11, 33 | "relationOptionsList", 34 | 12, 35 | "relationOption", 36 | 13, 37 | "collection", 38 | 14, 39 | "audio", 40 | 15, 41 | "video", 42 | 16, 43 | "date", 44 | 17, 45 | "spaceView", 46 | 18, 47 | "participant", 48 | 19, 49 | "pdf", 50 | 20, 51 | "chat", 52 | 21, 53 | "chatDerived", 54 | 22, 55 | "tag", 56 | 23 57 | ], 58 | "oneOf": [ 59 | { 60 | "type": "string" 61 | }, 62 | { 63 | "type": "integer" 64 | } 65 | ], 66 | "title": "Layout" 67 | }, 68 | "name": { 69 | "type": "string" 70 | }, 71 | "requiredRelations": { 72 | "items": { 73 | "$ref": "#/definitions/anytype.model.Relation" 74 | }, 75 | "type": "array", 76 | "description": "relations required for this object type" 77 | } 78 | }, 79 | "additionalProperties": true, 80 | "type": "object", 81 | "title": "Layout" 82 | }, 83 | "anytype.model.Relation": { 84 | "properties": { 85 | "id": { 86 | "type": "string" 87 | }, 88 | "key": { 89 | "type": "string", 90 | "description": "Key under which the value is stored in the map. Must be unique for the object type. It usually auto-generated bsonid, but also may be something human-readable in case of prebuilt types." 91 | }, 92 | "format": { 93 | "enum": [ 94 | "longtext", 95 | 0, 96 | "shorttext", 97 | 1, 98 | "number", 99 | 2, 100 | "status", 101 | 3, 102 | "tag", 103 | 11, 104 | "date", 105 | 4, 106 | "file", 107 | 5, 108 | "checkbox", 109 | 6, 110 | "url", 111 | 7, 112 | "email", 113 | 8, 114 | "phone", 115 | 9, 116 | "emoji", 117 | 10, 118 | "object", 119 | 100, 120 | "relations", 121 | 101 122 | ], 123 | "oneOf": [ 124 | { 125 | "type": "string" 126 | }, 127 | { 128 | "type": "integer" 129 | } 130 | ], 131 | "title": "Relation Format", 132 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 133 | }, 134 | "name": { 135 | "type": "string", 136 | "description": "name to show (can be localized for bundled types)" 137 | }, 138 | "defaultValue": { 139 | "oneOf": [ 140 | { 141 | "type": "array" 142 | }, 143 | { 144 | "type": "boolean" 145 | }, 146 | { 147 | "type": "number" 148 | }, 149 | { 150 | "type": "object" 151 | }, 152 | { 153 | "type": "string" 154 | } 155 | ], 156 | "title": "Value", 157 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 158 | }, 159 | "dataSource": { 160 | "enum": [ 161 | "details", 162 | 0, 163 | "derived", 164 | 1, 165 | "account", 166 | 2, 167 | "local", 168 | 3 169 | ], 170 | "oneOf": [ 171 | { 172 | "type": "string" 173 | }, 174 | { 175 | "type": "integer" 176 | } 177 | ], 178 | "title": "Data Source" 179 | }, 180 | "hidden": { 181 | "type": "boolean", 182 | "description": "internal, not displayed to user (e.g. coverX, coverY)" 183 | }, 184 | "readOnly": { 185 | "type": "boolean", 186 | "description": "value not editable by user tobe renamed to readonlyValue" 187 | }, 188 | "readOnlyRelation": { 189 | "type": "boolean", 190 | "description": "relation metadata, eg name and format is not editable by user" 191 | }, 192 | "multi": { 193 | "type": "boolean", 194 | "description": "allow multiple values (stored in pb list)" 195 | }, 196 | "objectTypes": { 197 | "items": { 198 | "type": "string" 199 | }, 200 | "type": "array", 201 | "description": "URL of object type, empty to allow link to any object" 202 | }, 203 | "selectDict": { 204 | "items": { 205 | "$ref": "#/definitions/anytype.model.Relation.Option" 206 | }, 207 | "type": "array", 208 | "description": "index 10, 11 was used in internal-only builds. Can be reused, but may break some test accounts default dictionary with unique values to choose for select/multiSelect format" 209 | }, 210 | "maxCount": { 211 | "type": "integer", 212 | "description": "max number of values can be set for this relation. 0 means no limit. 1 means the value can be stored in non-repeated field" 213 | }, 214 | "description": { 215 | "type": "string" 216 | }, 217 | "scope": { 218 | "enum": [ 219 | "object", 220 | 0, 221 | "type", 222 | 1, 223 | "setOfTheSameType", 224 | 2, 225 | "objectsOfTheSameType", 226 | 3, 227 | "library", 228 | 4 229 | ], 230 | "oneOf": [ 231 | { 232 | "type": "string" 233 | }, 234 | { 235 | "type": "integer" 236 | } 237 | ], 238 | "title": "Scope" 239 | }, 240 | "creator": { 241 | "type": "string", 242 | "description": "creator profile id" 243 | }, 244 | "revision": { 245 | "type": "string", 246 | "description": "revision of system relation. Used to check if we should change relation content or not" 247 | } 248 | }, 249 | "additionalProperties": true, 250 | "type": "object", 251 | "title": "Relation", 252 | "description": "Relation describe the human-interpreted relation type. It may be something like \"Date of creation, format=date\" or \"Assignee, format=objectId, objectType=person\"" 253 | }, 254 | "anytype.model.Relation.Option": { 255 | "properties": { 256 | "id": { 257 | "type": "string", 258 | "description": "id generated automatically if omitted" 259 | }, 260 | "text": { 261 | "type": "string" 262 | }, 263 | "color": { 264 | "type": "string", 265 | "description": "stored" 266 | }, 267 | "relationKey": { 268 | "type": "string", 269 | "description": "4 is reserved for old relation format stored" 270 | } 271 | }, 272 | "additionalProperties": true, 273 | "type": "object", 274 | "title": "Option" 275 | } 276 | } 277 | } -------------------------------------------------------------------------------- /json/models/LinkPreview.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/LinkPreview", 4 | "definitions": { 5 | "LinkPreview": { 6 | "properties": { 7 | "url": { 8 | "type": "string" 9 | }, 10 | "title": { 11 | "type": "string" 12 | }, 13 | "description": { 14 | "type": "string" 15 | }, 16 | "imageUrl": { 17 | "type": "string" 18 | }, 19 | "faviconUrl": { 20 | "type": "string" 21 | }, 22 | "type": { 23 | "enum": [ 24 | "Unknown", 25 | 0, 26 | "Page", 27 | 1, 28 | "Image", 29 | 2, 30 | "Text", 31 | 3 32 | ], 33 | "oneOf": [ 34 | { 35 | "type": "string" 36 | }, 37 | { 38 | "type": "integer" 39 | } 40 | ], 41 | "title": "Type" 42 | } 43 | }, 44 | "additionalProperties": true, 45 | "type": "object", 46 | "title": "Link Preview" 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /json/models/ManifestInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/ManifestInfo", 4 | "definitions": { 5 | "ManifestInfo": { 6 | "properties": { 7 | "schema": { 8 | "type": "string" 9 | }, 10 | "id": { 11 | "type": "string" 12 | }, 13 | "name": { 14 | "type": "string" 15 | }, 16 | "author": { 17 | "type": "string" 18 | }, 19 | "license": { 20 | "type": "string" 21 | }, 22 | "title": { 23 | "type": "string" 24 | }, 25 | "description": { 26 | "type": "string" 27 | }, 28 | "screenshots": { 29 | "items": { 30 | "type": "string" 31 | }, 32 | "type": "array" 33 | }, 34 | "downloadLink": { 35 | "type": "string" 36 | }, 37 | "fileSize": { 38 | "type": "integer" 39 | }, 40 | "categories": { 41 | "items": { 42 | "type": "string" 43 | }, 44 | "type": "array" 45 | }, 46 | "language": { 47 | "type": "string" 48 | } 49 | }, 50 | "additionalProperties": true, 51 | "type": "object", 52 | "title": "Manifest Info" 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /json/models/Membership.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Membership", 4 | "definitions": { 5 | "Membership": { 6 | "properties": { 7 | "tier": { 8 | "type": "integer", 9 | "description": "it was Tier before, changed to int32 to allow dynamic values" 10 | }, 11 | "status": { 12 | "enum": [ 13 | "StatusUnknown", 14 | 0, 15 | "StatusPending", 16 | 1, 17 | "StatusActive", 18 | 2, 19 | "StatusPendingRequiresFinalization", 20 | 3 21 | ], 22 | "oneOf": [ 23 | { 24 | "type": "string" 25 | }, 26 | { 27 | "type": "integer" 28 | } 29 | ], 30 | "title": "Status" 31 | }, 32 | "dateStarted": { 33 | "type": "string" 34 | }, 35 | "dateEnds": { 36 | "type": "string" 37 | }, 38 | "isAutoRenew": { 39 | "type": "boolean" 40 | }, 41 | "paymentMethod": { 42 | "enum": [ 43 | "MethodNone", 44 | 0, 45 | "MethodStripe", 46 | 1, 47 | "MethodCrypto", 48 | 2, 49 | "MethodInappApple", 50 | 3, 51 | "MethodInappGoogle", 52 | 4 53 | ], 54 | "oneOf": [ 55 | { 56 | "type": "string" 57 | }, 58 | { 59 | "type": "integer" 60 | } 61 | ], 62 | "title": "Payment Method" 63 | }, 64 | "nsName": { 65 | "type": "string", 66 | "description": "can be empty if user did not ask for any name" 67 | }, 68 | "nsNameType": { 69 | "enum": [ 70 | "AnyName", 71 | 0 72 | ], 73 | "oneOf": [ 74 | { 75 | "type": "string" 76 | }, 77 | { 78 | "type": "integer" 79 | } 80 | ], 81 | "title": "Nameservice Name Type" 82 | }, 83 | "userEmail": { 84 | "type": "string", 85 | "description": "if the email was verified by the user or set during the checkout - it will be here" 86 | }, 87 | "subscribeToNewsletter": { 88 | "type": "boolean" 89 | } 90 | }, 91 | "additionalProperties": true, 92 | "type": "object", 93 | "title": "Membership" 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /json/models/MembershipTierData.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/MembershipTierData", 4 | "definitions": { 5 | "MembershipTierData": { 6 | "properties": { 7 | "id": { 8 | "type": "integer", 9 | "description": "this is a unique Payment Node ID of the tier WARNING: tiers can be sorted differently, not according to their IDs!" 10 | }, 11 | "name": { 12 | "type": "string", 13 | "description": "localazied name of the tier" 14 | }, 15 | "description": { 16 | "type": "string", 17 | "description": "just a short technical description" 18 | }, 19 | "isTest": { 20 | "type": "boolean", 21 | "description": "is this tier for testing and debugging only?" 22 | }, 23 | "periodType": { 24 | "enum": [ 25 | "PeriodTypeUnknown", 26 | 0, 27 | "PeriodTypeUnlimited", 28 | 1, 29 | "PeriodTypeDays", 30 | 2, 31 | "PeriodTypeWeeks", 32 | 3, 33 | "PeriodTypeMonths", 34 | 4, 35 | "PeriodTypeYears", 36 | 5 37 | ], 38 | "oneOf": [ 39 | { 40 | "type": "string" 41 | }, 42 | { 43 | "type": "integer" 44 | } 45 | ], 46 | "title": "Period Type" 47 | }, 48 | "periodValue": { 49 | "type": "integer", 50 | "description": "i.e. \"5 days\" or \"3 years\"" 51 | }, 52 | "priceStripeUsdCents": { 53 | "type": "integer", 54 | "description": "this one is a price we use ONLY on Stripe platform" 55 | }, 56 | "anyNamesCountIncluded": { 57 | "type": "integer", 58 | "description": "number of ANY NS names that this tier includes also in the \"features\" list (see below)" 59 | }, 60 | "anyNameMinLength": { 61 | "type": "integer", 62 | "description": "somename.any - is of len 8" 63 | }, 64 | "features": { 65 | "items": { 66 | "type": "string" 67 | }, 68 | "type": "array", 69 | "description": "localized strings for the features" 70 | }, 71 | "colorStr": { 72 | "type": "string", 73 | "description": "green, blue, red, purple, custom" 74 | }, 75 | "stripeProductId": { 76 | "type": "string", 77 | "description": "Stripe platform-specific data:" 78 | }, 79 | "stripeManageUrl": { 80 | "type": "string" 81 | }, 82 | "iosProductId": { 83 | "type": "string", 84 | "description": "iOS platform-specific data:" 85 | }, 86 | "iosManageUrl": { 87 | "type": "string" 88 | }, 89 | "androidProductId": { 90 | "type": "string", 91 | "description": "Android platform-specific data:" 92 | }, 93 | "androidManageUrl": { 94 | "type": "string" 95 | }, 96 | "offer": { 97 | "type": "string", 98 | "description": "\"limited offer\" or somehing like that" 99 | } 100 | }, 101 | "additionalProperties": true, 102 | "type": "object", 103 | "title": "Membership Tier Data" 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /json/models/Metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Metadata", 4 | "definitions": { 5 | "Metadata": { 6 | "properties": { 7 | "identity": { 8 | "$ref": "#/definitions/anytype.model.Metadata.Payload.IdentityPayload", 9 | "additionalProperties": true 10 | } 11 | }, 12 | "additionalProperties": true, 13 | "type": "object", 14 | "title": "Metadata" 15 | }, 16 | "anytype.model.Metadata.Payload.IdentityPayload": { 17 | "properties": { 18 | "profileSymKey": { 19 | "type": "string", 20 | "format": "binary", 21 | "binaryEncoding": "base64" 22 | } 23 | }, 24 | "additionalProperties": true, 25 | "type": "object", 26 | "title": "Identity Payload" 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /json/models/Notification.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Notification", 4 | "definitions": { 5 | "Notification": { 6 | "properties": { 7 | "id": { 8 | "type": "string" 9 | }, 10 | "createTime": { 11 | "type": "string" 12 | }, 13 | "status": { 14 | "enum": [ 15 | "Created", 16 | 0, 17 | "Shown", 18 | 1, 19 | "Read", 20 | 2, 21 | "Replied", 22 | 3 23 | ], 24 | "oneOf": [ 25 | { 26 | "type": "string" 27 | }, 28 | { 29 | "type": "integer" 30 | } 31 | ], 32 | "title": "Status" 33 | }, 34 | "isLocal": { 35 | "type": "boolean" 36 | }, 37 | "import": { 38 | "$ref": "#/definitions/anytype.model.Notification.Import", 39 | "additionalProperties": true 40 | }, 41 | "export": { 42 | "$ref": "#/definitions/anytype.model.Notification.Export", 43 | "additionalProperties": true 44 | }, 45 | "galleryImport": { 46 | "$ref": "#/definitions/anytype.model.Notification.GalleryImport", 47 | "additionalProperties": true 48 | }, 49 | "requestToJoin": { 50 | "$ref": "#/definitions/anytype.model.Notification.RequestToJoin", 51 | "additionalProperties": true 52 | }, 53 | "test": { 54 | "$ref": "#/definitions/anytype.model.Notification.Test", 55 | "additionalProperties": true 56 | }, 57 | "participantRequestApproved": { 58 | "$ref": "#/definitions/anytype.model.Notification.ParticipantRequestApproved", 59 | "additionalProperties": true 60 | }, 61 | "requestToLeave": { 62 | "$ref": "#/definitions/anytype.model.Notification.RequestToLeave", 63 | "additionalProperties": true 64 | }, 65 | "participantRemove": { 66 | "$ref": "#/definitions/anytype.model.Notification.ParticipantRemove", 67 | "additionalProperties": true 68 | }, 69 | "participantRequestDecline": { 70 | "$ref": "#/definitions/anytype.model.Notification.ParticipantRequestDecline", 71 | "additionalProperties": true 72 | }, 73 | "participantPermissionsChange": { 74 | "$ref": "#/definitions/anytype.model.Notification.ParticipantPermissionsChange", 75 | "additionalProperties": true 76 | }, 77 | "space": { 78 | "type": "string" 79 | }, 80 | "aclHeadId": { 81 | "type": "string" 82 | } 83 | }, 84 | "additionalProperties": true, 85 | "type": "object", 86 | "title": "Notification" 87 | }, 88 | "anytype.model.Notification.Export": { 89 | "properties": { 90 | "errorCode": { 91 | "enum": [ 92 | "NULL", 93 | 0, 94 | "UNKNOWN_ERROR", 95 | 1, 96 | "BAD_INPUT", 97 | 2 98 | ], 99 | "oneOf": [ 100 | { 101 | "type": "string" 102 | }, 103 | { 104 | "type": "integer" 105 | } 106 | ], 107 | "title": "Code" 108 | }, 109 | "exportType": { 110 | "enum": [ 111 | "Markdown", 112 | 0, 113 | "Protobuf", 114 | 1, 115 | "JSON", 116 | 2, 117 | "DOT", 118 | 3, 119 | "SVG", 120 | 4, 121 | "GRAPH_JSON", 122 | 5 123 | ], 124 | "oneOf": [ 125 | { 126 | "type": "string" 127 | }, 128 | { 129 | "type": "integer" 130 | } 131 | ], 132 | "title": "Format" 133 | } 134 | }, 135 | "additionalProperties": true, 136 | "type": "object", 137 | "title": "Export" 138 | }, 139 | "anytype.model.Notification.GalleryImport": { 140 | "properties": { 141 | "processId": { 142 | "type": "string" 143 | }, 144 | "errorCode": { 145 | "enum": [ 146 | "NULL", 147 | 0, 148 | "UNKNOWN_ERROR", 149 | 1, 150 | "BAD_INPUT", 151 | 2, 152 | "INTERNAL_ERROR", 153 | 3, 154 | "FILE_LOAD_ERROR", 155 | 8, 156 | "IMPORT_IS_CANCELED", 157 | 6, 158 | "NOTION_NO_OBJECTS_IN_INTEGRATION", 159 | 5, 160 | "NOTION_SERVER_IS_UNAVAILABLE", 161 | 12, 162 | "NOTION_RATE_LIMIT_EXCEEDED", 163 | 13, 164 | "FILE_IMPORT_NO_OBJECTS_IN_ZIP_ARCHIVE", 165 | 14, 166 | "FILE_IMPORT_NO_OBJECTS_IN_DIRECTORY", 167 | 17, 168 | "HTML_WRONG_HTML_STRUCTURE", 169 | 10, 170 | "PB_NOT_ANYBLOCK_FORMAT", 171 | 11, 172 | "CSV_LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED", 173 | 7, 174 | "INSUFFICIENT_PERMISSIONS", 175 | 9 176 | ], 177 | "oneOf": [ 178 | { 179 | "type": "string" 180 | }, 181 | { 182 | "type": "integer" 183 | } 184 | ], 185 | "title": "Error Code" 186 | }, 187 | "spaceId": { 188 | "type": "string" 189 | }, 190 | "name": { 191 | "type": "string" 192 | }, 193 | "spaceName": { 194 | "type": "string" 195 | } 196 | }, 197 | "additionalProperties": true, 198 | "type": "object", 199 | "title": "Gallery Import" 200 | }, 201 | "anytype.model.Notification.Import": { 202 | "properties": { 203 | "processId": { 204 | "type": "string" 205 | }, 206 | "errorCode": { 207 | "enum": [ 208 | "NULL", 209 | 0, 210 | "UNKNOWN_ERROR", 211 | 1, 212 | "BAD_INPUT", 213 | 2, 214 | "INTERNAL_ERROR", 215 | 3, 216 | "FILE_LOAD_ERROR", 217 | 8, 218 | "IMPORT_IS_CANCELED", 219 | 6, 220 | "NOTION_NO_OBJECTS_IN_INTEGRATION", 221 | 5, 222 | "NOTION_SERVER_IS_UNAVAILABLE", 223 | 12, 224 | "NOTION_RATE_LIMIT_EXCEEDED", 225 | 13, 226 | "FILE_IMPORT_NO_OBJECTS_IN_ZIP_ARCHIVE", 227 | 14, 228 | "FILE_IMPORT_NO_OBJECTS_IN_DIRECTORY", 229 | 17, 230 | "HTML_WRONG_HTML_STRUCTURE", 231 | 10, 232 | "PB_NOT_ANYBLOCK_FORMAT", 233 | 11, 234 | "CSV_LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED", 235 | 7, 236 | "INSUFFICIENT_PERMISSIONS", 237 | 9 238 | ], 239 | "oneOf": [ 240 | { 241 | "type": "string" 242 | }, 243 | { 244 | "type": "integer" 245 | } 246 | ], 247 | "title": "Error Code" 248 | }, 249 | "importType": { 250 | "enum": [ 251 | "Notion", 252 | 0, 253 | "Markdown", 254 | 1, 255 | "External", 256 | 2, 257 | "Pb", 258 | 3, 259 | "Html", 260 | 4, 261 | "Txt", 262 | 5, 263 | "Csv", 264 | 6 265 | ], 266 | "oneOf": [ 267 | { 268 | "type": "string" 269 | }, 270 | { 271 | "type": "integer" 272 | } 273 | ], 274 | "title": "Type" 275 | }, 276 | "spaceId": { 277 | "type": "string" 278 | }, 279 | "name": { 280 | "type": "string" 281 | }, 282 | "spaceName": { 283 | "type": "string" 284 | } 285 | }, 286 | "additionalProperties": true, 287 | "type": "object", 288 | "title": "Import" 289 | }, 290 | "anytype.model.Notification.ParticipantPermissionsChange": { 291 | "properties": { 292 | "spaceId": { 293 | "type": "string" 294 | }, 295 | "permissions": { 296 | "enum": [ 297 | "Reader", 298 | 0, 299 | "Writer", 300 | 1, 301 | "Owner", 302 | 2, 303 | "NoPermissions", 304 | 3 305 | ], 306 | "oneOf": [ 307 | { 308 | "type": "string" 309 | }, 310 | { 311 | "type": "integer" 312 | } 313 | ], 314 | "title": "Participant Permissions" 315 | }, 316 | "spaceName": { 317 | "type": "string" 318 | } 319 | }, 320 | "additionalProperties": true, 321 | "type": "object", 322 | "title": "Participant Permissions Change" 323 | }, 324 | "anytype.model.Notification.ParticipantRemove": { 325 | "properties": { 326 | "identity": { 327 | "type": "string" 328 | }, 329 | "identityName": { 330 | "type": "string" 331 | }, 332 | "identityIcon": { 333 | "type": "string" 334 | }, 335 | "spaceId": { 336 | "type": "string" 337 | }, 338 | "spaceName": { 339 | "type": "string" 340 | } 341 | }, 342 | "additionalProperties": true, 343 | "type": "object", 344 | "title": "Participant Remove" 345 | }, 346 | "anytype.model.Notification.ParticipantRequestApproved": { 347 | "properties": { 348 | "spaceId": { 349 | "type": "string" 350 | }, 351 | "permissions": { 352 | "enum": [ 353 | "Reader", 354 | 0, 355 | "Writer", 356 | 1, 357 | "Owner", 358 | 2, 359 | "NoPermissions", 360 | 3 361 | ], 362 | "oneOf": [ 363 | { 364 | "type": "string" 365 | }, 366 | { 367 | "type": "integer" 368 | } 369 | ], 370 | "title": "Participant Permissions" 371 | }, 372 | "spaceName": { 373 | "type": "string" 374 | } 375 | }, 376 | "additionalProperties": true, 377 | "type": "object", 378 | "title": "Participant Request Approved" 379 | }, 380 | "anytype.model.Notification.ParticipantRequestDecline": { 381 | "properties": { 382 | "spaceId": { 383 | "type": "string" 384 | }, 385 | "spaceName": { 386 | "type": "string" 387 | } 388 | }, 389 | "additionalProperties": true, 390 | "type": "object", 391 | "title": "Participant Request Decline" 392 | }, 393 | "anytype.model.Notification.RequestToJoin": { 394 | "properties": { 395 | "spaceId": { 396 | "type": "string" 397 | }, 398 | "identity": { 399 | "type": "string" 400 | }, 401 | "identityName": { 402 | "type": "string" 403 | }, 404 | "identityIcon": { 405 | "type": "string" 406 | }, 407 | "spaceName": { 408 | "type": "string" 409 | } 410 | }, 411 | "additionalProperties": true, 412 | "type": "object", 413 | "title": "Request To Join" 414 | }, 415 | "anytype.model.Notification.RequestToLeave": { 416 | "properties": { 417 | "spaceId": { 418 | "type": "string" 419 | }, 420 | "identity": { 421 | "type": "string" 422 | }, 423 | "identityName": { 424 | "type": "string" 425 | }, 426 | "identityIcon": { 427 | "type": "string" 428 | }, 429 | "spaceName": { 430 | "type": "string" 431 | } 432 | }, 433 | "additionalProperties": true, 434 | "type": "object", 435 | "title": "Request To Leave" 436 | }, 437 | "anytype.model.Notification.Test": { 438 | "additionalProperties": true, 439 | "type": "object", 440 | "title": "Test" 441 | } 442 | } 443 | } -------------------------------------------------------------------------------- /json/models/Object.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Object", 4 | "definitions": { 5 | "Object": { 6 | "additionalProperties": true, 7 | "type": "object", 8 | "title": "Object" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /json/models/ObjectType.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/ObjectType", 4 | "definitions": { 5 | "ObjectType": { 6 | "properties": { 7 | "url": { 8 | "type": "string", 9 | "description": "leave empty in case you want to create the new one" 10 | }, 11 | "name": { 12 | "type": "string", 13 | "description": "name of objectType in singular form (can be localized for bundled types)" 14 | }, 15 | "relationLinks": { 16 | "items": { 17 | "$ref": "#/definitions/anytype.model.RelationLink" 18 | }, 19 | "type": "array", 20 | "description": "cannot contain more than one Relation with the same RelationType" 21 | }, 22 | "layout": { 23 | "enum": [ 24 | "basic", 25 | 0, 26 | "profile", 27 | 1, 28 | "todo", 29 | 2, 30 | "set", 31 | 3, 32 | "objectType", 33 | 4, 34 | "relation", 35 | 5, 36 | "file", 37 | 6, 38 | "dashboard", 39 | 7, 40 | "image", 41 | 8, 42 | "note", 43 | 9, 44 | "space", 45 | 10, 46 | "bookmark", 47 | 11, 48 | "relationOptionsList", 49 | 12, 50 | "relationOption", 51 | 13, 52 | "collection", 53 | 14, 54 | "audio", 55 | 15, 56 | "video", 57 | 16, 58 | "date", 59 | 17, 60 | "spaceView", 61 | 18, 62 | "participant", 63 | 19, 64 | "pdf", 65 | 20, 66 | "chat", 67 | 21, 68 | "chatDerived", 69 | 22, 70 | "tag", 71 | 23 72 | ], 73 | "oneOf": [ 74 | { 75 | "type": "string" 76 | }, 77 | { 78 | "type": "integer" 79 | } 80 | ], 81 | "title": "Layout" 82 | }, 83 | "iconEmoji": { 84 | "type": "string", 85 | "description": "emoji symbol" 86 | }, 87 | "description": { 88 | "type": "string" 89 | }, 90 | "hidden": { 91 | "type": "boolean" 92 | }, 93 | "readonly": { 94 | "type": "boolean" 95 | }, 96 | "types": { 97 | "items": { 98 | "enum": [ 99 | "AccountOld", 100 | 0, 101 | "Page", 102 | 16, 103 | "ProfilePage", 104 | 17, 105 | "Home", 106 | 32, 107 | "Archive", 108 | 48, 109 | "Widget", 110 | 112, 111 | "File", 112 | 256, 113 | "Template", 114 | 288, 115 | "BundledTemplate", 116 | 289, 117 | "BundledRelation", 118 | 512, 119 | "SubObject", 120 | 513, 121 | "BundledObjectType", 122 | 514, 123 | "AnytypeProfile", 124 | 515, 125 | "Date", 126 | 516, 127 | "Workspace", 128 | 518, 129 | "STRelation", 130 | 521, 131 | "STType", 132 | 528, 133 | "STRelationOption", 134 | 529, 135 | "SpaceView", 136 | 530, 137 | "Identity", 138 | 532, 139 | "Participant", 140 | 534, 141 | "MissingObject", 142 | 519, 143 | "FileObject", 144 | 533, 145 | "NotificationObject", 146 | 535, 147 | "DevicesObject", 148 | 536, 149 | "ChatObject", 150 | 537, 151 | "ChatDerivedObject", 152 | 544, 153 | "AccountObject", 154 | 545 155 | ] 156 | }, 157 | "type": "array", 158 | "title": "Smart Block Type" 159 | }, 160 | "isArchived": { 161 | "type": "boolean", 162 | "description": "sets locally to hide object type from set and some other places" 163 | }, 164 | "installedByDefault": { 165 | "type": "boolean" 166 | }, 167 | "key": { 168 | "type": "string", 169 | "description": "name of objectType (can be localized for bundled types)" 170 | }, 171 | "revision": { 172 | "type": "string", 173 | "description": "revision of system objectType. Used to check if we should change type content or not" 174 | }, 175 | "restrictObjectCreation": { 176 | "type": "boolean", 177 | "description": "restricts creating objects of this type for users" 178 | }, 179 | "iconColor": { 180 | "type": "string", 181 | "description": "color of object type icon" 182 | }, 183 | "iconName": { 184 | "type": "string", 185 | "description": "name of object type icon" 186 | }, 187 | "pluralName": { 188 | "type": "string", 189 | "description": "name of objectType in plural form (can be localized for bundled types)" 190 | } 191 | }, 192 | "additionalProperties": true, 193 | "type": "object", 194 | "title": "Object Type" 195 | }, 196 | "anytype.model.RelationLink": { 197 | "properties": { 198 | "key": { 199 | "type": "string" 200 | }, 201 | "format": { 202 | "enum": [ 203 | "longtext", 204 | 0, 205 | "shorttext", 206 | 1, 207 | "number", 208 | 2, 209 | "status", 210 | 3, 211 | "tag", 212 | 11, 213 | "date", 214 | 4, 215 | "file", 216 | 5, 217 | "checkbox", 218 | 6, 219 | "url", 220 | 7, 221 | "email", 222 | 8, 223 | "phone", 224 | 9, 225 | "emoji", 226 | 10, 227 | "object", 228 | 100, 229 | "relations", 230 | 101 231 | ], 232 | "oneOf": [ 233 | { 234 | "type": "string" 235 | }, 236 | { 237 | "type": "integer" 238 | } 239 | ], 240 | "title": "Relation Format", 241 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 242 | } 243 | }, 244 | "additionalProperties": true, 245 | "type": "object", 246 | "title": "Relation Link" 247 | } 248 | } 249 | } -------------------------------------------------------------------------------- /json/models/ParticipantPermissionChange.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/ParticipantPermissionChange", 4 | "definitions": { 5 | "ParticipantPermissionChange": { 6 | "properties": { 7 | "identity": { 8 | "type": "string" 9 | }, 10 | "perms": { 11 | "enum": [ 12 | "Reader", 13 | 0, 14 | "Writer", 15 | 1, 16 | "Owner", 17 | 2, 18 | "NoPermissions", 19 | 3 20 | ], 21 | "oneOf": [ 22 | { 23 | "type": "string" 24 | }, 25 | { 26 | "type": "integer" 27 | } 28 | ], 29 | "title": "Participant Permissions" 30 | } 31 | }, 32 | "additionalProperties": true, 33 | "type": "object", 34 | "title": "Participant Permission Change" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /json/models/Range.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Range", 4 | "definitions": { 5 | "Range": { 6 | "properties": { 7 | "from": { 8 | "type": "integer" 9 | }, 10 | "to": { 11 | "type": "integer" 12 | } 13 | }, 14 | "additionalProperties": true, 15 | "type": "object", 16 | "title": "Range", 17 | "description": "General purpose structure, uses in Mark." 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /json/models/Relation.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Relation", 4 | "definitions": { 5 | "Relation": { 6 | "properties": { 7 | "id": { 8 | "type": "string" 9 | }, 10 | "key": { 11 | "type": "string", 12 | "description": "Key under which the value is stored in the map. Must be unique for the object type. It usually auto-generated bsonid, but also may be something human-readable in case of prebuilt types." 13 | }, 14 | "format": { 15 | "enum": [ 16 | "longtext", 17 | 0, 18 | "shorttext", 19 | 1, 20 | "number", 21 | 2, 22 | "status", 23 | 3, 24 | "tag", 25 | 11, 26 | "date", 27 | 4, 28 | "file", 29 | 5, 30 | "checkbox", 31 | 6, 32 | "url", 33 | 7, 34 | "email", 35 | 8, 36 | "phone", 37 | 9, 38 | "emoji", 39 | 10, 40 | "object", 41 | 100, 42 | "relations", 43 | 101 44 | ], 45 | "oneOf": [ 46 | { 47 | "type": "string" 48 | }, 49 | { 50 | "type": "integer" 51 | } 52 | ], 53 | "title": "Relation Format", 54 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 55 | }, 56 | "name": { 57 | "type": "string", 58 | "description": "name to show (can be localized for bundled types)" 59 | }, 60 | "defaultValue": { 61 | "oneOf": [ 62 | { 63 | "type": "array" 64 | }, 65 | { 66 | "type": "boolean" 67 | }, 68 | { 69 | "type": "number" 70 | }, 71 | { 72 | "type": "object" 73 | }, 74 | { 75 | "type": "string" 76 | } 77 | ], 78 | "title": "Value", 79 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 80 | }, 81 | "dataSource": { 82 | "enum": [ 83 | "details", 84 | 0, 85 | "derived", 86 | 1, 87 | "account", 88 | 2, 89 | "local", 90 | 3 91 | ], 92 | "oneOf": [ 93 | { 94 | "type": "string" 95 | }, 96 | { 97 | "type": "integer" 98 | } 99 | ], 100 | "title": "Data Source" 101 | }, 102 | "hidden": { 103 | "type": "boolean", 104 | "description": "internal, not displayed to user (e.g. coverX, coverY)" 105 | }, 106 | "readOnly": { 107 | "type": "boolean", 108 | "description": "value not editable by user tobe renamed to readonlyValue" 109 | }, 110 | "readOnlyRelation": { 111 | "type": "boolean", 112 | "description": "relation metadata, eg name and format is not editable by user" 113 | }, 114 | "multi": { 115 | "type": "boolean", 116 | "description": "allow multiple values (stored in pb list)" 117 | }, 118 | "objectTypes": { 119 | "items": { 120 | "type": "string" 121 | }, 122 | "type": "array", 123 | "description": "URL of object type, empty to allow link to any object" 124 | }, 125 | "selectDict": { 126 | "items": { 127 | "$ref": "#/definitions/anytype.model.Relation.Option" 128 | }, 129 | "type": "array", 130 | "description": "index 10, 11 was used in internal-only builds. Can be reused, but may break some test accounts default dictionary with unique values to choose for select/multiSelect format" 131 | }, 132 | "maxCount": { 133 | "type": "integer", 134 | "description": "max number of values can be set for this relation. 0 means no limit. 1 means the value can be stored in non-repeated field" 135 | }, 136 | "description": { 137 | "type": "string" 138 | }, 139 | "scope": { 140 | "enum": [ 141 | "object", 142 | 0, 143 | "type", 144 | 1, 145 | "setOfTheSameType", 146 | 2, 147 | "objectsOfTheSameType", 148 | 3, 149 | "library", 150 | 4 151 | ], 152 | "oneOf": [ 153 | { 154 | "type": "string" 155 | }, 156 | { 157 | "type": "integer" 158 | } 159 | ], 160 | "title": "Scope" 161 | }, 162 | "creator": { 163 | "type": "string", 164 | "description": "creator profile id" 165 | }, 166 | "revision": { 167 | "type": "string", 168 | "description": "revision of system relation. Used to check if we should change relation content or not" 169 | } 170 | }, 171 | "additionalProperties": true, 172 | "type": "object", 173 | "title": "Relation", 174 | "description": "Relation describe the human-interpreted relation type. It may be something like \"Date of creation, format=date\" or \"Assignee, format=objectId, objectType=person\"" 175 | }, 176 | "anytype.model.Relation.Option": { 177 | "properties": { 178 | "id": { 179 | "type": "string", 180 | "description": "id generated automatically if omitted" 181 | }, 182 | "text": { 183 | "type": "string" 184 | }, 185 | "color": { 186 | "type": "string", 187 | "description": "stored" 188 | }, 189 | "relationKey": { 190 | "type": "string", 191 | "description": "4 is reserved for old relation format stored" 192 | } 193 | }, 194 | "additionalProperties": true, 195 | "type": "object", 196 | "title": "Option" 197 | } 198 | } 199 | } -------------------------------------------------------------------------------- /json/models/RelationLink.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/RelationLink", 4 | "definitions": { 5 | "RelationLink": { 6 | "properties": { 7 | "key": { 8 | "type": "string" 9 | }, 10 | "format": { 11 | "enum": [ 12 | "longtext", 13 | 0, 14 | "shorttext", 15 | 1, 16 | "number", 17 | 2, 18 | "status", 19 | 3, 20 | "tag", 21 | 11, 22 | "date", 23 | 4, 24 | "file", 25 | 5, 26 | "checkbox", 27 | 6, 28 | "url", 29 | 7, 30 | "email", 31 | 8, 32 | "phone", 33 | 9, 34 | "emoji", 35 | 10, 36 | "object", 37 | 100, 38 | "relations", 39 | 101 40 | ], 41 | "oneOf": [ 42 | { 43 | "type": "string" 44 | }, 45 | { 46 | "type": "integer" 47 | } 48 | ], 49 | "title": "Relation Format", 50 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 51 | } 52 | }, 53 | "additionalProperties": true, 54 | "type": "object", 55 | "title": "Relation Link" 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /json/models/RelationOptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/RelationOptions", 4 | "definitions": { 5 | "RelationOptions": { 6 | "properties": { 7 | "options": { 8 | "items": { 9 | "$ref": "#/definitions/anytype.model.Relation.Option" 10 | }, 11 | "type": "array" 12 | } 13 | }, 14 | "additionalProperties": true, 15 | "type": "object", 16 | "title": "Relation Options" 17 | }, 18 | "anytype.model.Relation.Option": { 19 | "properties": { 20 | "id": { 21 | "type": "string", 22 | "description": "id generated automatically if omitted" 23 | }, 24 | "text": { 25 | "type": "string" 26 | }, 27 | "color": { 28 | "type": "string", 29 | "description": "stored" 30 | }, 31 | "relationKey": { 32 | "type": "string", 33 | "description": "4 is reserved for old relation format stored" 34 | } 35 | }, 36 | "additionalProperties": true, 37 | "type": "object", 38 | "title": "Option" 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /json/models/RelationWithValue.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/RelationWithValue", 4 | "definitions": { 5 | "RelationWithValue": { 6 | "properties": { 7 | "relation": { 8 | "$ref": "#/definitions/anytype.model.Relation", 9 | "additionalProperties": true 10 | }, 11 | "value": { 12 | "oneOf": [ 13 | { 14 | "type": "array" 15 | }, 16 | { 17 | "type": "boolean" 18 | }, 19 | { 20 | "type": "number" 21 | }, 22 | { 23 | "type": "object" 24 | }, 25 | { 26 | "type": "string" 27 | } 28 | ], 29 | "title": "Value", 30 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 31 | } 32 | }, 33 | "additionalProperties": true, 34 | "type": "object", 35 | "title": "Relation With Value" 36 | }, 37 | "anytype.model.Relation": { 38 | "properties": { 39 | "id": { 40 | "type": "string" 41 | }, 42 | "key": { 43 | "type": "string", 44 | "description": "Key under which the value is stored in the map. Must be unique for the object type. It usually auto-generated bsonid, but also may be something human-readable in case of prebuilt types." 45 | }, 46 | "format": { 47 | "enum": [ 48 | "longtext", 49 | 0, 50 | "shorttext", 51 | 1, 52 | "number", 53 | 2, 54 | "status", 55 | 3, 56 | "tag", 57 | 11, 58 | "date", 59 | 4, 60 | "file", 61 | 5, 62 | "checkbox", 63 | 6, 64 | "url", 65 | 7, 66 | "email", 67 | 8, 68 | "phone", 69 | 9, 70 | "emoji", 71 | 10, 72 | "object", 73 | 100, 74 | "relations", 75 | 101 76 | ], 77 | "oneOf": [ 78 | { 79 | "type": "string" 80 | }, 81 | { 82 | "type": "integer" 83 | } 84 | ], 85 | "title": "Relation Format", 86 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 87 | }, 88 | "name": { 89 | "type": "string", 90 | "description": "name to show (can be localized for bundled types)" 91 | }, 92 | "defaultValue": { 93 | "oneOf": [ 94 | { 95 | "type": "array" 96 | }, 97 | { 98 | "type": "boolean" 99 | }, 100 | { 101 | "type": "number" 102 | }, 103 | { 104 | "type": "object" 105 | }, 106 | { 107 | "type": "string" 108 | } 109 | ], 110 | "title": "Value", 111 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 112 | }, 113 | "dataSource": { 114 | "enum": [ 115 | "details", 116 | 0, 117 | "derived", 118 | 1, 119 | "account", 120 | 2, 121 | "local", 122 | 3 123 | ], 124 | "oneOf": [ 125 | { 126 | "type": "string" 127 | }, 128 | { 129 | "type": "integer" 130 | } 131 | ], 132 | "title": "Data Source" 133 | }, 134 | "hidden": { 135 | "type": "boolean", 136 | "description": "internal, not displayed to user (e.g. coverX, coverY)" 137 | }, 138 | "readOnly": { 139 | "type": "boolean", 140 | "description": "value not editable by user tobe renamed to readonlyValue" 141 | }, 142 | "readOnlyRelation": { 143 | "type": "boolean", 144 | "description": "relation metadata, eg name and format is not editable by user" 145 | }, 146 | "multi": { 147 | "type": "boolean", 148 | "description": "allow multiple values (stored in pb list)" 149 | }, 150 | "objectTypes": { 151 | "items": { 152 | "type": "string" 153 | }, 154 | "type": "array", 155 | "description": "URL of object type, empty to allow link to any object" 156 | }, 157 | "selectDict": { 158 | "items": { 159 | "$ref": "#/definitions/anytype.model.Relation.Option" 160 | }, 161 | "type": "array", 162 | "description": "index 10, 11 was used in internal-only builds. Can be reused, but may break some test accounts default dictionary with unique values to choose for select/multiSelect format" 163 | }, 164 | "maxCount": { 165 | "type": "integer", 166 | "description": "max number of values can be set for this relation. 0 means no limit. 1 means the value can be stored in non-repeated field" 167 | }, 168 | "description": { 169 | "type": "string" 170 | }, 171 | "scope": { 172 | "enum": [ 173 | "object", 174 | 0, 175 | "type", 176 | 1, 177 | "setOfTheSameType", 178 | 2, 179 | "objectsOfTheSameType", 180 | 3, 181 | "library", 182 | 4 183 | ], 184 | "oneOf": [ 185 | { 186 | "type": "string" 187 | }, 188 | { 189 | "type": "integer" 190 | } 191 | ], 192 | "title": "Scope" 193 | }, 194 | "creator": { 195 | "type": "string", 196 | "description": "creator profile id" 197 | }, 198 | "revision": { 199 | "type": "string", 200 | "description": "revision of system relation. Used to check if we should change relation content or not" 201 | } 202 | }, 203 | "additionalProperties": true, 204 | "type": "object", 205 | "title": "Relation", 206 | "description": "Relation describe the human-interpreted relation type. It may be something like \"Date of creation, format=date\" or \"Assignee, format=objectId, objectType=person\"" 207 | }, 208 | "anytype.model.Relation.Option": { 209 | "properties": { 210 | "id": { 211 | "type": "string", 212 | "description": "id generated automatically if omitted" 213 | }, 214 | "text": { 215 | "type": "string" 216 | }, 217 | "color": { 218 | "type": "string", 219 | "description": "stored" 220 | }, 221 | "relationKey": { 222 | "type": "string", 223 | "description": "4 is reserved for old relation format stored" 224 | } 225 | }, 226 | "additionalProperties": true, 227 | "type": "object", 228 | "title": "Option" 229 | } 230 | } 231 | } -------------------------------------------------------------------------------- /json/models/Relations.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Relations", 4 | "definitions": { 5 | "Relations": { 6 | "properties": { 7 | "relations": { 8 | "items": { 9 | "$ref": "#/definitions/anytype.model.Relation" 10 | }, 11 | "type": "array" 12 | } 13 | }, 14 | "additionalProperties": true, 15 | "type": "object", 16 | "title": "Relations" 17 | }, 18 | "anytype.model.Relation": { 19 | "properties": { 20 | "id": { 21 | "type": "string" 22 | }, 23 | "key": { 24 | "type": "string", 25 | "description": "Key under which the value is stored in the map. Must be unique for the object type. It usually auto-generated bsonid, but also may be something human-readable in case of prebuilt types." 26 | }, 27 | "format": { 28 | "enum": [ 29 | "longtext", 30 | 0, 31 | "shorttext", 32 | 1, 33 | "number", 34 | 2, 35 | "status", 36 | 3, 37 | "tag", 38 | 11, 39 | "date", 40 | 4, 41 | "file", 42 | 5, 43 | "checkbox", 44 | 6, 45 | "url", 46 | 7, 47 | "email", 48 | 8, 49 | "phone", 50 | 9, 51 | "emoji", 52 | 10, 53 | "object", 54 | 100, 55 | "relations", 56 | 101 57 | ], 58 | "oneOf": [ 59 | { 60 | "type": "string" 61 | }, 62 | { 63 | "type": "integer" 64 | } 65 | ], 66 | "title": "Relation Format", 67 | "description": "RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized" 68 | }, 69 | "name": { 70 | "type": "string", 71 | "description": "name to show (can be localized for bundled types)" 72 | }, 73 | "defaultValue": { 74 | "oneOf": [ 75 | { 76 | "type": "array" 77 | }, 78 | { 79 | "type": "boolean" 80 | }, 81 | { 82 | "type": "number" 83 | }, 84 | { 85 | "type": "object" 86 | }, 87 | { 88 | "type": "string" 89 | } 90 | ], 91 | "title": "Value", 92 | "description": "`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value." 93 | }, 94 | "dataSource": { 95 | "enum": [ 96 | "details", 97 | 0, 98 | "derived", 99 | 1, 100 | "account", 101 | 2, 102 | "local", 103 | 3 104 | ], 105 | "oneOf": [ 106 | { 107 | "type": "string" 108 | }, 109 | { 110 | "type": "integer" 111 | } 112 | ], 113 | "title": "Data Source" 114 | }, 115 | "hidden": { 116 | "type": "boolean", 117 | "description": "internal, not displayed to user (e.g. coverX, coverY)" 118 | }, 119 | "readOnly": { 120 | "type": "boolean", 121 | "description": "value not editable by user tobe renamed to readonlyValue" 122 | }, 123 | "readOnlyRelation": { 124 | "type": "boolean", 125 | "description": "relation metadata, eg name and format is not editable by user" 126 | }, 127 | "multi": { 128 | "type": "boolean", 129 | "description": "allow multiple values (stored in pb list)" 130 | }, 131 | "objectTypes": { 132 | "items": { 133 | "type": "string" 134 | }, 135 | "type": "array", 136 | "description": "URL of object type, empty to allow link to any object" 137 | }, 138 | "selectDict": { 139 | "items": { 140 | "$ref": "#/definitions/anytype.model.Relation.Option" 141 | }, 142 | "type": "array", 143 | "description": "index 10, 11 was used in internal-only builds. Can be reused, but may break some test accounts default dictionary with unique values to choose for select/multiSelect format" 144 | }, 145 | "maxCount": { 146 | "type": "integer", 147 | "description": "max number of values can be set for this relation. 0 means no limit. 1 means the value can be stored in non-repeated field" 148 | }, 149 | "description": { 150 | "type": "string" 151 | }, 152 | "scope": { 153 | "enum": [ 154 | "object", 155 | 0, 156 | "type", 157 | 1, 158 | "setOfTheSameType", 159 | 2, 160 | "objectsOfTheSameType", 161 | 3, 162 | "library", 163 | 4 164 | ], 165 | "oneOf": [ 166 | { 167 | "type": "string" 168 | }, 169 | { 170 | "type": "integer" 171 | } 172 | ], 173 | "title": "Scope" 174 | }, 175 | "creator": { 176 | "type": "string", 177 | "description": "creator profile id" 178 | }, 179 | "revision": { 180 | "type": "string", 181 | "description": "revision of system relation. Used to check if we should change relation content or not" 182 | } 183 | }, 184 | "additionalProperties": true, 185 | "type": "object", 186 | "title": "Relation", 187 | "description": "Relation describe the human-interpreted relation type. It may be something like \"Date of creation, format=date\" or \"Assignee, format=objectId, objectType=person\"" 188 | }, 189 | "anytype.model.Relation.Option": { 190 | "properties": { 191 | "id": { 192 | "type": "string", 193 | "description": "id generated automatically if omitted" 194 | }, 195 | "text": { 196 | "type": "string" 197 | }, 198 | "color": { 199 | "type": "string", 200 | "description": "stored" 201 | }, 202 | "relationKey": { 203 | "type": "string", 204 | "description": "4 is reserved for old relation format stored" 205 | } 206 | }, 207 | "additionalProperties": true, 208 | "type": "object", 209 | "title": "Option" 210 | } 211 | } 212 | } -------------------------------------------------------------------------------- /json/models/Restrictions.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Restrictions", 4 | "definitions": { 5 | "Restrictions": { 6 | "properties": { 7 | "object": { 8 | "items": { 9 | "enum": [ 10 | "None", 11 | 0, 12 | "Delete", 13 | 1, 14 | "Relations", 15 | 2, 16 | "Blocks", 17 | 3, 18 | "Details", 19 | 4, 20 | "TypeChange", 21 | 5, 22 | "LayoutChange", 23 | 6, 24 | "Template", 25 | 7, 26 | "Duplicate", 27 | 8, 28 | "CreateObjectOfThisType", 29 | 9, 30 | "Publish", 31 | 10 32 | ] 33 | }, 34 | "type": "array", 35 | "title": "Object Restriction" 36 | }, 37 | "dataview": { 38 | "items": { 39 | "$ref": "#/definitions/anytype.model.Restrictions.DataviewRestrictions" 40 | }, 41 | "type": "array" 42 | } 43 | }, 44 | "additionalProperties": true, 45 | "type": "object", 46 | "title": "Restrictions" 47 | }, 48 | "anytype.model.Restrictions.DataviewRestrictions": { 49 | "properties": { 50 | "blockId": { 51 | "type": "string" 52 | }, 53 | "restrictions": { 54 | "items": { 55 | "enum": [ 56 | "DVNone", 57 | 0, 58 | "DVRelation", 59 | 1, 60 | "DVCreateObject", 61 | 2, 62 | "DVViews", 63 | 3 64 | ] 65 | }, 66 | "type": "array", 67 | "title": "Dataview Restriction" 68 | } 69 | }, 70 | "additionalProperties": true, 71 | "type": "object", 72 | "title": "Dataview Restrictions" 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /json/models/Search.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/Search", 4 | "definitions": { 5 | "Search": { 6 | "additionalProperties": true, 7 | "type": "object", 8 | "title": "Search" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /json/models/SpaceObjectHeader.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "$ref": "#/definitions/SpaceObjectHeader", 4 | "definitions": { 5 | "SpaceObjectHeader": { 6 | "properties": { 7 | "spaceID": { 8 | "type": "string" 9 | } 10 | }, 11 | "additionalProperties": true, 12 | "type": "object", 13 | "title": "Space Object Header" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /models.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package anytype.model; 3 | option go_package = "pkg/lib/pb/model"; 4 | 5 | import "google/protobuf/struct.proto"; 6 | 7 | message SmartBlockSnapshotBase { 8 | repeated Block blocks = 1; 9 | google.protobuf.Struct details = 2; 10 | google.protobuf.Struct fileKeys = 3 [deprecated=true]; 11 | repeated Relation extraRelations = 4 [deprecated=true]; 12 | repeated string objectTypes = 5; 13 | google.protobuf.Struct collections = 6; 14 | repeated string removedCollectionKeys = 8; 15 | repeated RelationLink relationLinks = 7; 16 | string key = 9; // only used for pb backup purposes, ignored in other cases 17 | int64 originalCreatedTimestamp = 10; // ignored in import/export in favor of createdDate relation. Used to store original user-side object creation timestamp 18 | FileInfo fileInfo = 11; 19 | } 20 | 21 | enum SmartBlockType { 22 | AccountOld = 0; // deprecated 23 | 24 | Page = 0x10; 25 | ProfilePage = 0x11; 26 | Home = 0x20; 27 | Archive = 0x30; 28 | Widget = 0x70; 29 | 30 | File = 0x100; 31 | 32 | Template = 0x120; 33 | BundledTemplate = 0x121; 34 | 35 | BundledRelation = 0x200; // DEPRECATED 36 | SubObject = 0x201; 37 | BundledObjectType = 0x202; // DEPRECATED 38 | AnytypeProfile = 0x203; 39 | Date = 0x204; 40 | Workspace = 0x206; 41 | STRelation = 0x209; 42 | STType = 0x210; 43 | STRelationOption = 0x211; 44 | SpaceView = 0x212; 45 | 46 | Identity = 0x214; 47 | Participant = 0x216; 48 | MissingObject = 0x207; 49 | 50 | FileObject = 0x215; 51 | 52 | NotificationObject = 0x217; 53 | DevicesObject = 0x218; 54 | ChatObject = 0x219; // Container for any-store based chats 55 | ChatDerivedObject = 0x220; // Any-store based object for chat 56 | AccountObject = 0x221; // Container for account data in tech space 57 | } 58 | 59 | message Search { 60 | message Result { 61 | string objectId = 1; 62 | google.protobuf.Struct details = 2; // 63 | repeated Meta meta = 3; // meta information about the search result 64 | } 65 | 66 | message Meta { 67 | string highlight = 1; // truncated text with highlights 68 | repeated Range highlightRanges = 2; // ranges of the highlight in the text (using utf-16 runes) 69 | string blockId = 3; // block id where the highlight has been found 70 | string relationKey = 4; // relation key of the block where the highlight has been found 71 | google.protobuf.Struct relationDetails = 5; // contains details for dependent object. E.g. relation option or type. todo: rename to dependantDetails 72 | } 73 | } 74 | 75 | message Block { 76 | string id = 1; 77 | google.protobuf.Struct fields = 2; 78 | Restrictions restrictions = 3; 79 | repeated string childrenIds = 4; 80 | string backgroundColor = 5; 81 | Align align = 6; 82 | VerticalAlign verticalAlign = 7; 83 | 84 | oneof content { 85 | Content.Smartblock smartblock = 11; 86 | 87 | Content.Text text = 14; 88 | Content.File file = 15; 89 | Content.Layout layout = 16; 90 | Content.Div div = 17; 91 | Content.Bookmark bookmark = 18; 92 | Content.Icon icon = 19; 93 | Content.Link link = 20; 94 | Content.Dataview dataview = 21; 95 | Content.Relation relation = 22; 96 | Content.FeaturedRelations featuredRelations = 23; 97 | Content.Latex latex = 24; 98 | Content.TableOfContents tableOfContents = 25; 99 | Content.Table table = 26; 100 | Content.TableColumn tableColumn = 27; 101 | Content.TableRow tableRow = 28; 102 | Content.Widget widget = 29; 103 | Content.Chat chat = 30; 104 | } 105 | 106 | message Restrictions { 107 | bool read = 1; 108 | bool edit = 2; 109 | bool remove = 3; 110 | bool drag = 4; 111 | bool dropOn = 5; 112 | } 113 | 114 | enum Position { 115 | None = 0; 116 | // above target block 117 | Top = 1; 118 | // under target block 119 | Bottom = 2; 120 | // to left of target block 121 | Left = 3; 122 | // to right of target block 123 | Right = 4; 124 | // inside target block, as last block 125 | Inner = 5; 126 | // replace target block 127 | Replace = 6; 128 | // inside target block, as first block 129 | InnerFirst = 7; 130 | } 131 | 132 | enum Align { 133 | AlignLeft = 0; 134 | AlignCenter = 1; 135 | AlignRight = 2; 136 | AlignJustify = 3; 137 | } 138 | 139 | enum VerticalAlign { 140 | VerticalAlignTop = 0; 141 | VerticalAlignMiddle = 1; 142 | VerticalAlignBottom = 2; 143 | } 144 | 145 | message Content { 146 | /* 147 | * Layout have no visual representation, but affects on blocks, that it contains. 148 | * Row/Column layout blocks creates only automatically, after some of a D&D operations, for example 149 | */ 150 | message Layout { 151 | Style style = 1; 152 | 153 | enum Style { 154 | Row = 0; 155 | Column = 1; 156 | Div = 2; 157 | Header = 3; 158 | TableRows = 4; 159 | TableColumns = 5; 160 | } 161 | } 162 | 163 | /* 164 | * Link: block to link some content from an external sources. 165 | */ 166 | message Link { 167 | string targetBlockId = 1; // id of the target block 168 | Style style = 2; // deprecated 169 | google.protobuf.Struct fields = 3; 170 | IconSize iconSize = 4; 171 | CardStyle cardStyle = 5; 172 | Description description = 6; 173 | repeated string relations = 7; 174 | 175 | enum IconSize { 176 | SizeNone = 0; 177 | SizeSmall = 1; 178 | SizeMedium = 2; 179 | } 180 | 181 | enum Style { 182 | Page = 0; 183 | Dataview = 1; 184 | Dashboard = 2; 185 | Archive = 3; 186 | // ... 187 | } 188 | 189 | enum Description { 190 | None = 0; 191 | Added = 1; 192 | Content = 2; 193 | } 194 | 195 | enum CardStyle { 196 | Text = 0; 197 | Card = 1; 198 | Inline = 2; 199 | } 200 | } 201 | 202 | /* 203 | * Divider: block, that contains only one horizontal thin line 204 | */ 205 | message Div { 206 | Style style = 1; 207 | 208 | enum Style { 209 | Line = 0; 210 | Dots = 1; 211 | } 212 | } 213 | 214 | /* 215 | * Bookmark is to keep a web-link and to preview a content. 216 | */ 217 | message Bookmark { 218 | string url = 1; 219 | // Deprecated. Get this data from the target object. 220 | string title = 2; 221 | // Deprecated. Get this data from the target object. 222 | string description = 3; 223 | // Deprecated. Get this data from the target object. 224 | string imageHash = 4; 225 | // Deprecated. Get this data from the target object. 226 | string faviconHash = 5; 227 | 228 | LinkPreview.Type type = 6; 229 | string targetObjectId = 7; 230 | 231 | State state = 8; 232 | 233 | enum State { 234 | Empty = 0; 235 | Fetching = 1; 236 | Done = 2; 237 | Error = 3; 238 | } 239 | } 240 | 241 | message Icon { 242 | string name = 1; 243 | } 244 | 245 | message FeaturedRelations { 246 | } 247 | 248 | message Text { 249 | string text = 1; 250 | Style style = 2; 251 | Marks marks = 3; // list of marks to apply to the text 252 | bool checked = 4; 253 | string color = 5; 254 | string iconEmoji = 6; // used with style Callout 255 | string iconImage = 7; // in case both image and emoji are set, image should has a priority in the UI 256 | 257 | message Marks { 258 | repeated Mark marks = 1; 259 | } 260 | 261 | message Mark { 262 | Range range = 1; // range of symbols to apply this mark. From(symbol) To(symbol) 263 | Type type = 2; 264 | string param = 3; // link, color, etc 265 | 266 | enum Type { 267 | Strikethrough = 0; 268 | Keyboard = 1; 269 | Italic = 2; 270 | Bold = 3; 271 | Underscored = 4; 272 | Link = 5; 273 | TextColor = 6; 274 | BackgroundColor = 7; 275 | Mention = 8; 276 | Emoji = 9; 277 | Object = 10; 278 | } 279 | } 280 | 281 | enum Style { 282 | Paragraph = 0; 283 | Header1 = 1; 284 | Header2 = 2; 285 | Header3 = 3; 286 | Header4 = 4; // deprecated 287 | Quote = 5; 288 | Code = 6; 289 | Title = 7; // currently only one block of this style can exists on a page 290 | Checkbox = 8; 291 | Marked = 9; 292 | Numbered = 10; 293 | Toggle = 11; 294 | Description = 12; // currently only one block of this style can exists on a page 295 | Callout = 13; 296 | 297 | } 298 | } 299 | 300 | message File { 301 | string hash = 1; 302 | string name = 2; 303 | Type type = 3; 304 | string mime = 4; 305 | int64 size = 5; 306 | int64 addedAt = 6; 307 | string targetObjectId = 9; 308 | 309 | State state = 7; 310 | Style style = 8; 311 | 312 | enum Type { 313 | None = 0; 314 | File = 1; 315 | Image = 2; 316 | Video = 3; 317 | Audio = 4; 318 | PDF = 5; 319 | } 320 | 321 | enum Style { 322 | Auto = 0; // all types expect File and None has Embed style by default 323 | Link = 1; 324 | Embed = 2; 325 | } 326 | 327 | enum State { 328 | Empty = 0; // There is no file and preview, it's an empty block, that waits files. 329 | Uploading = 1; // There is still no file/preview, but file already uploading 330 | Done = 2; // File and preview downloaded 331 | Error = 3; // Error while uploading 332 | } 333 | } 334 | 335 | message Smartblock { 336 | } 337 | 338 | message Dataview { 339 | repeated string source = 1; // can be set for detached(without TargetObjectId) inline sets 340 | repeated View views = 2; 341 | string activeView = 3; // do not generate changes for this field 342 | // deprecated 343 | repeated model.Relation relations = 4; 344 | repeated GroupOrder groupOrders = 12; 345 | repeated ObjectOrder objectOrders = 13; 346 | repeated anytype.model.RelationLink relationLinks = 5; 347 | string TargetObjectId = 6; // empty for original set/collection objects and for detached inline sets 348 | bool isCollection = 14; 349 | 350 | message View { 351 | string id = 1; 352 | Type type = 2; 353 | string name = 3; 354 | repeated Sort sorts = 4; 355 | repeated Filter filters = 5; 356 | repeated Relation relations = 6; // relations fields/columns options, also used to provide the order 357 | string coverRelationKey = 7; // Relation used for cover in gallery 358 | bool hideIcon = 8; // Hide icon near name 359 | Size cardSize = 9; // Gallery card size 360 | bool coverFit = 10; // Image fits container 361 | string groupRelationKey = 11; // Group view by this relationKey 362 | bool groupBackgroundColors = 12; // Enable backgrounds in groups 363 | int32 pageLimit = 13; // Limit of objects shown in widget 364 | string defaultTemplateId = 14; // Default template that is chosen for new object created within the view 365 | string defaultObjectTypeId = 15; // Default object type that is chosen for new object created within the view 366 | string endRelationKey = 16; // Group view by this relationKey 367 | 368 | enum Type { 369 | Table = 0; 370 | List = 1; 371 | Gallery = 2; 372 | Kanban = 3; 373 | Calendar = 4; 374 | Graph = 5; 375 | } 376 | 377 | enum Size { 378 | Small = 0; 379 | Medium = 1; 380 | Large = 2; 381 | } 382 | } 383 | 384 | message Relation { 385 | string key = 1; 386 | bool isVisible = 2; 387 | int32 width = 3; // the displayed column % calculated based on other visible relations 388 | // bool isReadOnly = 4; // deprecated 389 | 390 | bool dateIncludeTime = 5; 391 | TimeFormat timeFormat = 6; 392 | DateFormat dateFormat = 7; 393 | FormulaType formula = 8; 394 | Block.Align align = 9; 395 | 396 | enum DateFormat { 397 | MonthAbbrBeforeDay = 0; // Jul 30, 2020 398 | MonthAbbrAfterDay = 1; // 30 Jul 2020 399 | Short = 2; // 30/07/2020 400 | ShortUS = 3; // 07/30/2020 401 | ISO = 4; // 2020-07-30 402 | } 403 | 404 | enum TimeFormat { 405 | Format12 = 0; 406 | Format24 = 1; 407 | } 408 | 409 | enum FormulaType { 410 | None = 0; 411 | Count = 1; 412 | CountValue = 2; 413 | CountDistinct = 3; 414 | CountEmpty = 4; 415 | CountNotEmpty = 5; 416 | PercentEmpty = 6; 417 | PercentNotEmpty = 7; 418 | MathSum = 8; 419 | MathAverage = 9; 420 | MathMedian = 10; 421 | MathMin = 11; 422 | MathMax = 12; 423 | Range = 13; 424 | } 425 | } 426 | 427 | message Sort { 428 | string RelationKey = 1; 429 | Type type = 2; 430 | repeated google.protobuf.Value customOrder = 3; 431 | RelationFormat format = 4; 432 | bool includeTime = 5; 433 | string id = 6; 434 | EmptyType emptyPlacement = 7; 435 | bool noCollate = 8; 436 | 437 | enum Type { 438 | Asc = 0; 439 | Desc = 1; 440 | Custom = 2; 441 | } 442 | 443 | enum EmptyType { 444 | NotSpecified = 0; 445 | Start = 1; 446 | End = 2; 447 | } 448 | } 449 | 450 | message Filter { 451 | string id = 9; 452 | Operator operator = 1; // looks not applicable? 453 | string RelationKey = 2; 454 | string relationProperty = 5; 455 | Condition condition = 3; 456 | google.protobuf.Value value = 4; 457 | QuickOption quickOption = 6; 458 | RelationFormat format = 7; 459 | bool includeTime = 8; 460 | repeated Filter nestedFilters = 10; 461 | 462 | enum Operator { 463 | No = 0; 464 | Or = 1; 465 | And = 2; 466 | } 467 | 468 | enum Condition { 469 | None = 0; 470 | Equal = 1; 471 | NotEqual = 2; 472 | Greater = 3; 473 | Less = 4; 474 | GreaterOrEqual = 5; 475 | LessOrEqual = 6; 476 | Like = 7; 477 | NotLike = 8; 478 | In = 9; // "at least one value(from the provided list) is IN" 479 | NotIn = 10; // "none of provided values are IN" 480 | Empty = 11; 481 | NotEmpty = 12; 482 | AllIn = 13; 483 | NotAllIn = 14; 484 | ExactIn = 15; 485 | NotExactIn = 16; 486 | Exists = 17; 487 | } 488 | 489 | enum QuickOption { 490 | ExactDate = 0; 491 | Yesterday = 1; 492 | Today = 2; 493 | Tomorrow = 3; 494 | LastWeek = 4; 495 | CurrentWeek = 5; 496 | NextWeek = 6; 497 | LastMonth = 7; 498 | CurrentMonth = 8; 499 | NextMonth = 9; 500 | NumberOfDaysAgo = 10; 501 | NumberOfDaysNow = 11; 502 | } 503 | } 504 | 505 | message GroupOrder { 506 | string viewId = 1; 507 | repeated ViewGroup viewGroups = 2; 508 | } 509 | 510 | message ViewGroup { 511 | string groupId = 1; 512 | int32 index = 2; 513 | bool hidden = 3; 514 | string backgroundColor = 4; 515 | } 516 | 517 | message ObjectOrder { 518 | string viewId = 1; 519 | string groupId = 2; 520 | repeated string objectIds = 3; 521 | } 522 | 523 | message Group { 524 | string id = 1; 525 | oneof Value { 526 | Status status = 2; 527 | Tag tag = 3; 528 | Checkbox checkbox = 4; 529 | Date date = 5; 530 | } 531 | } 532 | 533 | message Status { 534 | string id = 1; 535 | } 536 | 537 | message Tag { 538 | repeated string ids = 1; 539 | } 540 | 541 | message Checkbox { 542 | bool checked = 1; 543 | } 544 | 545 | message Date { 546 | } 547 | } 548 | 549 | message Relation { 550 | string key = 1; 551 | } 552 | 553 | message Latex { 554 | string text = 1; 555 | Processor processor = 2; 556 | 557 | enum Processor { 558 | Latex = 0; 559 | Mermaid = 1; 560 | Chart = 2; 561 | Youtube = 3; 562 | Vimeo = 4; 563 | Soundcloud = 5; 564 | GoogleMaps = 6; 565 | Miro = 7; 566 | Figma = 8; 567 | Twitter = 9; 568 | OpenStreetMap = 10; 569 | Reddit = 11; 570 | Facebook = 12; 571 | Instagram = 13; 572 | Telegram = 14; 573 | GithubGist = 15; 574 | Codepen = 16; 575 | Bilibili = 17; 576 | Excalidraw = 18; 577 | Kroki = 19; 578 | Graphviz = 20; 579 | Sketchfab = 21; 580 | Image = 22; 581 | } 582 | } 583 | 584 | message TableOfContents { 585 | } 586 | 587 | message Table {} 588 | message TableColumn {} 589 | message TableRow { 590 | bool isHeader = 1; 591 | } 592 | 593 | message Widget { 594 | Layout layout = 1; 595 | int32 limit = 2; 596 | string viewId = 3; 597 | bool autoAdded = 4; 598 | 599 | enum Layout { 600 | Link = 0; 601 | Tree = 1; 602 | List = 2; 603 | CompactList = 3; 604 | View = 4; 605 | } 606 | } 607 | message Chat { 608 | 609 | } 610 | } 611 | } 612 | 613 | /* 614 | * Used to decode block meta only, without the content itself 615 | */ 616 | message BlockMetaOnly { 617 | string id = 1; 618 | google.protobuf.Struct fields = 2; 619 | } 620 | 621 | /* 622 | * General purpose structure, uses in Mark. 623 | */ 624 | message Range { 625 | int32 from = 1; 626 | int32 to = 2; 627 | } 628 | 629 | /** 630 | * Contains basic information about a user account 631 | */ 632 | message Account { 633 | string id = 1; // User's thread id 634 | Config config = 4; 635 | Status status = 5; 636 | Info info = 6; 637 | 638 | message Config { 639 | bool enableDataview = 1; 640 | bool enableDebug = 2; 641 | bool enablePrereleaseChannel = 3; 642 | bool enableSpaces = 4; 643 | 644 | google.protobuf.Struct extra = 100; 645 | } 646 | 647 | message Status { 648 | StatusType statusType = 1; 649 | int64 deletionDate = 2; 650 | } 651 | 652 | enum StatusType { 653 | Active = 0; 654 | PendingDeletion = 1; 655 | StartedDeletion = 2; 656 | Deleted = 3; 657 | } 658 | 659 | message Info { 660 | string homeObjectId = 2; // home dashboard block id 661 | string archiveObjectId = 3; // archive block id 662 | string profileObjectId = 4; // profile block id 663 | string marketplaceWorkspaceId = 11; // marketplace workspace id 664 | string workspaceObjectId = 15; // workspace object id. used for space-level chat 665 | 666 | string deviceId = 8; 667 | string accountSpaceId = 9; // the first created private space. It's filled only when account is created 668 | string widgetsId = 10; 669 | string spaceViewId = 13; 670 | string techSpaceId = 14; 671 | 672 | string gatewayUrl = 101; // gateway url for fetching static files 673 | string localStoragePath = 103; // path to local storage 674 | string timeZone = 104; // time zone from config 675 | string analyticsId = 105; 676 | string networkId = 106; // network id to which anytype is connected 677 | string ethereumAddress = 107; // we have Any PK AND Ethereum PK derived from one seed phrase 678 | } 679 | 680 | message Auth { 681 | message AppInfo { 682 | string appHash = 1; 683 | string appName = 2; // either from process or specified manually when creating 684 | string appKey = 4; 685 | int64 createdAt = 5; 686 | int64 expireAt = 6; 687 | LocalApiScope scope = 7; 688 | bool isActive = 8; 689 | } 690 | enum LocalApiScope { 691 | Limited = 0; // Used in WebClipper; AccountSelect(to be deprecated), ObjectSearch, ObjectShow, ObjectCreate, ObjectCreateFromURL, BlockPreview, BlockPaste, BroadcastPayloadEvent 692 | JsonAPI = 1; // JSON API only, no direct grpc api calls allowed 693 | Full = 2; // Full access, not available via LocalLink 694 | } 695 | } 696 | 697 | } 698 | 699 | message LinkPreview { 700 | string url = 1; 701 | string title = 2; 702 | string description = 3; 703 | string imageUrl = 4; 704 | string faviconUrl = 5; 705 | Type type = 6; 706 | 707 | enum Type { 708 | Unknown = 0; 709 | Page = 1; 710 | Image = 2; 711 | Text = 3; 712 | } 713 | } 714 | 715 | message Restrictions { 716 | repeated ObjectRestriction object = 1; 717 | repeated DataviewRestrictions dataview = 2; 718 | 719 | enum ObjectRestriction { 720 | None = 0; 721 | // restricts delete 722 | Delete = 1; 723 | // restricts work with relations 724 | Relations = 2; 725 | // restricts work with blocks 726 | Blocks = 3; 727 | // restricts work with details 728 | Details = 4; 729 | // restricts type changing 730 | TypeChange = 5; 731 | // restricts layout changing 732 | LayoutChange = 6; 733 | // restricts template creation from this object 734 | Template = 7; 735 | // restricts duplicate object 736 | Duplicate = 8; 737 | // can be set only for types. Restricts creating objects of this type 738 | CreateObjectOfThisType = 9; 739 | // object is not allowed to publish 740 | Publish = 10; 741 | } 742 | 743 | 744 | message DataviewRestrictions { 745 | string blockId = 1; 746 | repeated DataviewRestriction restrictions = 2; 747 | } 748 | 749 | enum DataviewRestriction { 750 | DVNone = 0; 751 | DVRelation = 1; 752 | DVCreateObject = 2; 753 | DVViews = 3; 754 | } 755 | } 756 | 757 | message Object { 758 | message ChangePayload { 759 | SmartBlockType smartBlockType = 1; 760 | string key = 2; 761 | bytes data = 3; 762 | } 763 | } 764 | 765 | message SpaceObjectHeader { 766 | string spaceID = 1; 767 | } 768 | 769 | message ObjectType { 770 | string url = 1; // leave empty in case you want to create the new one 771 | string name = 2; // name of objectType in singular form (can be localized for bundled types) 772 | repeated RelationLink relationLinks = 3; // cannot contain more than one Relation with the same RelationType 773 | Layout layout = 4; 774 | string iconEmoji = 5; // emoji symbol 775 | string description = 6; 776 | bool hidden = 7; 777 | bool readonly = 10; 778 | repeated SmartBlockType types = 8; 779 | bool isArchived = 9; // sets locally to hide object type from set and some other places 780 | bool installedByDefault = 11; 781 | string key = 12; // name of objectType (can be localized for bundled types) 782 | int64 revision = 13; // revision of system objectType. Used to check if we should change type content or not 783 | bool restrictObjectCreation = 14; // restricts creating objects of this type for users 784 | int64 iconColor = 15; // color of object type icon 785 | string iconName = 16; // name of object type icon 786 | string pluralName = 17; // name of objectType in plural form (can be localized for bundled types) 787 | 788 | enum Layout { 789 | basic = 0; 790 | profile = 1; 791 | todo = 2; 792 | set = 3; 793 | objectType = 4; 794 | relation = 5; 795 | file = 6; 796 | dashboard = 7; 797 | image = 8; 798 | note = 9; 799 | space = 10; 800 | bookmark = 11; 801 | relationOptionsList = 12; 802 | relationOption = 13; 803 | collection = 14; 804 | audio = 15; 805 | video = 16; 806 | date = 17; 807 | spaceView = 18; 808 | participant = 19; 809 | 810 | pdf = 20; 811 | chat = 21; // deprecated 812 | chatDerived = 22; 813 | tag = 23; 814 | } 815 | } 816 | 817 | message Layout { 818 | ObjectType.Layout id = 1; 819 | string name = 2; 820 | repeated Relation requiredRelations = 3; // relations required for this object type 821 | } 822 | 823 | message RelationWithValue { 824 | Relation relation = 1; 825 | google.protobuf.Value value = 2; 826 | } 827 | 828 | // Relation describe the human-interpreted relation type. It may be something like "Date of creation, format=date" or "Assignee, format=objectId, objectType=person" 829 | message Relation { 830 | string id = 100; 831 | 832 | // Key under which the value is stored in the map. Must be unique for the object type. 833 | // It usually auto-generated bsonid, but also may be something human-readable in case of prebuilt types. 834 | string key = 1; 835 | 836 | RelationFormat format = 2; // format of the underlying data 837 | string name = 3; // name to show (can be localized for bundled types) 838 | google.protobuf.Value defaultValue = 4; 839 | DataSource dataSource = 5; // where the data is stored 840 | 841 | bool hidden = 6; // internal, not displayed to user (e.g. coverX, coverY) 842 | bool readOnly = 7; // value not editable by user tobe renamed to readonlyValue 843 | bool readOnlyRelation = 15; // relation metadata, eg name and format is not editable by user 844 | 845 | bool multi = 8; // allow multiple values (stored in pb list) 846 | 847 | repeated string objectTypes = 9; // URL of object type, empty to allow link to any object 848 | // index 10, 11 was used in internal-only builds. Can be reused, but may break some test accounts 849 | repeated Option selectDict = 12; // default dictionary with unique values to choose for select/multiSelect format 850 | int32 maxCount = 13; // max number of values can be set for this relation. 0 means no limit. 1 means the value can be stored in non-repeated field 851 | string description = 14; 852 | 853 | // on-store fields, injected only locally 854 | Scope scope = 20; // deprecated, to be removed 855 | string creator = 21; // creator profile id 856 | int64 revision = 22; // revision of system relation. Used to check if we should change relation content or not 857 | 858 | message Option { 859 | string id = 1; // id generated automatically if omitted 860 | string text = 2; 861 | string color = 3; // stored 862 | // 4 is reserved for old relation format 863 | string relationKey = 5; // stored 864 | } 865 | 866 | enum Scope { 867 | object = 0; // stored within the object 868 | type = 1; // stored within the object type 869 | setOfTheSameType = 2; // aggregated from the dataview of sets of the same object type 870 | objectsOfTheSameType = 3; // aggregated from the dataview of sets of the same object type 871 | library = 4; // aggregated from relations library 872 | } 873 | 874 | enum DataSource { 875 | details = 0; // default, stored inside the object's details 876 | derived = 1; // stored locally, e.g. in badger or generated on the fly 877 | account = 2; // stored in the account DB. means existing only for specific anytype account 878 | local = 3; // stored locally 879 | } 880 | } 881 | 882 | // RelationFormat describes how the underlying data is stored in the google.protobuf.Value and how it should be validated/sanitized 883 | enum RelationFormat { 884 | longtext = 0; // string 885 | shorttext = 1; // string, usually short enough. May be truncated in the future 886 | number = 2; // double 887 | status = 3; // string or list of string(len==1) 888 | tag = 11; // list of string (choose multiple from a list) 889 | date = 4; // float64(pb.Value doesn't have int64) or the string 890 | file = 5; // relation can has objects of specific types: file, image, audio, video 891 | checkbox = 6; // boolean 892 | url = 7; // string with sanity check 893 | email = 8; // string with sanity check 894 | phone = 9; // string with sanity check 895 | emoji = 10; // one emoji, can contains multiple utf-8 symbols 896 | 897 | object = 100; // relation can has objectType to specify objectType 898 | relations = 101; // base64-encoded relation pb model 899 | 900 | } 901 | 902 | enum ObjectOrigin { 903 | none = 0; 904 | clipboard = 1; 905 | dragAndDrop = 2; 906 | import = 3; 907 | webclipper = 4; 908 | sharingExtension = 5; 909 | usecase = 6; 910 | builtin = 7; 911 | bookmark = 8; 912 | api = 9; 913 | } 914 | 915 | message RelationLink { 916 | string key = 1; 917 | RelationFormat format = 2; 918 | } 919 | 920 | message Relations { 921 | repeated Relation relations = 1; 922 | } 923 | 924 | message RelationOptions { 925 | repeated Relation.Option options = 1; 926 | } 927 | 928 | message InternalFlag { 929 | Value value = 1; 930 | 931 | // Use such a weird construction due to the issue with imported repeated enum type 932 | // Look https://github.com/golang/protobuf/issues/1135 for more information. 933 | enum Value { 934 | editorDeleteEmpty = 0; 935 | editorSelectType = 1; 936 | editorSelectTemplate = 2; 937 | collectionDontIndexLinks = 3; 938 | } 939 | } 940 | 941 | 942 | /* 943 | * Works with a smart blocks: Page, Dashboard 944 | * Dashboard opened, click on a page, Rpc.Block.open, Block.ShowFullscreen(PageBlock) 945 | */ 946 | message ObjectView { 947 | string rootId = 1; // Root block id 948 | repeated Block blocks = 2; // dependent simple blocks (descendants) 949 | repeated DetailsSet details = 3; // details for the current and dependent objects 950 | SmartBlockType type = 4; 951 | 952 | message DetailsSet { 953 | string id = 1; // context objectId 954 | google.protobuf.Struct details = 2; // can not be a partial state. Should replace client details state 955 | repeated string subIds = 3; 956 | } 957 | 958 | message RelationWithValuePerObject { 959 | string objectId = 1; 960 | repeated RelationWithValue relations = 2; 961 | } 962 | 963 | repeated Relation relations = 7; // DEPRECATED, use relationLinks instead 964 | repeated RelationLink relationLinks = 10; 965 | 966 | Restrictions restrictions = 8; // object restrictions 967 | HistorySize history = 9; 968 | 969 | message HistorySize { 970 | int32 undo = 1; 971 | int32 redo = 2; 972 | } 973 | 974 | repeated BlockParticipant blockParticipants = 11; 975 | message BlockParticipant { 976 | string blockId = 1; 977 | string participantId = 2; 978 | } 979 | } 980 | 981 | enum SpaceStatus { 982 | // Unknown means the space is not loaded yet 983 | Unknown = 0; 984 | // Loading - the space in progress of loading 985 | Loading = 1; 986 | // Ok - the space loaded and available 987 | Ok = 2; 988 | // Missing - the space is missing 989 | Missing = 3; 990 | // Error - the space loading ended with an error 991 | Error = 4; 992 | 993 | // RemoteWaitingDeletion - network status is "waiting deletion" 994 | RemoteWaitingDeletion = 5; 995 | // RemoteDeleted - the space is deleted in the current network 996 | RemoteDeleted = 6; 997 | // SpaceDeleted - the space should be deleted in the network 998 | SpaceDeleted = 7; 999 | // SpaceActive - the space is active in the network 1000 | SpaceActive = 8; 1001 | // SpaceJoining - the account is joining the space 1002 | SpaceJoining = 9; 1003 | // SpaceRemoving - the account is removing from space or the space is removed from network 1004 | SpaceRemoving = 10; 1005 | } 1006 | 1007 | message ParticipantPermissionChange { 1008 | string identity = 1; 1009 | ParticipantPermissions perms = 2; 1010 | } 1011 | 1012 | enum ParticipantPermissions { 1013 | Reader = 0; 1014 | Writer = 1; 1015 | Owner = 2; 1016 | NoPermissions = 3; 1017 | } 1018 | 1019 | enum InviteType { 1020 | Member = 0; // aclKey contains the key to sign the ACL record 1021 | Guest = 1; // guestKey contains the privateKey of the guest user 1022 | WithoutApprove = 2; // aclKey contains the key to sign the ACL record, but no approval needed 1023 | } 1024 | 1025 | enum ParticipantStatus { 1026 | Joining = 0; 1027 | Active = 1; 1028 | Removed = 2; 1029 | Declined = 3; 1030 | Removing = 4; 1031 | Canceled = 5; 1032 | } 1033 | 1034 | enum SpaceAccessType { 1035 | Private = 0; 1036 | Personal = 1; 1037 | Shared = 2; 1038 | } 1039 | 1040 | enum SpaceUxType { 1041 | Chat = 0; // chat-first UX 1042 | Data = 1; // objects-first UX 1043 | Stream = 2; // stream UX (chat with limited amount of owners) 1044 | } 1045 | 1046 | message Metadata { 1047 | oneof payload { 1048 | Payload.IdentityPayload identity = 1; 1049 | } 1050 | 1051 | message Payload { 1052 | message IdentityPayload { 1053 | bytes profileSymKey = 1; 1054 | } 1055 | } 1056 | } 1057 | 1058 | message Notification { 1059 | string id = 1; 1060 | int64 createTime = 2; 1061 | Status status = 4; 1062 | bool isLocal = 5; 1063 | oneof payload { 1064 | Import import = 6; 1065 | Export export = 8; 1066 | GalleryImport galleryImport = 9; 1067 | RequestToJoin requestToJoin = 10; 1068 | Test test = 11; 1069 | ParticipantRequestApproved participantRequestApproved = 13; 1070 | RequestToLeave requestToLeave = 15; 1071 | ParticipantRemove participantRemove = 16; 1072 | ParticipantRequestDecline participantRequestDecline = 17; 1073 | ParticipantPermissionsChange participantPermissionsChange = 18; 1074 | } 1075 | string space = 7; 1076 | string aclHeadId = 14; 1077 | 1078 | message Import { 1079 | string processId = 1; 1080 | model.Import.ErrorCode errorCode = 2; 1081 | model.Import.Type importType = 3; 1082 | string spaceId = 4; 1083 | string name = 5; 1084 | string spaceName = 6; 1085 | } 1086 | 1087 | message Export { 1088 | Code errorCode = 2; 1089 | model.Export.Format exportType = 3; 1090 | enum Code { 1091 | NULL = 0; 1092 | UNKNOWN_ERROR = 1; 1093 | BAD_INPUT = 2; 1094 | } 1095 | } 1096 | 1097 | message GalleryImport { 1098 | string processId = 1; 1099 | model.Import.ErrorCode errorCode = 2; 1100 | string spaceId = 3; 1101 | string name = 4; 1102 | string spaceName = 5; 1103 | } 1104 | 1105 | message RequestToJoin { 1106 | string spaceId = 1; 1107 | string identity = 2; 1108 | string identityName = 3; 1109 | string identityIcon = 4; 1110 | string spaceName = 5; 1111 | } 1112 | 1113 | message Test {} 1114 | 1115 | message ParticipantRequestApproved { 1116 | string spaceId = 1; 1117 | ParticipantPermissions permissions = 2; 1118 | string spaceName = 5; 1119 | } 1120 | 1121 | message RequestToLeave { 1122 | string spaceId = 1; 1123 | string identity = 2; 1124 | string identityName = 3; 1125 | string identityIcon = 4; 1126 | string spaceName = 5; 1127 | } 1128 | 1129 | message ParticipantRemove { 1130 | string identity = 1; 1131 | string identityName = 2; 1132 | string identityIcon = 3; 1133 | string spaceId = 4; 1134 | string spaceName = 5; 1135 | } 1136 | 1137 | message ParticipantRequestDecline { 1138 | string spaceId = 1; 1139 | string spaceName = 3; 1140 | } 1141 | 1142 | message ParticipantPermissionsChange { 1143 | string spaceId = 1; 1144 | ParticipantPermissions permissions = 2; 1145 | string spaceName = 3; 1146 | } 1147 | 1148 | enum Status { 1149 | Created = 0; 1150 | Shown = 1; 1151 | Read = 2; 1152 | Replied = 3; 1153 | } 1154 | 1155 | enum ActionType { 1156 | CLOSE = 0; 1157 | } 1158 | } 1159 | 1160 | message Export { 1161 | enum Format { 1162 | Markdown = 0; 1163 | Protobuf = 1; 1164 | JSON = 2; 1165 | DOT = 3; 1166 | SVG = 4; 1167 | GRAPH_JSON = 5; 1168 | } 1169 | } 1170 | 1171 | message Import { 1172 | enum Type { 1173 | Notion = 0; 1174 | Markdown = 1; 1175 | External = 2; // external developers use it 1176 | Pb = 3; 1177 | Html = 4; 1178 | Txt = 5; 1179 | Csv = 6; 1180 | } 1181 | 1182 | enum ErrorCode { 1183 | NULL = 0; 1184 | UNKNOWN_ERROR = 1; 1185 | BAD_INPUT = 2; 1186 | INTERNAL_ERROR = 3; 1187 | FILE_LOAD_ERROR = 8; 1188 | IMPORT_IS_CANCELED = 6; 1189 | 1190 | NOTION_NO_OBJECTS_IN_INTEGRATION= 5; 1191 | NOTION_SERVER_IS_UNAVAILABLE = 12; 1192 | NOTION_RATE_LIMIT_EXCEEDED= 13; 1193 | 1194 | FILE_IMPORT_NO_OBJECTS_IN_ZIP_ARCHIVE = 14; 1195 | FILE_IMPORT_NO_OBJECTS_IN_DIRECTORY = 17; 1196 | 1197 | HTML_WRONG_HTML_STRUCTURE = 10; 1198 | 1199 | PB_NOT_ANYBLOCK_FORMAT = 11; 1200 | 1201 | CSV_LIMIT_OF_ROWS_OR_RELATIONS_EXCEEDED = 7; 1202 | 1203 | INSUFFICIENT_PERMISSIONS = 9; 1204 | } 1205 | } 1206 | 1207 | message Invite { 1208 | bytes payload = 1; 1209 | bytes signature = 2; 1210 | } 1211 | 1212 | message InvitePayload { 1213 | string creatorIdentity = 1; 1214 | string creatorName = 2; 1215 | bytes aclKey = 3; 1216 | string spaceId = 4; 1217 | string spaceName = 5; 1218 | string spaceIconCid = 6; 1219 | repeated FileEncryptionKey spaceIconEncryptionKeys = 7; 1220 | 1221 | InviteType inviteType = 8; 1222 | bytes guestKey = 9; 1223 | } 1224 | 1225 | message IdentityProfile { 1226 | string identity = 1; 1227 | string name = 2; 1228 | string iconCid = 3; 1229 | repeated FileEncryptionKey iconEncryptionKeys = 4; 1230 | string description = 5; 1231 | string globalName = 6; 1232 | } 1233 | 1234 | message FileInfo { 1235 | string fileId = 1; 1236 | repeated FileEncryptionKey encryptionKeys = 2; 1237 | } 1238 | 1239 | message FileEncryptionKey { 1240 | string path = 1; 1241 | string key = 2; 1242 | } 1243 | 1244 | enum ImageKind { 1245 | Basic = 0; 1246 | Cover = 1; 1247 | Icon = 2; 1248 | AutomaticallyAdded = 3; 1249 | } 1250 | 1251 | enum FileIndexingStatus { 1252 | NotIndexed = 0; 1253 | Indexed = 1; 1254 | NotFound = 2; 1255 | } 1256 | 1257 | enum SpaceShareableStatus { 1258 | StatusUnknown = 0; 1259 | StatusShareable = 1; 1260 | StatusNotShareable = 2; 1261 | } 1262 | 1263 | message ManifestInfo { 1264 | string schema = 1; 1265 | string id = 2; 1266 | string name = 3; 1267 | string author = 4; 1268 | string license = 5; 1269 | string title = 6; 1270 | string description = 7; 1271 | repeated string screenshots = 8; 1272 | string downloadLink = 9; 1273 | int32 fileSize = 10; 1274 | repeated string categories = 11; 1275 | string language = 12; 1276 | } 1277 | 1278 | enum NameserviceNameType { 1279 | // .any suffix 1280 | AnyName = 0; 1281 | } 1282 | 1283 | 1284 | message Membership { 1285 | enum Status { 1286 | StatusUnknown = 0; 1287 | // please wait a bit more, we are still processing your request 1288 | // the payment is confirmed, but we need more time to do some side-effects: 1289 | // - increase limits 1290 | // - send emails 1291 | // - allocate names 1292 | StatusPending = 1; 1293 | // the membership is active, ready to use! 1294 | StatusActive = 2; 1295 | // in some cases we need to finalize the process: 1296 | // - if user has bought membership directly without first calling 1297 | // the BuySubscription method 1298 | // in this case please call Finalize to finish the process 1299 | StatusPendingRequiresFinalization = 3; 1300 | } 1301 | 1302 | enum PaymentMethod { 1303 | MethodNone = 0; 1304 | MethodStripe = 1; 1305 | MethodCrypto = 2; 1306 | MethodInappApple = 3; 1307 | MethodInappGoogle = 4; 1308 | } 1309 | 1310 | enum EmailVerificationStatus { 1311 | // user NEVER comleted the verification of the email 1312 | StatusNotVerified = 0; 1313 | // user has asked for new code, but did not enter it yet 1314 | // (even if email was verified before, you can ask to UPDATE your e-mail) 1315 | // please wait, you can not ask for more codes yet 1316 | StatusCodeSent = 1; 1317 | // the e-mail is finally verified 1318 | StatusVerified = 2; 1319 | } 1320 | 1321 | // it was Tier before, changed to int32 to allow dynamic values 1322 | uint32 tier = 1; 1323 | Status status = 2; 1324 | uint64 dateStarted = 3; 1325 | uint64 dateEnds = 4; 1326 | bool isAutoRenew = 5; 1327 | PaymentMethod paymentMethod = 6; 1328 | // can be empty if user did not ask for any name 1329 | string nsName = 7; 1330 | anytype.model.NameserviceNameType nsNameType = 8; 1331 | // if the email was verified by the user or set during the checkout - it will be here 1332 | string userEmail = 9; 1333 | bool subscribeToNewsletter = 10; 1334 | } 1335 | 1336 | message MembershipTierData { 1337 | enum PeriodType { 1338 | PeriodTypeUnknown = 0; 1339 | PeriodTypeUnlimited = 1; 1340 | PeriodTypeDays = 2; 1341 | PeriodTypeWeeks = 3; 1342 | PeriodTypeMonths = 4; 1343 | PeriodTypeYears = 5; 1344 | } 1345 | 1346 | // this is a unique Payment Node ID of the tier 1347 | // WARNING: tiers can be sorted differently, not according to their IDs! 1348 | uint32 id = 1; 1349 | // localazied name of the tier 1350 | string name = 2; 1351 | // just a short technical description 1352 | string description = 3; 1353 | // is this tier for testing and debugging only? 1354 | bool isTest = 4; 1355 | // how long is the period of the subscription 1356 | PeriodType periodType = 5; 1357 | // i.e. "5 days" or "3 years" 1358 | uint32 periodValue = 6; 1359 | // this one is a price we use ONLY on Stripe platform 1360 | uint32 priceStripeUsdCents = 7; 1361 | // number of ANY NS names that this tier includes 1362 | // also in the "features" list (see below) 1363 | uint32 anyNamesCountIncluded = 8; 1364 | // somename.any - is of len 8 1365 | uint32 anyNameMinLength = 9; 1366 | // localized strings for the features 1367 | repeated string features = 10; 1368 | // green, blue, red, purple, custom 1369 | string colorStr = 11; 1370 | 1371 | // Stripe platform-specific data: 1372 | string stripeProductId = 12; 1373 | string stripeManageUrl = 13; 1374 | 1375 | // iOS platform-specific data: 1376 | string iosProductId = 15; 1377 | string iosManageUrl = 16; 1378 | 1379 | // Android platform-specific data: 1380 | string androidProductId = 17; 1381 | string androidManageUrl = 18; 1382 | 1383 | // "limited offer" or somehing like that 1384 | string offer = 19; 1385 | } 1386 | 1387 | enum DeviceNetworkType { 1388 | WIFI = 0; 1389 | CELLULAR = 1; 1390 | NOT_CONNECTED = 2; 1391 | } 1392 | 1393 | message Detail { 1394 | string key = 1; 1395 | google.protobuf.Value value = 2; // NUll - removes key 1396 | } 1397 | 1398 | message DeviceInfo { 1399 | string id = 1; 1400 | string name = 2; 1401 | int64 addDate = 3; 1402 | bool archived = 4; 1403 | bool isConnected = 5; 1404 | } 1405 | 1406 | message ChatState { 1407 | message UnreadState { 1408 | string oldestOrderId = 1; // oldest(in the lex sorting) unread message order id. Client should ALWAYS scroll through unread messages from the oldest to the newest 1409 | int32 counter = 2; // total number of unread messages 1410 | } 1411 | UnreadState messages = 1; // unread messages 1412 | UnreadState mentions = 2; // unread mentions 1413 | string lastStateId = 3; // reflects the state of the chat db at the moment of sending response/event that includes this state 1414 | } 1415 | 1416 | message ChatMessage { 1417 | string id = 1; // Unique message identifier 1418 | string orderId = 2; // Lexicographical id for message in order of tree traversal 1419 | string creator = 3; // Identifier for the message creator 1420 | int64 createdAt = 4; 1421 | int64 modifiedAt = 9; 1422 | 1423 | // stateId is ever-increasing id (BSON ObjectId) for this message. Unlike orderId, this ID is ordered by the time messages are added. For example, it's useful to prevent accidental reading of messages from the past when a ChatReadMessages request is sent: a message from the past may appear, but the client is still unaware of it 1424 | string stateId = 11; 1425 | 1426 | string replyToMessageId = 5; // Identifier for the message being replied to 1427 | MessageContent message = 6; // Message content 1428 | repeated Attachment attachments = 7; // Attachments slice 1429 | Reactions reactions = 8; // Reactions to the message 1430 | bool read = 10; // Message read status 1431 | bool mentionRead = 12; 1432 | message MessageContent { 1433 | string text = 1; // The text content of the message part 1434 | Block.Content.Text.Style style = 2; // The style/type of the message part 1435 | repeated Block.Content.Text.Mark marks = 3; // List of marks applied to the text 1436 | } 1437 | 1438 | message Attachment { 1439 | string target = 1; // Identifier for the attachment object 1440 | AttachmentType type = 2; // Type of attachment 1441 | 1442 | enum AttachmentType { 1443 | FILE = 0; // File attachment 1444 | IMAGE = 1; // Image attachment 1445 | LINK = 2; // Link attachment 1446 | } 1447 | } 1448 | 1449 | message Reactions { 1450 | map reactions = 1; // Map of emoji to list of user IDs 1451 | 1452 | message IdentityList { 1453 | repeated string ids = 1; // List of user IDs 1454 | } 1455 | } 1456 | } 1457 | -------------------------------------------------------------------------------- /snapshot.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package anytype; 3 | option go_package = "pb"; 4 | 5 | import "models.proto"; 6 | import "changes.proto"; 7 | 8 | message SnapshotWithType { 9 | anytype.model.SmartBlockType sbType = 1; 10 | anytype.Change.Snapshot snapshot = 2; 11 | } 12 | 13 | message Profile { 14 | string name = 1; 15 | string avatar = 2; 16 | string address = 4; 17 | string spaceDashboardId = 5; 18 | string profileId = 6; 19 | string analyticsId = 7; 20 | string startingPage = 8; 21 | } 22 | --------------------------------------------------------------------------------