diff --git a/Dockerfile b/Dockerfile index 428ec4664c5..439a479ae74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,6 +95,14 @@ RUN \ apt-get update && \ apt-get install dart=2.13.4-1 +# elixir +RUN \ + wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && \ + dpkg -i erlang-solutions_2.0_all.deb && \ + apt-get -q update && apt-get install --no-install-recommends -y -q esl-erlang elixir && \ + rm erlang-solutions_2.0_all.deb && \ + mix local.hex --force + # rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y @@ -125,4 +133,4 @@ RUN go build -o /usr/local/bin/ory github.com/ory/cli RUN swagger version RUN ory version -ENTRYPOINT /bin/bash \ No newline at end of file +ENTRYPOINT /bin/bash diff --git a/README.md b/README.md index 089a8b8ec32..6cc7bbf087f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ desired version. You may also manually build and publish this image using: ```shell script -docker build -t oryd/sdk:latest . +docker build --platform linux/amd64 -t oryd/sdk:latest . docker tag oryd/sdk:latest oryd/sdk:v0.0.34 docker push oryd/sdk:v0.0.34 ``` @@ -20,7 +20,7 @@ docker push oryd/sdk:v0.0.34 If you wish to debug some generators or build steps, you can run the image locally: ```shell script -docker run --mount type=bind,source="$(pwd)",target=/sdk --name sdk --user "$(id -u):$(id -g)" -it oryd/sdk:v0.0.47 /bin/sh +docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/sdk --name sdk --user "$(id -u):$(id -g)" -it oryd/sdk:latest /bin/sh ``` ### Debugging Failing CircleCI Tests @@ -29,13 +29,12 @@ If a CircleCI tests fails ([see example](https://app.circleci.com/pipelines/gith you may run the following code snippet to reproduce the failure locally: ```shell script -docker run --mount type=bind,source="$(pwd)",target=/project -it oryd/sdk:v0.0.47 /bin/sh +docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/project -it oryd/sdk:latest /bin/sh export FORCE_VERSION=v1.11.0 export FORCE_PROJECT=hydra # or hydra or something else cd /project -cp spec/api.json "/sdk/spec/${CIRCLE_PROJECT_REPONAME}/v0.0.1-test.0.json" ./scripts/generate.sh ./scripts/test.sh ``` diff --git a/clients/client/elixir/.gitignore b/clients/client/elixir/.gitignore new file mode 100644 index 00000000000..b6012c77a3a --- /dev/null +++ b/clients/client/elixir/.gitignore @@ -0,0 +1,20 @@ +# The directory Mix will write compiled artifacts to. +/_build + +# If you run "mix test --cover", coverage assets end up here. +/cover + +# The directory Mix downloads your dependencies sources to. +/deps + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez diff --git a/clients/client/elixir/.openapi-generator-ignore b/clients/client/elixir/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/clients/client/elixir/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/clients/client/elixir/.openapi-generator/FILES b/clients/client/elixir/.openapi-generator/FILES new file mode 100644 index 00000000000..58607b2a08e --- /dev/null +++ b/clients/client/elixir/.openapi-generator/FILES @@ -0,0 +1,116 @@ +.gitignore +.openapi-generator-ignore +README.md +config/config.exs +lib/client/api/metadata.ex +lib/client/api/v0alpha0.ex +lib/client/api/v0alpha2.ex +lib/client/connection.ex +lib/client/deserializer.ex +lib/client/model/active_project.ex +lib/client/model/admin_create_identity_body.ex +lib/client/model/admin_create_self_service_recovery_link_body.ex +lib/client/model/admin_update_identity_body.ex +lib/client/model/api_token.ex +lib/client/model/authenticator_assurance_level.ex +lib/client/model/cloud_account.ex +lib/client/model/cname_settings.ex +lib/client/model/create_custom_hostname_body.ex +lib/client/model/create_subscription_payload.ex +lib/client/model/error_authenticator_assurance_level_not_satisfied.ex +lib/client/model/generic_error.ex +lib/client/model/health_not_ready_status.ex +lib/client/model/health_status.ex +lib/client/model/identity.ex +lib/client/model/identity_credentials.ex +lib/client/model/identity_credentials_type.ex +lib/client/model/identity_preset.ex +lib/client/model/identity_schema.ex +lib/client/model/identity_schema_location.ex +lib/client/model/identity_schema_validation_result.ex +lib/client/model/identity_state.ex +lib/client/model/inline_object.ex +lib/client/model/inline_response_200.ex +lib/client/model/inline_response_200_1.ex +lib/client/model/inline_response_503.ex +lib/client/model/invite_payload.ex +lib/client/model/is_owner_for_project_by_slug.ex +lib/client/model/is_owner_for_project_by_slug_payload.ex +lib/client/model/json_error.ex +lib/client/model/needs_privileged_session_error.ex +lib/client/model/null_plan.ex +lib/client/model/pagination.ex +lib/client/model/project.ex +lib/client/model/project_host.ex +lib/client/model/project_invite.ex +lib/client/model/project_revision.ex +lib/client/model/project_revision_hook.ex +lib/client/model/project_revision_identity_schema.ex +lib/client/model/project_revision_third_party_login_provider.ex +lib/client/model/project_slug.ex +lib/client/model/quota_project_member_seats.ex +lib/client/model/recovery_address.ex +lib/client/model/revoked_sessions.ex +lib/client/model/schema_patch.ex +lib/client/model/self_service_browser_location_change_required_error.ex +lib/client/model/self_service_error.ex +lib/client/model/self_service_flow_expired_error.ex +lib/client/model/self_service_login_flow.ex +lib/client/model/self_service_logout_url.ex +lib/client/model/self_service_recovery_flow.ex +lib/client/model/self_service_recovery_flow_state.ex +lib/client/model/self_service_recovery_link.ex +lib/client/model/self_service_registration_flow.ex +lib/client/model/self_service_settings_flow.ex +lib/client/model/self_service_settings_flow_state.ex +lib/client/model/self_service_verification_flow.ex +lib/client/model/self_service_verification_flow_state.ex +lib/client/model/session.ex +lib/client/model/session_authentication_method.ex +lib/client/model/session_device.ex +lib/client/model/settings_profile_form_config.ex +lib/client/model/stripe_customer_response.ex +lib/client/model/submit_self_service_login_flow_body.ex +lib/client/model/submit_self_service_login_flow_with_lookup_secret_method_body.ex +lib/client/model/submit_self_service_login_flow_with_oidc_method_body.ex +lib/client/model/submit_self_service_login_flow_with_password_method_body.ex +lib/client/model/submit_self_service_login_flow_with_totp_method_body.ex +lib/client/model/submit_self_service_login_flow_with_web_authn_method_body.ex +lib/client/model/submit_self_service_logout_flow_without_browser_body.ex +lib/client/model/submit_self_service_recovery_flow_body.ex +lib/client/model/submit_self_service_recovery_flow_with_link_method_body.ex +lib/client/model/submit_self_service_registration_flow_body.ex +lib/client/model/submit_self_service_registration_flow_with_oidc_method_body.ex +lib/client/model/submit_self_service_registration_flow_with_password_method_body.ex +lib/client/model/submit_self_service_settings_flow_body.ex +lib/client/model/submit_self_service_settings_flow_with_lookup_method_body.ex +lib/client/model/submit_self_service_settings_flow_with_oidc_method_body.ex +lib/client/model/submit_self_service_settings_flow_with_password_method_body.ex +lib/client/model/submit_self_service_settings_flow_with_profile_method_body.ex +lib/client/model/submit_self_service_settings_flow_with_totp_method_body.ex +lib/client/model/submit_self_service_settings_flow_with_web_authn_method_body.ex +lib/client/model/submit_self_service_verification_flow_body.ex +lib/client/model/submit_self_service_verification_flow_with_link_method_body.ex +lib/client/model/subscription.ex +lib/client/model/successful_project_config_update.ex +lib/client/model/successful_self_service_login_without_browser.ex +lib/client/model/successful_self_service_registration_without_browser.ex +lib/client/model/ui_container.ex +lib/client/model/ui_node.ex +lib/client/model/ui_node_anchor_attributes.ex +lib/client/model/ui_node_attributes.ex +lib/client/model/ui_node_image_attributes.ex +lib/client/model/ui_node_input_attributes.ex +lib/client/model/ui_node_meta.ex +lib/client/model/ui_node_script_attributes.ex +lib/client/model/ui_node_text_attributes.ex +lib/client/model/ui_text.ex +lib/client/model/update_custom_hostname_body.ex +lib/client/model/update_project_config_config.ex +lib/client/model/update_subscription_payload.ex +lib/client/model/verifiable_identity_address.ex +lib/client/model/version.ex +lib/client/model/warning.ex +lib/client/request_builder.ex +mix.exs +test/test_helper.exs diff --git a/clients/client/elixir/.openapi-generator/VERSION b/clients/client/elixir/.openapi-generator/VERSION new file mode 100644 index 00000000000..804440660c7 --- /dev/null +++ b/clients/client/elixir/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.2.1 \ No newline at end of file diff --git a/clients/client/elixir/README.md b/clients/client/elixir/README.md new file mode 100644 index 00000000000..a3b86611687 --- /dev/null +++ b/clients/client/elixir/README.md @@ -0,0 +1,26 @@ +# Client + +Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. + +### Building + +To install the required dependencies and to build the elixir project, run: +``` +mix local.hex --force +mix do deps.get, compile +``` + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `ory_client` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [{:ory_client, "~> 0.1.0"}] +end +``` + +Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) +and published on [HexDocs](https://hexdocs.pm). Once published, the docs can +be found at [https://hexdocs.pm/ory_client](https://hexdocs.pm/ory_client). diff --git a/clients/client/elixir/config/config.exs b/clients/client/elixir/config/config.exs new file mode 100644 index 00000000000..7c1fc14014b --- /dev/null +++ b/clients/client/elixir/config/config.exs @@ -0,0 +1,30 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +# This configuration is loaded before any dependency and is restricted +# to this project. If another project depends on this project, this +# file won't be loaded nor affect the parent project. For this reason, +# if you want to provide default values for your application for +# 3rd-party users, it should be done in your "mix.exs" file. + +# You can configure for your application as: +# +# config :ory_apis, key: :value +# +# And access this configuration in your application as: +# +# Application.get_env(:ory_apis, :key) +# +# Or configure a 3rd-party app: +# +# config :logger, level: :info +# + +# It is also possible to import configuration files, relative to this +# directory. For example, you can emulate configuration per environment +# by uncommenting the line below and defining dev.exs, test.exs and such. +# Configuration from the imported file will override the ones defined +# here (which is why it is important to import them last). +# +# import_config "#{Mix.env}.exs" diff --git a/clients/client/elixir/lib/client/api/metadata.ex b/clients/client/elixir/lib/client/api/metadata.ex new file mode 100644 index 00000000000..8ecdf2517b4 --- /dev/null +++ b/clients/client/elixir/lib/client/api/metadata.ex @@ -0,0 +1,90 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule Client.Api.Metadata do + @moduledoc """ + API calls for all endpoints tagged `Metadata`. + """ + + alias Client.Connection + import Client.RequestBuilder + + + @doc """ + Return Running Software Version. + This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.InlineResponse2001.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_version(Tesla.Env.client, keyword()) :: {:ok, Client.Model.InlineResponse2001.t} | {:error, Tesla.Env.t} + def get_version(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/api/kratos/public/version") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.InlineResponse2001{}} + ]) + end + + @doc """ + Check HTTP Server Status + This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.InlineResponse200.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec is_alive(Tesla.Env.client, keyword()) :: {:ok, Client.Model.GenericError.t} | {:ok, Client.Model.InlineResponse200.t} | {:error, Tesla.Env.t} + def is_alive(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/api/kratos/public/health/alive") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.InlineResponse200{}}, + { 500, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Check HTTP Server and Database Status + This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.InlineResponse200.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec is_ready(Tesla.Env.client, keyword()) :: {:ok, Client.Model.InlineResponse503.t} | {:ok, Client.Model.InlineResponse200.t} | {:error, Tesla.Env.t} + def is_ready(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/api/kratos/public/health/ready") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.InlineResponse200{}}, + { 503, %Client.Model.InlineResponse503{}} + ]) + end +end diff --git a/clients/client/elixir/lib/client/api/v0alpha0.ex b/clients/client/elixir/lib/client/api/v0alpha0.ex new file mode 100644 index 00000000000..cf44e08a9a3 --- /dev/null +++ b/clients/client/elixir/lib/client/api/v0alpha0.ex @@ -0,0 +1,330 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule Client.Api.V0alpha0 do + @moduledoc """ + API calls for all endpoints tagged `V0alpha0`. + """ + + alias Client.Connection + import Client.RequestBuilder + + + @doc """ + Create a Project + Creates a new project. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :body (ProjectRevision): + ## Returns + + {:ok, Client.Model.Project.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec create_project(Tesla.Env.client, keyword()) :: {:ok, Client.Model.Project.t} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def create_project(connection, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:post) + |> url("/backoffice/public/projects") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 201, %Client.Model.Project{}}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Returns Your Active Ory Cloud Project + Use this API to get your active project in the Ory Cloud Console UI. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.ActiveProject.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_active_project(Tesla.Env.client, keyword()) :: {:ok, Client.Model.GenericError.t} | {:ok, Client.Model.ActiveProject.t} | {:error, Tesla.Env.t} + def get_active_project(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/backoffice/public/console/projects/active") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.ActiveProject{}}, + { 401, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Get a Project + Get a projects you have access to by its ID. + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.Project.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_project(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.Project.t} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def get_project(connection, project_id, _opts \\ []) do + %{} + |> method(:get) + |> url("/backoffice/public/projects/#{project_id}") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.Project{}}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Get all members associated with this project. + This endpoint requires the user to be a member of the project with the role `OWNER` or `DEVELOPER`. + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, [%CloudAccount{}, ...]} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_project_members(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.GenericError.t} | {:ok, list(Client.Model.CloudAccount.t)} | {:error, Tesla.Env.t} + def get_project_members(connection, project_id, _opts \\ []) do + %{} + |> method(:get) + |> url("/backoffice/public/projects/#{project_id}/members") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, [%Client.Model.CloudAccount{}]}, + { 401, %Client.Model.GenericError{}}, + { 406, %Client.Model.GenericError{}}, + { 500, %Client.Model.GenericError{}} + ]) + end + + @doc """ + List All Projects + Lists all projects you have access to. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, [%Project{}, ...]} on success + {:error, Tesla.Env.t} on failure + """ + @spec list_projects(Tesla.Env.client, keyword()) :: {:ok, list(Client.Model.Project.t)} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def list_projects(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/backoffice/public/projects") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, [%Client.Model.Project{}]}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Irrecoverably Purge a Project + !! Use with extreme caution !! Using this API endpoint you can purge (completely delete) a project and its data. This action can not be undone and will delete ALL your data. !! Use with extreme caution !! + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, nil} on success + {:error, Tesla.Env.t} on failure + """ + @spec purge_project(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def purge_project(connection, project_id, _opts \\ []) do + %{} + |> method(:delete) + |> url("/backoffice/public/projects/#{project_id}") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 204, false}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Remove a member associated with this project. This also sets their invite status to `REMOVED`. + This endpoint requires the user to be a member of the project with the role `OWNER`. + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - member_id (String.t): Member ID + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, nil} on success + {:error, Tesla.Env.t} on failure + """ + @spec remove_project_member(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def remove_project_member(connection, project_id, member_id, _opts \\ []) do + %{} + |> method(:delete) + |> url("/backoffice/public/projects/#{project_id}/members/#{member_id}") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 204, false}, + { 400, %Client.Model.GenericError{}}, + { 401, %Client.Model.GenericError{}}, + { 406, %Client.Model.GenericError{}}, + { 500, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Sets Your Active Project + Use this API to set your active project in the Ory Cloud Console UI. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :body (InlineObject): + ## Returns + + {:ok, nil} on success + {:error, Tesla.Env.t} on failure + """ + @spec set_active_project(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def set_active_project(connection, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:put) + |> url("/backoffice/public/console/projects/active") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 204, false}, + { 401, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Update a Project + Creates a new configuration revision for a project. + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - opts (KeywordList): [optional] Optional parameters + - :body (ProjectRevision): + ## Returns + + {:ok, Client.Model.Project.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec update_project(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.Project.t} | {:ok, Client.Model.GenericError.t} | {:error, Tesla.Env.t} + def update_project(connection, project_id, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:put) + |> url("/backoffice/public/projects/#{project_id}") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.Project{}}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end + + @doc """ + Update an Ory Cloud Project Configuration + This endpoints allows you to update the Ory Cloud Project configuration for individual services (identity, permission, ...). The configuration is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions). This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version. If you have an older version of a configuration, you should set the version key in the payload! While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source. For configuration items that can not be translated to Ory Cloud, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed. Be aware that updating any service's configuration will completely override your current configuration for that service! + + ## Parameters + + - connection (Client.Connection): Connection to server + - project_id (String.t): Project ID The project's ID. + - opts (KeywordList): [optional] Optional parameters + - :body (UpdateProjectConfigConfig): + ## Returns + + {:ok, Client.Model.SuccessfulProjectConfigUpdate.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec update_project_config(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.GenericError.t} | {:ok, Client.Model.SuccessfulProjectConfigUpdate.t} | {:error, Tesla.Env.t} + def update_project_config(connection, project_id, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:put) + |> url("/backoffice/public/projects/#{project_id}/configs") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SuccessfulProjectConfigUpdate{}}, + { 400, %Client.Model.GenericError{}}, + { 401, %Client.Model.GenericError{}}, + { 403, %Client.Model.GenericError{}}, + { 404, %Client.Model.GenericError{}}, + { :default, %Client.Model.GenericError{}} + ]) + end +end diff --git a/clients/client/elixir/lib/client/api/v0alpha2.ex b/clients/client/elixir/lib/client/api/v0alpha2.ex new file mode 100644 index 00000000000..1c83cc2c37d --- /dev/null +++ b/clients/client/elixir/lib/client/api/v0alpha2.ex @@ -0,0 +1,1321 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule Client.Api.V0alpha2 do + @moduledoc """ + API calls for all endpoints tagged `V0alpha2`. + """ + + alias Client.Connection + import Client.RequestBuilder + + + @doc """ + Create an Identity + This endpoint creates an identity. It is NOT possible to set an identity's credentials (password, ...) using this method! A way to achieve that will be introduced in the future. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model). + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :body (AdminCreateIdentityBody): + ## Returns + + {:ok, Client.Model.Identity.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_create_identity(Tesla.Env.client, keyword()) :: {:ok, Client.Model.Identity.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_create_identity(connection, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:post) + |> url("/api/kratos/admin/identities") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 201, %Client.Model.Identity{}}, + { 400, %Client.Model.JsonError{}}, + { 409, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Create a Recovery Link + This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :body (AdminCreateSelfServiceRecoveryLinkBody): + ## Returns + + {:ok, Client.Model.SelfServiceRecoveryLink.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_create_self_service_recovery_link(Tesla.Env.client, keyword()) :: {:ok, Client.Model.SelfServiceRecoveryLink.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_create_self_service_recovery_link(connection, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:post) + |> url("/api/kratos/admin/recovery/link") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceRecoveryLink{}}, + { 400, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Delete an Identity + Calling this endpoint irrecoverably and permanently deletes the identity given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID is the identity's ID. + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, nil} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_delete_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_delete_identity(connection, id, _opts \\ []) do + %{} + |> method(:delete) + |> url("/api/kratos/admin/identities/#{id}") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 204, false}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity. + This endpoint is useful for: To forcefully logout Identity from all devices and sessions + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID is the identity's ID. + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, nil} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_delete_identity_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_delete_identity_sessions(connection, id, _opts \\ []) do + %{} + |> method(:delete) + |> url("/api/kratos/admin/identities/#{id}/sessions") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 204, false}, + { 400, %Client.Model.JsonError{}}, + { 401, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get an Identity + Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID must be set to the ID of identity you want to get + - opts (KeywordList): [optional] Optional parameters + - :include_credential ([String.t]): DeclassifyCredentials will declassify one or more identity's credentials Currently, only `oidc` is supported. This will return the initial OAuth 2.0 Access, Refresh and (optionally) OpenID Connect ID Token. + ## Returns + + {:ok, Client.Model.Identity.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_get_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.Identity.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_get_identity(connection, id, opts \\ []) do + optional_params = %{ + :"include_credential" => :query + } + %{} + |> method(:get) + |> url("/api/kratos/admin/identities/#{id}") + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.Identity{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + List Identities + Lists all identities. Does not support search at the moment. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model). + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :per_page (integer()): Items per Page This is the number of items per page. + - :page (integer()): Pagination Page + ## Returns + + {:ok, [%Identity{}, ...]} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_list_identities(Tesla.Env.client, keyword()) :: {:ok, list(Client.Model.Identity.t)} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_list_identities(connection, opts \\ []) do + optional_params = %{ + :"per_page" => :query, + :"page" => :query + } + %{} + |> method(:get) + |> url("/api/kratos/admin/identities") + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, [%Client.Model.Identity{}]}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + This endpoint returns all sessions that belong to the given Identity. + This endpoint is useful for: Listing all sessions that belong to an Identity in an administrative context. + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID is the identity's ID. + - opts (KeywordList): [optional] Optional parameters + - :per_page (integer()): Items per Page This is the number of items per page. + - :page (integer()): Pagination Page + - :active (boolean()): Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned. + ## Returns + + {:ok, [%Session{}, ...]} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_list_identity_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, list(Client.Model.Session.t)} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_list_identity_sessions(connection, id, opts \\ []) do + optional_params = %{ + :"per_page" => :query, + :"page" => :query, + :"active" => :query + } + %{} + |> method(:get) + |> url("/api/kratos/admin/identities/#{id}/sessions") + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, [%Client.Model.Session{}]}, + { 400, %Client.Model.JsonError{}}, + { 401, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Update an Identity + This endpoint updates an identity. It is NOT possible to set an identity's credentials (password, ...) using this method! A way to achieve that will be introduced in the future. The full identity payload (except credentials) is expected. This endpoint does not support patching. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID must be set to the ID of identity you want to update + - opts (KeywordList): [optional] Optional parameters + - :body (AdminUpdateIdentityBody): + ## Returns + + {:ok, Client.Model.Identity.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec admin_update_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.Identity.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def admin_update_identity(connection, id, opts \\ []) do + optional_params = %{ + :body => :body + } + %{} + |> method(:put) + |> url("/api/kratos/admin/identities/#{id}") + |> add_optional_params(optional_params, opts) + |> ensure_body() + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.Identity{}}, + { 400, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 409, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Create a Logout URL for Browsers + This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. The URL is only valid for the currently signed in user. If no user is signed in, this endpoint returns a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies. + + ## Parameters + + - connection (Client.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + - :cookie (String.t): HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. + ## Returns + + {:ok, Client.Model.SelfServiceLogoutUrl.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec create_self_service_logout_flow_url_for_browsers(Tesla.Env.client, keyword()) :: {:ok, Client.Model.JsonError.t} | {:ok, Client.Model.SelfServiceLogoutUrl.t} | {:error, Tesla.Env.t} + def create_self_service_logout_flow_url_for_browsers(connection, opts \\ []) do + optional_params = %{ + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/logout/browser") + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceLogoutUrl{}}, + { 401, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get a JSON Schema + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID must be set to the ID of schema you want to get + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, map()} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_json_schema(Tesla.Env.client, String.t, keyword()) :: {:ok, Map.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_json_schema(connection, id, _opts \\ []) do + %{} + |> method(:get) + |> url("/api/kratos/public/schemas/#{id}") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, false}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Self-Service Errors + This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): Error is the error's ID + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, Client.Model.SelfServiceError.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_error(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.SelfServiceError.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_self_service_error(connection, id, _opts \\ []) do + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/errors") + |> add_param(:query, :"id", id) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceError{}}, + { 403, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Login Flow + This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/login', async function (req, res) { const flow = await client.getSelfServiceLoginFlow(req.header('cookie'), req.query['flow']) res.render('login', flow) }) ``` This request may fail due to several reasons. The `error.id` can be one of: `session_already_available`: The user is already signed in. `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`). + - opts (KeywordList): [optional] Optional parameters + - :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. + ## Returns + + {:ok, Client.Model.SelfServiceLoginFlow.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_login_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.SelfServiceLoginFlow.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_self_service_login_flow(connection, id, opts \\ []) do + optional_params = %{ + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/login/flows") + |> add_param(:query, :"id", id) + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceLoginFlow{}}, + { 403, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 410, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Recovery Flow + This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getSelfServiceRecoveryFlow(req.header('Cookie'), req.query['flow']) res.render('recovery', flow) }) ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`). + - opts (KeywordList): [optional] Optional parameters + - :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. + ## Returns + + {:ok, Client.Model.SelfServiceRecoveryFlow.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_recovery_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.JsonError.t} | {:ok, Client.Model.SelfServiceRecoveryFlow.t} | {:error, Tesla.Env.t} + def get_self_service_recovery_flow(connection, id, opts \\ []) do + optional_params = %{ + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/recovery/flows") + |> add_param(:query, :"id", id) + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceRecoveryFlow{}}, + { 404, %Client.Model.JsonError{}}, + { 410, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Registration Flow + This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/registration', async function (req, res) { const flow = await client.getSelfServiceRegistrationFlow(req.header('cookie'), req.query['flow']) res.render('registration', flow) }) ``` This request may fail due to several reasons. The `error.id` can be one of: `session_already_available`: The user is already signed in. `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`). + - opts (KeywordList): [optional] Optional parameters + - :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. + ## Returns + + {:ok, Client.Model.SelfServiceRegistrationFlow.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_registration_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.SelfServiceRegistrationFlow.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_self_service_registration_flow(connection, id, opts \\ []) do + optional_params = %{ + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/registration/flows") + |> add_param(:query, :"id", id) + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceRegistrationFlow{}}, + { 403, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 410, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Settings Flow + When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor or change the configuration. You can access this endpoint without credentials when using Ory Kratos' Admin API. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The flow was interrupted with `session_refresh_required` but apparently some other identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): ID is the Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`). + - opts (KeywordList): [optional] Optional parameters + - :x_session_token (String.t): The Session Token When using the SDK in an app without a browser, please include the session token here. + - :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. You only need to do this for browser- based flows. + ## Returns + + {:ok, Client.Model.SelfServiceSettingsFlow.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_settings_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.SelfServiceSettingsFlow.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_self_service_settings_flow(connection, id, opts \\ []) do + optional_params = %{ + :"X-Session-Token" => :headers, + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/settings/flows") + |> add_param(:query, :"id", id) + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceSettingsFlow{}}, + { 401, %Client.Model.JsonError{}}, + { 403, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 410, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get Verification Flow + This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getSelfServiceVerificationFlow(req.header('cookie'), req.query['flow']) res.render('verification', flow) }) More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation). + + ## Parameters + + - connection (Client.Connection): Connection to server + - id (String.t): The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`). + - opts (KeywordList): [optional] Optional parameters + - :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. + ## Returns + + {:ok, Client.Model.SelfServiceVerificationFlow.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec get_self_service_verification_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Client.Model.SelfServiceVerificationFlow.t} | {:ok, Client.Model.JsonError.t} | {:error, Tesla.Env.t} + def get_self_service_verification_flow(connection, id, opts \\ []) do + optional_params = %{ + :"cookie" => :headers + } + %{} + |> method(:get) + |> url("/api/kratos/public/self-service/verification/flows") + |> add_param(:query, :"id", id) + |> add_optional_params(optional_params, opts) + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %Client.Model.SelfServiceVerificationFlow{}}, + { 403, %Client.Model.JsonError{}}, + { 404, %Client.Model.JsonError{}}, + { 500, %Client.Model.JsonError{}} + ]) + end + + @doc """ + Get WebAuthn JavaScript + This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: ```html