View Source BasicECommerce.DataSource.Adapter behaviour (Basic e-commerce v0.1.0)

Specification of the data source adapter.

Link to this section Summary

Types

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

t()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Callbacks

Returns the applicable special offers for a given SKU.

Gets a single product by its SKU.

Returns the list of products.

Link to this section Types

@type config() :: Keyword.t()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Full definition:

config :: Keyword.t()
@type product() :: BasicECommerce.Product.t()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Full definition:

product :: BasicECommerce.Product.t()
@type sku() :: atom()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Full definition:

sku :: atom()
@type special_offer() :: BasicECommerce.SpecialOffer.t()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Full definition:

special_offer :: BasicECommerce.SpecialOffer.t()
@type t() :: module()

(This type is managed by TypeCheck, which allows checking values against the type at runtime.)

Full definition:

t :: module

Link to this section Callbacks

Link to this callback

applicable_special_offers(sku, config)

View Source
@callback applicable_special_offers(sku :: sku(), config :: config()) :: [special_offer()]

Returns the applicable special offers for a given SKU.

Link to this callback

get_product(sku, config)

View Source
@callback get_product(sku :: sku(), config :: config()) ::
  {:ok, product()} | {:error, String.t()}

Gets a single product by its SKU.

@callback list_products(config :: config()) :: [product()]

Returns the list of products.