> local iter = ldoc.modules.iter
>
> local function trim(s)
>   return (s:gsub("^%s*(.-)%s*$", "%1"))
> end
>
> local function starts_with(str, prefix)
>   return str:sub(1, prefix:len()) == prefix
> end
>
> local function display_name(item)
>   if item.type == "field" then
>     if starts_with(item.name, ldoc.project) then
>       return trim(item.name)
>     end
>     return trim(ldoc.project .. "." .. item.name)
>   end
>   return trim(ldoc.display_name(item))
> end
>
> local function href(item, pre)
>   pre = pre or ""
>   if item.tags.redirect then
>     for value in iter(item.tags.redirect) do
>       return value
>     end
>   end
>   if item.type == "function" then
>     return pre .. ldoc.no_spaces(item.name)
>   end
>   return pre .. ldoc.no_spaces(display_name(item))
> end
>
> local function has_content(items)
>   for item in items() do
>     if not item.tags.redirect then
>       return true
>     end
>   end
>   return false
> end
>
> local function param_modifiers(item, p)
>   local buf = "" -- no access to table.concat or ldoc.tools.join, I'm forced to use a string
>   local comma = ""
>   local tp  = item:type_of_param(p)
>   if tp and tp ~= '' then
>     if tp:sub(1,1) ~= '`' and tp:sub(-1) ~= '`' then
>       buf = buf .. comma .. '`' .. tp .. '`'
>     else
>       buf = buf .. comma .. tp
>     end
>     comma = ", "
>   end
>   local def = item:default_of_param(p)
>   if def == true then
>     buf = buf .. comma .. "_optional_"
>     comma = ", "
>   elseif def then
>     buf = buf .. comma .. "_default_: `" .. def .. "`"
>     comma = ", "
>   end
>   if item:readonly(p) then
>     buf = buf .. comma .. "_read-only_"
>     comma = ", "
>   end
>   if #buf > 0 then
>     return "(" .. buf .. ")"
>   end
>   return ""
> end
>
---
#
#  WARNING: this file was auto-generated by a script.
#  DO NOT edit this file directly. Instead, send a pull request to change
#  https://github.com/Kong/kong/tree/master/autodoc/pdk/ldoc/ldoc.ltp
#  or its associated files
#
title: $(module.name)
pdk: true
toc: true
source_url: https://github.com/Kong/kong/tree/master/kong/pdk
---

$(module.summary) $(module.description)
> for kind, items in module.kinds() do
>
>   if has_content(items) then

$(module.kinds:get_section_description(kind))
>     for item in items() do
>       if not item.tags.redirect then -- skip redirects

## $(display_name(item))

$(ldoc.descript(item))
>         if ldoc.custom_tags then
>           for custom in iter(ldoc.custom_tags) do
>             local tag = item.tags[custom[1]]
>             if tag and not custom.hidden then

**$(custom.title or custom[1])**

>               for value in iter(tag) do
* $(custom.format and custom.format(value) or value)
>               end -- for
>             end -- if tag
>           end -- for custom
>         end -- if ldoc.custom_tags
>
>         if item.params and #item.params > 0 then
>           local subnames = module.kinds:type_of(item).subnames
>           if subnames then

**$(subnames)**

>           end
>           for parm in iter(item.params) do
>             local sublist_prefix = ""
>             local param, sublist = item:subparam(parm)
>             if sublist then
>               sublist_prefix = sublist .. ": " .. item.params.map[sublist]
>             end
>             for p in iter(param) do
>               local name = item:display_name_of(p)
* **$(sublist_prefix)$(name)** $(param_modifiers(item, p)): $(item.params.map[p])
>             end -- for p in iter(param)
>           end -- for parm in iter(item.params)
>         end -- if item.params and #item.params > 0
>
>         if item.retgroups then
>           local groups = item.retgroups

**Returns**

>           for i, group in ldoc.ipairs(groups) do
>             local list_prefix = "*"
>             local return_count = 0
>             for r in group:iter() do
>               return_count = return_count + 1
>             end
>             if return_count > 1 then
>               list_prefix = "1. "
>             end
>             for r in group:iter() do
>               local type, ctypes = item:return_type(r);
>               if type ~= '' then
>                 type = "`" .. type .. "`: "
>               end
$(list_prefix) $(type) $(r.text)

>               if ctypes then
>
>                 for c in ctypes:iter() do
* `$(c.name)` $c.type $(c.comment)
>                 end
>               end
>             end -- for r in group
>             if i < #groups then

**Or**

>             end
>           end -- for i,group
>         end -- if item.retgroups
>
>         if item.raise then

**Raises**

$(item.raise)
>         end
>
>         if item.see then

**See**

>           for see in iter(item.see) do
* <a href="$(ldoc.href(see))">$(see.label)</a>
>           end
>         end -- if see
>
>         if item.usage then

**Usage**

>           for usage in iter(item.usage) do
``` lua
$(trim(usage))
```
>           end -- for usage
>         end -- if usage

>       end -- if not item.tags.redirect

>     end -- for items
>   end -- if has_content(items)
> end -- for kinds
