Skip to main content

Organization plugin for Belgie

Project description

belgie-organization

Organization plugin and client for Belgie.

Breaking change in 0.1.0

OrganizationPlugin no longer exposes built-in HTTP endpoints. The plugin now exists to inject a request-scoped OrganizationClient into your own FastAPI routes.

Usage

from typing import Annotated

from fastapi import Depends, FastAPI

from belgie import Belgie
from belgie.organization import OrganizationClient

app = FastAPI()
app.include_router(auth.router)

organization_plugin = auth.add_plugin(...)


@app.post("/org/create")
async def create_org(
    org_client: Annotated[OrganizationClient, Depends(organization_plugin)],
) -> dict[str, str]:
    organization, _member = await org_client.create(
        name="Acme",
        slug="acme",
        role="owner",
    )
    return {"organization_id": str(organization.id)}


@app.post("/org/invite")
async def invite_member(
    org_client: Annotated[OrganizationClient, Depends(organization_plugin)],
) -> dict[str, str]:
    invitation = await org_client.invite(
        email="member@example.com",
        role="member",
    )
    return {"invitation_id": str(invitation.id)}

Core client methods

  • create, check_slug, list_for_user, set_active, get_active, get_full, update, delete
  • list_members, add_member, remove_member, update_member_role, get_active_member, leave
  • invite, accept_invitation, cancel_invitation, reject_invitation, get_invitation, list_invitations, list_user_invitations

Roles

Role values are required for create/invite/member-role flows. Inputs support str, StrEnum, and role sequences. Roles are persisted as a normalized comma-separated string.

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

belgie_organization-0.10.4.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

belgie_organization-0.10.4-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file belgie_organization-0.10.4.tar.gz.

File metadata

  • Download URL: belgie_organization-0.10.4.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for belgie_organization-0.10.4.tar.gz
Algorithm Hash digest
SHA256 da6849aa50403a66af22902e251d589baba9c0171e8ee84cff484f5e1fcba4cc
MD5 cbca84d5c9d96ef8571b613089aa0b1d
BLAKE2b-256 8480203d96c13c8a979925a9a0a23e31cd84b8bb053284cc46553b8f19a35f45

See more details on using hashes here.

File details

Details for the file belgie_organization-0.10.4-py3-none-any.whl.

File metadata

  • Download URL: belgie_organization-0.10.4-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for belgie_organization-0.10.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b191fbd7b4b4a2dd3c37b2e4436580f410c58ba6714153bad21d3e1c52e98b2
MD5 43bdb0c84368fcc351f65f3088c34b6e
BLAKE2b-256 eebf32cd6bec4c64761afa9f2ac130de64a3b76eb36dfd1d48cd0b46e49058e5

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