{{ define "left" }} {{ partial "sidebar.html" . }} {{ end }} {{ define "main" }} {{ partial "breadcrumbs-legacy.html" . }}

{{ .Title }}

{{ $openapi := index site.Data.api .Params.apidata }} {{ printf "## %s version %s" $openapi.info.title $openapi.info.version | .RenderString }} {{ .RenderString $openapi.info.description }} {{ range $path, $pathKeys := $openapi.paths }} {{ range $key, $properties := $pathKeys }} {{ if in "get put patch post delete" $key }} {{ if isset $properties "operationId" }} {{ printf "### %s {#%s}" $properties.summary $properties.operationId | $.RenderString }} {{ else }} {{ printf "### %s {#%s}" $properties.summary (urlize $properties.summary) | $.RenderString }} {{ end }} {{ $badgeColors := (dict "get" "bg-blue-light-500 dark:bg-blue-dark-300" "head" "bg-gray-light-500 dark:bg-gray-dark-300" "put" "bg-green-light-500 dark:bg-green-dark-300" "post" "bg-violet-light-500 dark:bg-violet-dark-300" "delete" "bg-red-light-500 dark:bg-red-dark-300" "patch" "bg-amber-light-500 dark:bg-amber-dark-500" ) }} {{ $key }}  {{ $path }} {{ $curlExample := printf `curl -X %s \ "%sapi%s"` ($key | upper) (index $openapi.servers 0).url $path }} {{ highlight $curlExample "console" }} {{ $properties.description | $.RenderString (dict "display" "block") }} {{ with $properties.parameters }} {{ range . }} {{ $paramData := . }} {{ if (index . "$ref") }} {{ $refName := index (last 1 (split (index . "$ref") "/")) 0 }} {{ $paramData = index $openapi.components.parameters $refName }} {{ end }} {{ end }}
{{ T "apiPropParam" }} {{ T "apiPropType" }} {{ T "apiPropValue" }} {{ T "apiPropReq" }} {{ T "apiPropDesc" }}
{{ $paramData.name }} {{ $paramData.in }} {{ if isset $paramData.schema "$ref" }} {{ $refName := index (last 1 (split (index $paramData.schema "$ref") "/")) 0 }} {{ range (index $openapi.components.schemas $refName).enum }} {{ . }} {{ end }} {{ else }} {{ $paramData.schema.type }} {{ end }} {{ $paramData.required }} {{ $paramData.description | $.RenderString }}
{{ end }} {{ range $responseCode, $responseDetails := $properties.responses }} {{ if isset $responseDetails "content" }} {{ range $exampleName, $example := (index $responseDetails.content "application/json").examples }} {{ if isset $example "schema" }} {{ $refPath := index (index $example "schema") "$ref" }} {{ range $index, $component := (split $refPath "/") }} {{ if (index $openapi.components.examples $component) }}
{{ T "apiExampleResponseCode" }}: {{ $responseCode }}
{{ (index $openapi.components.examples $component).value | jsonify (dict "indent" "  ") }}
{{ end }} {{ end }} {{ else }} {{ T "apiExampleResponse" }}:

              {{- $example.value | jsonify (dict "indent" "  ") }}
              
{{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}
{{ end }} {{ define "right" }} {{ partial "api-aside.html" . }} {{ end }}