{% macro @type(type, isArray, isRest) -%} {%- if type.type === 'stringLiteral' -%} "{{type.value}}" {%- endif -%} {%- if type.declaration and type.declaration.children -%} {
{%- for child in type.declaration.children -%}
{{child.name}}:
{{ @type(child.type) }}
{%- endfor -%}
} {%- endif -%} {%- if type.type === 'array' and (type.elementType.type === "union" or (type.elementType.type === "typeParameter" and type.elementType.constraint.type === "union")) -%} {{ @type(type.elementType, true) }} {%- elif type.type === 'array' -%} {{ @type(type.elementType) }}{{ '[]' }} {%- endif -%} {%- if type.type === 'array' -%} {{ ' | ' }}{{ @type(type.elementType) }} {%- endif -%} {%- if type.type === 'intrinsic' -%} {{type.name}} {%- endif -%} {%- if type.type === 'reference' and type.id and API_TOOLS.findById(data.typedoc, type.id) -%} {{type.name}} {%- elif API_TOOLS.findByName(data.typedoc, type.name) -%} {{type.name}} {%- elif type.type === 'reference' -%} {{type.name}} {%- endif -%} {%- if type.type === 'reflection' and type.declaration.signatures.length > 0 -%} function({{ @signatureParams(type.declaration.signatures[0].parameters) }}) : {{@type(type.declaration.signatures[0].type)}} {%- elif type.type === 'reflection' and type.declaration.id and API_TOOLS.findById(data.typedoc, type.declaration.id) -%} {% set declaration = API_TOOLS.findById(data.typedoc, type.declaration.id) %} {{declaration.name}} {%- elif type.type === 'reflection' and type.declaration and type.declaration.indexSignature -%} {% for signature in type.declaration.indexSignature %} {% for param in signature.parameters%}[key: {{@type(param.type)}}]: {% endfor %}{{@type(signature.type)}} {% endfor %} {%- elif type.type === 'reflection' -%} {{ type.name }} {%- endif -%} {%- if type.type === 'union' -%} {%- for t in type.types -%} {{ @type(t) }}{% if isArray %}{{ '[]' }}{% endif %} {%- if (loop.last === false) -%} {{ ' | ' }} {%- endif -%} {%- endfor -%} {%- endif -%} {%- if type.type === 'tuple' -%} {%- for t in type.elements -%} {%- if (loop.first) -%} {{ '[' }} {%- endif -%} {{ @type(t) }} {%- if (loop.last === false) -%} {{ ', ' }} {%- endif -%} {%- if (loop.last) -%} {{ ']' }} {%- endif -%} {%- endfor -%} {%- endif -%} {%- if type.type === 'typeParameter' and type.constraint -%} {{ @type(type.constraint, isArray) }} {%- endif -%} {%- if type.typeArguments -%} {% for arg in type.typeArguments -%} {%- if (loop.first) -%}{{ '<' }}{%- endif -%} {{ @type(arg) }} {%- if (loop.last) -%}{{ '>' }}{%- endif -%} {%- endfor %} {%- endif -%} {%- endmacro %} {% macro @param(param) -%} {%- if param -%} {{param.name}}: {{@type(param.type, undefined, param.flags.isRest)}} {%- endif -%} {%- endmacro %} {% macro @signatureParams(params) -%} {% for param in params | stripThisFromParams -%}{{ @param(param) }}{{ ', ' if (loop.last === false)}}{%- endfor %} {%- endmacro %} {% macro @signature(signature) -%}
  • {{ signature.name }}({{ @signatureParams(signature.parameters) }}) : {{@type(signature.type)}}
  • {%- endmacro %} {% macro @inherited(inheritedFrom) -%} {% if inheritedFrom %} Inherited {% endif %} {%- endmacro %} {% macro @propertyTableForId (id, header, column1Header, column2Header)%} {% if header %}

    {{header | safe}}

    {% endif %}
    {% for child in API_TOOLS.findById(data.typedoc, id).children %} {% endfor %}
    {{column1Header}} {{column2Header}} Notes
    {{child.name}} {{ @flags(child.flags) }} {{ @inherited(child.inheritedFrom) }} {% if child.defaultValue %} {{ child.defaultValue }} {% elif child.getSignature %} {{ @type(child.getSignature[0].type) }} {% else %} {{ @type(child.type) }} {% endif %} {% markdown -%} {{ child.comment.shortText | safe | trim }} {%- endmarkdown %}
    {% endmacro %} {% macro @properties (group, children) %}
    {% for id in group.children %} {% set child = API_TOOLS.findChildById(id, children) %} {% endfor %}
    {{ API_TOOLS.findChildById(group.children[0], children).kindString }} {{ 'Value' if API_TOOLS.findChildById(group.children[0], children).defaultValue else 'Type' }} Notes
    {{child.name}} {{ @flags(child.flags) }} {{ @inherited(child.inheritedFrom) }} {% if child.defaultValue %} {{ child.defaultValue }} {% elif child.getSignature %} {{ @type(child.getSignature[0].type) }} {% else %} {{ @type(child.type) }} {% endif %} {% markdown -%} {{ child.comment.shortText | safe | trim }} {%- endmarkdown %}
    {% endmacro %} {% macro @indexSignature (signatures, parentKind) %}
    {% for child in signatures %} {% endfor %}
    Key Type Value Type Notes
    {{ @type(child.parameters[0].type) }} {% if child.defaultValue %} {{ child.defaultValue }} {% elif child.getSignature %} {{ @type(child.getSignature[0].type) }} {% else %} {{ @type(child.type) }} {% endif %} {% markdown -%} {{ child.comment.shortText | safe | trim }} {%- endmarkdown %}
    {% endmacro %} {% macro @flags(flags) %} {% if flags.isOptional %} Optional {% endif %} {% if flags.isPrivate %} Private {% endif %} {% if flags.isProtected %} Protected {% endif %} {% if flags.isRequired %} Required {% endif %} {% if flags.isStatic %} Static {% endif %} {% endmacro %} {% macro @signatures(signatures) %} {%- if signatures[0].comment.shortText -%} {% markdown -%} {{ signatures[0].comment.shortText | safe }} {%- endmarkdown %} {%- endif %} {% if signatures[0].comment.text %} {% markdown -%} {{ signatures[0].comment.text | safe }} {%- endmarkdown %} {% endif %}
    {% if signatures[0].parameters %}

    Parameters

    {{@parametersTable(signatures[0].parameters, signatures[0].name)}} {% endif %} {% for param in signatures[0].parameters %} {% if param.name == "requestOptions" and param.type.type === "reference" %} {% set id = API_TOOLS.findByName(data.typedoc, param.type.name).id %} {{ @propertyTableForId(id, "Available requestOptions", "Property", "Type")}} {% endif %} {% if param.name == "requestOptions" and param.type.type !== "reference" and param.type.id %} {{ @propertyTableForId(param.type.id, "Options", "Property", "Type")}} {% endif %} {% endfor %}

    Returns

    {%- markdown -%} {{ signatures[0].comment.returns | safe }} {%- endmarkdown %}
    {{@type(signatures[0].type)}}
    {% if (signatures[0].type.name === "Promise" and signatures[0].type.typeArguments[0].type === "reference") %} {% set id = API_TOOLS.findByName(data.typedoc, signatures[0].type.typeArguments[0].name).id %} {{ @propertyTableForId(id, undefined, "Property", "Type") }} {% elif (signatures[0].type.name === "Promise" and signatures[0].type.typeArguments[0].id) or signatures[0].type.id %} {% set id = signatures[0].type.typeArguments[0].id or signatures[0].type.id %} {{ @propertyTableForId(id, undefined, "Property", "Type") }} {% endif %} {% endmacro %} {% macro @methodsTable(group, children) %}
    {% for childId in group.children %} {% set child = API_TOOLS.findChildById(childId, children) %} {% endfor %}
    Method Returns Notes
      {% for signature in child.signatures -%}
    • {{ signature.name }}({{ @signatureParams(signature.parameters) }})
    • {%- endfor %}
    {{@type(child.signatures[0].type)}} {% markdown -%} {{ child.signatures[0].comment.shortText | safe | trim }} {%- endmarkdown %} {% markdown -%} {{ child.signatures[0].comment.text | safe | trim }} {%- endmarkdown %}
    {% for childId in group.children %} {% set child = API_TOOLS.findChildById(childId, children) %} {% set signatures = child.signatures %}

    {{signatures[0].name}}

    {{ @flags(child.flags)}} {% if child.flags.isStatic %} Static {{kindString}} Method {% elif child.flags.isPrivate %} Private {{kindString}} Method {% elif child.flags.isProtected %} Protected {{kindString}} Method {% else %} {{kindString}} Method {% endif %}

    {% markdown -%} {{ signatures[0].comment.shortText | safe }} {%- endmarkdown %}
    {% if (signatures[0].parameters | stripThisFromParams).length > 0 %}

    Parameters

    {{@parametersTable(signatures[0].parameters, signatures[0].name)}} {% endif %}

    Returns

    {%- markdown -%} {{ signatures[0].comment.returns | safe }} {%- endmarkdown %}
    {{@type(signatures[0].type)}}
    {% if signatures[0].comment.text %}
    {% markdown -%} {{ signatures[0].comment.text | safe }} {%- endmarkdown %} {% endif %}
    {% endfor %} {% endmacro %} {% macro @accessorsTable(group, children) %} {{ @properties(group, children) }} {# @TODO make a custom table when and if we need setters... #} {% endmacro %} {% macro @parametersTable(parameters, fnName) %}
    {% for param in parameters | stripThisFromParams -%} {%- endfor %}
    Parameter Type Default Notes
    {{param.name}} {% if param.defaultValue %} {{ @flags({isOptional: true}) }} {% elif not param.defaultValue and not param.flags.isOptional %} {{ @flags({isRequired: true}) }} {% else %} {{ @flags(param.flags) }} {% endif %} {{@type(param.type)}} {{param.defaultValue}} {% markdown -%} {{ param.comment.shortText | safe | trim }} {%- endmarkdown %} {% markdown -%} {{ param.comment.text | safe | trim }} {%- endmarkdown %}
    {% endmacro %}

    {{name}}

    {{kindString}}
    {% if comment %} {% markdown -%} {{ comment.shortText | safe }} {%- endmarkdown %} {% endif %} {% if comment and comment.text %} {% markdown -%} {{ comment.text | safe }} {%- endmarkdown %} {% endif %} {% if implementedTypes %}

    Implements

    {% endif %} {% if extendedTypes %}

    Extends

    {% endif %} {% if type %} Value(s):
    {{@type(type)}}
    {% endif %} {% if groups %} {% for group in groups %}

    {{group.title}}

    {% if group.title == 'Enumeration members' %} {{ @properties(group, children) }} {% endif %} {% if group.title == 'Properties' %} {{ @properties(group, children) }} {% endif %} {% if group.title == 'Constructors' %} {% set firstSignature = API_TOOLS.findChildById(group.children[0], children).signatures[0] %}

    Constructor Parameters

    {{@parametersTable(firstSignature.parameters, 'Constructor')}} {% endif %} {% if group.title == 'Accessors' %} {{ @accessorsTable(group, children) }} {% endif %} {% if group.title == 'Methods' %} {{ @methodsTable(group, children) }} {% endif %} {% endfor %} {% endif %} {% if indexSignature %}

    Index Signatures

    {{@indexSignature(indexSignature, kindString)}} {% endif %} {% if signatures %} {{@signatures(signatures)}} {% endif %}
    {% if signatures[0].comment.tags %} {% for tag in signatures[0].comment.tags %} {% if tag.tag === "restlink" %} REST API documentation for {{name}}() available at {{tag.text}}
    {% endif %} {% endfor %} {% endif %} {{kindString}} defined in packages/{{sources[0].fileName}}:{{sources[0].line}} {% if isDev %}
    Debug Info
    {{signatures[0].comment.tags | inspect}}
    {% endif %}