mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-08 08:53:43 +02:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import type { PluginDefinition } from "@yaakapp/api";
|
|
|
|
export const plugin: PluginDefinition = {
|
|
authentication: {
|
|
name: "apikey",
|
|
label: "API Key",
|
|
shortLabel: "API Key",
|
|
args: [
|
|
{
|
|
type: "select",
|
|
name: "location",
|
|
label: "Behavior",
|
|
defaultValue: "header",
|
|
options: [
|
|
{ label: "Insert Header", value: "header" },
|
|
{ label: "Append Query Parameter", value: "query" },
|
|
],
|
|
},
|
|
{
|
|
type: "text",
|
|
name: "key",
|
|
label: "Key",
|
|
dynamic: (_ctx, { values }) => {
|
|
return values.location === "query"
|
|
? {
|
|
label: "Parameter Name",
|
|
description: "The name of the query parameter to add to the request",
|
|
}
|
|
: {
|
|
label: "Header Name",
|
|
description: "The name of the header to add to the request",
|
|
};
|
|
},
|
|
},
|
|
{
|
|
type: "text",
|
|
name: "value",
|
|
label: "API Key",
|
|
optional: true,
|
|
password: true,
|
|
},
|
|
],
|
|
async onApply(_ctx, { values }) {
|
|
const key = String(values.key ?? "");
|
|
const value = String(values.value ?? "");
|
|
const location = String(values.location);
|
|
|
|
if (location === "query") {
|
|
return { setQueryParameters: [{ name: key, value }] };
|
|
}
|
|
return { setHeaders: [{ name: key, value }] };
|
|
},
|
|
},
|
|
};
|