Apicult.Generator (Apicult v0.2.0) View Source

Link to this section Summary

Functions

Generates the code corresponding to an api definition.

Link to this section Functions

Link to this function

generate_api_bindings(arg)

View Source

Specs

generate_api_bindings(Apicult.Parser.api()) :: Macro.t()

Generates the code corresponding to an api definition.

This includes one method per api endpoint, with the variables as arguments.

If there are configuration variables in the definition, then:

  • A Client struct holding them is created ;
  • A client function to create the struct is created. It takes keywords corresponding to the variable names, and uses the elixir config for the module as default ;
  • The Client struct is added as a first argument for each other methods (defaults to calling client()).