Metadata-Version: 2.4
Name: invinite_api
Version: 0.4.0
Summary: Invinite Web API
Home-page: 
Author: OpenAPI Generator community
Author-email: OpenAPI Generator Community <team@openapitools.org>
Project-URL: Homepage, https://invinite.com
Project-URL: Documentation, https://invinite.com/docs/web-api
Project-URL: Repository, https://github.com/outraday-org/invinite
Keywords: OpenAPI,OpenAPI-Generator,Invinite Web API
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: urllib3<3.0.0,>=2.1.0
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1
Dynamic: author

<!--
  Canonical, hand-written README for the invinite-api PyPI package.
  publish-sdk.yml copies this over sdks/python/README.md (a git-ignored,
  generator-default file) before the Python build, so this is the page PyPI
  renders (pyproject.toml `readme = "README.md"`). Edit here, not in the
  generated tree.
-->

# invinite-api

Typed Python client for the [Invinite](https://invinite.com) Web API — the
workspace REST API at `api.invinite.com`. It is generated from the same endpoint
registry that powers the REST API and the `inv` CLI, so its request and response
models always match the [reference](https://invinite.com/docs/web-api).

The client is built on urllib3 + pydantic and imports as `invinite_api`.

The generated surface includes the curated team activity stream and its
full-fidelity per-entity history, plus alert fire-history time ranges,
per-alert events, and summary counts.

## Install

```bash
pip install invinite-api
```

## Authentication

Create a `Configuration` with your `invw_` Web API token as the access token.
The client sends it as an `Authorization: Bearer <token>` header on every
request.

```python
import invinite_api

config = invinite_api.Configuration(access_token=token)
```

Team-scoped endpoints take the team as a per-method `x_team_id` argument — not a
global default header.

## Quickstart

Configure the client, call `users/me` to discover your team id, then make a
team-scoped list call.

```python
import invinite_api
from invinite_api import UsersApi, WorkspaceApi

config = invinite_api.Configuration(access_token=token)

with invinite_api.ApiClient(config) as client:
    # 1. Find the team to operate on.
    me = UsersApi(client).users_me()
    team_id = me.data.teams[0].id

    # 2. Make a team-scoped list call.
    spaces = WorkspaceApi(client).spaces_list(x_team_id=team_id, limit=50)

    for space in spaces.data.items:
        print(space)
```

## Pagination

List methods return `data.items` plus `data.next_cursor`. Pass the cursor back
on the next call until it is `None`.

```python
api = WorkspaceApi(client)
cursor = None
while True:
    page = api.spaces_list(x_team_id=team_id, limit=50, cursor=cursor)
    for space in page.data.items:
        pass  # process space ...
    cursor = page.data.next_cursor
    if cursor is None:
        break
```

## Error handling

On a non-2xx response the client raises `ApiException` (with per-status
subclasses). Inspect `error.status` and parse the standard
`{ "ok": false, "error": ..., "code": ... }` envelope from `error.body`:

```python
import json
from invinite_api.exceptions import ApiException

try:
    WorkspaceApi(client).spaces_list(x_team_id=team_id)
except ApiException as error:
    body = json.loads(error.body)  # { "ok": false, "error": ..., "code": ... }
    print(error.status, body["code"], body["error"])
```

## Regeneration

This client is a generated artifact. If an endpoint's types look wrong, the fix
belongs in the endpoint registry rather than in hand-written client code —
regenerating re-derives every model from the schema. Releases are published on
`sdk-v*` tags.

## Links

- [Web API docs](https://invinite.com/docs/web-api)
- [Repository](https://github.com/outraday-org/invinite)
