Intel471Ex.Client (intel471_ex v0.2.0)

Copy Markdown

HTTP Client for Intel 471 Verity API using Req.

All API requests use HTTP Basic Auth with Verity application credentials (client ID as username, client secret as password).

Summary

Functions

Makes a DELETE request to the Verity API.

Extracts an error message from an API response body.

Makes a GET request to the Verity API.

Makes a raw GET request returning binary response (for file downloads).

Makes a PATCH request to the Verity API with a JSON body.

Makes a POST request to the Verity API with a JSON body.

Makes a PUT request to the Verity API with a JSON body.

Makes an API request to Intel 471 Verity API.

Functions

delete(path, config \\ nil)

@spec delete(String.t(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a DELETE request to the Verity API.

Parameters

  • path: Full API path
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, _} = Intel471Ex.Client.delete("integrations/brand-exposure/v1/monitor/monitor-id")

extract_error_message(arg1)

@spec extract_error_message(any()) :: String.t() | nil

Extracts an error message from an API response body.

Looks for a "message" key in a map response body.

Examples

iex> Intel471Ex.Client.extract_error_message(%{"message" => "Not found"})
"Not found"

iex> Intel471Ex.Client.extract_error_message(%{message: "Unauthorized"})
"Unauthorized"

iex> Intel471Ex.Client.extract_error_message("something else")
nil

get(path, params \\ %{}, config \\ nil)

@spec get(String.t(), map(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a GET request to the Verity API.

Parameters

  • path: Full API path (e.g., "integrations/actors/v1/actors/stream")
  • params: Query parameters (optional)
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, result} = Intel471Ex.Client.get("integrations/actors/v1/actors/stream", %{actor: "conti", size: 10})

get_raw(path, config \\ nil)

@spec get_raw(String.t(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a raw GET request returning binary response (for file downloads).

Parameters

  • path: Full API path
  • config: Optional configuration override

Returns

  • {:ok, %{body: binary}} — Successful response with raw body
  • {:error, reason} — Error with reason

Examples

{:ok, %{body: pdf}} = Intel471Ex.Client.get_raw("integrations/intel-report/v1/reports/report-id/download-as-pdf")

patch(path, body, config \\ nil)

@spec patch(String.t(), map(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a PATCH request to the Verity API with a JSON body.

Parameters

  • path: Full API path
  • body: Request body (will be JSON-encoded)
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, _} = Intel471Ex.Client.patch("integrations/brand-exposure/v1/monitor/monitor-id", %{name: "updated-name"})

post(path, body, config \\ nil)

@spec post(String.t(), map(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a POST request to the Verity API with a JSON body.

Parameters

  • path: Full API path
  • body: Request body (will be JSON-encoded)
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, monitor} = Intel471Ex.Client.post("integrations/brand-exposure/v1/monitor", %{name: "example.com", targets: ["example.com"]})

put(path, body, config \\ nil)

@spec put(String.t(), map(), map() | nil) :: {:ok, map()} | {:error, any()}

Makes a PUT request to the Verity API with a JSON body.

Parameters

  • path: Full API path
  • body: Request body (will be JSON-encoded)
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, _} = Intel471Ex.Client.put("integrations/watchers/v1/alerts/12345/read", %{})

request(method, path, params \\ %{}, body \\ nil, config \\ nil)

@spec request(atom(), String.t(), map(), map() | nil, map() | nil) ::
  {:ok, map()} | {:error, map() | any()}

Makes an API request to Intel 471 Verity API.

Parameters

  • method: HTTP method (:get, :post, :put, :patch, :delete)
  • path: API endpoint path
  • params: Query parameters (optional)
  • body: Request body for POST/PUT/PATCH requests (optional)
  • config: Optional configuration override

Returns

  • {:ok, body} — Successful response with parsed JSON
  • {:error, reason} — Error with reason

Examples

{:ok, result} = Intel471Ex.Client.request(:get, "integrations/actors/v1/actors/stream", %{size: 10})
{:ok, monitor} = Intel471Ex.Client.request(:post, "integrations/brand-exposure/v1/monitor", %{}, %{name: "test"})