ABSmartly.SDK (ABSmartly v1.0.0)

Copy Markdown View Source

Main SDK class for ABSmartly.

Provides context creation methods:

Summary

Functions

Create context with synchronous data fetching (blocks until HTTP fetch completes).

Create context with async data fetching (non-blocking).

Create context with pre-fetched data (synchronous).

Create a new SDK instance using keyword list configuration.

Set custom retry count for the SDK instance (pipe-friendly).

Set custom timeout for the SDK instance (pipe-friendly).

Types

t()

@type t() :: %ABSmartly.SDK{config: ABSmartly.Types.SDKConfig.t()}

Functions

create_context(sdk_or_result, units, options \\ %{})

Create context with synchronous data fetching (blocks until HTTP fetch completes).

Use create_context_async/3 for non-blocking context creation.

create_context_async(sdk_or_result, units, options \\ %{})

Create context with async data fetching (non-blocking).

The context is created immediately and data is fetched in the background. Use Context.wait_until_ready/2 to block until data is available.

create_context_with(sdk_or_result, units, data, options \\ %{})

Create context with pre-fetched data (synchronous).

new(opts)

Create a new SDK instance using keyword list configuration.

Required Parameters

  • :endpoint - The URL to your API endpoint (e.g., "https://your-company.absmartly.io/v1")
  • :api_key - Your API key from the Web Console
  • :application - The name of your application
  • :environment - The environment name (e.g., "production", "development")

Optional Parameters

  • :timeout - Connection timeout in milliseconds (default: 3000)
  • :retries - Number of retry attempts for failed requests (default: 5)

with_retries(error, retries)

Set custom retry count for the SDK instance (pipe-friendly).

with_timeout(error, timeout)

Set custom timeout for the SDK instance (pipe-friendly).