Packages
ory_client
1.22.59
1.22.63
1.22.62
1.22.61
1.22.60
1.22.59
1.22.58
1.22.57
1.22.56
1.22.55
1.22.54
1.22.53
1.22.52
1.22.51
1.22.50
1.22.49
1.22.48
1.22.47
1.22.46
1.22.45
1.22.44
1.22.43
1.22.42
1.22.41
1.22.40
1.22.39
1.22.38
1.22.37
1.22.36
1.22.35
1.22.34
1.22.33
1.22.32
1.22.28
1.22.27
1.22.26
1.22.25
1.22.24
1.22.23
1.22.22
1.22.21
1.22.16
1.22.15
1.22.14
1.22.13
1.22.12
1.22.11
1.22.10
1.22.9
1.22.8
1.22.7
1.22.6
1.22.5
1.22.4
1.22.3
1.22.2
1.22.1
1.22.0
1.21.6
1.21.5
1.21.4
1.21.3
1.21.2
1.21.1
1.21.0
1.20.23
1.20.22
1.20.11
1.20.10
1.20.9
1.20.8
1.20.7
1.20.6
1.20.5
1.20.4
1.20.3
1.20.2
1.20.1
1.20.0
1.19.0
1.18.5
1.18.4
1.17.2
1.17.1
1.16.10
1.6.2
1.6.1
1.5.2
1.5.1
1.5.0
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.17
1.2.16
1.2.15
1.2.14
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.51
1.1.50
1.1.49
1.1.48
1.1.47
1.1.46
1.1.45
1.1.44
1.1.41
1.1.40
1.1.39
1.1.39-alpha.0
1.1.38
1.1.37
1.1.36
1.1.35
1.1.34
1.1.33
1.1.32
1.1.31
1.1.30
1.1.29
1.1.28
1.1.27
1.1.26
1.1.25
1.1.24
1.1.23
1.1.22
1.1.21
1.1.20
1.1.19
1.1.18
1.1.17
1.1.7
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0
1.0.0-alpha.0
0.2.0-alpha.60
0.2.0-alpha.48
0.2.0-alpha.47
0.2.0-alpha.46
0.2.0-alpha.45
0.2.0-alpha.44
0.2.0-alpha.43
0.2.0-alpha.42
0.2.0-alpha.41
0.2.0-alpha.40
0.2.0-alpha.39
0.2.0-alpha.38
0.2.0-alpha.37
0.2.0-alpha.36
0.2.0-alpha.35
0.2.0-alpha.34
0.2.0-alpha.33
0.2.0-alpha.32
0.2.0-alpha.31
0.2.0-alpha.30
0.2.0-alpha.29
0.2.0-alpha.28
0.2.0-alpha.27
0.2.0-alpha.26
0.2.0-alpha.25
0.2.0-alpha.24
0.2.0-alpha.23
0.2.0-alpha.22
0.2.0-alpha.21
0.2.0-alpha.20
0.2.0-alpha.19
0.2.0-alpha.18
0.2.0-alpha.16
0.2.0-alpha.15
0.2.0-alpha.14
0.2.0-alpha.4
0.2.0-alpha.2
0.1.0-alpha.12
0.1.0-alpha.11
0.1.0-alpha.10
0.1.0-alpha.9
0.1.0-alpha.8
0.1.0-alpha.7
0.1.0-alpha.6
0.1.0-alpha.5
0.1.0-alpha.4
0.1.0-alpha.3
0.1.0-alpha.2
0.1.0-alpha.1
0.0.1-alpha.189
0.0.1-alpha.188
0.0.1-alpha.187
OpenAPI API client for Ory Network, Ory's web-scale API for identity and access control.
Current section
Files
Jump to
Current section
Files
lib/ory/api/permission.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.12.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Ory.Api.Permission do
@moduledoc """
API calls for all endpoints tagged `Permission`.
"""
alias Ory.Connection
import Ory.RequestBuilder
@doc """
Batch check permissions
To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview).
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"max-depth"` (integer()):
- `:body` (BatchCheckPermissionBody):
### Returns
- `{:ok, Ory.Model.BatchCheckPermissionResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec batch_check_permission(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.ErrorGeneric.t} | {:ok, Ory.Model.BatchCheckPermissionResult.t} | {:error, Tesla.Env.t}
def batch_check_permission(connection, opts \\ []) do
optional_params = %{
:"max-depth" => :query,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/relation-tuples/batch/check")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.BatchCheckPermissionResult},
{400, Ory.Model.ErrorGeneric},
{:default, Ory.Model.ErrorGeneric}
])
end
@doc """
Check a permission
To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview).
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:namespace` (String.t): Namespace of the Relationship
- `:object` (String.t): Object of the Relationship
- `:relation` (String.t): Relation of the Relationship
- `:subject_id` (String.t): SubjectID of the Relationship
- `:"subject_set.namespace"` (String.t): Namespace of the Subject Set
- `:"subject_set.object"` (String.t): Object of the Subject Set
- `:"subject_set.relation"` (String.t): Relation of the Subject Set
- `:"max-depth"` (integer()):
### Returns
- `{:ok, Ory.Model.CheckPermissionResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec check_permission(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.CheckPermissionResult.t} | {:ok, Ory.Model.ErrorGeneric.t} | {:error, Tesla.Env.t}
def check_permission(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
}
request =
%{}
|> method(:get)
|> url("/relation-tuples/check/openapi")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.CheckPermissionResult},
{400, Ory.Model.ErrorGeneric},
{:default, Ory.Model.ErrorGeneric}
])
end
@doc """
Check a permission
To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview).
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:namespace` (String.t): Namespace of the Relationship
- `:object` (String.t): Object of the Relationship
- `:relation` (String.t): Relation of the Relationship
- `:subject_id` (String.t): SubjectID of the Relationship
- `:"subject_set.namespace"` (String.t): Namespace of the Subject Set
- `:"subject_set.object"` (String.t): Object of the Subject Set
- `:"subject_set.relation"` (String.t): Relation of the Subject Set
- `:"max-depth"` (integer()):
### Returns
- `{:ok, Ory.Model.CheckPermissionResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec check_permission_or_error(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.CheckPermissionResult.t} | {:ok, Ory.Model.ErrorGeneric.t} | {:error, Tesla.Env.t}
def check_permission_or_error(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
}
request =
%{}
|> method(:get)
|> url("/relation-tuples/check")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.CheckPermissionResult},
{400, Ory.Model.ErrorGeneric},
{403, Ory.Model.CheckPermissionResult},
{:default, Ory.Model.ErrorGeneric}
])
end
@doc """
Expand a Relationship into permissions.
Use this endpoint to expand a relationship tuple into permissions.
### 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` (keyword): Optional parameters
- `:"max-depth"` (integer()):
### Returns
- `{:ok, Ory.Model.ExpandedPermissionTree.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec expand_permissions(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, Ory.Model.ErrorGeneric.t} | {:ok, Ory.Model.ExpandedPermissionTree.t} | {:error, Tesla.Env.t}
def expand_permissions(connection, namespace, object, relation, opts \\ []) do
optional_params = %{
:"max-depth" => :query
}
request =
%{}
|> 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
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.ExpandedPermissionTree},
{400, Ory.Model.ErrorGeneric},
{404, Ory.Model.ErrorGeneric},
{:default, Ory.Model.ErrorGeneric}
])
end
@doc """
Check a permission
To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview).
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"max-depth"` (integer()):
- `:body` (PostCheckPermissionBody):
### Returns
- `{:ok, Ory.Model.CheckPermissionResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_check_permission(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.CheckPermissionResult.t} | {:ok, Ory.Model.ErrorGeneric.t} | {:error, Tesla.Env.t}
def post_check_permission(connection, opts \\ []) do
optional_params = %{
:"max-depth" => :query,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/relation-tuples/check/openapi")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.CheckPermissionResult},
{400, Ory.Model.ErrorGeneric},
{:default, Ory.Model.ErrorGeneric}
])
end
@doc """
Check a permission
To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview).
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"max-depth"` (integer()):
- `:body` (PostCheckPermissionOrErrorBody):
### Returns
- `{:ok, Ory.Model.CheckPermissionResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_check_permission_or_error(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.CheckPermissionResult.t} | {:ok, Ory.Model.ErrorGeneric.t} | {:error, Tesla.Env.t}
def post_check_permission_or_error(connection, opts \\ []) do
optional_params = %{
:"max-depth" => :query,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/relation-tuples/check")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Ory.Model.CheckPermissionResult},
{400, Ory.Model.ErrorGeneric},
{403, Ory.Model.CheckPermissionResult},
{:default, Ory.Model.ErrorGeneric}
])
end
end