Skip to content

Commit

Permalink
Add @deprecated to WorkOS.API
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Oct 21, 2023
1 parent 4509003 commit e2e5cc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/workos/api.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule WorkOS.API do
@deprecated "This module is deprecated. Please use WorkOS.Client instead."

@moduledoc """
Provides core API communication and data processing functionality.
"""
Expand Down
6 changes: 3 additions & 3 deletions lib/workos/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ defmodule WorkOS.Client do

require Logger

alias WorkOs.Castable
alias WorkOS.Castable

@callback request(t(), Keyword.t()) ::
{:ok, %{body: map(), status: pos_integer()}} | {:error, any()}

@type response(type) :: {:ok, type} | {:error, WorkOs.Error.t() | :client_error}
@type response(type) :: {:ok, type} | {:error, WorkOS.Error.t() | :client_error}

@type t() :: %__MODULE__{
api_key: String.t(),
Expand Down Expand Up @@ -107,7 +107,7 @@ defmodule WorkOS.Client do

{:ok, %{body: body}} when is_map(body) ->
Logger.error("#{inspect(__MODULE__)} error when calling #{path}: #{inspect(body)}")
{:error, Castable.cast(WorkOs.Error, body)}
{:error, Castable.cast(WorkOS.Error, body)}

{:ok, %{body: body}} when is_binary(body) ->
Logger.error("#{inspect(__MODULE__)} error when calling #{path}: #{body}")
Expand Down
4 changes: 2 additions & 2 deletions lib/workos/client/tesla_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule WorkOS.Client.TeslaClient do
@doc """
Sends a request to a WorkOs API endpoint, given list of request opts.
"""
@spec request(WorkOs.Client.t(), Keyword.t()) ::
@spec request(WorkOS.Client.t(), Keyword.t()) ::
{:ok, %{body: map(), status: pos_integer()}} | {:error, any()}
def request(client, opts) do
opts = Keyword.take(opts, [:method, :url, :query, :headers, :body, :opts])
Expand All @@ -17,7 +17,7 @@ defmodule WorkOS.Client.TeslaClient do
@doc """
Returns a new `Tesla.Client`, configured for calling the WorkOs API.
"""
@spec new(WorkOs.Client.t()) :: Tesla.Client.t()
@spec new(WorkOS.Client.t()) :: Tesla.Client.t()
def new(client) do
Tesla.client([
Tesla.Middleware.Logger,
Expand Down

0 comments on commit e2e5cc1

Please sign in to comment.