Download layouts/_shortcodes/http-api.html from abr00kx/taper: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/abr00kx/taper/resolve/main/layouts/_shortcodes/http-api.html
- Command line
-
hf download hf://abr00kx/taper/layouts/_shortcodes/http-api.html
-
curl -L -o http-api.html https://huggingface.co/abr00kx/taper/resolve/main/layouts/_shortcodes/http-api.html
1.66 kB
| {{/* | |
| This template is used to render an HTTP API, given an OpenAPI definition. | |
| It expects to be passed two parameters: | |
| * a `spec` parameter identifying the spec, which must be the name of | |
| a directory under /data/api | |
| * an `api` parameter, identifying an OpenAPI definition, | |
| which is the name of a schema file under "data/api/$spec". | |
| The file extension is omitted. For example: | |
| {{% http-api spec="server-server" api="public_rooms" %}} | |
| * an optional `anchor_base` parameter, which should be used as a | |
| prefix for the HTML IDs generated by this template. It should only | |
| be necessary to provide one for duplicate endpoints. | |
| This template replaces the old {{*_http_api}} template. | |
| */}} | |
| {{ $spec := .Params.spec}} | |
| {{ $api := .Params.api}} | |
| {{ $anchor_base := .Params.anchor_base}} | |
| {{/* | |
| Figure out which Page object to pass to the `openapi/render-api` partial. | |
| Either our own, or one stored under `endpoint_page` in the Scratch, if one | |
| exists. | |
| */}} | |
| {{ $target_page := .Page }} | |
| {{ with .Page.Scratch.Get "endpoint_page" }} | |
| {{ $target_page = . }} | |
| {{ end }} | |
| {{ $module_name := .Page.Scratch.Get "endpoint_module" }} | |
| {{ $api_data := index .Site.Data.api .Params.spec .Params.api }} | |
| {{ $base_url := (index $api_data.servers 0).variables.basePath.default }} | |
| {{ $path := delimit (slice "api" $spec $api) "/" }} | |
| {{ $api_data = partial "json-schema/resolve-refs" (dict "schema" $api_data "path" $path) }} | |
| {{ $api_data = partial "json-schema/resolve-allof" $api_data }} | |
| {{ partial "openapi/render-api" (dict "api_data" $api_data "base_url" $base_url "anchor_base" $anchor_base "page" $target_page "module" $module_name) }} | |