# Authzed

This repository houses the Elixir client library for Authzed.

[Authzed] is a database and service that stores, computes, and validates your application's permissions.

Developers create a schema that models their permissions requirements and use a client library, such as this one, to apply the schema to the database, insert data into the database, and query the data to efficiently check permissions in their applications.

Supported client API versions:
- [v1](
- [v1alpha1](
- [v0]( - Deprecated

You can find more info on each API on the [Authzed API reference documentation].
Additionally, Protobuf API documentation can be found on the [Buf Registry Authzed API repository].

[Authzed API Reference documentation]:
[Buf Registry Authzed API repository]:

## Basic Usage

### Installation

The package can be installed by adding `authzed_ex` to your list of dependencies in `mix.exs`:

def deps do
    {:authzed_ex, "~> 0.0.1"}

### Initializing a client

In order to successfully connect, you will have to provide a [Bearer Token] with your own API Token from the [Authzed dashboard] in place of `somerandomkeyhere` in the following example:

[Bearer Token]:
[Authzed Dashboard]:


alias Authzed.Api.V1.{Client, GRPCUtil}

client =

### Performing an API call


alias Authzed.Api.V1.{

# Is Emilia in the set of users that can read post #1?
post_one = "post", object_id: "1")

emilia = "user", object_id: "emilia"))

{:ok, response} =
    resource: post_one,
    permission: "view",
    subject: emilia

assert response.permissionship == :PERMISSIONSHIP_HAS_PERMISSION