Source code for maestral.core
"""
Dataclasses for our internal and external APIs.
"""
from __future__ import annotations
from enum import Enum
from dataclasses import dataclass
from datetime import datetime
# ==== user ============================================================================
@dataclass
[docs]
class Team:
"""A group of users with joint access to shared folders"""
"""Unique identifier of the team"""
"""Display name of the team"""
@dataclass
[docs]
class RootInfo:
"""Namespace info for the root of a shared filesystem"""
"""Unique ID of the user's root namespace"""
"""Unique ID of the user's personal namespace
This will be different from :attr:`root_namespace_id` when Maestral is set up to
sync the shared folder of a team.
"""
@dataclass
@dataclass
[docs]
class TeamRootInfo(RootInfo):
"""Path of the user's personal home folder relative to the root namespace
Only present for accounts set up as part of a team when syncing the entire team's
folder.
"""
@dataclass
[docs]
class Account:
"""Represents the user's account"""
"""Unique account ID"""
"""The user's name for display purposes"""
"""The user's email address"""
"""Whether the email address was verified"""
"""A URL to the user's photo"""
"""Whether the account is disabled"""
@dataclass
[docs]
class FullAccount(Account):
"""Represents the user's account and sync information"""
"""The user's country"""
"""The user's locale"""
"""The team that a user belongs to, if any"""
"""The member ID of user in a team, if any"""
"""The account type"""
"""The user's root namespace to sync"""
@dataclass
[docs]
class SpaceUsage:
"""Space usage information"""
"""Space used by in bytes"""
"""Space available in bytes"""
@dataclass
[docs]
class PersonalSpaceUsage(SpaceUsage):
"""Space usage information for a user"""
"""Space usage of a user's team, if any"""
# ==== files ===========================================================================
@dataclass
[docs]
class Metadata:
"""Base class for sync item metadata"""
"""Name of the file or folder"""
"""Normalised path on the server"""
"""Cased path for display purposes and the local file system"""
@dataclass
@dataclass
[docs]
class FileMetadata(Metadata):
"""File metadata"""
"""Unique ID on the server"""
"""Modified time in UTC as provided by clients"""
"""Server-side modified time in UTC"""
"""Unique ID of this version of a file"""
"""File size in bytes"""
"""If the file is a symlink, path of the target relative to the root namespace"""
"""Whether the file is shared"""
"""Unique ID of the account that created / modified this revision"""
"""Whether the file can be downloaded"""
"""A content hash of the file"""
@dataclass
[docs]
class FolderMetadata(Metadata):
"""Folder metadata"""
"""Unique ID on the server"""
"""Whether the folder is shared"""
@dataclass
[docs]
class ListFolderResult:
"""Result from listing the contents of a folder"""
"""List of entries"""
"""Whether there are more entries than listed"""
"""Cursor to iterate and fetch more entries"""
# ==== sharing =========================================================================
@dataclass
[docs]
class LinkPermissions:
"""Permissions for a shared link"""
"""If the link can be revoked"""
"""If the link allows users to download the item"""
"""The effective audience of link (who can use it)"""
"""The type of access that the link grants to the item (how they can use it)"""
"""Whether a password is required when accessing the item through this link
Note that users who already have access to an item otherwise will not need a
password regardless of this value."""
@dataclass
@dataclass
# ==== update checks ===================================================================
@dataclass
[docs]
class UpdateCheckResult:
"""Information on update availability"""
"""Whether an update to Maestral is available"""
"""The latest release that can be updated to"""
"""Release notes for all releases between the currently running version up to and
including the latest version"""