Skip to content

Commit 3ac2f83

Browse files
committed
permissions dropdown
1 parent dbcc83b commit 3ac2f83

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/components/APIRequest.astro

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { getProperty } from "dot-prop";
44
import { getSchema } from "~/util/api.ts";
55
import type { OpenAPIV3 } from "openapi-types";
66
import CURL from "./CURL.astro";
7+
import Details from "./Details.astro";
78
89
type Props = z.input<typeof props>;
910
@@ -91,6 +92,25 @@ if (jsonSchema.required) {
9192
json[property] = defaultValue;
9293
}
9394
}
95+
96+
const tokenGroups = operation["x-api-token-group"];
9497
---
9598

99+
{
100+
tokenGroups && (
101+
<Details header="Required API token permissions">
102+
<span>
103+
At least one of the following{" "}
104+
<a href="/fundamentals/api/reference/permissions/">token permissions</a>{" "}
105+
is required:
106+
</span>
107+
<ul>
108+
{tokenGroups.map((group) => (
109+
<li>{group}</li>
110+
))}
111+
</ul>
112+
</Details>
113+
)
114+
}
115+
96116
<CURL url={url.toString()} method={method} headers={headers} json={json} />

0 commit comments

Comments
 (0)