# NOTE: This file is auto generated by OpenAPI Generator 6.2.1 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Ory.Api.Api do
@moduledoc """
API calls for all endpoints tagged `Api`.
"""
alias Ory.Connection
import Ory.RequestBuilder
@doc """
Access Control Decision API
> This endpoint works with all HTTP Methods (GET, POST, PUT, ...) and matches every path prefixed with /decisions. This endpoint mirrors the proxy capability of ORY Oathkeeper's proxy functionality but instead of forwarding the request to the upstream server, returns 200 (request should be allowed), 401 (unauthorized), or 403 (forbidden) status codes. This endpoint can be used to integrate with other API Proxies like Ambassador, Kong, Envoy, and many more.
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec decisions(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def decisions(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/decisions")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{401, %Ory.Model.GenericError{}},
{403, %Ory.Model.GenericError{}},
{404, %Ory.Model.GenericError{}},
{500, %Ory.Model.GenericError{}}
])
end
@doc """
Retrieve a Rule
Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error.
### Parameters
- `connection` (Ory.Connection): Connection to server
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Ory.Model.Rule.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_rule(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.Rule.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def get_rule(connection, id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/rules/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %Ory.Model.Rule{}},
{404, %Ory.Model.GenericError{}},
{500, %Ory.Model.GenericError{}}
])
end
@doc """
Lists Cryptographic Keys
This endpoint returns cryptographic keys that are required to, for example, verify signatures of ID Tokens.
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Ory.Model.JsonWebKeySet.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_well_known_json_web_keys(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.JsonWebKeySet.t} | {:error, Tesla.Env.t}
def get_well_known_json_web_keys(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/.well-known/jwks.json")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %Ory.Model.JsonWebKeySet{}},
{500, %Ory.Model.GenericError{}}
])
end
@doc """
List All Rules
This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place.
### Parameters
- `connection` (Ory.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:limit` (integer()): The maximum amount of rules returned.
- `:offset` (integer()): The offset from where to start looking.
### Returns
- `{:ok, [%Rule{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_rules(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, list(Ory.Model.Rule.t)} | {:error, Tesla.Env.t}
def list_rules(connection, opts \\ []) do
optional_params = %{
:limit => :query,
:offset => :query
}
request =
%{}
|> method(:get)
|> url("/rules")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, [%Ory.Model.Rule{}]},
{500, %Ory.Model.GenericError{}}
])
end
end