Metadata-Version: 2.4
Name: nospoon-integrations
Version: 0.13.0
Summary: Cross-platform OAuth integrations SDK for NoSpoon applications
Project-URL: Homepage, https://github.com/nospoonai/nospoon-integrations
Project-URL: Documentation, https://github.com/nospoonai/nospoon-integrations#readme
Project-URL: Repository, https://github.com/nospoonai/nospoon-integrations
Project-URL: Issues, https://github.com/nospoonai/nospoon-integrations/issues
Author-email: NoSpoon <dev@nospoon.ai>
License-Expression: MIT
Keywords: facebook,google,hubspot,integrations,linkedin,oauth,supabase
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: all
Requires-Dist: mypy>=1.0.0; extra == 'all'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'all'
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
Requires-Dist: pytest>=7.0.0; extra == 'all'
Requires-Dist: ruff>=0.1.0; extra == 'all'
Requires-Dist: supabase>=2.0.0; extra == 'all'
Requires-Dist: types-requests>=2.31.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: types-requests>=2.31.0; extra == 'dev'
Provides-Extra: supabase
Requires-Dist: supabase>=2.0.0; extra == 'supabase'
Description-Content-Type: text/markdown

# NoSpoon Integrations - Python SDK

Cross-platform OAuth integrations SDK for NoSpoon applications.

## Installation

```bash
pip install nospoon-integrations

# With Supabase support
pip install nospoon-integrations[supabase]
```

## Quick Start

The `IntegrationClient` constructor takes `storage` plus one keyword argument per
provider you want to enable (each with its provider-specific config).

```python
import os
from nospoon_integrations import IntegrationClient, ProviderConfig
from nospoon_integrations.storage import SupabaseTokenStorage

# Initialize storage
storage = SupabaseTokenStorage(
    supabase_url=os.environ["SUPABASE_URL"],
    supabase_key=os.environ["SUPABASE_SERVICE_ROLE_KEY"],
)

# Initialize client with the providers you need (flat keyword arguments)
integrations = IntegrationClient(
    storage=storage,
    google=ProviderConfig(
        client_id=os.environ["GOOGLE_CLIENT_ID"],
        client_secret=os.environ["GOOGLE_CLIENT_SECRET"],
        scopes=["https://www.googleapis.com/auth/gmail.compose"],
    ),
    hubspot=ProviderConfig(
        client_id=os.environ["HUBSPOT_CLIENT_ID"],
        client_secret=os.environ["HUBSPOT_CLIENT_SECRET"],
    ),
)

# OAuth providers: redirect the user, then handle the callback
auth_url = integrations.google.get_auth_url("https://myapp.com/callback")
status = await integrations.google.get_connection_status(user_id)
```

### Credential providers (WordPress, Sanity)

WordPress and Sanity authenticate with a user-supplied credential rather than
OAuth. Enable them with their config, then call `connect()` with the credential —
it is verified live and only stored on success.

```python
from nospoon_integrations import IntegrationClient
from nospoon_integrations.providers import SanityConfig, SanityConnectInput
from nospoon_integrations.storage import MemoryTokenStorage

integrations = IntegrationClient(storage=MemoryTokenStorage(), sanity=SanityConfig())

# Verify + store the connection (raises CredentialVerificationError if invalid)
await integrations.sanity.connect(
    user_id,
    SanityConnectInput(project_id="abc123", dataset="production", token=os.environ["SANITY_TOKEN"]),
)

# Post a blog entry as a draft (HTML body is converted to Portable Text)
result = await integrations.sanity.create_post(
    user_id, title="Hello", body="<p>First post</p>", publish=True
)
```

## Providers

- **Google** — Gmail API, OAuth
- **HubSpot** — CRM contacts, OAuth
- **Facebook** — Graph API, Pages
- **LinkedIn** — Posts, OAuth
- **X (Twitter)** — Tweets, OAuth 2.0 + PKCE
- **WordPress** — self-hosted REST API, credential-based (Application Passwords)
- **Sanity** — Actions/Assets/Query APIs, credential-based (robot token); includes a dependency-free `html_to_portable_text()` converter

## Documentation

See the [main documentation](https://github.com/nospoonai/nospoon-integrations) for full usage details.

## License

MIT
