ex_api v1.0.0-rc.2 ExApi.Api View Source

Defines struct for api and macro to create it.

import ExApi.Api
def_api MyApi do
  # api contents here ...
end

Link to this section Summary

Functions

Defines an api. An api definas features that are optional to implement. You can preview on api extra doc pages which all documented features

Link to this section Types

Link to this type t() View Source
t() :: %ExApi.Api{default_implementation: {group_name :: atom, id :: atom}, doc: String.t, fallback_implementation: ExApi.Implementation.t, features: %{optional({funtion_name :: atom, arity :: non_neg_integer}) => ExApi.Feature.t}, implementations: %{optional(group_name :: atom) => [ExApi.Implementation.t]}, line: non_neg_integer, module: module, pid: pid}

Link to this section Functions

Link to this macro def_api(name, list) View Source (macro)
def_api(term, module, opts :: Keyword.t) :: {:module, module, binary, term}

Defines an api. An api definas features that are optional to implement. You can preview on api extra doc pages which all documented features.

Attributes

  1. @moduledoc - defines documentation for api.
  2. @doc - defines documentation for feature
  3. @spec - defines spec for feature

Example:

def_api MyLibrary.Api do
  @moduledoc "Describe why you created this api and features that you expect to implementation."

  @doc "Describe what this feature will do here ..."
  @spec feature_name(String.t) :: String.t
  def_feature feature_name(string)
end