From 26da695c0e4d282dafd6cb8e18eef072fb68241f Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Tue, 2 Jul 2024 11:11:27 +0700 Subject: [PATCH] Update get_state call to support options --- lib/lexdee.ex | 4 +++- lib/lexdee/behaviour.ex | 2 ++ lib/lexdee/instances/state.ex | 6 ++++-- mix.exs | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/lexdee.ex b/lib/lexdee.ex index 04a1dd5..5aacc8e 100644 --- a/lib/lexdee.ex +++ b/lib/lexdee.ex @@ -75,7 +75,9 @@ defmodule Lexdee do to: Instances.Logs, as: :show - defdelegate get_state(client, id), to: Instances.State, as: :show + defdelegate get_state(client, id, options \\ []), + to: Instances.State, + as: :show defdelegate start_instance(client, id, options \\ []), to: Instances.State, diff --git a/lib/lexdee/behaviour.ex b/lib/lexdee/behaviour.ex index 21953df..d476577 100644 --- a/lib/lexdee/behaviour.ex +++ b/lib/lexdee/behaviour.ex @@ -1,4 +1,6 @@ defmodule Lexdee.Behaviour do + @callback get_state(struct, binary, Keyword.t()) :: {:ok, map} | {:error, any} + @callback get_instance(struct, binary) :: {:ok, map} | {:error, any} @callback get_instance(struct, binary, Keyword.t()) :: {:ok, map} | {:error, any} diff --git a/lib/lexdee/instances/state.ex b/lib/lexdee/instances/state.ex index 02ca091..2f709a1 100644 --- a/lib/lexdee/instances/state.ex +++ b/lib/lexdee/instances/state.ex @@ -3,8 +3,10 @@ defmodule Lexdee.Instances.State do @path "/state" - @spec show(Tesla.Client.t(), binary) :: {:error, any} | {:ok, Tesla.Env.t()} - def show(client, id), do: Tesla.get(client, Path.join(id, @path)) + @spec show(Tesla.Client.t(), binary, Keyword.t()) :: + {:error, any} | {:ok, Tesla.Env.t()} + def show(client, id, options \\ []), + do: Tesla.get(client, Path.join(id, @path), options) @spec start(Tesla.Client.t(), binary, Keyword.t()) :: {:error, any} | {:ok, Tesla.Env.t()} diff --git a/mix.exs b/mix.exs index 9db401e..486b390 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Lexdee.MixProject do def project do [ app: :lexdee, - version: "2.3.9", + version: "2.3.10", elixir: "~> 1.9", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,