Apicult.Parser (Apicult v0.2.0) View Source
Apicult definition parsing
Link to this section Summary
Types
A full parsed apicult definition
A http request body
A key-value pair in a http body
A http body type
A config in the prelude, of the form api_key
or api_key=something
An endpoint
An expectation is a list on line that needs to appear in the resulting request. Used for testing an implementation of Apicult.
A key-value pair in a http header
A string containing interpolated variable (eg https://example.com/$api_key/something
)
An http method
A key-value pair in a querystring
The type of a variable. For now everything is a :string
An url definition, including method, querystring, headers and body
Functions
Parse the input (an Enum of strings) as an api definition
Parse a file as an api definition
Link to this section Types
Specs
A full parsed apicult definition
Specs
body() :: {type :: bodytype(), content :: [bodycontent()]} | nil
A http request body
Specs
bodycontent() :: {String.t(), interpolated()}
A key-value pair in a http body
Specs
bodytype() :: :form | :json
A http body type
Specs
A config in the prelude, of the form api_key
or api_key=something
Specs
endpoint() :: {:endpoint, name :: String.t(), variables :: [config()], url :: url(), result :: Apicult.Result.result() | nil, expectation :: expectation() | nil}
An endpoint
Specs
expectation() :: [String.t()]
An expectation is a list on line that needs to appear in the resulting request. Used for testing an implementation of Apicult.
Specs
http_header() :: {String.t(), interpolated()}
A key-value pair in a http header
Specs
A string containing interpolated variable (eg https://example.com/$api_key/something
)
Specs
method() :: :get | :post
An http method
Specs
querystring() :: {String.t(), interpolated()}
A key-value pair in a querystring
Specs
type() :: :string
The type of a variable. For now everything is a :string
Specs
url() :: {:url, method :: method(), url :: interpolated(), querystring :: [querystring()], headers :: [http_header()], body :: body()}
An url definition, including method, querystring, headers and body
Link to this section Functions
Specs
Parse the input (an Enum of strings) as an api definition
Specs
Parse a file as an api definition