{
  "namespace": "tabReadingSpace",
  "types": [
    {
      "id": "tabReadingSpace.AccountState",
      "type": "string",
      "enum": [
        "signed_out",
        "initializing",
        "ready",
        "ready_offline",
        "auth_error",
        "signing_out"
      ]
    },
    {
      "id": "tabReadingSpace.ReadingSurface",
      "type": "string",
      "enum": [
        "reader",
        "page_action",
        "selection",
        "library"
      ]
    },
    {
      "id": "tabReadingSpace.MembershipState",
      "type": "string",
      "enum": [
        "not_ready",
        "not_joined",
        "joined_manual",
        "joined_auto"
      ]
    },
    {
      "id": "tabReadingSpace.Extractor",
      "type": "string",
      "enum": [
        "chromium-read-anything",
        "custom"
      ]
    },
    {
      "id": "tabReadingSpace.SyncState",
      "type": "string",
      "enum": [
        "pending",
        "synced",
        "local_only_quota",
        "local_only_error",
        "pending_error"
      ]
    },
    {
      "id": "tabReadingSpace.ReadingStatusOverride",
      "type": "string",
      "enum": [
        "automatic",
        "unread",
        "completed"
      ]
    },
    {
      "id": "tabReadingSpace.MutationContext",
      "type": "object",
      "properties": {
        "contextToken": {
          "type": "string"
        },
        "sourceToken": {
          "type": "string"
        },
        "expectedGeneration": {
          "type": "number",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.CreateMutationContext",
      "type": "object",
      "properties": {
        "contextToken": {
          "type": "string"
        },
        "sourceToken": {
          "type": "string"
        },
        "expectedGeneration": {
          "type": "number",
          "optional": true
        },
        "clientRequestId": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryMutationContext",
      "type": "object",
      "properties": {
        "contextToken": {
          "type": "string"
        },
        "expectedGeneration": {
          "type": "number"
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryNoteMutationContext",
      "type": "object",
      "properties": {
        "documentId": {
          "type": "string"
        },
        "contextToken": {
          "type": "string"
        },
        "expectedGeneration": {
          "type": "number"
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryOpenContext",
      "type": "object",
      "properties": {
        "contextToken": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.UpdateReadingStatusInput",
      "type": "object",
      "properties": {
        "status": {
          "$ref": "tabReadingSpace.ReadingStatusOverride"
        }
      }
    },
    {
      "id": "tabReadingSpace.TextAnchor",
      "type": "object",
      "properties": {
        "prefix": {
          "type": "string"
        },
        "suffix": {
          "type": "string"
        },
        "startOffset": {
          "type": "integer",
          "minimum": 0
        },
        "endOffset": {
          "type": "integer",
          "minimum": 0
        },
        "contentFingerprint": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.SourceDocumentInput",
      "type": "object",
      "properties": {
        "inReadingSpace": {
          "type": "boolean"
        },
        "markOpened": {
          "type": "boolean",
          "optional": true
        },
        "autoOpenReader": {
          "type": "boolean"
        }
      }
    },
    {
      "id": "tabReadingSpace.UpdateReadingProgressInput",
      "type": "object",
      "properties": {
        "readingProgress": {
          "type": "number"
        },
        "lastReadingPosition": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.CreateNoteInput",
      "type": "object",
      "properties": {
        "kindId": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "selectedText": {
          "type": "string",
          "optional": true
        },
        "anchor": {
          "$ref": "tabReadingSpace.TextAnchor",
          "optional": true
        },
        "autoOpenReader": {
          "type": "boolean",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.Document",
      "type": "object",
      "properties": {
        "documentId": {
          "type": "string"
        },
        "originalUrl": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "inReadingSpace": {
          "type": "boolean"
        },
        "readingProgress": {
          "type": "number"
        },
        "lastReadingPosition": {
          "type": "string"
        },
        "readingStatusOverride": {
          "$ref": "tabReadingSpace.ReadingStatusOverride"
        },
        "autoOpenReader": {
          "type": "boolean"
        },
        "generation": {
          "type": "number"
        },
        "syncState": {
          "$ref": "tabReadingSpace.SyncState"
        }
      }
    },
    {
      "id": "tabReadingSpace.Note",
      "type": "object",
      "properties": {
        "noteId": {
          "type": "string"
        },
        "documentId": {
          "type": "string"
        },
        "kindId": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "selectedText": {
          "type": "string",
          "optional": true
        },
        "anchor": {
          "$ref": "tabReadingSpace.TextAnchor",
          "optional": true
        },
        "createdTimeUsec": {
          "type": "string"
        },
        "updatedTimeUsec": {
          "type": "string"
        },
        "generation": {
          "type": "number"
        },
        "documentGeneration": {
          "type": "number",
          "optional": true
        },
        "syncState": {
          "$ref": "tabReadingSpace.SyncState"
        }
      }
    },
    {
      "id": "tabReadingSpace.ListNotesOptions",
      "type": "object",
      "properties": {
        "offset": {
          "type": "integer",
          "minimum": 0
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      }
    },
    {
      "id": "tabReadingSpace.ListNotesPage",
      "type": "object",
      "properties": {
        "notes": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.Note"
          }
        },
        "hasMore": {
          "type": "boolean"
        },
        "nextOffset": {
          "type": "integer",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryDocument",
      "type": "object",
      "properties": {
        "documentId": {
          "type": "string"
        },
        "originalUrl": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "inReadingSpace": {
          "type": "boolean"
        },
        "readingProgress": {
          "type": "number"
        },
        "readingStatusOverride": {
          "$ref": "tabReadingSpace.ReadingStatusOverride"
        },
        "createdTimeUsec": {
          "type": "string"
        },
        "updatedTimeUsec": {
          "type": "string"
        },
        "lastOpenedTimeUsec": {
          "type": "string"
        },
        "generation": {
          "type": "number"
        },
        "syncState": {
          "$ref": "tabReadingSpace.SyncState"
        },
        "notes": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.Note"
          }
        }
      }
    },
    {
      "id": "tabReadingSpace.ListLibraryEntriesOptions",
      "type": "object",
      "properties": {
        "offset": {
          "type": "integer",
          "minimum": 0,
          "optional": true
        },
        "cursor": {
          "type": "string",
          "maxLength": 80,
          "optional": true
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryDocumentFilter",
      "type": "string",
      "enum": [
        "library",
        "has_notes",
        "in_reading_space"
      ]
    },
    {
      "id": "tabReadingSpace.ListDocumentsOptions",
      "type": "object",
      "properties": {
        "filter": {
          "$ref": "tabReadingSpace.LibraryDocumentFilter",
          "optional": true
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "optional": true
        },
        "cursor": {
          "type": "string",
          "maxLength": 80,
          "optional": true
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500
        }
      }
    },
    {
      "id": "tabReadingSpace.LibraryEntry",
      "type": "object",
      "properties": {
        "documentId": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "faviconHost": {
          "type": "string"
        },
        "activityTimeUsec": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.ListLibraryEntriesResult",
      "type": "object",
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.LibraryEntry"
          }
        },
        "truncated": {
          "type": "boolean"
        },
        "hasMore": {
          "type": "boolean"
        },
        "nextOffset": {
          "type": "integer",
          "optional": true
        },
        "nextCursor": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.ListDocumentsResult",
      "type": "object",
      "properties": {
        "documents": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.LibraryDocument"
          }
        },
        "truncated": {
          "type": "boolean"
        },
        "hasMore": {
          "type": "boolean"
        },
        "nextOffset": {
          "type": "integer",
          "optional": true
        },
        "nextCursor": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.SearchDocumentsOptions",
      "type": "object",
      "properties": {
        "query": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "filter": {
          "$ref": "tabReadingSpace.LibraryDocumentFilter",
          "optional": true
        },
        "cursor": {
          "type": "string",
          "maxLength": 160,
          "optional": true
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        }
      }
    },
    {
      "id": "tabReadingSpace.SearchDocumentsResult",
      "type": "object",
      "properties": {
        "documents": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.LibraryDocument"
          }
        },
        "hasMore": {
          "type": "boolean"
        },
        "nextCursor": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.UpdateNoteInput",
      "type": "object",
      "properties": {
        "content": {
          "type": "string"
        }
      }
    },
    {
      "id": "tabReadingSpace.CapabilityState",
      "type": "object",
      "properties": {
        "accountState": {
          "$ref": "tabReadingSpace.AccountState"
        },
        "canPersist": {
          "type": "boolean"
        },
        "syncEnabled": {
          "type": "boolean"
        },
        "initialSyncComplete": {
          "type": "boolean"
        },
        "contextToken": {
          "type": "string",
          "optional": true
        },
        "reason": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.ReadingSpaceChange",
      "type": "object",
      "properties": {
        "generation": {
          "type": "number"
        }
      }
    },
    {
      "id": "tabReadingSpace.AuthContextChange",
      "type": "object",
      "properties": {
        "generation": {
          "type": "number"
        },
        "accountState": {
          "$ref": "tabReadingSpace.AccountState"
        }
      }
    },
    {
      "id": "tabReadingSpace.SyncStatusChange",
      "type": "object",
      "properties": {
        "generation": {
          "type": "number"
        },
        "canPersist": {
          "type": "boolean"
        },
        "syncEnabled": {
          "type": "boolean"
        },
        "initialSyncComplete": {
          "type": "boolean"
        },
        "reason": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabReadingSpace.SupportedNoteKind",
      "type": "object",
      "properties": {
        "kindId": {
          "type": "string"
        },
        "requiredFields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "allowedFields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "allowedSources": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    {
      "id": "tabReadingSpace.ReadingSpaceLimits",
      "type": "object",
      "properties": {
        "maxNoteEntityBytes": {
          "type": "integer"
        },
        "maxDocumentEntityBytes": {
          "type": "integer"
        },
        "maxCategoryEntityBytes": {
          "type": "integer"
        },
        "maxNoteContentBytes": {
          "type": "integer"
        },
        "maxFlashcardTextBytes": {
          "type": "integer"
        },
        "maxSelectedTextBytes": {
          "type": "integer"
        },
        "maxDerivedTitleBytes": {
          "type": "integer"
        },
        "maxAnchorContextBytes": {
          "type": "integer"
        },
        "maxDocumentUrlBytes": {
          "type": "integer"
        },
        "maxCategoryNameBytes": {
          "type": "integer"
        },
        "maxCategoriesPerAccount": {
          "type": "integer"
        },
        "maxCategoriesPerDocument": {
          "type": "integer"
        },
        "maxNotesPerDocument": {
          "type": "integer"
        },
        "maxLibraryDocuments": {
          "type": "integer"
        }
      }
    },
    {
      "id": "tabReadingSpace.ReadingSpaceCapabilities",
      "type": "object",
      "properties": {
        "supportedNoteKinds": {
          "type": "array",
          "items": {
            "$ref": "tabReadingSpace.SupportedNoteKind"
          }
        },
        "supportedTodoStates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "limits": {
          "$ref": "tabReadingSpace.ReadingSpaceLimits"
        }
      }
    },
    {
      "id": "tabReadingSpace.ReadingSourceContext",
      "type": "object",
      "properties": {
        "sourceToken": {
          "type": "string"
        },
        "surface": {
          "$ref": "tabReadingSpace.ReadingSurface"
        },
        "originalUrl": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "membershipState": {
          "$ref": "tabReadingSpace.MembershipState"
        },
        "documentId": {
          "type": "string",
          "optional": true
        },
        "documentGeneration": {
          "type": "number",
          "optional": true
        },
        "selectedText": {
          "type": "string",
          "optional": true
        },
        "contentFingerprint": {
          "type": "string",
          "optional": true
        },
        "extractor": {
          "$ref": "tabReadingSpace.Extractor",
          "optional": true
        },
        "extractorVersion": {
          "type": "string",
          "optional": true
        }
      }
    }
  ],
  "functions": [
    {
      "name": "getCapabilityState",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "state",
            "$ref": "tabReadingSpace.CapabilityState"
          }
        ]
      }
    },
    {
      "name": "getCapabilities",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "capabilities",
            "$ref": "tabReadingSpace.ReadingSpaceCapabilities"
          }
        ]
      }
    },
    {
      "name": "getReadingModeEnabled",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "enabled",
            "type": "boolean"
          }
        ]
      }
    },
    {
      "name": "getSyncEnabled",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "enabled",
            "type": "boolean"
          }
        ]
      }
    },
    {
      "name": "setSyncEnabled",
      "type": "function",
      "parameters": [
        {
          "name": "enabled",
          "type": "boolean"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "enabled",
            "type": "boolean"
          }
        ]
      }
    },
    {
      "name": "getSourceContext",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "context",
            "$ref": "tabReadingSpace.ReadingSourceContext"
          }
        ]
      }
    },
    {
      "name": "bindSelection",
      "type": "function",
      "parameters": [],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "context",
            "$ref": "tabReadingSpace.ReadingSourceContext"
          }
        ]
      }
    },
    {
      "name": "openReader",
      "type": "function",
      "parameters": [
        {
          "name": "sourceToken",
          "type": "string"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    },
    {
      "name": "askSelection",
      "type": "function",
      "parameters": [
        {
          "name": "sourceToken",
          "type": "string"
        },
        {
          "name": "selectedText",
          "type": "string"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    },
    {
      "name": "getOrCreateDocument",
      "type": "function",
      "parameters": [
        {
          "name": "input",
          "$ref": "tabReadingSpace.SourceDocumentInput"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.MutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "document",
            "$ref": "tabReadingSpace.Document"
          }
        ]
      }
    },
    {
      "name": "updateReadingProgress",
      "type": "function",
      "parameters": [
        {
          "name": "input",
          "$ref": "tabReadingSpace.UpdateReadingProgressInput"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.MutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "document",
            "$ref": "tabReadingSpace.Document"
          }
        ]
      }
    },
    {
      "name": "listLibraryEntries",
      "type": "function",
      "parameters": [
        {
          "name": "options",
          "$ref": "tabReadingSpace.ListLibraryEntriesOptions",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabReadingSpace.ListLibraryEntriesResult"
          }
        ]
      }
    },
    {
      "name": "listDocuments",
      "type": "function",
      "parameters": [
        {
          "name": "options",
          "$ref": "tabReadingSpace.ListDocumentsOptions",
          "optional": true
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabReadingSpace.ListDocumentsResult"
          }
        ]
      }
    },
    {
      "name": "searchDocuments",
      "type": "function",
      "parameters": [
        {
          "name": "options",
          "$ref": "tabReadingSpace.SearchDocumentsOptions"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "result",
            "$ref": "tabReadingSpace.SearchDocumentsResult"
          }
        ]
      }
    },
    {
      "name": "openLibraryDocument",
      "type": "function",
      "parameters": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.LibraryOpenContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    },
    {
      "name": "updateReadingStatus",
      "type": "function",
      "parameters": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "input",
          "$ref": "tabReadingSpace.UpdateReadingStatusInput"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.LibraryMutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "document",
            "$ref": "tabReadingSpace.Document"
          }
        ]
      }
    },
    {
      "name": "deleteDocument",
      "type": "function",
      "parameters": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.LibraryMutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    },
    {
      "name": "deleteLibraryNote",
      "type": "function",
      "parameters": [
        {
          "name": "noteId",
          "type": "string"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.LibraryNoteMutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    },
    {
      "name": "createNote",
      "type": "function",
      "parameters": [
        {
          "name": "input",
          "$ref": "tabReadingSpace.CreateNoteInput"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.CreateMutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "note",
            "$ref": "tabReadingSpace.Note"
          }
        ]
      }
    },
    {
      "name": "listNotes",
      "type": "function",
      "parameters": [
        {
          "name": "context",
          "$ref": "tabReadingSpace.MutationContext"
        },
        {
          "name": "options",
          "$ref": "tabReadingSpace.ListNotesOptions"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "page",
            "$ref": "tabReadingSpace.ListNotesPage"
          }
        ]
      }
    },
    {
      "name": "updateNote",
      "type": "function",
      "parameters": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "input",
          "$ref": "tabReadingSpace.UpdateNoteInput"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.MutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "note",
            "$ref": "tabReadingSpace.Note"
          }
        ]
      }
    },
    {
      "name": "deleteNote",
      "type": "function",
      "parameters": [
        {
          "name": "id",
          "type": "string"
        },
        {
          "name": "context",
          "$ref": "tabReadingSpace.MutationContext"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": []
      }
    }
  ],
  "events": [
    {
      "name": "onChanged",
      "type": "function",
      "parameters": [
        {
          "name": "change",
          "$ref": "tabReadingSpace.ReadingSpaceChange"
        }
      ]
    },
    {
      "name": "onAuthContextChanged",
      "type": "function",
      "parameters": [
        {
          "name": "change",
          "$ref": "tabReadingSpace.AuthContextChange"
        }
      ]
    },
    {
      "name": "onSyncStatusChanged",
      "type": "function",
      "parameters": [
        {
          "name": "change",
          "$ref": "tabReadingSpace.SyncStatusChange"
        }
      ]
    }
  ]
}