Skip to main content

Type-safe Python SDK for the AppFlowy Cloud REST API

Project description

AppFlowy SDK

Type-safe Python SDK for the AppFlowy Cloud REST API.

Installation

pip install appflowysdk 
## or
uv add appflowysdk

Quick Start

from appflowy import AppFlowy

with AppFlowy(email="user@example.com", password="password") as client:
    # Authenticate
    token = client.login()
    print(f"Logged in, token expires in {token.expires_in}s")

    # List workspaces
    workspaces = client.get_workspaces(include_member_count=True)
    for ws in workspaces:
        print(f"{ws.workspace_name} ({ws.workspace_id})")

    # Get folder structure
    folder = client.get_workspace_folder(workspaces[0].workspace_id)

    # List databases
    databases = client.get_databases(workspaces[0].workspace_id)

    # Get database fields
    fields = client.get_database_fields(
        workspaces[0].workspace_id, databases[0].id
    )

    # Get row IDs
    rows = client.get_database_row_ids(
        workspaces[0].workspace_id, databases[0].id
    )

    # Get row details
    if rows:
        details = client.get_database_row_details(
            workspaces[0].workspace_id,
            databases[0].id,
            [rows[0].id],
            with_doc=True,
        )

    # Create a row
    row_id = client.create_database_row(
        workspaces[0].workspace_id,
        databases[0].id,
        cells={"field_id": "value"},
    )

    # Upsert a row
    row_id = client.upsert_database_row(
        workspaces[0].workspace_id,
        databases[0].id,
        pre_hash="unique-key",
        cells={"field_id": "value"},
    )

OAuth

client = AppFlowy()
token = client.oauth_redirect_token(
    code="auth_code_from_redirect",
    grant_type="authorization_code",
)

Error Handling

All SDK errors inherit from AppFlowyError:

from src.exception import (
    AppFlowyError,
    LoginError,
    RefreshTokenError,
    APIError,
    ValidationError,
    NetworkError,
)

API Reference

Method Endpoint Description
login() POST /gotrue/token?grant_type=password Password auth
refresh_token() POST /gotrue/token?grant_type=refresh_token Refresh token
oauth_redirect_token() GET /web-api/oauth-redirect/token OAuth token exchange
get_workspaces() GET /api/workspace List workspaces
get_workspace_folder() GET /api/workspace/{id}/folder Get folder tree
get_databases() GET /api/workspace/{id}/database List databases
get_database_fields() GET /api/workspace/{id}/database/{id}/fields List fields
get_database_row_ids() GET /api/workspace/{id}/database/{id}/row List row IDs
create_database_row() POST /api/workspace/{id}/database/{id}/row Create row
upsert_database_row() PUT /api/workspace/{id}/database/{id}/row Upsert row
get_database_row_ids_updated() GET /api/workspace/{id}/database/{id}/row/updated Updated rows
get_database_row_details() GET /api/workspace/{id}/database/{id}/row/detail Row details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appflowysdk-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appflowysdk-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file appflowysdk-0.1.0.tar.gz.

File metadata

  • Download URL: appflowysdk-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for appflowysdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a15ba76b3f4d6266e90e1cf54ba07f2126892fa673df945bdd9e11ef330ea56
MD5 723739ff2e03c9af3220a63c1cdb7c6b
BLAKE2b-256 89eb5779eb42ac88b57d211f0961ef0af9d2c87dcaf6d11567030f0d2f371d60

See more details on using hashes here.

File details

Details for the file appflowysdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: appflowysdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for appflowysdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a9b3c62cba1127097ace5b50a32b9248ddf9a183884cf49b864f11b6338b1bb
MD5 a9b0041d0054bb2cdcc10002e1849d53
BLAKE2b-256 1057a7f7fd1d0685ed2e635b34fbaa8477dc282ce6e3cb71d43fd385ebc7e8c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page