Packages

OpenAPI API client for Ory Keto, Ory's open source 'Zanzibar - Google's Consistent, Global Authorization System' implementation.

Current section

Files

Jump to
ory_keto lib ory api read.ex
Raw

lib/ory/api/read.ex

# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule Ory.Api.Read do
@moduledoc """
API calls for all endpoints tagged `Read`.
"""
alias Ory.Connection
import Ory.RequestBuilder
@doc """
Check a relation tuple
To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :namespace (String.t): Namespace of the Relation Tuple
- :object (String.t): Object of the Relation Tuple
- :relation (String.t): Relation of the Relation Tuple
- :subject_id (String.t): SubjectID of the Relation Tuple
- :subject_set_periodnamespace (String.t): Namespace of the Subject Set
- :subject_set_periodobject (String.t): Object of the Subject Set
- :subject_set_periodrelation (String.t): Relation of the Subject Set
- :max_depth (integer()):
## Returns
{:ok, Ory.Model.GetCheckResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_check(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.GetCheckResponse.t} | {:error, Tesla.Env.t}
def get_check(connection, opts \\ []) do
optional_params = %{
:namespace => :query,
:object => :query,
:relation => :query,
:subject_id => :query,
:"subject_set.namespace" => :query,
:"subject_set.object" => :query,
:"subject_set.relation" => :query,
:"max-depth" => :query
}
%{}
|> method(:get)
|> url("/relation-tuples/check/openapi")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.GetCheckResponse{}},
{ 400, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Check a relation tuple
To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.GetCheckResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_check_mirror_status(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.GetCheckResponse.t} | {:error, Tesla.Env.t}
def get_check_mirror_status(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/relation-tuples/check")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.GetCheckResponse{}},
{ 400, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GetCheckResponse{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Expand a Relation Tuple
Use this endpoint to expand a relation tuple.
## Parameters
- connection (Ory.Connection): Connection to server
- namespace (String.t): Namespace of the Subject Set
- object (String.t): Object of the Subject Set
- relation (String.t): Relation of the Subject Set
- opts (KeywordList): [optional] Optional parameters
- :max_depth (integer()):
## Returns
{:ok, Ory.Model.ExpandTree.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_expand(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.ExpandTree.t} | {:error, Tesla.Env.t}
def get_expand(connection, namespace, object, relation, opts \\ []) do
optional_params = %{
:"max-depth" => :query
}
%{}
|> method(:get)
|> url("/relation-tuples/expand")
|> add_param(:query, :namespace, namespace)
|> add_param(:query, :object, object)
|> add_param(:query, :relation, relation)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.ExpandTree{}},
{ 400, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Query relation tuples
Get all relation tuples that match the query. Only the namespace field is required.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :page_token (String.t):
- :page_size (integer()):
- :namespace (String.t): Namespace of the Relation Tuple
- :object (String.t): Object of the Relation Tuple
- :relation (String.t): Relation of the Relation Tuple
- :subject_id (String.t): SubjectID of the Relation Tuple
- :subject_set_periodnamespace (String.t): Namespace of the Subject Set
- :subject_set_periodobject (String.t): Object of the Subject Set
- :subject_set_periodrelation (String.t): Relation of the Subject Set
## Returns
{:ok, Ory.Model.GetRelationTuplesResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_relation_tuples(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GetRelationTuplesResponse.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def get_relation_tuples(connection, opts \\ []) do
optional_params = %{
:page_token => :query,
:page_size => :query,
:namespace => :query,
:object => :query,
:relation => :query,
:subject_id => :query,
:"subject_set.namespace" => :query,
:"subject_set.object" => :query,
:"subject_set.relation" => :query
}
%{}
|> method(:get)
|> url("/relation-tuples")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.GetRelationTuplesResponse{}},
{ 404, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Check a relation tuple
To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :max_depth (integer()):
- :body (RelationQuery):
## Returns
{:ok, Ory.Model.GetCheckResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec post_check(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.GetCheckResponse.t} | {:error, Tesla.Env.t}
def post_check(connection, opts \\ []) do
optional_params = %{
:"max-depth" => :query,
:body => :body
}
%{}
|> method(:post)
|> url("/relation-tuples/check/openapi")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.GetCheckResponse{}},
{ 400, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Check a relation tuple
To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.GetCheckResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec post_check_mirror_status(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.GetCheckResponse.t} | {:error, Tesla.Env.t}
def post_check_mirror_status(connection, _opts \\ []) do
%{}
|> method(:post)
|> url("/relation-tuples/check")
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.GetCheckResponse{}},
{ 400, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GetCheckResponse{}},
{ 500, %Ory.Model.GenericError{}}
])
end
end