openfga-sdk


Nameopenfga-sdk JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://github.com/openfga/python-sdk
SummaryA high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.
upload_time2024-11-15 17:37:51
maintainerNone
docs_urlNone
authorOpenFGA (https://openfga.dev)
requires_python>=3.10
licenseApache-2.0
keywords openfga authorization fga fine-grained-authorization rebac zanzibar
VCS
bugtrack_url
requirements aiohttp python-dateutil setuptools build urllib3 opentelemetry-api
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK for OpenFGA

[![pypi](https://img.shields.io/pypi/v/openfga_sdk.svg?style=flat)](https://pypi.org/project/openfga_sdk)
[![Release](https://img.shields.io/github/v/release/openfga/python-sdk?sort=semver&color=green)](https://github.com/openfga/python-sdk/releases)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk?ref=badge_shield)
[![Join our community](https://img.shields.io/badge/slack-cncf_%23openfga-40abb8.svg?logo=slack)](https://openfga.dev/community)
[![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga)

This is an autogenerated python SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api).

## Table of Contents

- [About OpenFGA](#about)
- [Resources](#resources)
- [Installation](#installation)
- [Getting Started](#getting-started)
  - [Initializing the API Client](#initializing-the-api-client)
  - [Get your Store ID](#get-your-store-id)
  - [Calling the API](#calling-the-api)
    - [Stores](#stores)
      - [List All Stores](#list-stores)
      - [Create a Store](#create-store)
      - [Get a Store](#get-store)
      - [Delete a Store](#delete-store)
    - [Authorization Models](#authorization-models)
      - [Read Authorization Models](#read-authorization-models)
      - [Write Authorization Model](#write-authorization-model)
      - [Read a Single Authorization Model](#read-a-single-authorization-model)
      - [Read the Latest Authorization Model](#read-the-latest-authorization-model)
    - [Relationship Tuples](#relationship-tuples)
      - [Read Relationship Tuple Changes (Watch)](#read-relationship-tuple-changes-watch)
      - [Read Relationship Tuples](#read-relationship-tuples)
      - [Write (Create and Delete) Relationship Tuples](#write-create-and-delete-relationship-tuples)
    - [Relationship Queries](#relationship-queries)
      - [Check](#check)
      - [Batch Check](#batch-check)
      - [Expand](#expand)
      - [List Objects](#list-objects)
      - [List Relations](#list-relations)
      - [List Users](#list-users)
    - [Assertions](#assertions)
      - [Read Assertions](#read-assertions)
      - [Write Assertions](#write-assertions)
  - [Retries](#retries)
  - [API Endpoints](#api-endpoints)
  - [Models](#models)
  - [OpenTelemetry](#opentelemetry)
- [Contributing](#contributing)
  - [Issues](#issues)
  - [Pull Requests](#pull-requests)
- [License](#license)

## About

[OpenFGA](https://openfga.dev) is an open source Fine-Grained Authorization solution inspired by [Google's Zanzibar paper](https://research.google/pubs/pub48190/). It was created by the FGA team at [Auth0](https://auth0.com) based on [Auth0 Fine-Grained Authorization (FGA)](https://fga.dev), available under [a permissive license (Apache-2)](https://github.com/openfga/rfcs/blob/main/LICENSE) and welcomes community contributions.

OpenFGA is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. OpenFGA’s design is optimized for reliability and low latency at a high scale.


## Resources

- [OpenFGA Documentation](https://openfga.dev/docs)
- [OpenFGA API Documentation](https://openfga.dev/api/service)
- [Twitter](https://twitter.com/openfga)
- [OpenFGA Community](https://openfga.dev/community)
- [Zanzibar Academy](https://zanzibar.academy)
- [Google's Zanzibar Paper (2019)](https://research.google/pubs/pub48190/)

## Installation

### pip install

#### PyPI

The openfga_sdk is available to be downloaded via PyPI, you can install directly using:

```sh
pip3 install openfga_sdk
```
(you may need to run `pip` with root permission: `sudo pip3 install openfga_sdk`)

Then import the package:
```python
import openfga_sdk
```

#### GitHub

The openfga_sdk is also hosted in GitHub, you can install directly using:

```sh
pip3 install https://github.com/openfga/python-sdk.git
```
(you may need to run `pip` with root permission: `sudo pip3 install https://github.com/openfga/python-sdk.git`)

Then import the package:
```python
import openfga_sdk
```

### Setuptools

Install via [Setuptools](https://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import openfga_sdk
```


## Getting Started

### Initializing the API Client

[Learn how to initialize your SDK](https://openfga.dev/docs/getting-started/setup-sdk-client)

We strongly recommend you initialize the `OpenFgaClient` only once and then re-use it throughout your app, otherwise you will incur the cost of having to re-initialize multiple times or at every request, the cost of reduced connection pooling and re-use, and would be particularly costly in the client credentials flow, as that flow will be preformed on every request.

> The `OpenFgaClient` will by default retry API requests up to 15 times on 429 and 5xx errors.

#### No Credentials

```python
from openfga_sdk import ClientConfiguration, OpenFgaClient


async def main():
    configuration = ClientConfiguration(
        api_url=FGA_API_URL,  # required
        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`
        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request
    )
    # Enter a context with an instance of the OpenFgaClient
    async with OpenFgaClient(configuration) as fga_client:
        api_response = await fga_client.read_authorization_models()
        await fga_client.close()
        return api_response
```

#### API Token

```python
from openfga_sdk import ClientConfiguration, OpenFgaClient
from openfga_sdk.credentials import CredentialConfiguration, Credentials


async def main():
    configuration = ClientConfiguration(
        api_url=FGA_API_URL,  # required
        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`
        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request
        credentials=Credentials(
            method='api_token',
            configuration=CredentialConfiguration(
                api_token=FGA_API_TOKEN,
            )
        )
    )
    # Enter a context with an instance of the OpenFgaClient
    async with OpenFgaClient(configuration) as fga_client:
        api_response = await fga_client.read_authorization_models()
        await fga_client.close()
        return api_response
```

#### Client Credentials

```python
from openfga_sdk import ClientConfiguration, OpenFgaClient
from openfga_sdk.credentials import Credentials, CredentialConfiguration


async def main():
    configuration = ClientConfiguration(
        api_url=FGA_API_URL,  # required
        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`
        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request
        credentials=Credentials(
            method='client_credentials',
            configuration=CredentialConfiguration(
                api_issuer=FGA_API_TOKEN_ISSUER,
                api_audience=FGA_API_AUDIENCE,
                client_id=FGA_CLIENT_ID,
                client_secret=FGA_CLIENT_SECRET,
            )
        )
    )
    # Enter a context with an instance of the OpenFgaClient
    async with OpenFgaClient(configuration) as fga_client:
        api_response = await fga_client.read_authorization_models()
        await fga_client.close()
        return api_response
```

#### Synchronous Client

To run outside of an async context, the project exports a synchronous client
from `openfga_sdk.sync` that supports all the credential types and calls,
without requiring async/await.

```python
from openfga_sdk.client import ClientConfiguration
from openfga_sdk.sync import OpenFgaClient


def main():
    configuration = ClientConfiguration(
        api_url=FGA_API_URL,  # required
        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`
        authorization_model_id=FGA_MODEL_ID,  # optional, can be overridden per request
    )
    # Enter a context with an instance of the OpenFgaClient
    with OpenFgaClient(configuration) as fga_client:
        api_response = fga_client.read_authorization_models()
        return api_response
```


### Get your Store ID

You need your store id to call the OpenFGA API (unless it is to call the [CreateStore](#create-store) or [ListStores](#list-stores) methods).

If your server is configured with [authentication enabled](https://openfga.dev/docs/getting-started/setup-openfga#configuring-authentication), you also need to have your credentials ready.

### Calling the API

#### Stores

##### List Stores

Get a paginated list of stores.

[API Documentation](https://openfga.dev/api/service#/Stores/ListStores)

```python
# from openfga_sdk.sync import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {"page_size": 25, "continuation_token": "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ=="}
response = await fga_client.list_stores(options)
# response = ListStoresResponse(...)
# response.stores = [Store({"id": "01FQH7V8BEG3GPQW93KTRFR8JB", "name": "FGA Demo Store", "created_at": "2022-01-01T00:00:00.000Z", "updated_at": "2022-01-01T00:00:00.000Z"})]
```


##### Create Store

Create and initialize a store.

[API Documentation](https://openfga.dev/api/service#/Stores/CreateStore)

```python
# from openfga_sdk import CreateStoreRequest, OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

body = CreateStoreRequest(
    name = "FGA Demo Store",
)
response = await fga_client.create_store(body)
# response.id = "01FQH7V8BEG3GPQW93KTRFR8JB"
```


##### Get Store

Get information about the current store.

[API Documentation](https://openfga.dev/api/service#/Stores/GetStore)

> Requires a client initialized with a storeId

```python
# from openfga_sdk import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

response = await fga_client.get_store()
# response = Store({"id": "01FQH7V8BEG3GPQW93KTRFR8JB", "name": "FGA Demo Store", "created_at": "2022-01-01T00:00:00.000Z", "updated_at": "2022-01-01T00:00:00.000Z"})
```


##### Delete Store

Delete a store.

[API Documentation](https://openfga.dev/api/service#/Stores/DeleteStore)

> Requires a client initialized with a storeId

```python
# from openfga_sdk import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

response = await fga_client.delete_store()
```


#### Authorization Models

##### Read Authorization Models

Read all authorization models in the store.

[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModels)

```python
# from openfga_sdk import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {"page_size": 25, "continuation_token": "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ=="}
response = await fga_client.read_authorization_models(options)
# response.authorization_models = [AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...], AuthorizationModel(id='01GXSBM5PVYHCJNRNKXMB4QZTW', schema_version = '1.1', type_definitions=type_definitions[...])]
```


##### Write Authorization Model

Create a new authorization model.

[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/WriteAuthorizationModel)

> Note: To learn how to build your authorization model, check the Docs at https://openfga.dev/docs.

> Learn more about [the OpenFGA configuration language](https://openfga.dev/docs/configuration-language).

> You can use the [OpenFGA Syntax Transformer](https://github.com/openfga/syntax-transformer) to convert between the friendly DSL and the JSON authorization model.

```python
# from openfga_sdk import (
#     Condition, ConditionParamTypeRef, Metadata, ObjectRelation, OpenFgaClient, RelationMetadata,
#     RelationReference, TypeDefinition, Userset, Usersets, WriteAuthorizationModelRequest
# )

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

body = WriteAuthorizationModelRequest(
    schema_version="1.1",
    type_definitions=[
        TypeDefinition(
            type="user"
        ),
        TypeDefinition(
            type="document",
            relations=dict(
                writer=Userset(
                    this=dict(),
                ),
                viewer=Userset(
                    union=Usersets(
                        child=[
                            Userset(this=dict()),
                            Userset(computed_userset=ObjectRelation(
                                object="",
                                relation="writer",
                            )),
                        ],
                    ),
                ),
            ),
            metadata=Metadata(
                relations=dict(
                    writer=RelationMetadata(
                        directly_related_user_types=[
                            RelationReference(type="user"),
                            RelationReference(type="user", condition="ViewCountLessThan200"),
                        ]
                    ),
                    viewer=RelationMetadata(
                        directly_related_user_types=[
                            RelationReference(type="user"),
                        ]
                    )
                )
            )
        )
    ],
    conditions=dict(
        ViewCountLessThan200=Condition(
            name="ViewCountLessThan200",
            expression="ViewCount < 200",
            parameters=dict(
                ViewCount=ConditionParamTypeRef(
                    type_name="TYPE_NAME_INT"
                ),
                Type=ConditionParamTypeRef(
                    type_name="TYPE_NAME_STRING"
                ),
                Name=ConditionParamTypeRef(
                    type_name="TYPE_NAME_STRING"
                ),
            )
        )
    )
)

response = await fga_client.write_authorization_model(body)
# response.authorization_model_id = "01GXSA8YR785C4FYS3C0RTG7B1"
```


##### Read a Single Authorization Model

Read a particular authorization model.

[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel)

```python
# from openfga_sdk import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}

response = await fga_client.read_authorization_model(options)
# response.authorization_model =  AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...])
```

##### Read the Latest Authorization Model

Reads the latest authorization model (note: this ignores the model id in configuration).

[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel)

```python
# from openfga_sdk import ClientConfiguration, OpenFgaClient

# Create the cofiguration object
# configuration = ClientConfiguration(
#     ...
#     authorization_model_id = FGA_MODEL_ID,
#     ...
# )

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

response = await fga_client.read_latest_authorization_model()
# response.authorization_model =  AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...])
```


#### Relationship Tuples

##### Read Relationship Tuple Changes (Watch)

Reads the list of historical relationship tuple writes and deletes.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/ReadChanges)

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client.models import ClientReadChangesRequest

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "page_size": "25",
    "continuation_token": "eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ=="
}
body = ClientReadChangesRequest(type="document")

response = await fga_client.read_changes(body, options)
# response.continuation_token = ...
# response.changes = [TupleChange(tuple_key=TupleKey(object="...",relation="...",user="..."),operation=TupleOperation("TUPLE_OPERATION_WRITE"),timestamp=datetime.fromisoformat("..."))]
```

##### Read Relationship Tuples

Reads the relationship tuples stored in the database. It does not evaluate nor exclude invalid tuples according to the authorization model.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Read)

```python
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

# Find if a relationship tuple stating that a certain user is a viewer of certain document
body = ReadRequestTupleKey(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
```

```python
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
body = ReadRequestTupleKey(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})

```

```python
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

# Find all relationship tuples where a certain user is a viewer of any document
body = ReadRequestTupleKey(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    object="document:",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
```

```python
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

# Find all relationship tuples where any user has a relationship as any relation with a particular document
body = ReadRequestTupleKey(
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
```

```python
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

# Read all stored relationship tuples
body = ReadRequestTupleKey()

response = await api_instance.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
```

##### Write (Create and Delete) Relationship Tuples

Create and/or delete relationship tuples to update the system state.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Write)

###### Transaction mode (default)

By default, write runs in a transaction mode where any invalid operation (deleting a non-existing tuple, creating an existing tuple, one of the tuples was invalid) or a server error will fail the entire operation.

```python
# from openfga_sdk import OpenFgaClient, RelationshipCondition
# from openfga_sdk.client.models import ClientTuple, ClientWriteRequest

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = ClientWriteRequest(
    writes=[
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="viewer",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
            condition=RelationshipCondition(
              name='ViewCountLessThan200',
              context=dict(
                  Name='Roadmap',
                  Type='Document',
              ),
            ),
        ),
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="viewer",
            object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
        ),
    ],
    deletes=[
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="writer",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        ),
    ],
)

response = await fga_client.write(body, options)
```

Convenience `write_tuples` and `delete_tuples` methods are also available.

###### Non-transaction mode

The SDK will split the writes into separate requests and send them sequentially to avoid violating rate limits.

```python
# from openfga_sdk import OpenFgaClient, RelationshipCondition
# from openfga_sdk.client.models import ClientTuple, ClientWriteRequest, WriteTransactionOpts

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1",
    "transaction": WriteTransactionOpts(
        disabled=True,
        max_parallel_requests=10, # Maximum number of requests to issue in parallel
        max_per_chunk=1, # Maximum number of requests to be sent in a transaction in a particular chunk
    )
}
body = ClientWriteRequest(
    writes=[
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="viewer",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        ),
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="viewer",
            object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
            condition=RelationshipCondition(
              name='ViewCountLessThan200',
              context=dict(
                  Name='Roadmap',
                  Type='Document',
              ),
            ),
        ),
    ],
    deletes=[
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="writer",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        ),
    ],
)

response = await fga_client.write(body, options)
```

#### Relationship Queries

##### Check

Check if a user has a particular relation with an object.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Check)

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client import ClientCheckRequest

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = ClientCheckRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="writer",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
    context=dict(
        ViewCount=100
    ),
)

response = await fga_client.check(body, options)
# response.allowed = True
```


##### Batch Check

Run a set of [checks](#check). Batch Check will return `allowed: false` if it encounters an error, and will return the error in the body.
If 429s or 5xxs are encountered, the underlying check will retry up to 15 times before giving up.

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client import ClientCheckRequest
# from openfga_sdk.client.models import ClientTuple

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = [ClientCheckRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
    contextual_tuples=[  # optional
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="editor",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        ),
    ],
    context=dict(
        ViewCount=100
    )
), ClientCheckRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="admin",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
    contextual_tuples=[  # optional
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="editor",
            object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
        ),
    ]
), ClientCheckRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="creator",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
), ClientCheckRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="deleter",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)]

response = await fga_client.batch_check(body, options)
# response.responses = [{
#   allowed: false,
#   request: {
#     user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#     relation: "viewer",
#     object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
#     contextual_tuples: [{
#       user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#       relation: "editor",
#       object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
#     }],
#    context=dict(
#        ViewCount=100
#    )
#   }
# }, {
#   allowed: false,
#   request: {
#     user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#     relation: "admin",
#     object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
#     contextual_tuples: [{
#       user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#       relation: "editor",
#       object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
#     }]
#   }
# }, {
#   allowed: false,
#   request: {
#     user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#     relation: "creator",
#     object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
#   },
#   error: <FgaError ...>
# }, {
#   allowed: true,
#   request: {
#     user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
#     relation: "deleter",
#     object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
#   }},
# ]
```

#### Expand

Expands the relationships in userset tree format.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Expand)

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client.models import ClientExpandRequest

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = ClientExpandRequest(
    relation="viewer",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
)

response = await fga_client.expand(body. options)
# response = ExpandResponse({"tree": UsersetTree({"root": Node({"name": "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#viewer", "leaf": Leaf({"users": Users({"users": ["user:81684243-9356-4421-8fbf-a4f8d36aa31b", "user:f52a4f7a-054d-47ff-bb6e-3ac81269988f"]})})})})})
```

#### List Objects

List the objects of a particular type a user has access to.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/ListObjects)

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client.models import ClientListObjectsRequest, ClientTuple

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = ClientListObjectsRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    type="document",
    contextual_tuples=[  # optional
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="writer",
            object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
        ),
    ],
    context=dict(
        ViewCount=100
    )
)

response = await fga_client.list_objects(body)
# response.objects = ["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]
```

#### List Relations

List the relations a user has on an object.

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client.models import ClientListRelationsRequest

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}
body = ClientListRelationsRequest(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
    relations=["can_view", "can_edit", "can_delete", "can_rename"],
    contextual_tuples=[  # optional
        ClientTuple(
            user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
            relation="writer",
            object="document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5",
        ),
    ],
    context=dict(
        ViewCount=100
    )
)

response = await fga_client.list_relations(body, options)

# response.relations = ["can_view", "can_edit"]
```

#### List Users

List the users who have a certain relation to a particular type.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/ListUsers)

```python
from openfga_sdk import OpenFgaClient
from openfga_sdk.models.fga_object import FgaObject
from openfga_sdk.client.models import ClientListUsersRequest, ClientTuple

configuration = ClientConfiguration(
    api_url=FGA_API_URL,
    # ...
)

async with OpenFgaClient(configuration) as api_client:
    options = {
        "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
    }

    request = ClientListUsersRequest(
        object=FgaObject(type="document", id="2021-budget"),
        relation="can_read",
        user_filters=[
            UserTypeFilter(type="user"),
            UserTypeFilter(type="team", relation="member"),
        ],
        context={},
        contextual_tuples=[
            ClientTuple(
                user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
                relation="editor",
                object="folder:product",
            ),
            ClientTuple(
                user="folder:product",
                relation="parent",
                object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
            ),
        ],
    )

    response = await api_client.list_users(request, options)

    # response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
```

#### Assertions

##### Read Assertions

Read assertions for a particular authorization model.

[API Documentation](https://openfga.dev/api/service#/Assertions/Read%20Assertions)

```python
# from openfga_sdk import OpenFgaClient

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}

response = await fga_client.read_assertions(options)
```

##### Write Assertions

Update the assertions for a particular authorization model.

[API Documentation](https://openfga.dev/api/service#/Assertions/Write%20Assertions)

```python
# from openfga_sdk import OpenFgaClient
# from openfga_sdk.client.models import ClientAssertion

# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)

options = {
    # You can rely on the model id set in the configuration or override it for this specific request
    "authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
}

body = [ClientAssertion(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
    expectation=True,
)]

response = await fga_client.write_assertions(body, options)
```


### Retries

If a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to 15 times with a minimum wait time of 100 milliseconds between each attempt.

To customize this behavior, create a `RetryParams` object and assign values to the `max_retry` and `min_wait_in_ms` constructor parameters. `max_retry` determines the maximum number of retries (up to 15), while `min_wait_in_ms` sets the minimum wait time between retries in milliseconds.

Apply your custom retry values by passing the object to the `ClientConfiguration` constructor's `retry_params` parameter.

```python
from openfga_sdk import ClientConfiguration, OpenFgaClient
from openfga_sdk.configuration import RetryParams
from os import environ

async def main():
    # Configure the client with custom retry settings
    config = ClientConfiguration(
        api_url=environ.get("FGA_API_URL"),
        retry_params=RetryParams(max_retry=3, min_wait_in_ms=250)
    )

    # Create a client instance and read authorization models
    async with OpenFgaClient(config) as client:
        return await client.read_authorization_models()
```


### API Endpoints

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*OpenFgaApi* | [**check**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#check) | **POST** /stores/{store_id}/check | Check whether a user is authorized to access an object
*OpenFgaApi* | [**create_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#create_store) | **POST** /stores | Create a store
*OpenFgaApi* | [**delete_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#delete_store) | **DELETE** /stores/{store_id} | Delete a store
*OpenFgaApi* | [**expand**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#expand) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules.  Useful to reason about and debug a certain relationship
*OpenFgaApi* | [**get_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#get_store) | **GET** /stores/{store_id} | Get a store
*OpenFgaApi* | [**list_objects**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_objects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with
*OpenFgaApi* | [**list_stores**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_stores) | **GET** /stores | List all stores
*OpenFgaApi* | [**list_users**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type.
*OpenFgaApi* | [**read**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules
*OpenFgaApi* | [**read_assertions**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_assertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID
*OpenFgaApi* | [**read_authorization_model**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_authorization_model) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model
*OpenFgaApi* | [**read_authorization_models**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_authorization_models) | **GET** /stores/{store_id}/authorization-models | Return all the authorization models for a particular store
*OpenFgaApi* | [**read_changes**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_changes) | **GET** /stores/{store_id}/changes | Return a list of all the tuple changes
*OpenFgaApi* | [**write**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write) | **POST** /stores/{store_id}/write | Add or delete tuples from the store
*OpenFgaApi* | [**write_assertions**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write_assertions) | **PUT** /stores/{store_id}/assertions/{authorization_model_id} | Upsert assertions for an authorization model ID
*OpenFgaApi* | [**write_authorization_model**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write_authorization_model) | **POST** /stores/{store_id}/authorization-models | Create a new authorization model



### Models

## Documentation For Models

 - [AbortedMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/AbortedMessageResponse.md)
 - [Any](https://github.com/openfga/python-sdk/blob/main/docs/Any.md)
 - [Assertion](https://github.com/openfga/python-sdk/blob/main/docs/Assertion.md)
 - [AssertionTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/AssertionTupleKey.md)
 - [AuthErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/AuthErrorCode.md)
 - [AuthorizationModel](https://github.com/openfga/python-sdk/blob/main/docs/AuthorizationModel.md)
 - [CheckRequest](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequest.md)
 - [CheckRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequestTupleKey.md)
 - [CheckResponse](https://github.com/openfga/python-sdk/blob/main/docs/CheckResponse.md)
 - [Computed](https://github.com/openfga/python-sdk/blob/main/docs/Computed.md)
 - [Condition](https://github.com/openfga/python-sdk/blob/main/docs/Condition.md)
 - [ConditionMetadata](https://github.com/openfga/python-sdk/blob/main/docs/ConditionMetadata.md)
 - [ConditionParamTypeRef](https://github.com/openfga/python-sdk/blob/main/docs/ConditionParamTypeRef.md)
 - [ConsistencyPreference](https://github.com/openfga/python-sdk/blob/main/docs/ConsistencyPreference.md)
 - [ContextualTupleKeys](https://github.com/openfga/python-sdk/blob/main/docs/ContextualTupleKeys.md)
 - [CreateStoreRequest](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreRequest.md)
 - [CreateStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreResponse.md)
 - [Difference](https://github.com/openfga/python-sdk/blob/main/docs/Difference.md)
 - [ErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/ErrorCode.md)
 - [ExpandRequest](https://github.com/openfga/python-sdk/blob/main/docs/ExpandRequest.md)
 - [ExpandRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/ExpandRequestTupleKey.md)
 - [ExpandResponse](https://github.com/openfga/python-sdk/blob/main/docs/ExpandResponse.md)
 - [FgaObject](https://github.com/openfga/python-sdk/blob/main/docs/FgaObject.md)
 - [ForbiddenResponse](https://github.com/openfga/python-sdk/blob/main/docs/ForbiddenResponse.md)
 - [GetStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/GetStoreResponse.md)
 - [InternalErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorCode.md)
 - [InternalErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorMessageResponse.md)
 - [Leaf](https://github.com/openfga/python-sdk/blob/main/docs/Leaf.md)
 - [ListObjectsRequest](https://github.com/openfga/python-sdk/blob/main/docs/ListObjectsRequest.md)
 - [ListObjectsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListObjectsResponse.md)
 - [ListStoresResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListStoresResponse.md)
 - [ListUsersRequest](https://github.com/openfga/python-sdk/blob/main/docs/ListUsersRequest.md)
 - [ListUsersResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListUsersResponse.md)
 - [Metadata](https://github.com/openfga/python-sdk/blob/main/docs/Metadata.md)
 - [Node](https://github.com/openfga/python-sdk/blob/main/docs/Node.md)
 - [Nodes](https://github.com/openfga/python-sdk/blob/main/docs/Nodes.md)
 - [NotFoundErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/NotFoundErrorCode.md)
 - [NullValue](https://github.com/openfga/python-sdk/blob/main/docs/NullValue.md)
 - [ObjectRelation](https://github.com/openfga/python-sdk/blob/main/docs/ObjectRelation.md)
 - [PathUnknownErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/PathUnknownErrorMessageResponse.md)
 - [ReadAssertionsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAssertionsResponse.md)
 - [ReadAuthorizationModelResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAuthorizationModelResponse.md)
 - [ReadAuthorizationModelsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAuthorizationModelsResponse.md)
 - [ReadChangesResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadChangesResponse.md)
 - [ReadRequest](https://github.com/openfga/python-sdk/blob/main/docs/ReadRequest.md)
 - [ReadRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/ReadRequestTupleKey.md)
 - [ReadResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadResponse.md)
 - [RelationMetadata](https://github.com/openfga/python-sdk/blob/main/docs/RelationMetadata.md)
 - [RelationReference](https://github.com/openfga/python-sdk/blob/main/docs/RelationReference.md)
 - [RelationshipCondition](https://github.com/openfga/python-sdk/blob/main/docs/RelationshipCondition.md)
 - [SourceInfo](https://github.com/openfga/python-sdk/blob/main/docs/SourceInfo.md)
 - [Status](https://github.com/openfga/python-sdk/blob/main/docs/Status.md)
 - [Store](https://github.com/openfga/python-sdk/blob/main/docs/Store.md)
 - [Tuple](https://github.com/openfga/python-sdk/blob/main/docs/Tuple.md)
 - [TupleChange](https://github.com/openfga/python-sdk/blob/main/docs/TupleChange.md)
 - [TupleKey](https://github.com/openfga/python-sdk/blob/main/docs/TupleKey.md)
 - [TupleKeyWithoutCondition](https://github.com/openfga/python-sdk/blob/main/docs/TupleKeyWithoutCondition.md)
 - [TupleOperation](https://github.com/openfga/python-sdk/blob/main/docs/TupleOperation.md)
 - [TupleToUserset](https://github.com/openfga/python-sdk/blob/main/docs/TupleToUserset.md)
 - [TypeDefinition](https://github.com/openfga/python-sdk/blob/main/docs/TypeDefinition.md)
 - [TypeName](https://github.com/openfga/python-sdk/blob/main/docs/TypeName.md)
 - [TypedWildcard](https://github.com/openfga/python-sdk/blob/main/docs/TypedWildcard.md)
 - [UnauthenticatedResponse](https://github.com/openfga/python-sdk/blob/main/docs/UnauthenticatedResponse.md)
 - [UnprocessableContentErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/UnprocessableContentErrorCode.md)
 - [UnprocessableContentMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/UnprocessableContentMessageResponse.md)
 - [User](https://github.com/openfga/python-sdk/blob/main/docs/User.md)
 - [UserTypeFilter](https://github.com/openfga/python-sdk/blob/main/docs/UserTypeFilter.md)
 - [Users](https://github.com/openfga/python-sdk/blob/main/docs/Users.md)
 - [Userset](https://github.com/openfga/python-sdk/blob/main/docs/Userset.md)
 - [UsersetTree](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTree.md)
 - [UsersetTreeDifference](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTreeDifference.md)
 - [UsersetTreeTupleToUserset](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTreeTupleToUserset.md)
 - [UsersetUser](https://github.com/openfga/python-sdk/blob/main/docs/UsersetUser.md)
 - [Usersets](https://github.com/openfga/python-sdk/blob/main/docs/Usersets.md)
 - [ValidationErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/ValidationErrorMessageResponse.md)
 - [WriteAssertionsRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteAssertionsRequest.md)
 - [WriteAuthorizationModelRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteAuthorizationModelRequest.md)
 - [WriteAuthorizationModelResponse](https://github.com/openfga/python-sdk/blob/main/docs/WriteAuthorizationModelResponse.md)
 - [WriteRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequest.md)
 - [WriteRequestDeletes](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequestDeletes.md)
 - [WriteRequestWrites](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequestWrites.md)



### OpenTelemetry

This SDK supports producing metrics that can be consumed as part of an [OpenTelemetry](https://opentelemetry.io/) setup. For more information, please see [the documentation](https://github.com/openfga/python-sdk/blob/main/docs/opentelemetry.md)

## Contributing

### Issues

If you have found a bug or if you have a feature request, please report them on the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section. Please do not report security vulnerabilities on the public GitHub issue tracker.

### Pull Requests

While we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well. 

## Author

[OpenFGA](https://github.com/openfga)

## License

This project is licensed under the Apache-2.0 license. See the [LICENSE](https://github.com/openfga/python-sdk/blob/main/LICENSE) file for more info.

The code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [python legacy template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python-legacy), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/openfga/python-sdk",
    "name": "openfga-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "openfga, authorization, fga, fine-grained-authorization, rebac, zanzibar",
    "author": "OpenFGA (https://openfga.dev)",
    "author_email": "community@openfga.dev",
    "download_url": "https://files.pythonhosted.org/packages/97/f4/714d70728d4b8493859b833e9fe69287fd4814a698b841ae81408d3d7b1a/openfga_sdk-0.8.0.tar.gz",
    "platform": null,
    "description": "# Python SDK for OpenFGA\n\n[![pypi](https://img.shields.io/pypi/v/openfga_sdk.svg?style=flat)](https://pypi.org/project/openfga_sdk)\n[![Release](https://img.shields.io/github/v/release/openfga/python-sdk?sort=semver&color=green)](https://github.com/openfga/python-sdk/releases)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk?ref=badge_shield)\n[![Join our community](https://img.shields.io/badge/slack-cncf_%23openfga-40abb8.svg?logo=slack)](https://openfga.dev/community)\n[![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square \"@openfga on Twitter\")](https://twitter.com/openfga)\n\nThis is an autogenerated python SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api).\n\n## Table of Contents\n\n- [About OpenFGA](#about)\n- [Resources](#resources)\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n  - [Initializing the API Client](#initializing-the-api-client)\n  - [Get your Store ID](#get-your-store-id)\n  - [Calling the API](#calling-the-api)\n    - [Stores](#stores)\n      - [List All Stores](#list-stores)\n      - [Create a Store](#create-store)\n      - [Get a Store](#get-store)\n      - [Delete a Store](#delete-store)\n    - [Authorization Models](#authorization-models)\n      - [Read Authorization Models](#read-authorization-models)\n      - [Write Authorization Model](#write-authorization-model)\n      - [Read a Single Authorization Model](#read-a-single-authorization-model)\n      - [Read the Latest Authorization Model](#read-the-latest-authorization-model)\n    - [Relationship Tuples](#relationship-tuples)\n      - [Read Relationship Tuple Changes (Watch)](#read-relationship-tuple-changes-watch)\n      - [Read Relationship Tuples](#read-relationship-tuples)\n      - [Write (Create and Delete) Relationship Tuples](#write-create-and-delete-relationship-tuples)\n    - [Relationship Queries](#relationship-queries)\n      - [Check](#check)\n      - [Batch Check](#batch-check)\n      - [Expand](#expand)\n      - [List Objects](#list-objects)\n      - [List Relations](#list-relations)\n      - [List Users](#list-users)\n    - [Assertions](#assertions)\n      - [Read Assertions](#read-assertions)\n      - [Write Assertions](#write-assertions)\n  - [Retries](#retries)\n  - [API Endpoints](#api-endpoints)\n  - [Models](#models)\n  - [OpenTelemetry](#opentelemetry)\n- [Contributing](#contributing)\n  - [Issues](#issues)\n  - [Pull Requests](#pull-requests)\n- [License](#license)\n\n## About\n\n[OpenFGA](https://openfga.dev) is an open source Fine-Grained Authorization solution inspired by [Google's Zanzibar paper](https://research.google/pubs/pub48190/). It was created by the FGA team at [Auth0](https://auth0.com) based on [Auth0 Fine-Grained Authorization (FGA)](https://fga.dev), available under [a permissive license (Apache-2)](https://github.com/openfga/rfcs/blob/main/LICENSE) and welcomes community contributions.\n\nOpenFGA is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. OpenFGA\u2019s design is optimized for reliability and low latency at a high scale.\n\n\n## Resources\n\n- [OpenFGA Documentation](https://openfga.dev/docs)\n- [OpenFGA API Documentation](https://openfga.dev/api/service)\n- [Twitter](https://twitter.com/openfga)\n- [OpenFGA Community](https://openfga.dev/community)\n- [Zanzibar Academy](https://zanzibar.academy)\n- [Google's Zanzibar Paper (2019)](https://research.google/pubs/pub48190/)\n\n## Installation\n\n### pip install\n\n#### PyPI\n\nThe openfga_sdk is available to be downloaded via PyPI, you can install directly using:\n\n```sh\npip3 install openfga_sdk\n```\n(you may need to run `pip` with root permission: `sudo pip3 install openfga_sdk`)\n\nThen import the package:\n```python\nimport openfga_sdk\n```\n\n#### GitHub\n\nThe openfga_sdk is also hosted in GitHub, you can install directly using:\n\n```sh\npip3 install https://github.com/openfga/python-sdk.git\n```\n(you may need to run `pip` with root permission: `sudo pip3 install https://github.com/openfga/python-sdk.git`)\n\nThen import the package:\n```python\nimport openfga_sdk\n```\n\n### Setuptools\n\nInstall via [Setuptools](https://pypi.python.org/pypi/setuptools).\n\n```sh\npython setup.py install --user\n```\n(or `sudo python setup.py install` to install the package for all users)\n\nThen import the package:\n```python\nimport openfga_sdk\n```\n\n\n## Getting Started\n\n### Initializing the API Client\n\n[Learn how to initialize your SDK](https://openfga.dev/docs/getting-started/setup-sdk-client)\n\nWe strongly recommend you initialize the `OpenFgaClient` only once and then re-use it throughout your app, otherwise you will incur the cost of having to re-initialize multiple times or at every request, the cost of reduced connection pooling and re-use, and would be particularly costly in the client credentials flow, as that flow will be preformed on every request.\n\n> The `OpenFgaClient` will by default retry API requests up to 15 times on 429 and 5xx errors.\n\n#### No Credentials\n\n```python\nfrom openfga_sdk import ClientConfiguration, OpenFgaClient\n\n\nasync def main():\n    configuration = ClientConfiguration(\n        api_url=FGA_API_URL,  # required\n        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`\n        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request\n    )\n    # Enter a context with an instance of the OpenFgaClient\n    async with OpenFgaClient(configuration) as fga_client:\n        api_response = await fga_client.read_authorization_models()\n        await fga_client.close()\n        return api_response\n```\n\n#### API Token\n\n```python\nfrom openfga_sdk import ClientConfiguration, OpenFgaClient\nfrom openfga_sdk.credentials import CredentialConfiguration, Credentials\n\n\nasync def main():\n    configuration = ClientConfiguration(\n        api_url=FGA_API_URL,  # required\n        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`\n        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request\n        credentials=Credentials(\n            method='api_token',\n            configuration=CredentialConfiguration(\n                api_token=FGA_API_TOKEN,\n            )\n        )\n    )\n    # Enter a context with an instance of the OpenFgaClient\n    async with OpenFgaClient(configuration) as fga_client:\n        api_response = await fga_client.read_authorization_models()\n        await fga_client.close()\n        return api_response\n```\n\n#### Client Credentials\n\n```python\nfrom openfga_sdk import ClientConfiguration, OpenFgaClient\nfrom openfga_sdk.credentials import Credentials, CredentialConfiguration\n\n\nasync def main():\n    configuration = ClientConfiguration(\n        api_url=FGA_API_URL,  # required\n        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`\n        authorization_model_id=FGA_MODEL_ID,  # Optional, can be overridden per request\n        credentials=Credentials(\n            method='client_credentials',\n            configuration=CredentialConfiguration(\n                api_issuer=FGA_API_TOKEN_ISSUER,\n                api_audience=FGA_API_AUDIENCE,\n                client_id=FGA_CLIENT_ID,\n                client_secret=FGA_CLIENT_SECRET,\n            )\n        )\n    )\n    # Enter a context with an instance of the OpenFgaClient\n    async with OpenFgaClient(configuration) as fga_client:\n        api_response = await fga_client.read_authorization_models()\n        await fga_client.close()\n        return api_response\n```\n\n#### Synchronous Client\n\nTo run outside of an async context, the project exports a synchronous client\nfrom `openfga_sdk.sync` that supports all the credential types and calls,\nwithout requiring async/await.\n\n```python\nfrom openfga_sdk.client import ClientConfiguration\nfrom openfga_sdk.sync import OpenFgaClient\n\n\ndef main():\n    configuration = ClientConfiguration(\n        api_url=FGA_API_URL,  # required\n        store_id=FGA_STORE_ID,  # optional, not needed when calling `CreateStore` or `ListStores`\n        authorization_model_id=FGA_MODEL_ID,  # optional, can be overridden per request\n    )\n    # Enter a context with an instance of the OpenFgaClient\n    with OpenFgaClient(configuration) as fga_client:\n        api_response = fga_client.read_authorization_models()\n        return api_response\n```\n\n\n### Get your Store ID\n\nYou need your store id to call the OpenFGA API (unless it is to call the [CreateStore](#create-store) or [ListStores](#list-stores) methods).\n\nIf your server is configured with [authentication enabled](https://openfga.dev/docs/getting-started/setup-openfga#configuring-authentication), you also need to have your credentials ready.\n\n### Calling the API\n\n#### Stores\n\n##### List Stores\n\nGet a paginated list of stores.\n\n[API Documentation](https://openfga.dev/api/service#/Stores/ListStores)\n\n```python\n# from openfga_sdk.sync import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\"page_size\": 25, \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"}\nresponse = await fga_client.list_stores(options)\n# response = ListStoresResponse(...)\n# response.stores = [Store({\"id\": \"01FQH7V8BEG3GPQW93KTRFR8JB\", \"name\": \"FGA Demo Store\", \"created_at\": \"2022-01-01T00:00:00.000Z\", \"updated_at\": \"2022-01-01T00:00:00.000Z\"})]\n```\n\n\n##### Create Store\n\nCreate and initialize a store.\n\n[API Documentation](https://openfga.dev/api/service#/Stores/CreateStore)\n\n```python\n# from openfga_sdk import CreateStoreRequest, OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\nbody = CreateStoreRequest(\n    name = \"FGA Demo Store\",\n)\nresponse = await fga_client.create_store(body)\n# response.id = \"01FQH7V8BEG3GPQW93KTRFR8JB\"\n```\n\n\n##### Get Store\n\nGet information about the current store.\n\n[API Documentation](https://openfga.dev/api/service#/Stores/GetStore)\n\n> Requires a client initialized with a storeId\n\n```python\n# from openfga_sdk import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\nresponse = await fga_client.get_store()\n# response = Store({\"id\": \"01FQH7V8BEG3GPQW93KTRFR8JB\", \"name\": \"FGA Demo Store\", \"created_at\": \"2022-01-01T00:00:00.000Z\", \"updated_at\": \"2022-01-01T00:00:00.000Z\"})\n```\n\n\n##### Delete Store\n\nDelete a store.\n\n[API Documentation](https://openfga.dev/api/service#/Stores/DeleteStore)\n\n> Requires a client initialized with a storeId\n\n```python\n# from openfga_sdk import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\nresponse = await fga_client.delete_store()\n```\n\n\n#### Authorization Models\n\n##### Read Authorization Models\n\nRead all authorization models in the store.\n\n[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModels)\n\n```python\n# from openfga_sdk import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\"page_size\": 25, \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"}\nresponse = await fga_client.read_authorization_models(options)\n# response.authorization_models = [AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...], AuthorizationModel(id='01GXSBM5PVYHCJNRNKXMB4QZTW', schema_version = '1.1', type_definitions=type_definitions[...])]\n```\n\n\n##### Write Authorization Model\n\nCreate a new authorization model.\n\n[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/WriteAuthorizationModel)\n\n> Note: To learn how to build your authorization model, check the Docs at https://openfga.dev/docs.\n\n> Learn more about [the OpenFGA configuration language](https://openfga.dev/docs/configuration-language).\n\n> You can use the [OpenFGA Syntax Transformer](https://github.com/openfga/syntax-transformer) to convert between the friendly DSL and the JSON authorization model.\n\n```python\n# from openfga_sdk import (\n#     Condition, ConditionParamTypeRef, Metadata, ObjectRelation, OpenFgaClient, RelationMetadata,\n#     RelationReference, TypeDefinition, Userset, Usersets, WriteAuthorizationModelRequest\n# )\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\nbody = WriteAuthorizationModelRequest(\n    schema_version=\"1.1\",\n    type_definitions=[\n        TypeDefinition(\n            type=\"user\"\n        ),\n        TypeDefinition(\n            type=\"document\",\n            relations=dict(\n                writer=Userset(\n                    this=dict(),\n                ),\n                viewer=Userset(\n                    union=Usersets(\n                        child=[\n                            Userset(this=dict()),\n                            Userset(computed_userset=ObjectRelation(\n                                object=\"\",\n                                relation=\"writer\",\n                            )),\n                        ],\n                    ),\n                ),\n            ),\n            metadata=Metadata(\n                relations=dict(\n                    writer=RelationMetadata(\n                        directly_related_user_types=[\n                            RelationReference(type=\"user\"),\n                            RelationReference(type=\"user\", condition=\"ViewCountLessThan200\"),\n                        ]\n                    ),\n                    viewer=RelationMetadata(\n                        directly_related_user_types=[\n                            RelationReference(type=\"user\"),\n                        ]\n                    )\n                )\n            )\n        )\n    ],\n    conditions=dict(\n        ViewCountLessThan200=Condition(\n            name=\"ViewCountLessThan200\",\n            expression=\"ViewCount < 200\",\n            parameters=dict(\n                ViewCount=ConditionParamTypeRef(\n                    type_name=\"TYPE_NAME_INT\"\n                ),\n                Type=ConditionParamTypeRef(\n                    type_name=\"TYPE_NAME_STRING\"\n                ),\n                Name=ConditionParamTypeRef(\n                    type_name=\"TYPE_NAME_STRING\"\n                ),\n            )\n        )\n    )\n)\n\nresponse = await fga_client.write_authorization_model(body)\n# response.authorization_model_id = \"01GXSA8YR785C4FYS3C0RTG7B1\"\n```\n\n\n##### Read a Single Authorization Model\n\nRead a particular authorization model.\n\n[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel)\n\n```python\n# from openfga_sdk import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\n\nresponse = await fga_client.read_authorization_model(options)\n# response.authorization_model =  AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...])\n```\n\n##### Read the Latest Authorization Model\n\nReads the latest authorization model (note: this ignores the model id in configuration).\n\n[API Documentation](https://openfga.dev/api/service#/Authorization%20Models/ReadAuthorizationModel)\n\n```python\n# from openfga_sdk import ClientConfiguration, OpenFgaClient\n\n# Create the cofiguration object\n# configuration = ClientConfiguration(\n#     ...\n#     authorization_model_id = FGA_MODEL_ID,\n#     ...\n# )\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\nresponse = await fga_client.read_latest_authorization_model()\n# response.authorization_model =  AuthorizationModel(id='01GXSA8YR785C4FYS3C0RTG7B1', schema_version = '1.1', type_definitions=type_definitions[...])\n```\n\n\n#### Relationship Tuples\n\n##### Read Relationship Tuple Changes (Watch)\n\nReads the list of historical relationship tuple writes and deletes.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/ReadChanges)\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client.models import ClientReadChangesRequest\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"page_size\": \"25\",\n    \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\"\n}\nbody = ClientReadChangesRequest(type=\"document\")\n\nresponse = await fga_client.read_changes(body, options)\n# response.continuation_token = ...\n# response.changes = [TupleChange(tuple_key=TupleKey(object=\"...\",relation=\"...\",user=\"...\"),operation=TupleOperation(\"TUPLE_OPERATION_WRITE\"),timestamp=datetime.fromisoformat(\"...\"))]\n```\n\n##### Read Relationship Tuples\n\nReads the relationship tuples stored in the database. It does not evaluate nor exclude invalid tuples according to the authorization model.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Read)\n\n```python\n# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\n# Find if a relationship tuple stating that a certain user is a viewer of certain document\nbody = ReadRequestTupleKey(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"viewer\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n)\n\nresponse = await fga_client.read(body)\n# response = ReadResponse({\"tuples\": [Tuple({\"key\": TupleKey({\"user\":\"...\",\"relation\":\"...\",\"object\":\"...\"}), \"timestamp\": datetime.fromisoformat(\"...\") })]})\n```\n\n```python\n# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\n# Find all relationship tuples where a certain user has a relationship as any relation to a certain document\nbody = ReadRequestTupleKey(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n)\n\nresponse = await fga_client.read(body)\n# response = ReadResponse({\"tuples\": [Tuple({\"key\": TupleKey({\"user\":\"...\",\"relation\":\"...\",\"object\":\"...\"}), \"timestamp\": datetime.fromisoformat(\"...\") })]})\n\n```\n\n```python\n# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\n# Find all relationship tuples where a certain user is a viewer of any document\nbody = ReadRequestTupleKey(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"viewer\",\n    object=\"document:\",\n)\n\nresponse = await fga_client.read(body)\n# response = ReadResponse({\"tuples\": [Tuple({\"key\": TupleKey({\"user\":\"...\",\"relation\":\"...\",\"object\":\"...\"}), \"timestamp\": datetime.fromisoformat(\"...\") })]})\n```\n\n```python\n# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\n# Find all relationship tuples where any user has a relationship as any relation with a particular document\nbody = ReadRequestTupleKey(\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n)\n\nresponse = await fga_client.read(body)\n# response = ReadResponse({\"tuples\": [Tuple({\"key\": TupleKey({\"user\":\"...\",\"relation\":\"...\",\"object\":\"...\"}), \"timestamp\": datetime.fromisoformat(\"...\") })]})\n```\n\n```python\n# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\n# Read all stored relationship tuples\nbody = ReadRequestTupleKey()\n\nresponse = await api_instance.read(body)\n# response = ReadResponse({\"tuples\": [Tuple({\"key\": TupleKey({\"user\":\"...\",\"relation\":\"...\",\"object\":\"...\"}), \"timestamp\": datetime.fromisoformat(\"...\") })]})\n```\n\n##### Write (Create and Delete) Relationship Tuples\n\nCreate and/or delete relationship tuples to update the system state.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Tuples/Write)\n\n###### Transaction mode (default)\n\nBy default, write runs in a transaction mode where any invalid operation (deleting a non-existing tuple, creating an existing tuple, one of the tuples was invalid) or a server error will fail the entire operation.\n\n```python\n# from openfga_sdk import OpenFgaClient, RelationshipCondition\n# from openfga_sdk.client.models import ClientTuple, ClientWriteRequest\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = ClientWriteRequest(\n    writes=[\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"viewer\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n            condition=RelationshipCondition(\n              name='ViewCountLessThan200',\n              context=dict(\n                  Name='Roadmap',\n                  Type='Document',\n              ),\n            ),\n        ),\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"viewer\",\n            object=\"document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5\",\n        ),\n    ],\n    deletes=[\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"writer\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n        ),\n    ],\n)\n\nresponse = await fga_client.write(body, options)\n```\n\nConvenience `write_tuples` and `delete_tuples` methods are also available.\n\n###### Non-transaction mode\n\nThe SDK will split the writes into separate requests and send them sequentially to avoid violating rate limits.\n\n```python\n# from openfga_sdk import OpenFgaClient, RelationshipCondition\n# from openfga_sdk.client.models import ClientTuple, ClientWriteRequest, WriteTransactionOpts\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\",\n    \"transaction\": WriteTransactionOpts(\n        disabled=True,\n        max_parallel_requests=10, # Maximum number of requests to issue in parallel\n        max_per_chunk=1, # Maximum number of requests to be sent in a transaction in a particular chunk\n    )\n}\nbody = ClientWriteRequest(\n    writes=[\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"viewer\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n        ),\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"viewer\",\n            object=\"document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5\",\n            condition=RelationshipCondition(\n              name='ViewCountLessThan200',\n              context=dict(\n                  Name='Roadmap',\n                  Type='Document',\n              ),\n            ),\n        ),\n    ],\n    deletes=[\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"writer\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n        ),\n    ],\n)\n\nresponse = await fga_client.write(body, options)\n```\n\n#### Relationship Queries\n\n##### Check\n\nCheck if a user has a particular relation with an object.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Check)\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client import ClientCheckRequest\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = ClientCheckRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"writer\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n    context=dict(\n        ViewCount=100\n    ),\n)\n\nresponse = await fga_client.check(body, options)\n# response.allowed = True\n```\n\n\n##### Batch Check\n\nRun a set of [checks](#check). Batch Check will return `allowed: false` if it encounters an error, and will return the error in the body.\nIf 429s or 5xxs are encountered, the underlying check will retry up to 15 times before giving up.\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client import ClientCheckRequest\n# from openfga_sdk.client.models import ClientTuple\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = [ClientCheckRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"viewer\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n    contextual_tuples=[  # optional\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"editor\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n        ),\n    ],\n    context=dict(\n        ViewCount=100\n    )\n), ClientCheckRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"admin\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n    contextual_tuples=[  # optional\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"editor\",\n            object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n        ),\n    ]\n), ClientCheckRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"creator\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n), ClientCheckRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"deleter\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n)]\n\nresponse = await fga_client.batch_check(body, options)\n# response.responses = [{\n#   allowed: false,\n#   request: {\n#     user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#     relation: \"viewer\",\n#     object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n#     contextual_tuples: [{\n#       user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#       relation: \"editor\",\n#       object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\"\n#     }],\n#    context=dict(\n#        ViewCount=100\n#    )\n#   }\n# }, {\n#   allowed: false,\n#   request: {\n#     user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#     relation: \"admin\",\n#     object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n#     contextual_tuples: [{\n#       user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#       relation: \"editor\",\n#       object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\"\n#     }]\n#   }\n# }, {\n#   allowed: false,\n#   request: {\n#     user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#     relation: \"creator\",\n#     object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n#   },\n#   error: <FgaError ...>\n# }, {\n#   allowed: true,\n#   request: {\n#     user: \"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n#     relation: \"deleter\",\n#     object: \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n#   }},\n# ]\n```\n\n#### Expand\n\nExpands the relationships in userset tree format.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/Expand)\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client.models import ClientExpandRequest\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = ClientExpandRequest(\n    relation=\"viewer\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n)\n\nresponse = await fga_client.expand(body. options)\n# response = ExpandResponse({\"tree\": UsersetTree({\"root\": Node({\"name\": \"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#viewer\", \"leaf\": Leaf({\"users\": Users({\"users\": [\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\", \"user:f52a4f7a-054d-47ff-bb6e-3ac81269988f\"]})})})})})\n```\n\n#### List Objects\n\nList the objects of a particular type a user has access to.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/ListObjects)\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client.models import ClientListObjectsRequest, ClientTuple\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = ClientListObjectsRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"viewer\",\n    type=\"document\",\n    contextual_tuples=[  # optional\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"writer\",\n            object=\"document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5\",\n        ),\n    ],\n    context=dict(\n        ViewCount=100\n    )\n)\n\nresponse = await fga_client.list_objects(body)\n# response.objects = [\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\"]\n```\n\n#### List Relations\n\nList the relations a user has on an object.\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client.models import ClientListRelationsRequest\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\nbody = ClientListRelationsRequest(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n    relations=[\"can_view\", \"can_edit\", \"can_delete\", \"can_rename\"],\n    contextual_tuples=[  # optional\n        ClientTuple(\n            user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n            relation=\"writer\",\n            object=\"document:0192ab2d-d36e-7cb3-a4a8-5d1d67a300c5\",\n        ),\n    ],\n    context=dict(\n        ViewCount=100\n    )\n)\n\nresponse = await fga_client.list_relations(body, options)\n\n# response.relations = [\"can_view\", \"can_edit\"]\n```\n\n#### List Users\n\nList the users who have a certain relation to a particular type.\n\n[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/ListUsers)\n\n```python\nfrom openfga_sdk import OpenFgaClient\nfrom openfga_sdk.models.fga_object import FgaObject\nfrom openfga_sdk.client.models import ClientListUsersRequest, ClientTuple\n\nconfiguration = ClientConfiguration(\n    api_url=FGA_API_URL,\n    # ...\n)\n\nasync with OpenFgaClient(configuration) as api_client:\n    options = {\n        \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n    }\n\n    request = ClientListUsersRequest(\n        object=FgaObject(type=\"document\", id=\"2021-budget\"),\n        relation=\"can_read\",\n        user_filters=[\n            UserTypeFilter(type=\"user\"),\n            UserTypeFilter(type=\"team\", relation=\"member\"),\n        ],\n        context={},\n        contextual_tuples=[\n            ClientTuple(\n                user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n                relation=\"editor\",\n                object=\"folder:product\",\n            ),\n            ClientTuple(\n                user=\"folder:product\",\n                relation=\"parent\",\n                object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n            ),\n        ],\n    )\n\n    response = await api_client.list_users(request, options)\n\n    # response.users = [{object: {type: \"user\", id: \"81684243-9356-4421-8fbf-a4f8d36aa31b\"}}, {userset: { type: \"user\" }}, ...]\n```\n\n#### Assertions\n\n##### Read Assertions\n\nRead assertions for a particular authorization model.\n\n[API Documentation](https://openfga.dev/api/service#/Assertions/Read%20Assertions)\n\n```python\n# from openfga_sdk import OpenFgaClient\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\n\nresponse = await fga_client.read_assertions(options)\n```\n\n##### Write Assertions\n\nUpdate the assertions for a particular authorization model.\n\n[API Documentation](https://openfga.dev/api/service#/Assertions/Write%20Assertions)\n\n```python\n# from openfga_sdk import OpenFgaClient\n# from openfga_sdk.client.models import ClientAssertion\n\n# Initialize the fga_client\n# fga_client = OpenFgaClient(configuration)\n\noptions = {\n    # You can rely on the model id set in the configuration or override it for this specific request\n    \"authorization_model_id\": \"01GXSA8YR785C4FYS3C0RTG7B1\"\n}\n\nbody = [ClientAssertion(\n    user=\"user:81684243-9356-4421-8fbf-a4f8d36aa31b\",\n    relation=\"viewer\",\n    object=\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a\",\n    expectation=True,\n)]\n\nresponse = await fga_client.write_assertions(body, options)\n```\n\n\n### Retries\n\nIf a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to 15 times with a minimum wait time of 100 milliseconds between each attempt.\n\nTo customize this behavior, create a `RetryParams` object and assign values to the `max_retry` and `min_wait_in_ms` constructor parameters. `max_retry` determines the maximum number of retries (up to 15), while `min_wait_in_ms` sets the minimum wait time between retries in milliseconds.\n\nApply your custom retry values by passing the object to the `ClientConfiguration` constructor's `retry_params` parameter.\n\n```python\nfrom openfga_sdk import ClientConfiguration, OpenFgaClient\nfrom openfga_sdk.configuration import RetryParams\nfrom os import environ\n\nasync def main():\n    # Configure the client with custom retry settings\n    config = ClientConfiguration(\n        api_url=environ.get(\"FGA_API_URL\"),\n        retry_params=RetryParams(max_retry=3, min_wait_in_ms=250)\n    )\n\n    # Create a client instance and read authorization models\n    async with OpenFgaClient(config) as client:\n        return await client.read_authorization_models()\n```\n\n\n### API Endpoints\n\nClass | Method | HTTP request | Description\n------------ | ------------- | ------------- | -------------\n*OpenFgaApi* | [**check**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#check) | **POST** /stores/{store_id}/check | Check whether a user is authorized to access an object\n*OpenFgaApi* | [**create_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#create_store) | **POST** /stores | Create a store\n*OpenFgaApi* | [**delete_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#delete_store) | **DELETE** /stores/{store_id} | Delete a store\n*OpenFgaApi* | [**expand**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#expand) | **POST** /stores/{store_id}/expand | Expand all relationships in userset tree format, and following userset rewrite rules.  Useful to reason about and debug a certain relationship\n*OpenFgaApi* | [**get_store**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#get_store) | **GET** /stores/{store_id} | Get a store\n*OpenFgaApi* | [**list_objects**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_objects) | **POST** /stores/{store_id}/list-objects | List all objects of the given type that the user has a relation with\n*OpenFgaApi* | [**list_stores**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_stores) | **GET** /stores | List all stores\n*OpenFgaApi* | [**list_users**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#list_users) | **POST** /stores/{store_id}/list-users | List the users matching the provided filter who have a certain relation to a particular type.\n*OpenFgaApi* | [**read**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read) | **POST** /stores/{store_id}/read | Get tuples from the store that matches a query, without following userset rewrite rules\n*OpenFgaApi* | [**read_assertions**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_assertions) | **GET** /stores/{store_id}/assertions/{authorization_model_id} | Read assertions for an authorization model ID\n*OpenFgaApi* | [**read_authorization_model**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_authorization_model) | **GET** /stores/{store_id}/authorization-models/{id} | Return a particular version of an authorization model\n*OpenFgaApi* | [**read_authorization_models**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_authorization_models) | **GET** /stores/{store_id}/authorization-models | Return all the authorization models for a particular store\n*OpenFgaApi* | [**read_changes**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#read_changes) | **GET** /stores/{store_id}/changes | Return a list of all the tuple changes\n*OpenFgaApi* | [**write**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write) | **POST** /stores/{store_id}/write | Add or delete tuples from the store\n*OpenFgaApi* | [**write_assertions**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write_assertions) | **PUT** /stores/{store_id}/assertions/{authorization_model_id} | Upsert assertions for an authorization model ID\n*OpenFgaApi* | [**write_authorization_model**](https://github.com/openfga/python-sdk/blob/main/docs/OpenFgaApi.md#write_authorization_model) | **POST** /stores/{store_id}/authorization-models | Create a new authorization model\n\n\n\n### Models\n\n## Documentation For Models\n\n - [AbortedMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/AbortedMessageResponse.md)\n - [Any](https://github.com/openfga/python-sdk/blob/main/docs/Any.md)\n - [Assertion](https://github.com/openfga/python-sdk/blob/main/docs/Assertion.md)\n - [AssertionTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/AssertionTupleKey.md)\n - [AuthErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/AuthErrorCode.md)\n - [AuthorizationModel](https://github.com/openfga/python-sdk/blob/main/docs/AuthorizationModel.md)\n - [CheckRequest](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequest.md)\n - [CheckRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/CheckRequestTupleKey.md)\n - [CheckResponse](https://github.com/openfga/python-sdk/blob/main/docs/CheckResponse.md)\n - [Computed](https://github.com/openfga/python-sdk/blob/main/docs/Computed.md)\n - [Condition](https://github.com/openfga/python-sdk/blob/main/docs/Condition.md)\n - [ConditionMetadata](https://github.com/openfga/python-sdk/blob/main/docs/ConditionMetadata.md)\n - [ConditionParamTypeRef](https://github.com/openfga/python-sdk/blob/main/docs/ConditionParamTypeRef.md)\n - [ConsistencyPreference](https://github.com/openfga/python-sdk/blob/main/docs/ConsistencyPreference.md)\n - [ContextualTupleKeys](https://github.com/openfga/python-sdk/blob/main/docs/ContextualTupleKeys.md)\n - [CreateStoreRequest](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreRequest.md)\n - [CreateStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/CreateStoreResponse.md)\n - [Difference](https://github.com/openfga/python-sdk/blob/main/docs/Difference.md)\n - [ErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/ErrorCode.md)\n - [ExpandRequest](https://github.com/openfga/python-sdk/blob/main/docs/ExpandRequest.md)\n - [ExpandRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/ExpandRequestTupleKey.md)\n - [ExpandResponse](https://github.com/openfga/python-sdk/blob/main/docs/ExpandResponse.md)\n - [FgaObject](https://github.com/openfga/python-sdk/blob/main/docs/FgaObject.md)\n - [ForbiddenResponse](https://github.com/openfga/python-sdk/blob/main/docs/ForbiddenResponse.md)\n - [GetStoreResponse](https://github.com/openfga/python-sdk/blob/main/docs/GetStoreResponse.md)\n - [InternalErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorCode.md)\n - [InternalErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/InternalErrorMessageResponse.md)\n - [Leaf](https://github.com/openfga/python-sdk/blob/main/docs/Leaf.md)\n - [ListObjectsRequest](https://github.com/openfga/python-sdk/blob/main/docs/ListObjectsRequest.md)\n - [ListObjectsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListObjectsResponse.md)\n - [ListStoresResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListStoresResponse.md)\n - [ListUsersRequest](https://github.com/openfga/python-sdk/blob/main/docs/ListUsersRequest.md)\n - [ListUsersResponse](https://github.com/openfga/python-sdk/blob/main/docs/ListUsersResponse.md)\n - [Metadata](https://github.com/openfga/python-sdk/blob/main/docs/Metadata.md)\n - [Node](https://github.com/openfga/python-sdk/blob/main/docs/Node.md)\n - [Nodes](https://github.com/openfga/python-sdk/blob/main/docs/Nodes.md)\n - [NotFoundErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/NotFoundErrorCode.md)\n - [NullValue](https://github.com/openfga/python-sdk/blob/main/docs/NullValue.md)\n - [ObjectRelation](https://github.com/openfga/python-sdk/blob/main/docs/ObjectRelation.md)\n - [PathUnknownErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/PathUnknownErrorMessageResponse.md)\n - [ReadAssertionsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAssertionsResponse.md)\n - [ReadAuthorizationModelResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAuthorizationModelResponse.md)\n - [ReadAuthorizationModelsResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadAuthorizationModelsResponse.md)\n - [ReadChangesResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadChangesResponse.md)\n - [ReadRequest](https://github.com/openfga/python-sdk/blob/main/docs/ReadRequest.md)\n - [ReadRequestTupleKey](https://github.com/openfga/python-sdk/blob/main/docs/ReadRequestTupleKey.md)\n - [ReadResponse](https://github.com/openfga/python-sdk/blob/main/docs/ReadResponse.md)\n - [RelationMetadata](https://github.com/openfga/python-sdk/blob/main/docs/RelationMetadata.md)\n - [RelationReference](https://github.com/openfga/python-sdk/blob/main/docs/RelationReference.md)\n - [RelationshipCondition](https://github.com/openfga/python-sdk/blob/main/docs/RelationshipCondition.md)\n - [SourceInfo](https://github.com/openfga/python-sdk/blob/main/docs/SourceInfo.md)\n - [Status](https://github.com/openfga/python-sdk/blob/main/docs/Status.md)\n - [Store](https://github.com/openfga/python-sdk/blob/main/docs/Store.md)\n - [Tuple](https://github.com/openfga/python-sdk/blob/main/docs/Tuple.md)\n - [TupleChange](https://github.com/openfga/python-sdk/blob/main/docs/TupleChange.md)\n - [TupleKey](https://github.com/openfga/python-sdk/blob/main/docs/TupleKey.md)\n - [TupleKeyWithoutCondition](https://github.com/openfga/python-sdk/blob/main/docs/TupleKeyWithoutCondition.md)\n - [TupleOperation](https://github.com/openfga/python-sdk/blob/main/docs/TupleOperation.md)\n - [TupleToUserset](https://github.com/openfga/python-sdk/blob/main/docs/TupleToUserset.md)\n - [TypeDefinition](https://github.com/openfga/python-sdk/blob/main/docs/TypeDefinition.md)\n - [TypeName](https://github.com/openfga/python-sdk/blob/main/docs/TypeName.md)\n - [TypedWildcard](https://github.com/openfga/python-sdk/blob/main/docs/TypedWildcard.md)\n - [UnauthenticatedResponse](https://github.com/openfga/python-sdk/blob/main/docs/UnauthenticatedResponse.md)\n - [UnprocessableContentErrorCode](https://github.com/openfga/python-sdk/blob/main/docs/UnprocessableContentErrorCode.md)\n - [UnprocessableContentMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/UnprocessableContentMessageResponse.md)\n - [User](https://github.com/openfga/python-sdk/blob/main/docs/User.md)\n - [UserTypeFilter](https://github.com/openfga/python-sdk/blob/main/docs/UserTypeFilter.md)\n - [Users](https://github.com/openfga/python-sdk/blob/main/docs/Users.md)\n - [Userset](https://github.com/openfga/python-sdk/blob/main/docs/Userset.md)\n - [UsersetTree](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTree.md)\n - [UsersetTreeDifference](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTreeDifference.md)\n - [UsersetTreeTupleToUserset](https://github.com/openfga/python-sdk/blob/main/docs/UsersetTreeTupleToUserset.md)\n - [UsersetUser](https://github.com/openfga/python-sdk/blob/main/docs/UsersetUser.md)\n - [Usersets](https://github.com/openfga/python-sdk/blob/main/docs/Usersets.md)\n - [ValidationErrorMessageResponse](https://github.com/openfga/python-sdk/blob/main/docs/ValidationErrorMessageResponse.md)\n - [WriteAssertionsRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteAssertionsRequest.md)\n - [WriteAuthorizationModelRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteAuthorizationModelRequest.md)\n - [WriteAuthorizationModelResponse](https://github.com/openfga/python-sdk/blob/main/docs/WriteAuthorizationModelResponse.md)\n - [WriteRequest](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequest.md)\n - [WriteRequestDeletes](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequestDeletes.md)\n - [WriteRequestWrites](https://github.com/openfga/python-sdk/blob/main/docs/WriteRequestWrites.md)\n\n\n\n### OpenTelemetry\n\nThis SDK supports producing metrics that can be consumed as part of an [OpenTelemetry](https://opentelemetry.io/) setup. For more information, please see [the documentation](https://github.com/openfga/python-sdk/blob/main/docs/opentelemetry.md)\n\n## Contributing\n\n### Issues\n\nIf you have found a bug or if you have a feature request, please report them on the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section. Please do not report security vulnerabilities on the public GitHub issue tracker.\n\n### Pull Requests\n\nWhile we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well. \n\n## Author\n\n[OpenFGA](https://github.com/openfga)\n\n## License\n\nThis project is licensed under the Apache-2.0 license. See the [LICENSE](https://github.com/openfga/python-sdk/blob/main/LICENSE) file for more info.\n\nThe code in this repo was auto generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) from a template based on the [python legacy template](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python-legacy), licensed under the [Apache License 2.0](https://github.com/OpenAPITools/openapi-generator/blob/master/LICENSE).\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/openfga/python-sdk"
    },
    "split_keywords": [
        "openfga",
        " authorization",
        " fga",
        " fine-grained-authorization",
        " rebac",
        " zanzibar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1aa00d1c3884ff7e8e6b4781d2f6d7771f0b166ab4b47dafcfe5fb58a0d79be4",
                "md5": "1be6cc7a569785b49e77878aec8d8050",
                "sha256": "20764dec18e6fe9f45bf1b48845deb6c6681c0c67542ce59c1db98d567322fd3"
            },
            "downloads": -1,
            "filename": "openfga_sdk-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1be6cc7a569785b49e77878aec8d8050",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 298750,
            "upload_time": "2024-11-15T17:37:49",
            "upload_time_iso_8601": "2024-11-15T17:37:49.196463Z",
            "url": "https://files.pythonhosted.org/packages/1a/a0/0d1c3884ff7e8e6b4781d2f6d7771f0b166ab4b47dafcfe5fb58a0d79be4/openfga_sdk-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "97f4714d70728d4b8493859b833e9fe69287fd4814a698b841ae81408d3d7b1a",
                "md5": "243ea36a2eadda4899b861df991e1d84",
                "sha256": "f069d0a4e00b57acc102bf49c2baaf2cc37c61dc90150e04547897e2ab748a69"
            },
            "downloads": -1,
            "filename": "openfga_sdk-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "243ea36a2eadda4899b861df991e1d84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 192649,
            "upload_time": "2024-11-15T17:37:51",
            "upload_time_iso_8601": "2024-11-15T17:37:51.664323Z",
            "url": "https://files.pythonhosted.org/packages/97/f4/714d70728d4b8493859b833e9fe69287fd4814a698b841ae81408d3d7b1a/openfga_sdk-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-15 17:37:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "openfga",
    "github_project": "python-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.9.3"
                ],
                [
                    "<",
                    "4"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "<",
                    "3"
                ],
                [
                    ">=",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "69.1.1"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    "<",
                    "2"
                ],
                [
                    ">=",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "<",
                    "3"
                ],
                [
                    ">=",
                    "1.25.11"
                ]
            ]
        },
        {
            "name": "opentelemetry-api",
            "specs": [
                [
                    "<",
                    "2"
                ],
                [
                    ">=",
                    "1.25.0"
                ]
            ]
        }
    ],
    "lcname": "openfga-sdk"
}
        
Elapsed time: 0.41967s