View Source WorkOS.Client behaviour (WorkOS SDK for Elixir v1.0.0)

WorkOS API client.

Summary

Types

@type response(type) :: {:ok, type} | {:error, WorkOS.Error.t() | :client_error}
@type t() :: %WorkOS.Client{
  api_key: String.t(),
  base_url: String.t() | nil,
  client: module() | nil,
  client_id: String.t()
}

Callbacks

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

Functions

Link to this function

delete(client, castable_module, path, body \\ %{}, opts \\ [])

View Source
@spec delete(t(), WorkOS.Castable.impl(), String.t(), map(), Keyword.t()) ::
  response(any())
Link to this function

get(client, castable_module, path, opts \\ [])

View Source
@spec get(t(), WorkOS.Castable.impl(), String.t(), Keyword.t()) :: response(any())
@spec new(WorkOS.config()) :: t()

Creates a new WorkOS client struct given a keyword list of config opts.

Link to this function

post(client, castable_module, path, body \\ %{}, opts \\ [])

View Source
@spec post(t(), WorkOS.Castable.impl(), String.t(), map(), Keyword.t()) ::
  response(any())
Link to this function

put(client, castable_module, path, body \\ %{}, opts \\ [])

View Source
@spec put(t(), WorkOS.Castable.impl(), String.t(), map(), Keyword.t()) ::
  response(any())