mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
0512565f8e
Apparently I didn't use my brain cells and rely on the /version endpoint that Headscale has exposed since 0.26 (our lowest supported version). Switching to that significantly simplifies the API surface.
26 lines
534 B
TypeScript
26 lines
534 B
TypeScript
import type { Key } from "~/types";
|
|
|
|
import type { Capabilities } from "../capabilities";
|
|
import type { Transport } from "../transport";
|
|
|
|
export interface ApiKeyApi {
|
|
list(): Promise<Key[]>;
|
|
}
|
|
|
|
export function makeApiKeyApi(
|
|
transport: Transport,
|
|
_capabilities: Capabilities,
|
|
apiKey: string,
|
|
): ApiKeyApi {
|
|
return {
|
|
list: async () => {
|
|
const { apiKeys } = await transport.request<{ apiKeys: Key[] }>({
|
|
method: "GET",
|
|
path: "v1/apikey",
|
|
apiKey,
|
|
});
|
|
return apiKeys;
|
|
},
|
|
};
|
|
}
|