mirror of
https://github.com/tale/headplane.git
synced 2026-07-27 16:18:57 +00:00
24 lines
527 B
TypeScript
24 lines
527 B
TypeScript
import type { Key } from '~/types';
|
|
import { defineApiEndpoints } from '../factory';
|
|
|
|
export interface ApiKeyEndpoints {
|
|
/**
|
|
* Retrieves all API keys from the Headscale instance.
|
|
*
|
|
* @returns An array of `Key` objects representing the API keys.
|
|
*/
|
|
getApiKeys(): Promise<Key[]>;
|
|
}
|
|
|
|
export default defineApiEndpoints<ApiKeyEndpoints>((client, apiKey) => ({
|
|
getApiKeys: async () => {
|
|
const { apiKeys } = await client.apiFetch<{ apiKeys: Key[] }>(
|
|
'GET',
|
|
'v1/apikey',
|
|
apiKey,
|
|
);
|
|
|
|
return apiKeys;
|
|
},
|
|
}));
|