ExEcrime.Client (ex_ecrime v0.1.0)
Base client module for interacting with the eCrime API. Handles API key configuration and client instantiation.
Summary
Functions
Returns authentication headers for API requests.
Performs login authentication with the eCrime API.
Creates a new client instance using the API key from the ECRIME_API_KEY environment variable. Raises an error if the environment variable is not set.
Functions
Returns authentication headers for API requests.
Examples
iex> client = ExEcrime.Client.new()
iex> ExEcrime.Client.auth_headers(client)
%{"X-API-Key" => "test_key"}
Performs login authentication with the eCrime API.
Returns the response body if status is 200, otherwise returns the full response.
Examples
iex> client = ExEcrime.Client.new()
iex> ExEcrime.Client.login(client)
%{"status" => "authenticated"} # Assuming this is the API response
Creates a new client instance using the API key from the ECRIME_API_KEY environment variable. Raises an error if the environment variable is not set.
Examples
iex> System.put_env("ECRIME_API_KEY", "test_key")
iex> client = ExEcrime.Client.new()
iex> client.api_key
"test_key"
iex> System.delete_env("ECRIME_API_KEY")
iex> ExEcrime.Client.new()
** (RuntimeError) Expected ECRIME_API_KEY environment variable to be set